diff --git a/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-disable-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-disable-usage.golden new file mode 100644 index 0000000000..79f0131119 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-disable-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Disabling the Alert manager deletes the contact points you have created and disables managed alerts in the specified Project and region. + +USAGE: + scw cockpit alert-manager disable [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for disable + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-enable-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-enable-usage.golden new file mode 100644 index 0000000000..e6c4e7a0d5 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-enable-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Enabling the Alert manager allows you to enable managed alerts and create contact points in the specified Project and region, to be notified when your Scaleway resources may require your attention. + +USAGE: + scw cockpit alert-manager enable [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for enable + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-get-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-get-usage.golden new file mode 100644 index 0000000000..9bb48568a8 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-get-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Retrieve information about the Alert manager which is unique per Project and region. By default the Alert manager is disabled. +The output returned displays a URL to access the Alert manager, and whether the Alert manager and managed alerts are enabled. + +USAGE: + scw cockpit alert-manager get [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for get + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-usage.golden new file mode 100644 index 0000000000..050117b4e4 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-alert-manager-usage.golden @@ -0,0 +1,22 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Alerting management commands. + +USAGE: + scw cockpit alert-manager + +AVAILABLE COMMANDS: + disable Disable the Alert manager + enable Enable the Alert manager + get Get the Alert manager + +FLAGS: + -h, --help help for alert-manager + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 alert-manager [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-cockpit-contact-point-create-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-contact-point-create-usage.golden new file mode 100644 index 0000000000..5d7af447c7 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-contact-point-create-usage.golden @@ -0,0 +1,22 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Contact points are email addresses associated with the default receiver, that the Alert manager sends alerts to. +The source of the alerts are data sources within the same Project and region as the Alert manager. +If you need to receive alerts for other receivers, you can create additional contact points and receivers in Grafana. Make sure that you select the Scaleway Alert manager. + +USAGE: + scw cockpit contact-point create [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [email.to] + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for create + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-contact-point-delete-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-contact-point-delete-usage.golden new file mode 100644 index 0000000000..a6cae6ba50 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-contact-point-delete-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Delete a contact point associated with the default receiver. + +USAGE: + scw cockpit contact-point delete [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [email.to] + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for delete + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-contact-point-list-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-contact-point-list-usage.golden new file mode 100644 index 0000000000..5cfff060d2 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-contact-point-list-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Retrieve a list of contact points for the specified Project. The response lists all contact points and receivers created in Grafana or via the API. + +USAGE: + scw cockpit contact-point list [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all) + +FLAGS: + -h, --help help for list + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-contact-point-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-contact-point-usage.golden new file mode 100644 index 0000000000..125bc76691 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-contact-point-usage.golden @@ -0,0 +1,22 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Contact point management commands. + +USAGE: + scw cockpit contact-point + +AVAILABLE COMMANDS: + create Create a contact point + delete Delete a contact point + list List contact points + +FLAGS: + -h, --help help for contact-point + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 contact-point [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-cockpit-data-source-create-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-data-source-create-usage.golden new file mode 100644 index 0000000000..8db807090e --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-data-source-create-usage.golden @@ -0,0 +1,25 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +You must specify the data source type upon creation. Available data source types include: + - metrics + - logs + - traces +The name of the data source will then be used as reference to name the associated Grafana data source. + +USAGE: + scw cockpit data-source create [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [name] Data source name + [type] Data source type (unknown_type | metrics | logs | traces) + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for create + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-data-source-delete-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-data-source-delete-usage.golden new file mode 100644 index 0000000000..d19fd452e8 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-data-source-delete-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Delete a given data source, specified by the data source ID. Note that deleting a data source is irreversible, and cannot be undone. + +USAGE: + scw cockpit data-source delete [arg=value ...] + +ARGS: + data-source-id ID of the data source to delete + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for delete + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-data-source-get-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-data-source-get-usage.golden new file mode 100644 index 0000000000..d25b1e1e0f --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-data-source-get-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Retrieve information about a given data source, specified by the data source ID. The data source's information such as its name, type, URL, origin, and retention period, is returned. + +USAGE: + scw cockpit data-source get [arg=value ...] + +ARGS: + data-source-id ID of the relevant data source + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for get + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-data-source-list-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-data-source-list-usage.golden new file mode 100644 index 0000000000..702bf5fa89 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-data-source-list-usage.golden @@ -0,0 +1,23 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Retrieve the list of data sources available in the specified region. By default, the data sources returned in the list are ordered by creation date, in ascending order. +You can list data sources by Project, type and origin. + +USAGE: + scw cockpit data-source list [arg=value ...] + +ARGS: + [order-by] Sort order for data sources in the response (created_at_asc | created_at_desc | name_asc | name_desc | type_asc | type_desc) + [project-id] Project ID to use. If none is passed the default project ID will be used + [origin] Origin to filter for, only data sources with matching origin will be returned (unknown_origin | scaleway | external) + [types.{index}] Types to filter for, only data sources with matching types will be returned (unknown_type | metrics | logs | traces) + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all) + +FLAGS: + -h, --help help for list + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-data-source-update-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-data-source-update-usage.golden new file mode 100644 index 0000000000..13fdd2c718 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-data-source-update-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Update a given data source name, specified by the data source ID. + +USAGE: + scw cockpit data-source update [arg=value ...] + +ARGS: + data-source-id ID of the data source to update + [name] Updated name of the data source + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for update + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-data-source-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-data-source-usage.golden new file mode 100644 index 0000000000..356bf1ede4 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-data-source-usage.golden @@ -0,0 +1,24 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Datasource management commands. + +USAGE: + scw cockpit data-source + +AVAILABLE COMMANDS: + create Create a data source + delete Delete a data source + get Get a data source + list List data sources + update Update a data source + +FLAGS: + -h, --help help for data-source + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 data-source [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-cockpit-grafana-get-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-grafana-get-usage.golden new file mode 100644 index 0000000000..886fb489c4 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-grafana-get-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Retrieve information on your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to. +The output returned displays the URL to access your Cockpit's Grafana. + +USAGE: + scw cockpit grafana get [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + +FLAGS: + -h, --help help for get + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-grafana-sync-data-sources-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-grafana-sync-data-sources-usage.golden new file mode 100644 index 0000000000..2bce8a995b --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-grafana-sync-data-sources-usage.golden @@ -0,0 +1,18 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Trigger the synchronization of all your data sources and the alert manager in the relevant regions. The alert manager will only be synchronized if you have enabled it. + +USAGE: + scw cockpit grafana sync-data-sources [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + +FLAGS: + -h, --help help for sync-data-sources + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-grafana-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-grafana-usage.golden new file mode 100644 index 0000000000..5d9c46a7f0 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-grafana-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Grafana user management commands. + +USAGE: + scw cockpit grafana + +AVAILABLE COMMANDS: + get Get your Cockpit's Grafana + sync-data-sources Synchronize Grafana data sources + +FLAGS: + -h, --help help for grafana + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 grafana [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-create-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-create-usage.golden index 6a859ea6e4..ffe55ec988 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-create-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-create-usage.golden @@ -1,13 +1,14 @@ 🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ -Create a Grafana user for your Cockpit's Grafana. Make sure you save the automatically-generated password and the Grafana user ID. +Create a Grafana user to connect to your Cockpit's Grafana. Upon creation, your user password displays only once, so make sure that you save it. +Each Grafana user is associated with a role: viewer or editor. A viewer can only view dashboards, whereas an editor can create and edit dashboards. Note that the `admin` username is not available for creation. USAGE: scw cockpit grafana-user create [arg=value ...] ARGS: [project-id] Project ID to use. If none is passed the default project ID will be used - [login] Username of the Grafana user + [login] Username of the Grafana user. Note that the `admin` username is not available for creation [role] Role assigned to the Grafana user (unknown_role | editor | viewer) FLAGS: diff --git a/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-list-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-list-usage.golden index 4ff4274a72..11a7c4a796 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-list-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-list-usage.golden @@ -1,12 +1,12 @@ 🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ -Get a list of all Grafana users created in your Cockpit's Grafana. +List all Grafana users created in your Cockpit's Grafana. By default, the Grafana users returned in the list are ordered in ascending order. USAGE: scw cockpit grafana-user list [arg=value ...] ARGS: - [order-by] (login_asc | login_desc) + [order-by] Order of the Grafana users (login_asc | login_desc) [project-id] Project ID to use. If none is passed the default project ID will be used FLAGS: diff --git a/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-reset-password-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-reset-password-usage.golden index 7bbf9f0a0e..559f3269b6 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-reset-password-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-reset-password-usage.golden @@ -1,6 +1,7 @@ 🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ Reset the password of a Grafana user, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user. +A new password regenerates and only displays once. Make sure that you save it. USAGE: scw cockpit grafana-user reset-password [arg=value ...] diff --git a/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-usage.golden index 00a06604e9..a1904024bb 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-grafana-user-usage.golden @@ -6,10 +6,10 @@ USAGE: scw cockpit grafana-user AVAILABLE COMMANDS: - create Create a Grafana user for your Cockpit's Grafana. Make sure you save the automatically-generated password and the Grafana user ID - delete Delete a Grafana user from your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user - list Get a list of all Grafana users created in your Cockpit's Grafana - reset-password Reset the password of a Grafana user, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user + create Create a Grafana user + delete Delete a Grafana user + list List Grafana users + reset-password Reset a Grafana user password FLAGS: -h, --help help for grafana-user diff --git a/cmd/scw/testdata/test-all-usage-cockpit-managed-alerts-disable-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-managed-alerts-disable-usage.golden new file mode 100644 index 0000000000..eba88f1cd2 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-managed-alerts-disable-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Disable the sending of managed alerts for the specified Project. + +USAGE: + scw cockpit managed-alerts disable [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for disable + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-managed-alerts-enable-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-managed-alerts-enable-usage.golden new file mode 100644 index 0000000000..15f12459e5 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-managed-alerts-enable-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +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. + +USAGE: + scw cockpit managed-alerts enable [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for enable + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 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 new file mode 100644 index 0000000000..9037a01efa --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-managed-alerts-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Managed alerts management commands. + +USAGE: + scw cockpit managed-alerts + +AVAILABLE COMMANDS: + disable Disable managed alerts + enable Enable managed alerts + +FLAGS: + -h, --help help for managed-alerts + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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/cmd/scw/testdata/test-all-usage-cockpit-plan-get-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-plan-get-usage.golden new file mode 100644 index 0000000000..168767fab3 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-plan-get-usage.golden @@ -0,0 +1,18 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Retrieve a pricing plan for the given Project, specified by the ID of the Project. + +USAGE: + scw cockpit plan get [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + +FLAGS: + -h, --help help for get + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-plan-list-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-plan-list-usage.golden index c8eab3d7c5..486416e387 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-plan-list-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-plan-list-usage.golden @@ -1,6 +1,6 @@ 🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ -Get a list of all pricing plans available. +Retrieve a list of available pricing plan types. USAGE: scw cockpit plan list [arg=value ...] diff --git a/cmd/scw/testdata/test-all-usage-cockpit-plan-select-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-plan-select-usage.golden index 0ba92cf81f..740d12af70 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-plan-select-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-plan-select-usage.golden @@ -1,13 +1,13 @@ 🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ -Select your chosen pricing plan for your Cockpit, specifying the Cockpit's Project ID and the pricing plan's ID in the request. +Apply a pricing plan on a given Project. You must specify the ID of the pricing plan type. Note that you will be billed for the plan you apply. USAGE: scw cockpit plan select [arg=value ...] ARGS: [project-id] Project ID to use. If none is passed the default project ID will be used - [plan-id] ID of the pricing plan + [plan-name] Name of the pricing plan (unknown_name | free | premium | custom) FLAGS: -h, --help help for select diff --git a/cmd/scw/testdata/test-all-usage-cockpit-plan-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-plan-usage.golden index 6465603854..fe7f7747c1 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-plan-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-plan-usage.golden @@ -6,8 +6,9 @@ USAGE: scw cockpit plan AVAILABLE COMMANDS: - list Get a list of all pricing plans available - select Select your chosen pricing plan for your Cockpit, specifying the Cockpit's Project ID and the pricing plan's ID in the request + get Get current plan + list List plan types + select Apply a pricing plan FLAGS: -h, --help help for plan diff --git a/cmd/scw/testdata/test-all-usage-cockpit-product-dashboards-get-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-product-dashboards-get-usage.golden new file mode 100644 index 0000000000..25afdb2988 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-product-dashboards-get-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Retrieve information about the dashboard of a Scaleway resource in Grafana, specified by the ID of the Project the Cockpit belongs to, and the name of the dashboard. + +USAGE: + scw cockpit product-dashboards get [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + dashboard-name Name of the dashboard + +FLAGS: + -h, --help help for get + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-product-dashboards-list-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-product-dashboards-list-usage.golden new file mode 100644 index 0000000000..377d2cc18e --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-product-dashboards-list-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Retrieve a list of available dashboards in Grafana, for all Scaleway resources which are integrated with Cockpit. + +USAGE: + scw cockpit product-dashboards list [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [tags.{index}] Tags to filter for + +FLAGS: + -h, --help help for list + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-product-dashboards-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-product-dashboards-usage.golden index ac5996bf36..4fe0bb1f34 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-product-dashboards-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-product-dashboards-usage.golden @@ -3,7 +3,11 @@ Product dashboards management commands. USAGE: - scw cockpit product-dashboards + scw cockpit product-dashboards + +AVAILABLE COMMANDS: + get Get Scaleway resource dashboard + list List Scaleway resources dashboards FLAGS: -h, --help help for product-dashboards @@ -13,3 +17,5 @@ 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 product-dashboards [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-cockpit-test-alert-trigger-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-test-alert-trigger-usage.golden new file mode 100644 index 0000000000..eaccbc5025 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-test-alert-trigger-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Send a test alert to the Alert manager to make sure your contact points get notified. + +USAGE: + scw cockpit test-alert trigger [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for trigger + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-test-alert-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-test-alert-usage.golden new file mode 100644 index 0000000000..82f3033551 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-test-alert-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Test alert management commands. + +USAGE: + scw cockpit test-alert + +AVAILABLE COMMANDS: + trigger Trigger a test alert + +FLAGS: + -h, --help help for test-alert + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 test-alert [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-cockpit-token-create-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-token-create-usage.golden index ffea92c587..f1f69888b3 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-token-create-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-token-create-usage.golden @@ -1,22 +1,16 @@ 🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ -Create a token in a given Project specified by the Project ID. +Give your token the relevant scopes to ensure it has the right permissions to interact with your data sources and the Alert manager. Make sure that you create your token in the same regions as the data sources you want to use it for. +Upon creation, your token's secret key display only once. Make sure that you save it. USAGE: scw cockpit token create [arg=value ...] ARGS: - [project-id] Project ID to use. If none is passed the default project ID will be used - [name=] Name of the token - [scopes.query-metrics] Permission to fetch metrics - [scopes.write-metrics] Permission to write metrics - [scopes.setup-metrics-rules] Permission to setup metrics rules - [scopes.query-logs] Permission to fetch logs - [scopes.write-logs] Permission to write logs - [scopes.setup-logs-rules] Permission to set up logs rules - [scopes.setup-alerts] Permission to set up alerts - [scopes.query-traces] Permission to fetch traces - [scopes.write-traces] Permission to write traces + [project-id] Project ID to use. If none is passed the default project ID will be used + [name] Name of the token + [token-scopes.{index}] Token permission scopes (unknown_scope | read_only_metrics | write_only_metrics | full_access_metrics_rules | read_only_logs | write_only_logs | full_access_logs_rules | full_access_alert_manager | read_only_traces | write_only_traces) + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) FLAGS: -h, --help help for create diff --git a/cmd/scw/testdata/test-all-usage-cockpit-token-delete-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-token-delete-usage.golden index d7a0de47c2..de308ef90b 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-token-delete-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-token-delete-usage.golden @@ -1,12 +1,13 @@ 🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ -Delete a given token specified by the token ID. +Delete a given token, specified by the token ID. Deleting a token is irreversible and cannot be undone. USAGE: scw cockpit token delete [arg=value ...] ARGS: - token-id ID of the token + token-id ID of the token to delete + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) FLAGS: -h, --help help for delete diff --git a/cmd/scw/testdata/test-all-usage-cockpit-token-get-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-token-get-usage.golden index 05a69566f0..a887a3a373 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-token-get-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-token-get-usage.golden @@ -1,12 +1,13 @@ 🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ -Retrieve a given token specified by the token ID. +Retrieve information about a given token, specified by the token ID. The token's information such as its scopes, is returned. USAGE: - scw cockpit token get [arg=value ...] + scw cockpit token get [arg=value ...] ARGS: - token-id ID of the token + token-id Token ID + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) FLAGS: -h, --help help for get diff --git a/cmd/scw/testdata/test-all-usage-cockpit-token-list-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-token-list-usage.golden index ce11285840..d5ab488ecd 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-token-list-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-token-list-usage.golden @@ -1,13 +1,16 @@ 🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ -Get a list of tokens in a given Project specified by the Project ID. +Retrieve a list of all tokens in the specified region. By default, tokens returned in the list are ordered by creation date, in ascending order. +You can filter tokens by Project ID and token scopes. USAGE: scw cockpit token list [arg=value ...] ARGS: - [order-by] How the response is ordered (created_at_asc | created_at_desc | name_asc | name_desc) - [project-id] Project ID to use. If none is passed the default project ID will be used + [order-by] Order in which to return results (created_at_asc | created_at_desc | name_asc | name_desc) + [project-id] Project ID to use. If none is passed the default project ID will be used + [token-scopes.{index}] Token scopes to filter for (unknown_scope | read_only_metrics | write_only_metrics | full_access_metrics_rules | read_only_logs | write_only_logs | full_access_logs_rules | full_access_alert_manager | read_only_traces | write_only_traces) + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all) FLAGS: -h, --help help for list diff --git a/cmd/scw/testdata/test-all-usage-cockpit-token-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-token-usage.golden index 8635cbd776..52e548bc0a 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-token-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-token-usage.golden @@ -6,10 +6,10 @@ USAGE: scw cockpit token AVAILABLE COMMANDS: - create Create a token in a given Project specified by the Project ID - delete Delete a given token specified by the token ID - get Retrieve a given token specified by the token ID - list Get a list of tokens in a given Project specified by the Project ID + create Create a token + delete Delete a token + get Get a token + list List tokens FLAGS: -h, --help help for token diff --git a/cmd/scw/testdata/test-all-usage-cockpit-usage-overview-get-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-usage-overview-get-usage.golden new file mode 100644 index 0000000000..4ab9f03943 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-usage-overview-get-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Retrieve the data source usage overview per type for the specified Project. + +USAGE: + scw cockpit usage-overview get [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [interval] + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for get + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 diff --git a/cmd/scw/testdata/test-all-usage-cockpit-usage-overview-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-usage-overview-usage.golden new file mode 100644 index 0000000000..7aa8c659f3 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-cockpit-usage-overview-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Usage overview management commands. + +USAGE: + scw cockpit usage-overview + +AVAILABLE COMMANDS: + get Get data source usage overview + +FLAGS: + -h, --help help for usage-overview + +GLOBAL FLAGS: + -c, --config string The path to the config file + -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 usage-overview [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-cockpit-usage.golden b/cmd/scw/testdata/test-all-usage-cockpit-usage.golden index 3756c411e8..ce61a2c4d7 100644 --- a/cmd/scw/testdata/test-all-usage-cockpit-usage.golden +++ b/cmd/scw/testdata/test-all-usage-cockpit-usage.golden @@ -6,14 +6,17 @@ USAGE: scw cockpit AVAILABLE COMMANDS: - alert Managed alerts management commands - cockpit Cockpit management commands - contact Contacts management commands - datasource Datasource management commands + alert-manager Alerting management commands + contact-point Contact point management commands + data-source Datasource management commands + grafana Grafana user management commands grafana-user Grafana user management commands + managed-alerts Managed alerts management commands plan Pricing plans management commands product-dashboards Product dashboards management commands + test-alert Test alert management commands token Token management commands + usage-overview Usage overview management commands FLAGS: -h, --help help for cockpit diff --git a/docs/commands/cockpit.md b/docs/commands/cockpit.md index 5ff90ae094..e9a9606ae9 100644 --- a/docs/commands/cockpit.md +++ b/docs/commands/cockpit.md @@ -2,49 +2,62 @@ # Documentation for `scw cockpit` This API allows you to manage your Scaleway Cockpit, for storing and visualizing metrics and logs. -- [Managed alerts management commands](#managed-alerts-management-commands) - - [Disable the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to](#disable-the-sending-of-managed-alerts-for-a-given-cockpit,-specified-by-the-id-of-the-project-the-cockpit-belongs-to) - - [Enable the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to](#enable-the-sending-of-managed-alerts-for-a-given-cockpit,-specified-by-the-id-of-the-project-the-cockpit-belongs-to) - - [Send a test alert to make sure your contact points get notified when an actual alert is triggered](#send-a-test-alert-to-make-sure-your-contact-points-get-notified-when-an-actual-alert-is-triggered) -- [Cockpit management commands](#cockpit-management-commands) - - [Activate the Cockpit of a given Project specified by the Project ID](#activate-the-cockpit-of-a-given-project-specified-by-the-project-id) - - [Deactivate the Cockpit of a given Project specified by the Project ID](#deactivate-the-cockpit-of-a-given-project-specified-by-the-project-id) - - [Retrieve the Cockpit of a given Project specified by the Project ID](#retrieve-the-cockpit-of-a-given-project-specified-by-the-project-id) - - [Wait for a cockpit to reach a stable state (installation)](#wait-for-a-cockpit-to-reach-a-stable-state-(installation)) -- [Contacts management commands](#contacts-management-commands) - - [Create a contact point associated with the default receiver, to receive alerts](#create-a-contact-point-associated-with-the-default-receiver,-to-receive-alerts) - - [Delete a contact point associated with the default receiver](#delete-a-contact-point-associated-with-the-default-receiver) - - [Get a list of contact points created for a given Cockpit, specified by the ID of the Project the Cockpit belongs to](#get-a-list-of-contact-points-created-for-a-given-cockpit,-specified-by-the-id-of-the-project-the-cockpit-belongs-to) +- [Alerting management commands](#alerting-management-commands) + - [Disable the Alert manager](#disable-the-alert-manager) + - [Enable the Alert manager](#enable-the-alert-manager) + - [Get the Alert manager](#get-the-alert-manager) +- [Contact point management commands](#contact-point-management-commands) + - [Create a contact point](#create-a-contact-point) + - [Delete a contact point](#delete-a-contact-point) + - [List contact points](#list-contact-points) - [Datasource management commands](#datasource-management-commands) + - [Create a data source](#create-a-data-source) + - [Delete a data source](#delete-a-data-source) + - [Get a data source](#get-a-data-source) + - [List data sources](#list-data-sources) + - [Update a data source](#update-a-data-source) +- [Grafana user management commands](#grafana-user-management-commands) + - [Get your Cockpit's Grafana](#get-your-cockpit's-grafana) + - [Synchronize Grafana data sources](#synchronize-grafana-data-sources) - [Grafana user management commands](#grafana-user-management-commands) - - [Create a Grafana user for your Cockpit's Grafana. Make sure you save the automatically-generated password and the Grafana user ID](#create-a-grafana-user-for-your-cockpit's-grafana.-make-sure-you-save-the-automatically-generated-password-and-the-grafana-user-id) - - [Delete a Grafana user from your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user](#delete-a-grafana-user-from-your-cockpit's-grafana,-specified-by-the-id-of-the-project-the-cockpit-belongs-to,-and-the-id-of-the-grafana-user) - - [Get a list of all Grafana users created in your Cockpit's Grafana](#get-a-list-of-all-grafana-users-created-in-your-cockpit's-grafana) - - [Reset the password of a Grafana user, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user](#reset-the-password-of-a-grafana-user,-specified-by-the-id-of-the-project-the-cockpit-belongs-to,-and-the-id-of-the-grafana-user) + - [Create a Grafana user](#create-a-grafana-user) + - [Delete a Grafana user](#delete-a-grafana-user) + - [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 a list of all pricing plans available](#get-a-list-of-all-pricing-plans-available) - - [Select your chosen pricing plan for your Cockpit, specifying the Cockpit's Project ID and the pricing plan's ID in the request](#select-your-chosen-pricing-plan-for-your-cockpit,-specifying-the-cockpit's-project-id-and-the-pricing-plan's-id-in-the-request) + - [Get current plan](#get-current-plan) + - [List plan types](#list-plan-types) + - [Apply a pricing plan](#apply-a-pricing-plan) - [Product dashboards management commands](#product-dashboards-management-commands) + - [Get Scaleway resource dashboard](#get-scaleway-resource-dashboard) + - [List Scaleway resources dashboards](#list-scaleway-resources-dashboards) +- [Test alert management commands](#test-alert-management-commands) + - [Trigger a test alert](#trigger-a-test-alert) - [Token management commands](#token-management-commands) - - [Create a token in a given Project specified by the Project ID](#create-a-token-in-a-given-project-specified-by-the-project-id) - - [Delete a given token specified by the token ID](#delete-a-given-token-specified-by-the-token-id) - - [Retrieve a given token specified by the token ID](#retrieve-a-given-token-specified-by-the-token-id) - - [Get a list of tokens in a given Project specified by the Project ID](#get-a-list-of-tokens-in-a-given-project-specified-by-the-project-id) + - [Create a token](#create-a-token) + - [Delete a token](#delete-a-token) + - [Get a token](#get-a-token) + - [List tokens](#list-tokens) +- [Usage overview management commands](#usage-overview-management-commands) + - [Get data source usage overview](#get-data-source-usage-overview) -## Managed alerts management commands +## Alerting management commands -Managed alerts management commands. +Alerting management commands. -### Disable the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to +### Disable the Alert manager -Disable the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to. +Disabling the Alert manager deletes the contact points you have created and disables managed alerts in the specified Project and region. **Usage:** ``` -scw cockpit alert disable [arg=value ...] +scw cockpit alert-manager disable [arg=value ...] ``` @@ -53,17 +66,18 @@ scw cockpit alert disable [arg=value ...] | 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 the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to +### Enable the Alert manager -Enable the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to. +Enabling the Alert manager allows you to enable managed alerts and create contact points in the specified Project and region, to be notified when your Scaleway resources may require your attention. **Usage:** ``` -scw cockpit alert enable [arg=value ...] +scw cockpit alert-manager enable [arg=value ...] ``` @@ -72,17 +86,19 @@ scw cockpit alert enable [arg=value ...] | 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 | -### Send a test alert to make sure your contact points get notified when an actual alert is triggered +### Get the Alert manager -Send a test alert to make sure your contact points get notified when an actual alert is triggered. +Retrieve information about the Alert manager which is unique per Project and region. By default the Alert manager is disabled. +The output returned displays a URL to access the Alert manager, and whether the Alert manager and managed alerts are enabled. **Usage:** ``` -scw cockpit alert test [arg=value ...] +scw cockpit alert-manager get [arg=value ...] ``` @@ -91,22 +107,25 @@ scw cockpit alert test [arg=value ...] | 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 | -## Cockpit management commands +## Contact point management commands -Cockpit management commands. +Contact point management commands. -### Activate the Cockpit of a given Project specified by the Project ID +### Create a contact point -Activate the Cockpit of a given Project specified by the Project ID. +Contact points are email addresses associated with the default receiver, that the Alert manager sends alerts to. +The source of the alerts are data sources within the same Project and region as the Alert manager. +If you need to receive alerts for other receivers, you can create additional contact points and receivers in Grafana. Make sure that you select the Scaleway Alert manager. **Usage:** ``` -scw cockpit cockpit activate [arg=value ...] +scw cockpit contact-point create [arg=value ...] ``` @@ -115,17 +134,19 @@ scw cockpit cockpit activate [arg=value ...] | Name | | Description | |------|---|-------------| | project-id | | Project ID to use. If none is passed the default project ID will be used | +| email.to | | | +| 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 | -### Deactivate the Cockpit of a given Project specified by the Project ID +### Delete a contact point -Deactivate the Cockpit of a given Project specified by the Project ID. +Delete a contact point associated with the default receiver. **Usage:** ``` -scw cockpit cockpit deactivate [arg=value ...] +scw cockpit contact-point delete [arg=value ...] ``` @@ -134,17 +155,19 @@ scw cockpit cockpit deactivate [arg=value ...] | Name | | Description | |------|---|-------------| | project-id | | Project ID to use. If none is passed the default project ID will be used | +| email.to | | | +| 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 | -### Retrieve the Cockpit of a given Project specified by the Project ID +### List contact points -Retrieve the Cockpit of a given Project specified by the Project ID. +Retrieve a list of contact points for the specified Project. The response lists all contact points and receivers created in Grafana or via the API. **Usage:** ``` -scw cockpit cockpit get [arg=value ...] +scw cockpit contact-point list [arg=value ...] ``` @@ -153,17 +176,27 @@ scw cockpit cockpit get [arg=value ...] | 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`, `all` | Region to target. If none is passed will use default region from the config | -### Wait for a cockpit to reach a stable state (installation) +## Datasource management commands + +Datasource management commands. + + +### Create a data source -Wait for a cockpit to reach a stable state. This is similar to using --wait flag on other action commands, but without requiring a new action on the cockpit. +You must specify the data source type upon creation. Available data source types include: + - metrics + - logs + - traces +The name of the data source will then be used as reference to name the associated Grafana data source. **Usage:** ``` -scw cockpit cockpit wait [arg=value ...] +scw cockpit data-source create [arg=value ...] ``` @@ -171,34 +204,62 @@ scw cockpit cockpit wait [arg=value ...] | Name | | Description | |------|---|-------------| -| project-id | Required | The ID of the project the cockpit is attached to | -| timeout | Default: `3m0s` | Timeout of the wait | +| project-id | | Project ID to use. If none is passed the default project ID will be used | +| name | | Data source name | +| type | One of: `unknown_type`, `metrics`, `logs`, `traces` | Data source type | +| 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 | + -**Examples:** +### Delete a data source +Delete a given data source, specified by the data source ID. Note that deleting a data source is irreversible, and cannot be undone. + +**Usage:** -Wait for a cockpit to reach a stable state ``` -scw cockpit cockpit wait 11111111-1111-1111-1111-111111111111 +scw cockpit data-source delete [arg=value ...] ``` +**Args:** + +| Name | | Description | +|------|---|-------------| +| data-source-id | Required | ID of the data source to delete | +| 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 | + + +### Get a data source -## Contacts management commands +Retrieve information about a given data source, specified by the data source ID. The data source's information such as its name, type, URL, origin, and retention period, is returned. + +**Usage:** + +``` +scw cockpit data-source get [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| data-source-id | Required | ID of the relevant data source | +| 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 | -Contacts management commands. -### Create a contact point associated with the default receiver, to receive alerts +### List data sources -Create a contact point associated with the default receiver, to receive alerts. +Retrieve the list of data sources available in the specified region. By default, the data sources returned in the list are ordered by creation date, in ascending order. +You can list data sources by Project, type and origin. **Usage:** ``` -scw cockpit contact create [arg=value ...] +scw cockpit data-source list [arg=value ...] ``` @@ -206,19 +267,22 @@ scw cockpit contact create [arg=value ...] | Name | | Description | |------|---|-------------| +| order-by | One of: `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`, `type_asc`, `type_desc` | Sort order for data sources in the response | | project-id | | Project ID to use. If none is passed the default project ID will be used | -| contact-point.email.to | | | +| origin | One of: `unknown_origin`, `scaleway`, `external` | Origin to filter for, only data sources with matching origin will be returned | +| types.{index} | One of: `unknown_type`, `metrics`, `logs`, `traces` | Types to filter for, only data sources with matching types will be returned | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw`, `all` | Region to target. If none is passed will use default region from the config | -### Delete a contact point associated with the default receiver +### Update a data source -Delete a contact point associated with the default receiver. +Update a given data source name, specified by the data source ID. **Usage:** ``` -scw cockpit contact delete [arg=value ...] +scw cockpit data-source update [arg=value ...] ``` @@ -226,19 +290,26 @@ scw cockpit contact delete [arg=value ...] | Name | | Description | |------|---|-------------| -| project-id | | Project ID to use. If none is passed the default project ID will be used | -| contact-point.email.to | | | +| data-source-id | Required | ID of the data source to update | +| name | | Updated name of the data source | +| 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 | + + + +## Grafana user management commands +Grafana user management commands. -### Get a list of contact points created for a given Cockpit, specified by the ID of the Project the Cockpit belongs to +### Get your Cockpit's Grafana -Get a list of contact points created for a given Cockpit, specified by the ID of the Project the Cockpit belongs to. +Retrieve information on your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to. +The output returned displays the URL to access your Cockpit's Grafana. **Usage:** ``` -scw cockpit contact list [arg=value ...] +scw cockpit grafana get [arg=value ...] ``` @@ -250,28 +321,34 @@ scw cockpit contact list [arg=value ...] -## Datasource management commands - -Datasource management commands. +### Synchronize Grafana data sources -Datasource management commands. +Trigger the synchronization of all your data sources and the alert manager in the relevant regions. The alert manager will only be synchronized if you have enabled it. **Usage:** ``` -scw cockpit datasource +scw cockpit grafana sync-data-sources [arg=value ...] ``` +**Args:** + +| Name | | Description | +|------|---|-------------| +| project-id | | Project ID to use. If none is passed the default project ID will be used | + + ## Grafana user management commands Grafana user management commands. -### Create a Grafana user for your Cockpit's Grafana. Make sure you save the automatically-generated password and the Grafana user ID +### Create a Grafana user -Create a Grafana user for your Cockpit's Grafana. Make sure you save the automatically-generated password and the Grafana user ID. +Create a Grafana user to connect to your Cockpit's Grafana. Upon creation, your user password displays only once, so make sure that you save it. +Each Grafana user is associated with a role: viewer or editor. A viewer can only view dashboards, whereas an editor can create and edit dashboards. Note that the `admin` username is not available for creation. **Usage:** @@ -285,12 +362,12 @@ scw cockpit grafana-user create [arg=value ...] | Name | | Description | |------|---|-------------| | project-id | | Project ID to use. If none is passed the default project ID will be used | -| login | | Username of the Grafana user | +| login | | Username of the Grafana user. Note that the `admin` username is not available for creation | | role | One of: `unknown_role`, `editor`, `viewer` | Role assigned to the Grafana user | -### Delete a Grafana user from your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user +### Delete a Grafana user Delete a Grafana user from your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user. @@ -310,9 +387,9 @@ scw cockpit grafana-user delete [arg=value ...] -### Get a list of all Grafana users created in your Cockpit's Grafana +### List Grafana users -Get a list of all Grafana users created in your Cockpit's Grafana. +List all Grafana users created in your Cockpit's Grafana. By default, the Grafana users returned in the list are ordered in ascending order. **Usage:** @@ -325,14 +402,15 @@ scw cockpit grafana-user list [arg=value ...] | Name | | Description | |------|---|-------------| -| order-by | One of: `login_asc`, `login_desc` | | +| order-by | One of: `login_asc`, `login_desc` | Order of the Grafana users | | project-id | | Project ID to use. If none is passed the default project ID will be used | -### Reset the password of a Grafana user, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user +### Reset a Grafana user password Reset the password of a Grafana user, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user. +A new password regenerates and only displays once. Make sure that you save it. **Usage:** @@ -350,14 +428,78 @@ scw cockpit grafana-user reset-password [arg=value ...] +## Managed alerts management commands + +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. + +**Usage:** + +``` +scw cockpit managed-alerts enable [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 | + + + ## Pricing plans management commands Pricing plans management commands. -### Get a list of all pricing plans available +### Get current plan -Get a list of all pricing plans available. +Retrieve a pricing plan for the given Project, specified by the ID of the Project. + +**Usage:** + +``` +scw cockpit plan get [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| project-id | | Project ID to use. If none is passed the default project ID will be used | + + + +### List plan types + +Retrieve a list of available pricing plan types. **Usage:** @@ -374,9 +516,9 @@ scw cockpit plan list [arg=value ...] -### Select your chosen pricing plan for your Cockpit, specifying the Cockpit's Project ID and the pricing plan's ID in the request +### Apply a pricing plan -Select your chosen pricing plan for your Cockpit, specifying the Cockpit's Project ID and the pricing plan's ID in the request. +Apply a pricing plan on a given Project. You must specify the ID of the pricing plan type. Note that you will be billed for the plan you apply. **Usage:** @@ -390,7 +532,7 @@ scw cockpit plan select [arg=value ...] | Name | | Description | |------|---|-------------| | project-id | | Project ID to use. If none is passed the default project ID will be used | -| plan-id | | ID of the pricing plan | +| plan-name | One of: `unknown_name`, `free`, `premium`, `custom` | Name of the pricing plan | @@ -398,24 +540,81 @@ scw cockpit plan select [arg=value ...] Product dashboards management commands. -Product dashboards management commands. + +### Get Scaleway resource dashboard + +Retrieve information about the dashboard of a Scaleway resource in Grafana, specified by the ID of the Project the Cockpit belongs to, and the name of the dashboard. **Usage:** ``` -scw cockpit product-dashboards +scw cockpit product-dashboards get [arg=value ...] ``` +**Args:** + +| Name | | Description | +|------|---|-------------| +| project-id | | Project ID to use. If none is passed the default project ID will be used | +| dashboard-name | Required | Name of the dashboard | + + + +### List Scaleway resources dashboards + +Retrieve a list of available dashboards in Grafana, for all Scaleway resources which are integrated with Cockpit. + +**Usage:** + +``` +scw cockpit product-dashboards list [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| project-id | | Project ID to use. If none is passed the default project ID will be used | +| tags.{index} | | Tags to filter for | + + + +## Test alert management commands + +Test alert management commands. + + +### Trigger a test alert + +Send a test alert to the Alert manager to make sure your contact points get notified. + +**Usage:** + +``` +scw cockpit test-alert trigger [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 | + + ## Token management commands Token management commands. -### Create a token in a given Project specified by the Project ID +### Create a token -Create a token in a given Project specified by the Project ID. +Give your token the relevant scopes to ensure it has the right permissions to interact with your data sources and the Alert manager. Make sure that you create your token in the same regions as the data sources you want to use it for. +Upon creation, your token's secret key display only once. Make sure that you save it. **Usage:** @@ -429,22 +628,15 @@ scw cockpit token create [arg=value ...] | Name | | Description | |------|---|-------------| | project-id | | Project ID to use. If none is passed the default project ID will be used | -| name | Default: `` | Name of the token | -| scopes.query-metrics | | Permission to fetch metrics | -| scopes.write-metrics | | Permission to write metrics | -| scopes.setup-metrics-rules | | Permission to setup metrics rules | -| scopes.query-logs | | Permission to fetch logs | -| scopes.write-logs | | Permission to write logs | -| scopes.setup-logs-rules | | Permission to set up logs rules | -| scopes.setup-alerts | | Permission to set up alerts | -| scopes.query-traces | | Permission to fetch traces | -| scopes.write-traces | | Permission to write traces | +| name | | Name of the token | +| token-scopes.{index} | One of: `unknown_scope`, `read_only_metrics`, `write_only_metrics`, `full_access_metrics_rules`, `read_only_logs`, `write_only_logs`, `full_access_logs_rules`, `full_access_alert_manager`, `read_only_traces`, `write_only_traces` | Token permission scopes | +| 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 | -### Delete a given token specified by the token ID +### Delete a token -Delete a given token specified by the token ID. +Delete a given token, specified by the token ID. Deleting a token is irreversible and cannot be undone. **Usage:** @@ -457,18 +649,19 @@ scw cockpit token delete [arg=value ...] | Name | | Description | |------|---|-------------| -| token-id | Required | ID of the token | +| token-id | Required | ID of the token to delete | +| 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 | -### Retrieve a given token specified by the token ID +### Get a token -Retrieve a given token specified by the token ID. +Retrieve information about a given token, specified by the token ID. The token's information such as its scopes, is returned. **Usage:** ``` -scw cockpit token get [arg=value ...] +scw cockpit token get [arg=value ...] ``` @@ -476,13 +669,15 @@ scw cockpit token get [arg=value ...] | Name | | Description | |------|---|-------------| -| token-id | Required | ID of the token | +| token-id | Required | Token ID | +| 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 | -### Get a list of tokens in a given Project specified by the Project ID +### List tokens -Get a list of tokens in a given Project specified by the Project ID. +Retrieve a list of all tokens in the specified region. By default, tokens returned in the list are ordered by creation date, in ascending order. +You can filter tokens by Project ID and token scopes. **Usage:** @@ -495,8 +690,36 @@ scw cockpit token list [arg=value ...] | Name | | Description | |------|---|-------------| -| order-by | One of: `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc` | How the response is ordered | +| order-by | One of: `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc` | Order in which to return results | +| project-id | | Project ID to use. If none is passed the default project ID will be used | +| token-scopes.{index} | One of: `unknown_scope`, `read_only_metrics`, `write_only_metrics`, `full_access_metrics_rules`, `read_only_logs`, `write_only_logs`, `full_access_logs_rules`, `full_access_alert_manager`, `read_only_traces`, `write_only_traces` | Token scopes to filter for | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw`, `all` | Region to target. If none is passed will use default region from the config | + + + +## Usage overview management commands + +Usage overview management commands. + + +### Get data source usage overview + +Retrieve the data source usage overview per type for the specified Project. + +**Usage:** + +``` +scw cockpit usage-overview get [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| | project-id | | Project ID to use. If none is passed the default project ID will be used | +| interval | | | +| 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 | diff --git a/internal/namespaces/cockpit/v1/custom.go b/internal/namespaces/cockpit/v1/custom.go new file mode 100644 index 0000000000..6bb06b6c68 --- /dev/null +++ b/internal/namespaces/cockpit/v1/custom.go @@ -0,0 +1,13 @@ +package cockpit + +import ( + "github.com/scaleway/scaleway-cli/v2/internal/core" +) + +func GetCommands() *core.Commands { + cmds := GetGeneratedCommands() + + cmds.MustFind("cockpit", "token", "get").Override(cockpitTokenGetBuilder) + + return cmds +} diff --git a/internal/namespaces/cockpit/v1/custom_cockpit.go b/internal/namespaces/cockpit/v1/custom_cockpit.go new file mode 100644 index 0000000000..6d2df2dd26 --- /dev/null +++ b/internal/namespaces/cockpit/v1/custom_cockpit.go @@ -0,0 +1,18 @@ +package cockpit + +import ( + "github.com/scaleway/scaleway-cli/v2/internal/core" +) + +func cockpitTokenGetBuilder(c *core.Command) *core.Command { + c.View = &core.View{ + Sections: []*core.ViewSection{ + { + Title: "Scopes", + FieldName: "Scopes", + }, + }, + } + + return c +} diff --git a/internal/namespaces/cockpit/v1beta1/cockpit_cli.go b/internal/namespaces/cockpit/v1beta1/cockpit_cli.go deleted file mode 100644 index 46b3b4239c..0000000000 --- a/internal/namespaces/cockpit/v1beta1/cockpit_cli.go +++ /dev/null @@ -1,775 +0,0 @@ -// This file was automatically generated. DO NOT EDIT. -// If you have any remark or suggestion do not hesitate to open an issue. - -package cockpit - -import ( - "context" - "reflect" - - "github.com/scaleway/scaleway-cli/v2/internal/core" - "github.com/scaleway/scaleway-sdk-go/api/cockpit/v1beta1" - "github.com/scaleway/scaleway-sdk-go/scw" -) - -// always import dependencies -var ( - _ = scw.RegionFrPar -) - -func GetGeneratedCommands() *core.Commands { - return core.NewCommands( - cockpitRoot(), - cockpitCockpit(), - cockpitDatasource(), - cockpitToken(), - cockpitGrafanaUser(), - cockpitPlan(), - cockpitAlert(), - cockpitContact(), - cockpitProductDashboards(), - cockpitCockpitActivate(), - cockpitCockpitGet(), - cockpitCockpitDeactivate(), - cockpitTokenCreate(), - cockpitTokenList(), - cockpitTokenGet(), - cockpitTokenDelete(), - cockpitContactCreate(), - cockpitContactList(), - cockpitContactDelete(), - cockpitAlertEnable(), - cockpitAlertDisable(), - cockpitAlertTest(), - cockpitGrafanaUserCreate(), - cockpitGrafanaUserList(), - cockpitGrafanaUserDelete(), - cockpitGrafanaUserResetPassword(), - cockpitPlanList(), - cockpitPlanSelect(), - ) -} -func cockpitRoot() *core.Command { - return &core.Command{ - Short: `This API allows you to manage your Scaleway Cockpit, for storing and visualizing metrics and logs`, - Long: `This API allows you to manage your Scaleway Cockpit, for storing and visualizing metrics and logs.`, - Namespace: "cockpit", - } -} - -func cockpitCockpit() *core.Command { - return &core.Command{ - Short: `Cockpit management commands`, - Long: `Cockpit management commands.`, - Namespace: "cockpit", - Resource: "cockpit", - } -} - -func cockpitDatasource() *core.Command { - return &core.Command{ - Short: `Datasource management commands`, - Long: `Datasource management commands.`, - Namespace: "cockpit", - Resource: "datasource", - } -} - -func cockpitToken() *core.Command { - return &core.Command{ - Short: `Token management commands`, - Long: `Token management commands.`, - Namespace: "cockpit", - Resource: "token", - } -} - -func cockpitGrafanaUser() *core.Command { - return &core.Command{ - Short: `Grafana user management commands`, - Long: `Grafana user management commands.`, - Namespace: "cockpit", - Resource: "grafana-user", - } -} - -func cockpitPlan() *core.Command { - return &core.Command{ - Short: `Pricing plans management commands`, - Long: `Pricing plans management commands.`, - Namespace: "cockpit", - Resource: "plan", - } -} - -func cockpitAlert() *core.Command { - return &core.Command{ - Short: `Managed alerts management commands`, - Long: `Managed alerts management commands.`, - Namespace: "cockpit", - Resource: "alert", - } -} - -func cockpitContact() *core.Command { - return &core.Command{ - Short: `Contacts management commands`, - Long: `Contacts management commands.`, - Namespace: "cockpit", - Resource: "contact", - } -} - -func cockpitProductDashboards() *core.Command { - return &core.Command{ - Short: `Product dashboards management commands`, - Long: `Product dashboards management commands.`, - Namespace: "cockpit", - Resource: "product-dashboards", - } -} - -func cockpitCockpitActivate() *core.Command { - return &core.Command{ - Short: `Activate the Cockpit of a given Project specified by the Project ID`, - Long: `Activate the Cockpit of a given Project specified by the Project ID.`, - Namespace: "cockpit", - Resource: "cockpit", - Verb: "activate", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.ActivateCockpitRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.ActivateCockpitRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - return api.ActivateCockpit(request) - - }, - } -} - -func cockpitCockpitGet() *core.Command { - return &core.Command{ - Short: `Retrieve the Cockpit of a given Project specified by the Project ID`, - Long: `Retrieve the Cockpit of a given Project specified by the Project ID.`, - Namespace: "cockpit", - Resource: "cockpit", - Verb: "get", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.GetCockpitRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.GetCockpitRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - return api.GetCockpit(request) - - }, - } -} - -func cockpitCockpitDeactivate() *core.Command { - return &core.Command{ - Short: `Deactivate the Cockpit of a given Project specified by the Project ID`, - Long: `Deactivate the Cockpit of a given Project specified by the Project ID.`, - Namespace: "cockpit", - Resource: "cockpit", - Verb: "deactivate", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.DeactivateCockpitRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.DeactivateCockpitRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - return api.DeactivateCockpit(request) - - }, - } -} - -func cockpitTokenCreate() *core.Command { - return &core.Command{ - Short: `Create a token in a given Project specified by the Project ID`, - Long: `Create a token in a given Project specified by the Project ID.`, - Namespace: "cockpit", - Resource: "token", - Verb: "create", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.CreateTokenRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - { - Name: "name", - Short: `Name of the token`, - Required: false, - Deprecated: false, - Positional: false, - Default: core.RandomValueGenerator("token"), - }, - { - Name: "scopes.query-metrics", - Short: `Permission to fetch metrics`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "scopes.write-metrics", - Short: `Permission to write metrics`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "scopes.setup-metrics-rules", - Short: `Permission to setup metrics rules`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "scopes.query-logs", - Short: `Permission to fetch logs`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "scopes.write-logs", - Short: `Permission to write logs`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "scopes.setup-logs-rules", - Short: `Permission to set up logs rules`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "scopes.setup-alerts", - Short: `Permission to set up alerts`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "scopes.query-traces", - Short: `Permission to fetch traces`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "scopes.write-traces", - Short: `Permission to write traces`, - Required: false, - Deprecated: false, - Positional: false, - }, - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.CreateTokenRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - return api.CreateToken(request) - - }, - } -} - -func cockpitTokenList() *core.Command { - return &core.Command{ - Short: `Get a list of tokens in a given Project specified by the Project ID`, - Long: `Get a list of tokens in a given Project specified by the Project ID.`, - Namespace: "cockpit", - Resource: "token", - Verb: "list", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.ListTokensRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "order-by", - Short: `How the response is ordered`, - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"created_at_asc", "created_at_desc", "name_asc", "name_desc"}, - }, - core.ProjectIDArgSpec(), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.ListTokensRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - opts := []scw.RequestOption{scw.WithAllPages()} - resp, err := api.ListTokens(request, opts...) - if err != nil { - return nil, err - } - return resp.Tokens, nil - - }, - } -} - -func cockpitTokenGet() *core.Command { - return &core.Command{ - Short: `Retrieve a given token specified by the token ID`, - Long: `Retrieve a given token specified by the token ID.`, - Namespace: "cockpit", - Resource: "token", - Verb: "get", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.GetTokenRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "token-id", - Short: `ID of the token`, - Required: true, - Deprecated: false, - Positional: true, - }, - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.GetTokenRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - return api.GetToken(request) - - }, - } -} - -func cockpitTokenDelete() *core.Command { - return &core.Command{ - Short: `Delete a given token specified by the token ID`, - Long: `Delete a given token specified by the token ID.`, - Namespace: "cockpit", - Resource: "token", - Verb: "delete", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.DeleteTokenRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "token-id", - Short: `ID of the token`, - Required: true, - Deprecated: false, - Positional: false, - }, - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.DeleteTokenRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - e = api.DeleteToken(request) - if e != nil { - return nil, e - } - return &core.SuccessResult{ - Resource: "token", - Verb: "delete", - }, nil - }, - } -} - -func cockpitContactCreate() *core.Command { - return &core.Command{ - Short: `Create a contact point associated with the default receiver, to receive alerts`, - Long: `Create a contact point associated with the default receiver, to receive alerts.`, - Namespace: "cockpit", - Resource: "contact", - Verb: "create", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.CreateContactPointRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - { - Name: "contact-point.email.to", - Required: false, - Deprecated: false, - Positional: false, - }, - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.CreateContactPointRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - return api.CreateContactPoint(request) - - }, - } -} - -func cockpitContactList() *core.Command { - return &core.Command{ - Short: `Get a list of contact points created for a given Cockpit, specified by the ID of the Project the Cockpit belongs to`, - Long: `Get a list of contact points created for a given Cockpit, specified by the ID of the Project the Cockpit belongs to.`, - Namespace: "cockpit", - Resource: "contact", - Verb: "list", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.ListContactPointsRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.ListContactPointsRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - opts := []scw.RequestOption{scw.WithAllPages()} - resp, err := api.ListContactPoints(request, opts...) - if err != nil { - return nil, err - } - return resp.ContactPoints, nil - - }, - } -} - -func cockpitContactDelete() *core.Command { - return &core.Command{ - Short: `Delete a contact point associated with the default receiver`, - Long: `Delete a contact point associated with the default receiver.`, - Namespace: "cockpit", - Resource: "contact", - Verb: "delete", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.DeleteContactPointRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - { - Name: "contact-point.email.to", - Required: false, - Deprecated: false, - Positional: false, - }, - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.DeleteContactPointRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - e = api.DeleteContactPoint(request) - if e != nil { - return nil, e - } - return &core.SuccessResult{ - Resource: "contact", - Verb: "delete", - }, nil - }, - } -} - -func cockpitAlertEnable() *core.Command { - return &core.Command{ - Short: `Enable the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to`, - Long: `Enable the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to.`, - Namespace: "cockpit", - Resource: "alert", - Verb: "enable", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.EnableManagedAlertsRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.EnableManagedAlertsRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - e = api.EnableManagedAlerts(request) - if e != nil { - return nil, e - } - return &core.SuccessResult{ - Resource: "alert", - Verb: "enable", - }, nil - }, - } -} - -func cockpitAlertDisable() *core.Command { - return &core.Command{ - Short: `Disable the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to`, - Long: `Disable the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to.`, - Namespace: "cockpit", - Resource: "alert", - Verb: "disable", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.DisableManagedAlertsRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.DisableManagedAlertsRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - e = api.DisableManagedAlerts(request) - if e != nil { - return nil, e - } - return &core.SuccessResult{ - Resource: "alert", - Verb: "disable", - }, nil - }, - } -} - -func cockpitAlertTest() *core.Command { - return &core.Command{ - Short: `Send a test alert to make sure your contact points get notified when an actual alert is triggered`, - Long: `Send a test alert to make sure your contact points get notified when an actual alert is triggered.`, - Namespace: "cockpit", - Resource: "alert", - Verb: "test", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.TriggerTestAlertRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.TriggerTestAlertRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - e = api.TriggerTestAlert(request) - if e != nil { - return nil, e - } - return &core.SuccessResult{ - Resource: "alert", - Verb: "test", - }, nil - }, - } -} - -func cockpitGrafanaUserCreate() *core.Command { - return &core.Command{ - Short: `Create a Grafana user for your Cockpit's Grafana. Make sure you save the automatically-generated password and the Grafana user ID`, - Long: `Create a Grafana user for your Cockpit's Grafana. Make sure you save the automatically-generated password and the Grafana user ID.`, - Namespace: "cockpit", - Resource: "grafana-user", - Verb: "create", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.CreateGrafanaUserRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - { - Name: "login", - Short: `Username of the Grafana user`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "role", - Short: `Role assigned to the Grafana user`, - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"unknown_role", "editor", "viewer"}, - }, - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.CreateGrafanaUserRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - return api.CreateGrafanaUser(request) - - }, - } -} - -func cockpitGrafanaUserList() *core.Command { - return &core.Command{ - Short: `Get a list of all Grafana users created in your Cockpit's Grafana`, - Long: `Get a list of all Grafana users created in your Cockpit's Grafana.`, - Namespace: "cockpit", - Resource: "grafana-user", - Verb: "list", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.ListGrafanaUsersRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "order-by", - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"login_asc", "login_desc"}, - }, - core.ProjectIDArgSpec(), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.ListGrafanaUsersRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - opts := []scw.RequestOption{scw.WithAllPages()} - resp, err := api.ListGrafanaUsers(request, opts...) - if err != nil { - return nil, err - } - return resp.GrafanaUsers, nil - - }, - } -} - -func cockpitGrafanaUserDelete() *core.Command { - return &core.Command{ - Short: `Delete a Grafana user from your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user`, - Long: `Delete a Grafana user from your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user.`, - Namespace: "cockpit", - Resource: "grafana-user", - Verb: "delete", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.DeleteGrafanaUserRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - { - Name: "grafana-user-id", - Short: `ID of the Grafana user`, - Required: true, - Deprecated: false, - Positional: false, - }, - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.DeleteGrafanaUserRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - e = api.DeleteGrafanaUser(request) - if e != nil { - return nil, e - } - return &core.SuccessResult{ - Resource: "grafana-user", - Verb: "delete", - }, nil - }, - } -} - -func cockpitGrafanaUserResetPassword() *core.Command { - return &core.Command{ - Short: `Reset the password of a Grafana user, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user`, - Long: `Reset the password of a Grafana user, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user.`, - Namespace: "cockpit", - Resource: "grafana-user", - Verb: "reset-password", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.ResetGrafanaUserPasswordRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - { - Name: "grafana-user-id", - Short: `ID of the Grafana user`, - Required: true, - Deprecated: false, - Positional: false, - }, - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.ResetGrafanaUserPasswordRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - return api.ResetGrafanaUserPassword(request) - - }, - } -} - -func cockpitPlanList() *core.Command { - return &core.Command{ - Short: `Get a list of all pricing plans available`, - Long: `Get a list of all pricing plans available.`, - Namespace: "cockpit", - Resource: "plan", - Verb: "list", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.ListPlansRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "order-by", - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"name_asc", "name_desc"}, - }, - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.ListPlansRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - opts := []scw.RequestOption{scw.WithAllPages()} - resp, err := api.ListPlans(request, opts...) - if err != nil { - return nil, err - } - return resp.Plans, nil - - }, - } -} - -func cockpitPlanSelect() *core.Command { - return &core.Command{ - Short: `Select your chosen pricing plan for your Cockpit, specifying the Cockpit's Project ID and the pricing plan's ID in the request`, - Long: `Select your chosen pricing plan for your Cockpit, specifying the Cockpit's Project ID and the pricing plan's ID in the request.`, - Namespace: "cockpit", - Resource: "plan", - Verb: "select", - // Deprecated: false, - ArgsType: reflect.TypeOf(cockpit.SelectPlanRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - { - Name: "plan-id", - Short: `ID of the pricing plan`, - Required: false, - Deprecated: false, - Positional: false, - }, - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*cockpit.SelectPlanRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - return api.SelectPlan(request) - - }, - } -} diff --git a/internal/namespaces/cockpit/v1beta1/custom.go b/internal/namespaces/cockpit/v1beta1/custom.go deleted file mode 100644 index 57b52d090f..0000000000 --- a/internal/namespaces/cockpit/v1beta1/custom.go +++ /dev/null @@ -1,24 +0,0 @@ -package cockpit - -import ( - "github.com/scaleway/scaleway-cli/v2/internal/core" - "github.com/scaleway/scaleway-cli/v2/internal/human" - cockpit "github.com/scaleway/scaleway-sdk-go/api/cockpit/v1beta1" -) - -func GetCommands() *core.Commands { - cmds := GetGeneratedCommands() - - cmds.Merge(core.NewCommands( - cockpitWaitCommand(), - )) - - human.RegisterMarshalerFunc(cockpit.CockpitStatus(""), human.EnumMarshalFunc(cockpitStatusMarshalSpecs)) - - cmds.MustFind("cockpit", "cockpit", "activate").Override(cockpitCockpitActivateBuilder) - cmds.MustFind("cockpit", "cockpit", "deactivate").Override(cockpitCockpitDeactivateBuilder) - cmds.MustFind("cockpit", "cockpit", "get").Override(cockpitCockpitGetBuilder) - cmds.MustFind("cockpit", "token", "get").Override(cockpitTokenGetBuilder) - - return cmds -} diff --git a/internal/namespaces/cockpit/v1beta1/custom_cockpit.go b/internal/namespaces/cockpit/v1beta1/custom_cockpit.go deleted file mode 100644 index 2a0579fa34..0000000000 --- a/internal/namespaces/cockpit/v1beta1/custom_cockpit.go +++ /dev/null @@ -1,152 +0,0 @@ -package cockpit - -import ( - "context" - "errors" - "fmt" - "net/http" - "reflect" - "time" - - "github.com/fatih/color" - "github.com/scaleway/scaleway-cli/v2/internal/core" - "github.com/scaleway/scaleway-cli/v2/internal/human" - cockpit "github.com/scaleway/scaleway-sdk-go/api/cockpit/v1beta1" - "github.com/scaleway/scaleway-sdk-go/logger" - "github.com/scaleway/scaleway-sdk-go/scw" -) - -var ( - cockpitActionTimeout = 3 * time.Minute - - cockpitStatusMarshalSpecs = human.EnumMarshalSpecs{ - cockpit.CockpitStatusCreating: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "creating"}, - cockpit.CockpitStatusReady: &human.EnumMarshalSpec{Attribute: color.FgGreen, Value: "ready"}, - cockpit.CockpitStatusDeleting: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "deleting"}, - cockpit.CockpitStatusUpdating: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "updating"}, - cockpit.CockpitStatusError: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "error"}, - } -) - -func cockpitWaitCommand() *core.Command { - type cockpitWaitRequest struct { - ProjectID string - Timeout time.Duration - } - - return &core.Command{ - Short: `Wait for a cockpit to reach a stable state (installation)`, - Long: `Wait for a cockpit to reach a stable state. This is similar to using --wait flag on other action commands, but without requiring a new action on the cockpit.`, - Namespace: "cockpit", - Resource: "cockpit", - Verb: "wait", - Groups: []string{"workflow"}, - ArgsType: reflect.TypeOf(cockpitWaitRequest{}), - Run: func(ctx context.Context, argsI interface{}) (i interface{}, err error) { - args := argsI.(*cockpitWaitRequest) - - api := cockpit.NewAPI(core.ExtractClient(ctx)) - logger.Debugf("starting to wait for cockpit to reach a stable delivery status") - targetCockpit, err := api.WaitForCockpit(&cockpit.WaitForCockpitRequest{ - ProjectID: args.ProjectID, - Timeout: scw.TimeDurationPtr(args.Timeout), - RetryInterval: core.DefaultRetryInterval, - }) - if err != nil { - return nil, err - } - - if targetCockpit.Status != cockpit.CockpitStatusReady { - return nil, &core.CliError{ - Err: errors.New("cockpit did not reach a stable delivery status"), - Details: fmt.Sprintf("cockpit %s is in %s status", targetCockpit.ProjectID, targetCockpit.Status), - } - } - - return targetCockpit, nil - }, - ArgSpecs: core.ArgSpecs{ - { - Name: "project-id", - Short: `The ID of the project the cockpit is attached to`, - Required: true, - Positional: true, - }, - core.WaitTimeoutArgSpec(cockpitActionTimeout), - }, - Examples: []*core.Example{ - { - Short: "Wait for a cockpit to reach a stable state", - ArgsJSON: `{"project_id": "11111111-1111-1111-1111-111111111111"}`, - }, - }, - } -} - -func cockpitCockpitActivateBuilder(command *core.Command) *core.Command { - command.WaitFunc = func(ctx context.Context, argsI, _ interface{}) (interface{}, error) { - req := argsI.(*cockpit.ActivateCockpitRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - return api.WaitForCockpit(&cockpit.WaitForCockpitRequest{ - ProjectID: req.ProjectID, - Timeout: scw.TimeDurationPtr(cockpitActionTimeout), - RetryInterval: core.DefaultRetryInterval, - }) - } - return command -} - -func cockpitCockpitDeactivateBuilder(command *core.Command) *core.Command { - command.WaitFunc = func(ctx context.Context, argsI, _ interface{}) (interface{}, error) { - req := argsI.(*cockpit.DeactivateCockpitRequest) - - client := core.ExtractClient(ctx) - api := cockpit.NewAPI(client) - _, err := api.WaitForCockpit(&cockpit.WaitForCockpitRequest{ - ProjectID: req.ProjectID, - Timeout: scw.TimeDurationPtr(cockpitActionTimeout), - RetryInterval: core.DefaultRetryInterval, - }) - if err != nil { - // if we get a 404 here, it means the resource was successfully deleted - notFoundError := &scw.ResourceNotFoundError{} - responseError := &scw.ResponseError{} - if errors.As(err, &responseError) && responseError.StatusCode == http.StatusNotFound || errors.As(err, ¬FoundError) { - return fmt.Sprintf("Cockpit %s successfully deleted.", req.ProjectID), nil - } - - return nil, err - } - - return nil, fmt.Errorf("cockpit %s is still active", req.ProjectID) - } - return command -} - -func cockpitCockpitGetBuilder(c *core.Command) *core.Command { - c.View = &core.View{ - Sections: []*core.ViewSection{ - { - Title: "Endpoints", - FieldName: "Endpoints", - }, - }, - } - - return c -} - -func cockpitTokenGetBuilder(c *core.Command) *core.Command { - c.View = &core.View{ - Sections: []*core.ViewSection{ - { - Title: "Scopes", - FieldName: "Scopes", - }, - }, - } - - return c -} diff --git a/internal/namespaces/get_commands.go b/internal/namespaces/get_commands.go index 9a29091983..0b64818956 100644 --- a/internal/namespaces/get_commands.go +++ b/internal/namespaces/get_commands.go @@ -11,7 +11,7 @@ import ( "github.com/scaleway/scaleway-cli/v2/internal/namespaces/baremetal/v1" billing "github.com/scaleway/scaleway-cli/v2/internal/namespaces/billing/v2beta1" block "github.com/scaleway/scaleway-cli/v2/internal/namespaces/block/v1alpha1" - cockpit "github.com/scaleway/scaleway-cli/v2/internal/namespaces/cockpit/v1beta1" + "github.com/scaleway/scaleway-cli/v2/internal/namespaces/cockpit/v1" configNamespace "github.com/scaleway/scaleway-cli/v2/internal/namespaces/config" container "github.com/scaleway/scaleway-cli/v2/internal/namespaces/container/v1beta1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/dedibox/v1"