Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
Managed alerts management commands.

USAGE:
scw cockpit managed-alerts <command>

AVAILABLE COMMANDS:
disable Disable managed alerts
enable Enable managed alerts
scw cockpit managed-alerts

FLAGS:
-h, --help help for managed-alerts
Expand All @@ -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.
37 changes: 2 additions & 35 deletions docs/commands/cockpit.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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`<br />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`<br />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

Expand Down
58 changes: 0 additions & 58 deletions internal/namespaces/cockpit/v1/cockpit_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ func GetGeneratedCommands() *core.Commands {
cockpitContactPointCreate(),
cockpitContactPointList(),
cockpitContactPointDelete(),
cockpitManagedAlertsEnable(),
cockpitManagedAlertsDisable(),
cockpitTestAlertTrigger(),
)
}
Expand Down Expand Up @@ -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`,
Expand Down
Loading