diff --git a/cmd/scw/testdata/test-all-usage-cockpit-managed-alerts-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-managed-alerts-usage.golden index 9037a01efa..ea4e8697fa 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-managed-alerts-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-managed-alerts-usage.golden @@ -3,11 +3,7 @@ Managed alerts management commands. USAGE: - scw cockpit managed-alerts - -AVAILABLE COMMANDS: - disable Disable managed alerts - enable Enable managed alerts + scw cockpit managed-alerts FLAGS: -h, --help help for managed-alerts @@ -17,5 +13,3 @@ GLOBAL FLAGS: -D, --debug Enable debug mode -o, --output string Output format: json or human, see 'scw help output' for more info (default "human") -p, --profile string The config profile to use - -Use "scw cockpit managed-alerts [command] --help" for more information about a command. diff --git a/docs/commands/cockpit.md b/docs/commands/cockpit.md index 9501c557f0..dfc432734c 100644 --- a/docs/commands/cockpit.md +++ b/docs/commands/cockpit.md @@ -25,8 +25,6 @@ This API allows you to manage your Scaleway Cockpit, for storing and visualizing - [List Grafana users](#list-grafana-users) - [Reset a Grafana user password](#reset-a-grafana-user-password) - [Managed alerts management commands](#managed-alerts-management-commands) - - [Disable managed alerts](#disable-managed-alerts) - - [Enable managed alerts](#enable-managed-alerts) - [Pricing plans management commands](#pricing-plans-management-commands) - [Get current plan](#get-current-plan) - [List plan types](#list-plan-types) @@ -431,46 +429,15 @@ scw cockpit grafana-user reset-password [arg=value ...] Managed alerts management commands. - -### Disable managed alerts - -Disable the sending of managed alerts for the specified Project. - -**Usage:** - -``` -scw cockpit managed-alerts disable [arg=value ...] -``` - - -**Args:** - -| Name | | Description | -|------|---|-------------| -| project-id | | Project ID to use. If none is passed the default project ID will be used | -| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config | - - - -### Enable managed alerts - -Enable the sending of managed alerts for the specified Project. Managed alerts are predefined alerts that apply to Scaleway recources integrated with Cockpit by default. +Managed alerts management commands. **Usage:** ``` -scw cockpit managed-alerts enable [arg=value ...] +scw cockpit managed-alerts ``` -**Args:** - -| Name | | Description | -|------|---|-------------| -| project-id | | Project ID to use. If none is passed the default project ID will be used | -| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config | - - ## Pricing plans management commands diff --git a/internal/namespaces/cockpit/v1/cockpit_cli.go b/internal/namespaces/cockpit/v1/cockpit_cli.go index 901707c6ab..14399e8118 100644 --- a/internal/namespaces/cockpit/v1/cockpit_cli.go +++ b/internal/namespaces/cockpit/v1/cockpit_cli.go @@ -58,8 +58,6 @@ func GetGeneratedCommands() *core.Commands { cockpitContactPointCreate(), cockpitContactPointList(), cockpitContactPointDelete(), - cockpitManagedAlertsEnable(), - cockpitManagedAlertsDisable(), cockpitTestAlertTrigger(), ) } @@ -1239,62 +1237,6 @@ func cockpitContactPointDelete() *core.Command { } } -func cockpitManagedAlertsEnable() *core.Command { - return &core.Command{ - Short: `Enable managed alerts`, - Long: `Enable the sending of managed alerts for the specified Project. Managed alerts are predefined alerts that apply to Scaleway recources integrated with Cockpit by default.`, - Namespace: "cockpit", - Resource: "managed-alerts", - Verb: "enable", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.RegionalAPIEnableManagedAlertsRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - core.RegionArgSpec( - scw.RegionFrPar, - scw.RegionNlAms, - scw.RegionPlWaw, - ), - }, - Run: func(ctx context.Context, args any) (i any, e error) { - request := args.(*cockpit.RegionalAPIEnableManagedAlertsRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewRegionalAPI(client) - - return api.EnableManagedAlerts(request) - }, - } -} - -func cockpitManagedAlertsDisable() *core.Command { - return &core.Command{ - Short: `Disable managed alerts`, - Long: `Disable the sending of managed alerts for the specified Project.`, - Namespace: "cockpit", - Resource: "managed-alerts", - Verb: "disable", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.RegionalAPIDisableManagedAlertsRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - core.RegionArgSpec( - scw.RegionFrPar, - scw.RegionNlAms, - scw.RegionPlWaw, - ), - }, - Run: func(ctx context.Context, args any) (i any, e error) { - request := args.(*cockpit.RegionalAPIDisableManagedAlertsRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewRegionalAPI(client) - - return api.DisableManagedAlerts(request) - }, - } -} - func cockpitTestAlertTrigger() *core.Command { return &core.Command{ Short: `Trigger a test alert`,