diff --git a/.gitignore b/.gitignore index 70c5d7e8f..428e142ad 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ dist/ # IDE .vscode +.idea # OS generated files .DS_Store diff --git a/CONTRIBUTION.md b/CONTRIBUTION.md index 9c8488a9a..be0a54346 100644 --- a/CONTRIBUTION.md +++ b/CONTRIBUTION.md @@ -173,6 +173,13 @@ func outputResult(p *print.Printer, cmd *cobra.Command, outputFormat string, res } p.Outputln(string(details)) return nil + case print.YAMLOutputFormat: + details, err := yaml.Marshal(resources) + if err != nil { + return fmt.Errorf("marshal resource list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() table.SetHeader("ID", "NAME", "STATE") diff --git a/README.md b/README.md index 3e33a00de..adcbb5e43 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,33 @@ stackit config list You can also edit the configuration file manually. +## Customization + +### Pager + +To specify a custom pager, use the `PAGER` environment variable. + +If the variable is not set, STACKIT CLI uses the `less` as default pager. + +When using `less` as a pager, STACKIT CLI will automatically pass following options +- -F, --quit-if-one-screen - Less will automatically exit if the entire file can be displayed on the first screen. +- -S, --chop-long-lines - Lines longer than the screen width will be chopped rather than being folded. +- -w, --hilite-unread - Temporarily highlights the first "new" line after a forward movement of a full page. +- -R, --RAW-CONTROL-CHARS - ANSI color and style sequences will be interpreted. + +> These options will not be added automatically if a custom pager is defined. +> +> In that case, users can define the parameters by using the specific environment variable required by the `PAGER` (if supported). + +> +> For example, if user sets the `PAGER` environment variable to `less` and would like to pass some arguments, `LESS` environment variable must be used as following: + +> +> export PAGER="less" +> +> export LESS="-R" + + ## Autocompletion If you wish to set up command autocompletion in your shell for the STACKIT CLI, please refer to our [autocompletion guide](./AUTOCOMPLETION.md). diff --git a/docs/stackit.md b/docs/stackit.md index 5f5c5b0b6..5d8cc339e 100644 --- a/docs/stackit.md +++ b/docs/stackit.md @@ -18,7 +18,7 @@ stackit [flags] -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously -h, --help Help for "stackit" - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") -v, --version Show "stackit" version diff --git a/docs/stackit_argus.md b/docs/stackit_argus.md index 4aa39f3de..b09e8d344 100644 --- a/docs/stackit_argus.md +++ b/docs/stackit_argus.md @@ -21,7 +21,7 @@ stackit argus [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_credentials.md b/docs/stackit_argus_credentials.md index 9205b3781..b8cb24b2d 100644 --- a/docs/stackit_argus_credentials.md +++ b/docs/stackit_argus_credentials.md @@ -21,7 +21,7 @@ stackit argus credentials [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_credentials_create.md b/docs/stackit_argus_credentials_create.md index d2cd837e7..9a5c0de17 100644 --- a/docs/stackit_argus_credentials_create.md +++ b/docs/stackit_argus_credentials_create.md @@ -30,7 +30,7 @@ stackit argus credentials create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_credentials_delete.md b/docs/stackit_argus_credentials_delete.md index 9437208f4..b88f82b44 100644 --- a/docs/stackit_argus_credentials_delete.md +++ b/docs/stackit_argus_credentials_delete.md @@ -29,7 +29,7 @@ stackit argus credentials delete USERNAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_credentials_list.md b/docs/stackit_argus_credentials_list.md index e51666bb9..889f08e04 100644 --- a/docs/stackit_argus_credentials_list.md +++ b/docs/stackit_argus_credentials_list.md @@ -36,7 +36,7 @@ stackit argus credentials list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_grafana.md b/docs/stackit_argus_grafana.md index dbfb5d0e4..3307c0b37 100644 --- a/docs/stackit_argus_grafana.md +++ b/docs/stackit_argus_grafana.md @@ -21,7 +21,7 @@ stackit argus grafana [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_grafana_describe.md b/docs/stackit_argus_grafana_describe.md index 1245939fa..53ea3812a 100644 --- a/docs/stackit_argus_grafana_describe.md +++ b/docs/stackit_argus_grafana_describe.md @@ -37,7 +37,7 @@ stackit argus grafana describe INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_grafana_public-read-access.md b/docs/stackit_argus_grafana_public-read-access.md index 00a09e974..963dbec1d 100644 --- a/docs/stackit_argus_grafana_public-read-access.md +++ b/docs/stackit_argus_grafana_public-read-access.md @@ -22,7 +22,7 @@ stackit argus grafana public-read-access [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_grafana_public-read-access_disable.md b/docs/stackit_argus_grafana_public-read-access_disable.md index da7f21453..b2f232934 100644 --- a/docs/stackit_argus_grafana_public-read-access_disable.md +++ b/docs/stackit_argus_grafana_public-read-access_disable.md @@ -29,7 +29,7 @@ stackit argus grafana public-read-access disable INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_grafana_public-read-access_enable.md b/docs/stackit_argus_grafana_public-read-access_enable.md index 096620a41..1cbe9579a 100644 --- a/docs/stackit_argus_grafana_public-read-access_enable.md +++ b/docs/stackit_argus_grafana_public-read-access_enable.md @@ -29,7 +29,7 @@ stackit argus grafana public-read-access enable INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_grafana_single-sign-on.md b/docs/stackit_argus_grafana_single-sign-on.md index f78be2f10..37540150e 100644 --- a/docs/stackit_argus_grafana_single-sign-on.md +++ b/docs/stackit_argus_grafana_single-sign-on.md @@ -22,7 +22,7 @@ stackit argus grafana single-sign-on [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_grafana_single-sign-on_disable.md b/docs/stackit_argus_grafana_single-sign-on_disable.md index d90f5e761..2766cb326 100644 --- a/docs/stackit_argus_grafana_single-sign-on_disable.md +++ b/docs/stackit_argus_grafana_single-sign-on_disable.md @@ -29,7 +29,7 @@ stackit argus grafana single-sign-on disable INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_grafana_single-sign-on_enable.md b/docs/stackit_argus_grafana_single-sign-on_enable.md index e3bc43627..33b6ae4e1 100644 --- a/docs/stackit_argus_grafana_single-sign-on_enable.md +++ b/docs/stackit_argus_grafana_single-sign-on_enable.md @@ -29,7 +29,7 @@ stackit argus grafana single-sign-on enable INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_instance.md b/docs/stackit_argus_instance.md index 26ffa10bb..8683c76eb 100644 --- a/docs/stackit_argus_instance.md +++ b/docs/stackit_argus_instance.md @@ -21,7 +21,7 @@ stackit argus instance [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_instance_create.md b/docs/stackit_argus_instance_create.md index 12728f040..ed63c92e0 100644 --- a/docs/stackit_argus_instance_create.md +++ b/docs/stackit_argus_instance_create.md @@ -34,7 +34,7 @@ stackit argus instance create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_instance_delete.md b/docs/stackit_argus_instance_delete.md index 6a9432f57..b0c681607 100644 --- a/docs/stackit_argus_instance_delete.md +++ b/docs/stackit_argus_instance_delete.md @@ -28,7 +28,7 @@ stackit argus instance delete INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_instance_describe.md b/docs/stackit_argus_instance_describe.md index fec05a0d4..77d3c6546 100644 --- a/docs/stackit_argus_instance_describe.md +++ b/docs/stackit_argus_instance_describe.md @@ -31,7 +31,7 @@ stackit argus instance describe INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_instance_list.md b/docs/stackit_argus_instance_list.md index f93235105..b91308146 100644 --- a/docs/stackit_argus_instance_list.md +++ b/docs/stackit_argus_instance_list.md @@ -35,7 +35,7 @@ stackit argus instance list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_instance_update.md b/docs/stackit_argus_instance_update.md index c2db5047b..25155965e 100644 --- a/docs/stackit_argus_instance_update.md +++ b/docs/stackit_argus_instance_update.md @@ -37,7 +37,7 @@ stackit argus instance update INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_plans.md b/docs/stackit_argus_plans.md index 33dfa4e79..bc65afb9e 100644 --- a/docs/stackit_argus_plans.md +++ b/docs/stackit_argus_plans.md @@ -35,7 +35,7 @@ stackit argus plans [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_scrape-config.md b/docs/stackit_argus_scrape-config.md index 15dea4a7f..8a96ec535 100644 --- a/docs/stackit_argus_scrape-config.md +++ b/docs/stackit_argus_scrape-config.md @@ -21,7 +21,7 @@ stackit argus scrape-config [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_scrape-config_create.md b/docs/stackit_argus_scrape-config_create.md index cf1dfec34..0df2e91bd 100644 --- a/docs/stackit_argus_scrape-config_create.md +++ b/docs/stackit_argus_scrape-config_create.md @@ -44,7 +44,7 @@ stackit argus scrape-config create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_scrape-config_delete.md b/docs/stackit_argus_scrape-config_delete.md index 8264d85fc..503433973 100644 --- a/docs/stackit_argus_scrape-config_delete.md +++ b/docs/stackit_argus_scrape-config_delete.md @@ -29,7 +29,7 @@ stackit argus scrape-config delete JOB_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_scrape-config_describe.md b/docs/stackit_argus_scrape-config_describe.md index 94a3be074..565c8f65f 100644 --- a/docs/stackit_argus_scrape-config_describe.md +++ b/docs/stackit_argus_scrape-config_describe.md @@ -32,7 +32,7 @@ stackit argus scrape-config describe JOB_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_scrape-config_generate-payload.md b/docs/stackit_argus_scrape-config_generate-payload.md index 94da2ec8d..9f246dfbd 100644 --- a/docs/stackit_argus_scrape-config_generate-payload.md +++ b/docs/stackit_argus_scrape-config_generate-payload.md @@ -43,7 +43,7 @@ stackit argus scrape-config generate-payload [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_scrape-config_list.md b/docs/stackit_argus_scrape-config_list.md index 45dc232d6..a4ae284f4 100644 --- a/docs/stackit_argus_scrape-config_list.md +++ b/docs/stackit_argus_scrape-config_list.md @@ -36,7 +36,7 @@ stackit argus scrape-config list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_argus_scrape-config_update.md b/docs/stackit_argus_scrape-config_update.md index a3b523377..f335fc673 100644 --- a/docs/stackit_argus_scrape-config_update.md +++ b/docs/stackit_argus_scrape-config_update.md @@ -40,7 +40,7 @@ stackit argus scrape-config update JOB_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_auth.md b/docs/stackit_auth.md index 726a902dd..00211ca7f 100644 --- a/docs/stackit_auth.md +++ b/docs/stackit_auth.md @@ -21,7 +21,7 @@ stackit auth [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_auth_activate-service-account.md b/docs/stackit_auth_activate-service-account.md index f0a3b8578..c7f83a103 100644 --- a/docs/stackit_auth_activate-service-account.md +++ b/docs/stackit_auth_activate-service-account.md @@ -41,7 +41,7 @@ stackit auth activate-service-account [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_auth_login.md b/docs/stackit_auth_login.md index fabd45362..e1f41a63e 100644 --- a/docs/stackit_auth_login.md +++ b/docs/stackit_auth_login.md @@ -28,7 +28,7 @@ stackit auth login [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_config.md b/docs/stackit_config.md index fedd6f2a3..7a5d45296 100644 --- a/docs/stackit_config.md +++ b/docs/stackit_config.md @@ -26,7 +26,7 @@ stackit config [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_config_list.md b/docs/stackit_config_list.md index 81491012e..f8b68be6e 100644 --- a/docs/stackit_config_list.md +++ b/docs/stackit_config_list.md @@ -37,7 +37,7 @@ stackit config list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_config_set.md b/docs/stackit_config_set.md index faa93fa1a..02b608352 100644 --- a/docs/stackit_config_set.md +++ b/docs/stackit_config_set.md @@ -54,7 +54,7 @@ stackit config set [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_curl.md b/docs/stackit_curl.md index 32c0aa110..27938ca6d 100644 --- a/docs/stackit_curl.md +++ b/docs/stackit_curl.md @@ -43,7 +43,7 @@ stackit curl URL [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns.md b/docs/stackit_dns.md index c4868f149..07d1fa87c 100644 --- a/docs/stackit_dns.md +++ b/docs/stackit_dns.md @@ -21,7 +21,7 @@ stackit dns [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_record-set.md b/docs/stackit_dns_record-set.md index 45856f397..33816f70f 100644 --- a/docs/stackit_dns_record-set.md +++ b/docs/stackit_dns_record-set.md @@ -21,7 +21,7 @@ stackit dns record-set [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_record-set_create.md b/docs/stackit_dns_record-set_create.md index 341fe3cf3..0d8cb5a53 100644 --- a/docs/stackit_dns_record-set_create.md +++ b/docs/stackit_dns_record-set_create.md @@ -34,7 +34,7 @@ stackit dns record-set create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_record-set_delete.md b/docs/stackit_dns_record-set_delete.md index 3621c8ae2..c831ba208 100644 --- a/docs/stackit_dns_record-set_delete.md +++ b/docs/stackit_dns_record-set_delete.md @@ -29,7 +29,7 @@ stackit dns record-set delete RECORD_SET_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_record-set_describe.md b/docs/stackit_dns_record-set_describe.md index 09473b59b..a29428708 100644 --- a/docs/stackit_dns_record-set_describe.md +++ b/docs/stackit_dns_record-set_describe.md @@ -32,7 +32,7 @@ stackit dns record-set describe RECORD_SET_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_record-set_list.md b/docs/stackit_dns_record-set_list.md index f69026510..4b6e7654d 100644 --- a/docs/stackit_dns_record-set_list.md +++ b/docs/stackit_dns_record-set_list.md @@ -48,7 +48,7 @@ stackit dns record-set list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_record-set_update.md b/docs/stackit_dns_record-set_update.md index 8b55c3fec..ff150283f 100644 --- a/docs/stackit_dns_record-set_update.md +++ b/docs/stackit_dns_record-set_update.md @@ -33,7 +33,7 @@ stackit dns record-set update RECORD_SET_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_zone.md b/docs/stackit_dns_zone.md index d46ebe906..2d484e5e6 100644 --- a/docs/stackit_dns_zone.md +++ b/docs/stackit_dns_zone.md @@ -21,7 +21,7 @@ stackit dns zone [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_zone_create.md b/docs/stackit_dns_zone_create.md index 2ef4da873..2ac88572c 100644 --- a/docs/stackit_dns_zone_create.md +++ b/docs/stackit_dns_zone_create.md @@ -44,7 +44,7 @@ stackit dns zone create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_zone_delete.md b/docs/stackit_dns_zone_delete.md index c5605b826..04f96576f 100644 --- a/docs/stackit_dns_zone_delete.md +++ b/docs/stackit_dns_zone_delete.md @@ -28,7 +28,7 @@ stackit dns zone delete ZONE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_zone_describe.md b/docs/stackit_dns_zone_describe.md index 312a1ec77..f65163566 100644 --- a/docs/stackit_dns_zone_describe.md +++ b/docs/stackit_dns_zone_describe.md @@ -31,7 +31,7 @@ stackit dns zone describe ZONE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_zone_list.md b/docs/stackit_dns_zone_list.md index 324110b6a..92c527c00 100644 --- a/docs/stackit_dns_zone_list.md +++ b/docs/stackit_dns_zone_list.md @@ -44,7 +44,7 @@ stackit dns zone list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_dns_zone_update.md b/docs/stackit_dns_zone_update.md index d09e8cec6..334d7fbec 100644 --- a/docs/stackit_dns_zone_update.md +++ b/docs/stackit_dns_zone_update.md @@ -38,7 +38,7 @@ stackit dns zone update ZONE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer.md b/docs/stackit_load-balancer.md index e4bff615a..8c154e2b8 100644 --- a/docs/stackit_load-balancer.md +++ b/docs/stackit_load-balancer.md @@ -21,7 +21,7 @@ stackit load-balancer [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_create.md b/docs/stackit_load-balancer_create.md index b685dd6e7..054947308 100644 --- a/docs/stackit_load-balancer_create.md +++ b/docs/stackit_load-balancer_create.md @@ -39,7 +39,7 @@ stackit load-balancer create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_delete.md b/docs/stackit_load-balancer_delete.md index 3dd43b2ae..4c8c895a9 100644 --- a/docs/stackit_load-balancer_delete.md +++ b/docs/stackit_load-balancer_delete.md @@ -28,7 +28,7 @@ stackit load-balancer delete LOAD_BALANCER_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_describe.md b/docs/stackit_load-balancer_describe.md index f3b41e9ce..de7abebc8 100644 --- a/docs/stackit_load-balancer_describe.md +++ b/docs/stackit_load-balancer_describe.md @@ -31,7 +31,7 @@ stackit load-balancer describe LOAD_BALANCER_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_generate-payload.md b/docs/stackit_load-balancer_generate-payload.md index f01579eca..b0533dfb2 100644 --- a/docs/stackit_load-balancer_generate-payload.md +++ b/docs/stackit_load-balancer_generate-payload.md @@ -37,7 +37,7 @@ stackit load-balancer generate-payload [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_list.md b/docs/stackit_load-balancer_list.md index e4525cff4..b73422bf6 100644 --- a/docs/stackit_load-balancer_list.md +++ b/docs/stackit_load-balancer_list.md @@ -35,7 +35,7 @@ stackit load-balancer list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_observability-credentials.md b/docs/stackit_load-balancer_observability-credentials.md index 4ccba5c45..187047d14 100644 --- a/docs/stackit_load-balancer_observability-credentials.md +++ b/docs/stackit_load-balancer_observability-credentials.md @@ -21,7 +21,7 @@ stackit load-balancer observability-credentials [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_observability-credentials_add.md b/docs/stackit_load-balancer_observability-credentials_add.md index f66ccf0e6..8abbc2fe9 100644 --- a/docs/stackit_load-balancer_observability-credentials_add.md +++ b/docs/stackit_load-balancer_observability-credentials_add.md @@ -34,7 +34,7 @@ stackit load-balancer observability-credentials add [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_observability-credentials_cleanup.md b/docs/stackit_load-balancer_observability-credentials_cleanup.md index e994d0803..6f72a76c2 100644 --- a/docs/stackit_load-balancer_observability-credentials_cleanup.md +++ b/docs/stackit_load-balancer_observability-credentials_cleanup.md @@ -28,12 +28,11 @@ stackit load-balancer observability-credentials cleanup [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` ### SEE ALSO -* [stackit load-balancer observability-credentials](./stackit_load-balancer_observability-credentials.md) - Provides functionality for Load Balancer observability credentials - +- [stackit load-balancer observability-credentials](./stackit_load-balancer_observability-credentials.md) - Provides functionality for Load Balancer observability credentials diff --git a/docs/stackit_load-balancer_observability-credentials_delete.md b/docs/stackit_load-balancer_observability-credentials_delete.md index c58199974..7c2965552 100644 --- a/docs/stackit_load-balancer_observability-credentials_delete.md +++ b/docs/stackit_load-balancer_observability-credentials_delete.md @@ -28,7 +28,7 @@ stackit load-balancer observability-credentials delete CREDENTIALS_REF [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_observability-credentials_describe.md b/docs/stackit_load-balancer_observability-credentials_describe.md index cf0d63e59..5feb0a190 100644 --- a/docs/stackit_load-balancer_observability-credentials_describe.md +++ b/docs/stackit_load-balancer_observability-credentials_describe.md @@ -28,7 +28,7 @@ stackit load-balancer observability-credentials describe CREDENTIALS_REF [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_observability-credentials_list.md b/docs/stackit_load-balancer_observability-credentials_list.md index 581aa37a8..893fecdbf 100644 --- a/docs/stackit_load-balancer_observability-credentials_list.md +++ b/docs/stackit_load-balancer_observability-credentials_list.md @@ -43,7 +43,7 @@ stackit load-balancer observability-credentials list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_observability-credentials_update.md b/docs/stackit_load-balancer_observability-credentials_update.md index 86646227e..2ef125bbc 100644 --- a/docs/stackit_load-balancer_observability-credentials_update.md +++ b/docs/stackit_load-balancer_observability-credentials_update.md @@ -34,7 +34,7 @@ stackit load-balancer observability-credentials update [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_quota.md b/docs/stackit_load-balancer_quota.md index b81c73575..9ffb0b5e3 100644 --- a/docs/stackit_load-balancer_quota.md +++ b/docs/stackit_load-balancer_quota.md @@ -28,7 +28,7 @@ stackit load-balancer quota [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_target-pool.md b/docs/stackit_load-balancer_target-pool.md index 92f97009f..cce372cee 100644 --- a/docs/stackit_load-balancer_target-pool.md +++ b/docs/stackit_load-balancer_target-pool.md @@ -21,7 +21,7 @@ stackit load-balancer target-pool [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_target-pool_add-target.md b/docs/stackit_load-balancer_target-pool_add-target.md index ba18837e5..c5de949df 100644 --- a/docs/stackit_load-balancer_target-pool_add-target.md +++ b/docs/stackit_load-balancer_target-pool_add-target.md @@ -32,7 +32,7 @@ stackit load-balancer target-pool add-target TARGET_IP [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_target-pool_describe.md b/docs/stackit_load-balancer_target-pool_describe.md index 02a409205..25564de96 100644 --- a/docs/stackit_load-balancer_target-pool_describe.md +++ b/docs/stackit_load-balancer_target-pool_describe.md @@ -32,7 +32,7 @@ stackit load-balancer target-pool describe TARGET_POOL_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_target-pool_remove-target.md b/docs/stackit_load-balancer_target-pool_remove-target.md index a910fb3a9..af638f939 100644 --- a/docs/stackit_load-balancer_target-pool_remove-target.md +++ b/docs/stackit_load-balancer_target-pool_remove-target.md @@ -30,7 +30,7 @@ stackit load-balancer target-pool remove-target TARGET_IP [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_load-balancer_update.md b/docs/stackit_load-balancer_update.md index 97eeddb81..a2d9b771f 100644 --- a/docs/stackit_load-balancer_update.md +++ b/docs/stackit_load-balancer_update.md @@ -39,7 +39,7 @@ stackit load-balancer update LOAD_BALANCER_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme.md b/docs/stackit_logme.md index 4d11081b6..38a1419ab 100644 --- a/docs/stackit_logme.md +++ b/docs/stackit_logme.md @@ -21,7 +21,7 @@ stackit logme [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_credentials.md b/docs/stackit_logme_credentials.md index 6fdc82ba1..0d2712c1d 100644 --- a/docs/stackit_logme_credentials.md +++ b/docs/stackit_logme_credentials.md @@ -21,7 +21,7 @@ stackit logme credentials [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_credentials_create.md b/docs/stackit_logme_credentials_create.md index 3a6a2ad6f..2dc853cec 100644 --- a/docs/stackit_logme_credentials_create.md +++ b/docs/stackit_logme_credentials_create.md @@ -33,7 +33,7 @@ stackit logme credentials create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_credentials_delete.md b/docs/stackit_logme_credentials_delete.md index 9da8d2e23..020b53c99 100644 --- a/docs/stackit_logme_credentials_delete.md +++ b/docs/stackit_logme_credentials_delete.md @@ -29,7 +29,7 @@ stackit logme credentials delete CREDENTIALS_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_credentials_describe.md b/docs/stackit_logme_credentials_describe.md index 828d46231..a882a1c70 100644 --- a/docs/stackit_logme_credentials_describe.md +++ b/docs/stackit_logme_credentials_describe.md @@ -32,7 +32,7 @@ stackit logme credentials describe CREDENTIALS_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_credentials_list.md b/docs/stackit_logme_credentials_list.md index 3bb6cfc44..2ae3d2bfa 100644 --- a/docs/stackit_logme_credentials_list.md +++ b/docs/stackit_logme_credentials_list.md @@ -36,7 +36,7 @@ stackit logme credentials list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_instance.md b/docs/stackit_logme_instance.md index edaa09f89..90c389041 100644 --- a/docs/stackit_logme_instance.md +++ b/docs/stackit_logme_instance.md @@ -21,7 +21,7 @@ stackit logme instance [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_instance_create.md b/docs/stackit_logme_instance_create.md index 5b6d78082..281d13e9b 100644 --- a/docs/stackit_logme_instance_create.md +++ b/docs/stackit_logme_instance_create.md @@ -45,7 +45,7 @@ stackit logme instance create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_instance_delete.md b/docs/stackit_logme_instance_delete.md index f1c45b4d6..94bc52c53 100644 --- a/docs/stackit_logme_instance_delete.md +++ b/docs/stackit_logme_instance_delete.md @@ -28,7 +28,7 @@ stackit logme instance delete INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_instance_describe.md b/docs/stackit_logme_instance_describe.md index ca3105bec..26241ca7a 100644 --- a/docs/stackit_logme_instance_describe.md +++ b/docs/stackit_logme_instance_describe.md @@ -31,7 +31,7 @@ stackit logme instance describe INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_instance_list.md b/docs/stackit_logme_instance_list.md index ded2abe71..9180286b2 100644 --- a/docs/stackit_logme_instance_list.md +++ b/docs/stackit_logme_instance_list.md @@ -35,7 +35,7 @@ stackit logme instance list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_instance_update.md b/docs/stackit_logme_instance_update.md index f29639948..d6ac88f29 100644 --- a/docs/stackit_logme_instance_update.md +++ b/docs/stackit_logme_instance_update.md @@ -41,7 +41,7 @@ stackit logme instance update INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_logme_plans.md b/docs/stackit_logme_plans.md index aafe53e00..f2450971f 100644 --- a/docs/stackit_logme_plans.md +++ b/docs/stackit_logme_plans.md @@ -35,7 +35,7 @@ stackit logme plans [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb.md b/docs/stackit_mariadb.md index 42dff9880..18d6875c2 100644 --- a/docs/stackit_mariadb.md +++ b/docs/stackit_mariadb.md @@ -21,7 +21,7 @@ stackit mariadb [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_credentials.md b/docs/stackit_mariadb_credentials.md index 2a4950db2..34f79706f 100644 --- a/docs/stackit_mariadb_credentials.md +++ b/docs/stackit_mariadb_credentials.md @@ -21,7 +21,7 @@ stackit mariadb credentials [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_credentials_create.md b/docs/stackit_mariadb_credentials_create.md index 1ea118fb3..beb6159c6 100644 --- a/docs/stackit_mariadb_credentials_create.md +++ b/docs/stackit_mariadb_credentials_create.md @@ -33,7 +33,7 @@ stackit mariadb credentials create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_credentials_delete.md b/docs/stackit_mariadb_credentials_delete.md index 5cf28431d..812c4f7bc 100644 --- a/docs/stackit_mariadb_credentials_delete.md +++ b/docs/stackit_mariadb_credentials_delete.md @@ -29,7 +29,7 @@ stackit mariadb credentials delete CREDENTIALS_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_credentials_describe.md b/docs/stackit_mariadb_credentials_describe.md index b89d54f4c..79b828146 100644 --- a/docs/stackit_mariadb_credentials_describe.md +++ b/docs/stackit_mariadb_credentials_describe.md @@ -32,7 +32,7 @@ stackit mariadb credentials describe CREDENTIALS_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_credentials_list.md b/docs/stackit_mariadb_credentials_list.md index 0ff725526..cc49e23c4 100644 --- a/docs/stackit_mariadb_credentials_list.md +++ b/docs/stackit_mariadb_credentials_list.md @@ -36,7 +36,7 @@ stackit mariadb credentials list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_instance.md b/docs/stackit_mariadb_instance.md index 5ba8366ad..2da27c38b 100644 --- a/docs/stackit_mariadb_instance.md +++ b/docs/stackit_mariadb_instance.md @@ -21,7 +21,7 @@ stackit mariadb instance [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_instance_create.md b/docs/stackit_mariadb_instance_create.md index db1898f61..3a8a063b9 100644 --- a/docs/stackit_mariadb_instance_create.md +++ b/docs/stackit_mariadb_instance_create.md @@ -45,7 +45,7 @@ stackit mariadb instance create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_instance_delete.md b/docs/stackit_mariadb_instance_delete.md index 32a5e786f..564057900 100644 --- a/docs/stackit_mariadb_instance_delete.md +++ b/docs/stackit_mariadb_instance_delete.md @@ -28,7 +28,7 @@ stackit mariadb instance delete INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_instance_describe.md b/docs/stackit_mariadb_instance_describe.md index 89e9468d2..13c5014e1 100644 --- a/docs/stackit_mariadb_instance_describe.md +++ b/docs/stackit_mariadb_instance_describe.md @@ -31,7 +31,7 @@ stackit mariadb instance describe INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_instance_list.md b/docs/stackit_mariadb_instance_list.md index b0e0fbab5..301787ef6 100644 --- a/docs/stackit_mariadb_instance_list.md +++ b/docs/stackit_mariadb_instance_list.md @@ -35,7 +35,7 @@ stackit mariadb instance list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_instance_update.md b/docs/stackit_mariadb_instance_update.md index aa1fc35e2..1c7712c00 100644 --- a/docs/stackit_mariadb_instance_update.md +++ b/docs/stackit_mariadb_instance_update.md @@ -41,7 +41,7 @@ stackit mariadb instance update INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mariadb_plans.md b/docs/stackit_mariadb_plans.md index cc179c71d..4ad4db981 100644 --- a/docs/stackit_mariadb_plans.md +++ b/docs/stackit_mariadb_plans.md @@ -35,7 +35,7 @@ stackit mariadb plans [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex.md b/docs/stackit_mongodbflex.md index d44688246..3d6810d68 100644 --- a/docs/stackit_mongodbflex.md +++ b/docs/stackit_mongodbflex.md @@ -21,7 +21,7 @@ stackit mongodbflex [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` @@ -29,6 +29,7 @@ stackit mongodbflex [flags] ### SEE ALSO * [stackit](./stackit.md) - Manage STACKIT resources using the command line +* [stackit mongodbflex backup](./stackit_mongodbflex_backup.md) - Provides functionality for MongoDB Flex instance backups * [stackit mongodbflex instance](./stackit_mongodbflex_instance.md) - Provides functionality for MongoDB Flex instances * [stackit mongodbflex options](./stackit_mongodbflex_options.md) - Lists MongoDB Flex options * [stackit mongodbflex user](./stackit_mongodbflex_user.md) - Provides functionality for MongoDB Flex users diff --git a/docs/stackit_mongodbflex_backup.md b/docs/stackit_mongodbflex_backup.md new file mode 100644 index 000000000..de46caf3a --- /dev/null +++ b/docs/stackit_mongodbflex_backup.md @@ -0,0 +1,38 @@ +## stackit mongodbflex backup + +Provides functionality for MongoDB Flex instance backups + +### Synopsis + +Provides functionality for MongoDB Flex instance backups. + +``` +stackit mongodbflex backup [flags] +``` + +### Options + +``` + -h, --help Help for "stackit mongodbflex backup" +``` + +### Options inherited from parent commands + +``` + -y, --assume-yes If set, skips all confirmation prompts + --async If set, runs the command asynchronously + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] + -p, --project-id string Project ID + --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") +``` + +### SEE ALSO + +* [stackit mongodbflex](./stackit_mongodbflex.md) - Provides functionality for MongoDB Flex +* [stackit mongodbflex backup describe](./stackit_mongodbflex_backup_describe.md) - Shows details of a backup for a MongoDB Flex instance +* [stackit mongodbflex backup list](./stackit_mongodbflex_backup_list.md) - Lists all backups which are available for a MongoDB Flex instance +* [stackit mongodbflex backup restore](./stackit_mongodbflex_backup_restore.md) - Restores a MongoDB Flex instance from a backup +* [stackit mongodbflex backup restore-jobs](./stackit_mongodbflex_backup_restore-jobs.md) - Lists all restore jobs which have been run for a MongoDB Flex instance +* [stackit mongodbflex backup schedule](./stackit_mongodbflex_backup_schedule.md) - Shows details of the backup schedule and retention policy of a MongoDB Flex instance +* [stackit mongodbflex backup update-schedule](./stackit_mongodbflex_backup_update-schedule.md) - Updates the backup schedule and retention policy for a MongoDB Flex instance + diff --git a/docs/stackit_mongodbflex_backup_describe.md b/docs/stackit_mongodbflex_backup_describe.md new file mode 100644 index 000000000..bb422f064 --- /dev/null +++ b/docs/stackit_mongodbflex_backup_describe.md @@ -0,0 +1,43 @@ +## stackit mongodbflex backup describe + +Shows details of a backup for a MongoDB Flex instance + +### Synopsis + +Shows details of a backup for a MongoDB Flex instance. + +``` +stackit mongodbflex backup describe BACKUP_ID [flags] +``` + +### Examples + +``` + Get details of a backup with ID "xxx" for a MongoDB Flex instance with ID "yyy" + $ stackit mongodbflex backup describe xxx --instance-id yyy + + Get details of a backup with ID "xxx" for a MongoDB Flex instance with ID "yyy" in JSON format + $ stackit mongodbflex backup describe xxx --instance-id yyy --output-format json +``` + +### Options + +``` + -h, --help Help for "stackit mongodbflex backup describe" + --instance-id string Instance ID +``` + +### Options inherited from parent commands + +``` + -y, --assume-yes If set, skips all confirmation prompts + --async If set, runs the command asynchronously + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] + -p, --project-id string Project ID + --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") +``` + +### SEE ALSO + +* [stackit mongodbflex backup](./stackit_mongodbflex_backup.md) - Provides functionality for MongoDB Flex instance backups + diff --git a/docs/stackit_mongodbflex_backup_list.md b/docs/stackit_mongodbflex_backup_list.md new file mode 100644 index 000000000..611ae3a22 --- /dev/null +++ b/docs/stackit_mongodbflex_backup_list.md @@ -0,0 +1,47 @@ +## stackit mongodbflex backup list + +Lists all backups which are available for a MongoDB Flex instance + +### Synopsis + +Lists all backups which are available for a MongoDB Flex instance. + +``` +stackit mongodbflex backup list [flags] +``` + +### Examples + +``` + List all backups of instance with ID "xxx" + $ stackit mongodbflex backup list --instance-id xxx + + List all backups of instance with ID "xxx" in JSON format + $ stackit mongodbflex backup list --instance-id xxx --output-format json + + List up to 10 backups of instance with ID "xxx" + $ stackit mongodbflex backup list --instance-id xxx --limit 10 +``` + +### Options + +``` + -h, --help Help for "stackit mongodbflex backup list" + --instance-id string Instance ID + --limit int Maximum number of entries to list +``` + +### Options inherited from parent commands + +``` + -y, --assume-yes If set, skips all confirmation prompts + --async If set, runs the command asynchronously + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] + -p, --project-id string Project ID + --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") +``` + +### SEE ALSO + +* [stackit mongodbflex backup](./stackit_mongodbflex_backup.md) - Provides functionality for MongoDB Flex instance backups + diff --git a/docs/stackit_mongodbflex_backup_restore-jobs.md b/docs/stackit_mongodbflex_backup_restore-jobs.md new file mode 100644 index 000000000..8b909182b --- /dev/null +++ b/docs/stackit_mongodbflex_backup_restore-jobs.md @@ -0,0 +1,47 @@ +## stackit mongodbflex backup restore-jobs + +Lists all restore jobs which have been run for a MongoDB Flex instance + +### Synopsis + +Lists all restore jobs which have been run for a MongoDB Flex instance. + +``` +stackit mongodbflex backup restore-jobs [flags] +``` + +### Examples + +``` + List all restore jobs of instance with ID "xxx" + $ stackit mongodbflex backup restore-jobs --instance-id xxx + + List all restore jobs of instance with ID "xxx" in JSON format + $ stackit mongodbflex backup restore-jobs --instance-id xxx --output-format json + + List up to 10 restore jobs of instance with ID "xxx" + $ stackit mongodbflex backup restore-jobs --instance-id xxx --limit 10 +``` + +### Options + +``` + -h, --help Help for "stackit mongodbflex backup restore-jobs" + --instance-id string Instance ID + --limit int Maximum number of entries to list +``` + +### Options inherited from parent commands + +``` + -y, --assume-yes If set, skips all confirmation prompts + --async If set, runs the command asynchronously + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] + -p, --project-id string Project ID + --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") +``` + +### SEE ALSO + +* [stackit mongodbflex backup](./stackit_mongodbflex_backup.md) - Provides functionality for MongoDB Flex instance backups + diff --git a/docs/stackit_mongodbflex_backup_restore.md b/docs/stackit_mongodbflex_backup_restore.md new file mode 100644 index 000000000..87185a3e2 --- /dev/null +++ b/docs/stackit_mongodbflex_backup_restore.md @@ -0,0 +1,51 @@ +## stackit mongodbflex backup restore + +Restores a MongoDB Flex instance from a backup + +### Synopsis + +Restores a MongoDB Flex instance from a backup of an instance or clones a MongoDB Flex instance from a point-in-time snapshot. +The backup is specified by a backup ID and the point-in-time snapshot is specified by a timestamp. +You can specify the instance to which the backup will be applied. If not specified, the backup will be applied to the same instance from which it was taken. + +``` +stackit mongodbflex backup restore [flags] +``` + +### Examples + +``` + Restore a MongoDB Flex instance with ID "yyy" using backup with ID "zzz" + $ stackit mongodbflex backup restore --instance-id yyy --backup-id zzz + + Clone a MongoDB Flex instance with ID "yyy" via point-in-time restore to timestamp "2024-05-14T14:31:48Z" + $ stackit mongodbflex backup restore --instance-id yyy --timestamp 2024-05-14T14:31:48Z + + Restore a MongoDB Flex instance with ID "yyy", using backup from instance with ID "zzz" with backup ID "xxx" + $ stackit mongodbflex backup restore --instance-id zzz --backup-instance-id yyy --backup-id xxx +``` + +### Options + +``` + --backup-id string Backup ID + --backup-instance-id string Instance ID of the target instance to restore the backup to + -h, --help Help for "stackit mongodbflex backup restore" + --instance-id string Instance ID + --timestamp string Timestamp of the snapshot to use as a source for cloning the instance in a date-time with the RFC3339 layout format, e.g. 2024-01-01T00:00:00Z +``` + +### Options inherited from parent commands + +``` + -y, --assume-yes If set, skips all confirmation prompts + --async If set, runs the command asynchronously + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] + -p, --project-id string Project ID + --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") +``` + +### SEE ALSO + +* [stackit mongodbflex backup](./stackit_mongodbflex_backup.md) - Provides functionality for MongoDB Flex instance backups + diff --git a/docs/stackit_mongodbflex_backup_schedule.md b/docs/stackit_mongodbflex_backup_schedule.md new file mode 100644 index 000000000..945d5081b --- /dev/null +++ b/docs/stackit_mongodbflex_backup_schedule.md @@ -0,0 +1,43 @@ +## stackit mongodbflex backup schedule + +Shows details of the backup schedule and retention policy of a MongoDB Flex instance + +### Synopsis + +Shows details of the backup schedule and retention policy of a MongoDB Flex instance. + +``` +stackit mongodbflex backup schedule [flags] +``` + +### Examples + +``` + Get details of the backup schedule of a MongoDB Flex instance with ID "xxx" + $ stackit mongodbflex backup schedule --instance-id xxx + + Get details of the backup schedule of a MongoDB Flex instance with ID "xxx" in JSON format + $ stackit mongodbflex backup schedule --instance-id xxx --output-format json +``` + +### Options + +``` + -h, --help Help for "stackit mongodbflex backup schedule" + --instance-id string Instance ID +``` + +### Options inherited from parent commands + +``` + -y, --assume-yes If set, skips all confirmation prompts + --async If set, runs the command asynchronously + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] + -p, --project-id string Project ID + --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") +``` + +### SEE ALSO + +* [stackit mongodbflex backup](./stackit_mongodbflex_backup.md) - Provides functionality for MongoDB Flex instance backups + diff --git a/docs/stackit_mongodbflex_backup_update-schedule.md b/docs/stackit_mongodbflex_backup_update-schedule.md new file mode 100644 index 000000000..ee51091cf --- /dev/null +++ b/docs/stackit_mongodbflex_backup_update-schedule.md @@ -0,0 +1,51 @@ +## stackit mongodbflex backup update-schedule + +Updates the backup schedule and retention policy for a MongoDB Flex instance + +### Synopsis + +Updates the backup schedule and retention policy for a MongoDB Flex instance. +The current backup schedule and retention policy can be seen in the output of the "stackit mongodbflex backup schedule" command. +The backup schedule is defined in the cron scheduling system format e.g. '0 0 * * *'. +See below for more detail on the retention policy options. + +``` +stackit mongodbflex backup update-schedule [flags] +``` + +### Examples + +``` + Update the backup schedule of a MongoDB Flex instance with ID "xxx" + $ stackit mongodbflex backup update-schedule --instance-id xxx --schedule '6 6 * * *' + + Update the retention days for snapshots of a MongoDB Flex instance with ID "xxx" to 5 days + $ stackit mongodbflex backup update-schedule --instance-id xxx --save-snapshot-days 5 +``` + +### Options + +``` + -h, --help Help for "stackit mongodbflex backup update-schedule" + --instance-id string Instance ID + --save-daily-snapshot-days int Number of days to retain daily snapshots. Should be less than or equal to the number of days of the selected weekly or monthly value. + --save-monthly-snapshot-months int Number of months to retain monthly snapshots + --save-snapshot-days int Number of days to retain snapshots. Should be less than or equal to the value of the daily backup. + --save-weekly-snapshot-weeks int Number of weeks to retain weekly snapshots. Should be less than or equal to the number of weeks of the selected monthly value. + --schedule string Backup schedule, in the cron scheduling system format e.g. '0 0 * * *' +``` + +### Options inherited from parent commands + +``` + -y, --assume-yes If set, skips all confirmation prompts + --async If set, runs the command asynchronously + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] + -p, --project-id string Project ID + --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") +``` + +### SEE ALSO + +* [stackit mongodbflex backup](./stackit_mongodbflex_backup.md) - Provides functionality for MongoDB Flex instance backups + diff --git a/docs/stackit_mongodbflex_instance.md b/docs/stackit_mongodbflex_instance.md index 5c470ac76..c38c90538 100644 --- a/docs/stackit_mongodbflex_instance.md +++ b/docs/stackit_mongodbflex_instance.md @@ -21,7 +21,7 @@ stackit mongodbflex instance [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_instance_create.md b/docs/stackit_mongodbflex_instance_create.md index 141b5c73a..2b424836f 100644 --- a/docs/stackit_mongodbflex_instance_create.md +++ b/docs/stackit_mongodbflex_instance_create.md @@ -44,7 +44,7 @@ stackit mongodbflex instance create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_instance_delete.md b/docs/stackit_mongodbflex_instance_delete.md index 1486979ae..88718bb37 100644 --- a/docs/stackit_mongodbflex_instance_delete.md +++ b/docs/stackit_mongodbflex_instance_delete.md @@ -28,7 +28,7 @@ stackit mongodbflex instance delete INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_instance_describe.md b/docs/stackit_mongodbflex_instance_describe.md index 0d07e5d7f..870da5e13 100644 --- a/docs/stackit_mongodbflex_instance_describe.md +++ b/docs/stackit_mongodbflex_instance_describe.md @@ -31,7 +31,7 @@ stackit mongodbflex instance describe INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_instance_list.md b/docs/stackit_mongodbflex_instance_list.md index d3027c649..3b3995ed6 100644 --- a/docs/stackit_mongodbflex_instance_list.md +++ b/docs/stackit_mongodbflex_instance_list.md @@ -35,7 +35,7 @@ stackit mongodbflex instance list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_instance_update.md b/docs/stackit_mongodbflex_instance_update.md index e6c1c1b3d..ef64d5088 100644 --- a/docs/stackit_mongodbflex_instance_update.md +++ b/docs/stackit_mongodbflex_instance_update.md @@ -41,7 +41,7 @@ stackit mongodbflex instance update INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_options.md b/docs/stackit_mongodbflex_options.md index d1bab2db1..b695104a8 100644 --- a/docs/stackit_mongodbflex_options.md +++ b/docs/stackit_mongodbflex_options.md @@ -39,7 +39,7 @@ stackit mongodbflex options [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_user.md b/docs/stackit_mongodbflex_user.md index 2cfcf5ea4..7b45211b7 100644 --- a/docs/stackit_mongodbflex_user.md +++ b/docs/stackit_mongodbflex_user.md @@ -21,7 +21,7 @@ stackit mongodbflex user [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_user_create.md b/docs/stackit_mongodbflex_user_create.md index 71fa36df5..6a6645be0 100644 --- a/docs/stackit_mongodbflex_user_create.md +++ b/docs/stackit_mongodbflex_user_create.md @@ -38,7 +38,7 @@ stackit mongodbflex user create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_user_delete.md b/docs/stackit_mongodbflex_user_delete.md index da9383752..6297faa1f 100644 --- a/docs/stackit_mongodbflex_user_delete.md +++ b/docs/stackit_mongodbflex_user_delete.md @@ -30,7 +30,7 @@ stackit mongodbflex user delete USER_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_user_describe.md b/docs/stackit_mongodbflex_user_describe.md index 7b19e5da9..2295b1c84 100644 --- a/docs/stackit_mongodbflex_user_describe.md +++ b/docs/stackit_mongodbflex_user_describe.md @@ -34,7 +34,7 @@ stackit mongodbflex user describe USER_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_user_list.md b/docs/stackit_mongodbflex_user_list.md index 1cfa7a703..df3305a73 100644 --- a/docs/stackit_mongodbflex_user_list.md +++ b/docs/stackit_mongodbflex_user_list.md @@ -36,7 +36,7 @@ stackit mongodbflex user list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_user_reset-password.md b/docs/stackit_mongodbflex_user_reset-password.md index 339cd6a8d..e269e1ff7 100644 --- a/docs/stackit_mongodbflex_user_reset-password.md +++ b/docs/stackit_mongodbflex_user_reset-password.md @@ -30,7 +30,7 @@ stackit mongodbflex user reset-password USER_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_mongodbflex_user_update.md b/docs/stackit_mongodbflex_user_update.md index 011c0220b..3702eb36c 100644 --- a/docs/stackit_mongodbflex_user_update.md +++ b/docs/stackit_mongodbflex_user_update.md @@ -31,7 +31,7 @@ stackit mongodbflex user update USER_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage.md b/docs/stackit_object-storage.md index 6f13ef1e4..676bc3110 100644 --- a/docs/stackit_object-storage.md +++ b/docs/stackit_object-storage.md @@ -21,7 +21,7 @@ stackit object-storage [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_bucket.md b/docs/stackit_object-storage_bucket.md index 138d6afcf..b8d8df4b6 100644 --- a/docs/stackit_object-storage_bucket.md +++ b/docs/stackit_object-storage_bucket.md @@ -21,7 +21,7 @@ stackit object-storage bucket [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_bucket_create.md b/docs/stackit_object-storage_bucket_create.md index 95851f1f0..f22115b06 100644 --- a/docs/stackit_object-storage_bucket_create.md +++ b/docs/stackit_object-storage_bucket_create.md @@ -28,7 +28,7 @@ stackit object-storage bucket create BUCKET_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_bucket_delete.md b/docs/stackit_object-storage_bucket_delete.md index d93981f09..56380a641 100644 --- a/docs/stackit_object-storage_bucket_delete.md +++ b/docs/stackit_object-storage_bucket_delete.md @@ -28,7 +28,7 @@ stackit object-storage bucket delete BUCKET_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_bucket_describe.md b/docs/stackit_object-storage_bucket_describe.md index 132161e79..7520a8217 100644 --- a/docs/stackit_object-storage_bucket_describe.md +++ b/docs/stackit_object-storage_bucket_describe.md @@ -31,7 +31,7 @@ stackit object-storage bucket describe BUCKET_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_bucket_list.md b/docs/stackit_object-storage_bucket_list.md index b9ec5faee..11cd639fb 100644 --- a/docs/stackit_object-storage_bucket_list.md +++ b/docs/stackit_object-storage_bucket_list.md @@ -35,7 +35,7 @@ stackit object-storage bucket list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_credentials-group.md b/docs/stackit_object-storage_credentials-group.md index 958b29bd3..3c028ed12 100644 --- a/docs/stackit_object-storage_credentials-group.md +++ b/docs/stackit_object-storage_credentials-group.md @@ -21,7 +21,7 @@ stackit object-storage credentials-group [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_credentials-group_create.md b/docs/stackit_object-storage_credentials-group_create.md index 37ff1c105..291be494a 100644 --- a/docs/stackit_object-storage_credentials-group_create.md +++ b/docs/stackit_object-storage_credentials-group_create.md @@ -29,7 +29,7 @@ stackit object-storage credentials-group create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_credentials-group_delete.md b/docs/stackit_object-storage_credentials-group_delete.md index 5c36b6299..d9d94802a 100644 --- a/docs/stackit_object-storage_credentials-group_delete.md +++ b/docs/stackit_object-storage_credentials-group_delete.md @@ -28,7 +28,7 @@ stackit object-storage credentials-group delete CREDENTIALS_GROUP_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_credentials-group_list.md b/docs/stackit_object-storage_credentials-group_list.md index f66df9fc5..bd91a8942 100644 --- a/docs/stackit_object-storage_credentials-group_list.md +++ b/docs/stackit_object-storage_credentials-group_list.md @@ -35,7 +35,7 @@ stackit object-storage credentials-group list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_credentials.md b/docs/stackit_object-storage_credentials.md index d135bc8b5..de61b0195 100644 --- a/docs/stackit_object-storage_credentials.md +++ b/docs/stackit_object-storage_credentials.md @@ -21,7 +21,7 @@ stackit object-storage credentials [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_credentials_create.md b/docs/stackit_object-storage_credentials_create.md index 92a45a3c1..6e91d075a 100644 --- a/docs/stackit_object-storage_credentials_create.md +++ b/docs/stackit_object-storage_credentials_create.md @@ -33,7 +33,7 @@ stackit object-storage credentials create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_credentials_delete.md b/docs/stackit_object-storage_credentials_delete.md index e44f350b5..b14154ec8 100644 --- a/docs/stackit_object-storage_credentials_delete.md +++ b/docs/stackit_object-storage_credentials_delete.md @@ -29,7 +29,7 @@ stackit object-storage credentials delete CREDENTIALS_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_credentials_list.md b/docs/stackit_object-storage_credentials_list.md index be0b501ec..647c024b5 100644 --- a/docs/stackit_object-storage_credentials_list.md +++ b/docs/stackit_object-storage_credentials_list.md @@ -36,7 +36,7 @@ stackit object-storage credentials list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_disable.md b/docs/stackit_object-storage_disable.md index 7cf45af0b..0699e5249 100644 --- a/docs/stackit_object-storage_disable.md +++ b/docs/stackit_object-storage_disable.md @@ -28,7 +28,7 @@ stackit object-storage disable [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_object-storage_enable.md b/docs/stackit_object-storage_enable.md index d9eee4bfb..441997bd6 100644 --- a/docs/stackit_object-storage_enable.md +++ b/docs/stackit_object-storage_enable.md @@ -28,7 +28,7 @@ stackit object-storage enable [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch.md b/docs/stackit_opensearch.md index d20efcea2..30af3bd1f 100644 --- a/docs/stackit_opensearch.md +++ b/docs/stackit_opensearch.md @@ -21,7 +21,7 @@ stackit opensearch [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_credentials.md b/docs/stackit_opensearch_credentials.md index deed441c6..13358215e 100644 --- a/docs/stackit_opensearch_credentials.md +++ b/docs/stackit_opensearch_credentials.md @@ -21,7 +21,7 @@ stackit opensearch credentials [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_credentials_create.md b/docs/stackit_opensearch_credentials_create.md index 2f2ab2c0d..c90ae9f11 100644 --- a/docs/stackit_opensearch_credentials_create.md +++ b/docs/stackit_opensearch_credentials_create.md @@ -33,7 +33,7 @@ stackit opensearch credentials create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_credentials_delete.md b/docs/stackit_opensearch_credentials_delete.md index e144a0ce6..e19e2a091 100644 --- a/docs/stackit_opensearch_credentials_delete.md +++ b/docs/stackit_opensearch_credentials_delete.md @@ -29,7 +29,7 @@ stackit opensearch credentials delete CREDENTIALS_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_credentials_describe.md b/docs/stackit_opensearch_credentials_describe.md index 87159d515..bb0095b67 100644 --- a/docs/stackit_opensearch_credentials_describe.md +++ b/docs/stackit_opensearch_credentials_describe.md @@ -32,7 +32,7 @@ stackit opensearch credentials describe CREDENTIALS_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_credentials_list.md b/docs/stackit_opensearch_credentials_list.md index 41d5b9ff0..6aea2e1c7 100644 --- a/docs/stackit_opensearch_credentials_list.md +++ b/docs/stackit_opensearch_credentials_list.md @@ -36,7 +36,7 @@ stackit opensearch credentials list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_instance.md b/docs/stackit_opensearch_instance.md index 968d343af..26182779c 100644 --- a/docs/stackit_opensearch_instance.md +++ b/docs/stackit_opensearch_instance.md @@ -21,7 +21,7 @@ stackit opensearch instance [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_instance_create.md b/docs/stackit_opensearch_instance_create.md index 45f32f32c..ef67d29f1 100644 --- a/docs/stackit_opensearch_instance_create.md +++ b/docs/stackit_opensearch_instance_create.md @@ -46,7 +46,7 @@ stackit opensearch instance create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_instance_delete.md b/docs/stackit_opensearch_instance_delete.md index ba6c0e571..49c4ab8ee 100644 --- a/docs/stackit_opensearch_instance_delete.md +++ b/docs/stackit_opensearch_instance_delete.md @@ -28,7 +28,7 @@ stackit opensearch instance delete INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_instance_describe.md b/docs/stackit_opensearch_instance_describe.md index 7dc48d49f..3aafa406d 100644 --- a/docs/stackit_opensearch_instance_describe.md +++ b/docs/stackit_opensearch_instance_describe.md @@ -31,7 +31,7 @@ stackit opensearch instance describe INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_instance_list.md b/docs/stackit_opensearch_instance_list.md index 27b622e58..a67f9821f 100644 --- a/docs/stackit_opensearch_instance_list.md +++ b/docs/stackit_opensearch_instance_list.md @@ -35,7 +35,7 @@ stackit opensearch instance list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_instance_update.md b/docs/stackit_opensearch_instance_update.md index e50f7f7a7..5d688fdc3 100644 --- a/docs/stackit_opensearch_instance_update.md +++ b/docs/stackit_opensearch_instance_update.md @@ -42,7 +42,7 @@ stackit opensearch instance update INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_opensearch_plans.md b/docs/stackit_opensearch_plans.md index 97925f34a..f733314ab 100644 --- a/docs/stackit_opensearch_plans.md +++ b/docs/stackit_opensearch_plans.md @@ -35,7 +35,7 @@ stackit opensearch plans [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_organization.md b/docs/stackit_organization.md index 643b64f8d..2c3091969 100644 --- a/docs/stackit_organization.md +++ b/docs/stackit_organization.md @@ -22,7 +22,7 @@ stackit organization [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_organization_member.md b/docs/stackit_organization_member.md index accffe572..e7651ee04 100644 --- a/docs/stackit_organization_member.md +++ b/docs/stackit_organization_member.md @@ -21,7 +21,7 @@ stackit organization member [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_organization_member_add.md b/docs/stackit_organization_member_add.md index fa75db1a5..46f7dedf0 100644 --- a/docs/stackit_organization_member_add.md +++ b/docs/stackit_organization_member_add.md @@ -34,7 +34,7 @@ stackit organization member add SUBJECT [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_organization_member_list.md b/docs/stackit_organization_member_list.md index 13e6112f3..2f3772038 100644 --- a/docs/stackit_organization_member_list.md +++ b/docs/stackit_organization_member_list.md @@ -38,7 +38,7 @@ stackit organization member list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_organization_member_remove.md b/docs/stackit_organization_member_remove.md index 745cd22c4..f164052b8 100644 --- a/docs/stackit_organization_member_remove.md +++ b/docs/stackit_organization_member_remove.md @@ -36,7 +36,7 @@ stackit organization member remove SUBJECT [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_organization_role.md b/docs/stackit_organization_role.md index 9f7675ffb..e95f20a39 100644 --- a/docs/stackit_organization_role.md +++ b/docs/stackit_organization_role.md @@ -21,7 +21,7 @@ stackit organization role [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_organization_role_list.md b/docs/stackit_organization_role_list.md index bb8690e3e..9f2f9b491 100644 --- a/docs/stackit_organization_role_list.md +++ b/docs/stackit_organization_role_list.md @@ -36,7 +36,7 @@ stackit organization role list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex.md b/docs/stackit_postgresflex.md index 22d00bf6b..005ec9f19 100644 --- a/docs/stackit_postgresflex.md +++ b/docs/stackit_postgresflex.md @@ -21,7 +21,7 @@ stackit postgresflex [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_backup.md b/docs/stackit_postgresflex_backup.md index 2a3d9a7e3..c1caacfce 100644 --- a/docs/stackit_postgresflex_backup.md +++ b/docs/stackit_postgresflex_backup.md @@ -21,7 +21,7 @@ stackit postgresflex backup [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_backup_describe.md b/docs/stackit_postgresflex_backup_describe.md index 81a3309f0..cb5171718 100644 --- a/docs/stackit_postgresflex_backup_describe.md +++ b/docs/stackit_postgresflex_backup_describe.md @@ -32,7 +32,7 @@ stackit postgresflex backup describe BACKUP_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_backup_list.md b/docs/stackit_postgresflex_backup_list.md index e655afdcf..92b8373f7 100644 --- a/docs/stackit_postgresflex_backup_list.md +++ b/docs/stackit_postgresflex_backup_list.md @@ -36,7 +36,7 @@ stackit postgresflex backup list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_backup_update-schedule.md b/docs/stackit_postgresflex_backup_update-schedule.md index 02362430c..7971a9b89 100644 --- a/docs/stackit_postgresflex_backup_update-schedule.md +++ b/docs/stackit_postgresflex_backup_update-schedule.md @@ -30,7 +30,7 @@ stackit postgresflex backup update-schedule [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_instance.md b/docs/stackit_postgresflex_instance.md index 1376ac743..679dfc2a2 100644 --- a/docs/stackit_postgresflex_instance.md +++ b/docs/stackit_postgresflex_instance.md @@ -21,7 +21,7 @@ stackit postgresflex instance [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_instance_clone.md b/docs/stackit_postgresflex_instance_clone.md index 609dcab34..d158b15b8 100644 --- a/docs/stackit_postgresflex_instance_clone.md +++ b/docs/stackit_postgresflex_instance_clone.md @@ -37,7 +37,7 @@ stackit postgresflex instance clone INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_instance_create.md b/docs/stackit_postgresflex_instance_create.md index 112307adf..ea5c1f247 100644 --- a/docs/stackit_postgresflex_instance_create.md +++ b/docs/stackit_postgresflex_instance_create.md @@ -44,7 +44,7 @@ stackit postgresflex instance create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_instance_delete.md b/docs/stackit_postgresflex_instance_delete.md index 2461854dd..0f864709e 100644 --- a/docs/stackit_postgresflex_instance_delete.md +++ b/docs/stackit_postgresflex_instance_delete.md @@ -34,7 +34,7 @@ stackit postgresflex instance delete INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_instance_describe.md b/docs/stackit_postgresflex_instance_describe.md index df2e0434c..957dd5450 100644 --- a/docs/stackit_postgresflex_instance_describe.md +++ b/docs/stackit_postgresflex_instance_describe.md @@ -31,7 +31,7 @@ stackit postgresflex instance describe INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_instance_list.md b/docs/stackit_postgresflex_instance_list.md index 295baca57..a05845ba0 100644 --- a/docs/stackit_postgresflex_instance_list.md +++ b/docs/stackit_postgresflex_instance_list.md @@ -35,7 +35,7 @@ stackit postgresflex instance list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_instance_update.md b/docs/stackit_postgresflex_instance_update.md index 3a8980d7d..75a10e519 100644 --- a/docs/stackit_postgresflex_instance_update.md +++ b/docs/stackit_postgresflex_instance_update.md @@ -41,7 +41,7 @@ stackit postgresflex instance update INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_options.md b/docs/stackit_postgresflex_options.md index 57cc6ed9b..0638b2ec4 100644 --- a/docs/stackit_postgresflex_options.md +++ b/docs/stackit_postgresflex_options.md @@ -39,7 +39,7 @@ stackit postgresflex options [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_user.md b/docs/stackit_postgresflex_user.md index 720c85cd0..2e0d97ffc 100644 --- a/docs/stackit_postgresflex_user.md +++ b/docs/stackit_postgresflex_user.md @@ -21,7 +21,7 @@ stackit postgresflex user [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_user_create.md b/docs/stackit_postgresflex_user_create.md index 1a33e4ae4..335038430 100644 --- a/docs/stackit_postgresflex_user_create.md +++ b/docs/stackit_postgresflex_user_create.md @@ -37,7 +37,7 @@ stackit postgresflex user create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_user_delete.md b/docs/stackit_postgresflex_user_delete.md index 7f75f6dc3..f85225ede 100644 --- a/docs/stackit_postgresflex_user_delete.md +++ b/docs/stackit_postgresflex_user_delete.md @@ -31,7 +31,7 @@ stackit postgresflex user delete USER_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_user_describe.md b/docs/stackit_postgresflex_user_describe.md index 5fbcdc899..dd1d74e8e 100644 --- a/docs/stackit_postgresflex_user_describe.md +++ b/docs/stackit_postgresflex_user_describe.md @@ -34,7 +34,7 @@ stackit postgresflex user describe USER_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_user_list.md b/docs/stackit_postgresflex_user_list.md index 23e84a491..9db37967d 100644 --- a/docs/stackit_postgresflex_user_list.md +++ b/docs/stackit_postgresflex_user_list.md @@ -36,7 +36,7 @@ stackit postgresflex user list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_user_reset-password.md b/docs/stackit_postgresflex_user_reset-password.md index 4bf83d21a..857313808 100644 --- a/docs/stackit_postgresflex_user_reset-password.md +++ b/docs/stackit_postgresflex_user_reset-password.md @@ -30,7 +30,7 @@ stackit postgresflex user reset-password USER_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_postgresflex_user_update.md b/docs/stackit_postgresflex_user_update.md index dd027426e..f0a0e5250 100644 --- a/docs/stackit_postgresflex_user_update.md +++ b/docs/stackit_postgresflex_user_update.md @@ -30,7 +30,7 @@ stackit postgresflex user update USER_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project.md b/docs/stackit_project.md index 698df8078..5c30842c4 100644 --- a/docs/stackit_project.md +++ b/docs/stackit_project.md @@ -22,7 +22,7 @@ stackit project [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project_create.md b/docs/stackit_project_create.md index 582d1f29a..b3168ab91 100644 --- a/docs/stackit_project_create.md +++ b/docs/stackit_project_create.md @@ -34,7 +34,7 @@ stackit project create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project_delete.md b/docs/stackit_project_delete.md index ca90cedb0..03566109f 100644 --- a/docs/stackit_project_delete.md +++ b/docs/stackit_project_delete.md @@ -31,7 +31,7 @@ stackit project delete [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project_describe.md b/docs/stackit_project_describe.md index c9d746c94..24f145174 100644 --- a/docs/stackit_project_describe.md +++ b/docs/stackit_project_describe.md @@ -35,7 +35,7 @@ stackit project describe [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project_list.md b/docs/stackit_project_list.md index a182923c0..c968bef0c 100644 --- a/docs/stackit_project_list.md +++ b/docs/stackit_project_list.md @@ -43,7 +43,7 @@ stackit project list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project_member.md b/docs/stackit_project_member.md index 6835a6d59..6cf65e449 100644 --- a/docs/stackit_project_member.md +++ b/docs/stackit_project_member.md @@ -21,7 +21,7 @@ stackit project member [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project_member_add.md b/docs/stackit_project_member_add.md index 9ef13b064..b92c1d1e0 100644 --- a/docs/stackit_project_member_add.md +++ b/docs/stackit_project_member_add.md @@ -33,7 +33,7 @@ stackit project member add SUBJECT [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project_member_list.md b/docs/stackit_project_member_list.md index 1d91e8886..dbc1b5f06 100644 --- a/docs/stackit_project_member_list.md +++ b/docs/stackit_project_member_list.md @@ -37,7 +37,7 @@ stackit project member list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project_member_remove.md b/docs/stackit_project_member_remove.md index 0a8dd80d4..f94e96a04 100644 --- a/docs/stackit_project_member_remove.md +++ b/docs/stackit_project_member_remove.md @@ -35,7 +35,7 @@ stackit project member remove SUBJECT [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project_role.md b/docs/stackit_project_role.md index 3294413f9..17551b60d 100644 --- a/docs/stackit_project_role.md +++ b/docs/stackit_project_role.md @@ -21,7 +21,7 @@ stackit project role [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project_role_list.md b/docs/stackit_project_role_list.md index e9770999e..2c34a8727 100644 --- a/docs/stackit_project_role_list.md +++ b/docs/stackit_project_role_list.md @@ -35,7 +35,7 @@ stackit project role list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_project_update.md b/docs/stackit_project_update.md index 784041f14..f9e569c8a 100644 --- a/docs/stackit_project_update.md +++ b/docs/stackit_project_update.md @@ -37,7 +37,7 @@ stackit project update [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq.md b/docs/stackit_rabbitmq.md index 8855b6463..e3060985c 100644 --- a/docs/stackit_rabbitmq.md +++ b/docs/stackit_rabbitmq.md @@ -21,7 +21,7 @@ stackit rabbitmq [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_credentials.md b/docs/stackit_rabbitmq_credentials.md index 48e9342af..96968f4b3 100644 --- a/docs/stackit_rabbitmq_credentials.md +++ b/docs/stackit_rabbitmq_credentials.md @@ -21,7 +21,7 @@ stackit rabbitmq credentials [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_credentials_create.md b/docs/stackit_rabbitmq_credentials_create.md index 2f836291e..5221b186e 100644 --- a/docs/stackit_rabbitmq_credentials_create.md +++ b/docs/stackit_rabbitmq_credentials_create.md @@ -33,7 +33,7 @@ stackit rabbitmq credentials create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_credentials_delete.md b/docs/stackit_rabbitmq_credentials_delete.md index 3046a6da2..ff8c1e207 100644 --- a/docs/stackit_rabbitmq_credentials_delete.md +++ b/docs/stackit_rabbitmq_credentials_delete.md @@ -29,7 +29,7 @@ stackit rabbitmq credentials delete CREDENTIALS_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_credentials_describe.md b/docs/stackit_rabbitmq_credentials_describe.md index bca32624d..48fb1b2ab 100644 --- a/docs/stackit_rabbitmq_credentials_describe.md +++ b/docs/stackit_rabbitmq_credentials_describe.md @@ -32,7 +32,7 @@ stackit rabbitmq credentials describe CREDENTIALS_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_credentials_list.md b/docs/stackit_rabbitmq_credentials_list.md index 44208eb88..105de4d9f 100644 --- a/docs/stackit_rabbitmq_credentials_list.md +++ b/docs/stackit_rabbitmq_credentials_list.md @@ -36,7 +36,7 @@ stackit rabbitmq credentials list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_instance.md b/docs/stackit_rabbitmq_instance.md index d56d4b9fb..e417d7664 100644 --- a/docs/stackit_rabbitmq_instance.md +++ b/docs/stackit_rabbitmq_instance.md @@ -21,7 +21,7 @@ stackit rabbitmq instance [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_instance_create.md b/docs/stackit_rabbitmq_instance_create.md index ee83c5f28..bc14709c9 100644 --- a/docs/stackit_rabbitmq_instance_create.md +++ b/docs/stackit_rabbitmq_instance_create.md @@ -46,7 +46,7 @@ stackit rabbitmq instance create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_instance_delete.md b/docs/stackit_rabbitmq_instance_delete.md index 66b30a589..f216d6cd3 100644 --- a/docs/stackit_rabbitmq_instance_delete.md +++ b/docs/stackit_rabbitmq_instance_delete.md @@ -28,7 +28,7 @@ stackit rabbitmq instance delete INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_instance_describe.md b/docs/stackit_rabbitmq_instance_describe.md index e491b2417..1aa75f6ef 100644 --- a/docs/stackit_rabbitmq_instance_describe.md +++ b/docs/stackit_rabbitmq_instance_describe.md @@ -31,7 +31,7 @@ stackit rabbitmq instance describe INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_instance_list.md b/docs/stackit_rabbitmq_instance_list.md index 335db3700..5fc3d72f1 100644 --- a/docs/stackit_rabbitmq_instance_list.md +++ b/docs/stackit_rabbitmq_instance_list.md @@ -35,7 +35,7 @@ stackit rabbitmq instance list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_instance_update.md b/docs/stackit_rabbitmq_instance_update.md index 1208bc817..6976587dc 100644 --- a/docs/stackit_rabbitmq_instance_update.md +++ b/docs/stackit_rabbitmq_instance_update.md @@ -42,7 +42,7 @@ stackit rabbitmq instance update INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_rabbitmq_plans.md b/docs/stackit_rabbitmq_plans.md index b801e281f..ebd2d6652 100644 --- a/docs/stackit_rabbitmq_plans.md +++ b/docs/stackit_rabbitmq_plans.md @@ -35,7 +35,7 @@ stackit rabbitmq plans [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis.md b/docs/stackit_redis.md index b8fff49e6..16beda8f8 100644 --- a/docs/stackit_redis.md +++ b/docs/stackit_redis.md @@ -21,7 +21,7 @@ stackit redis [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_credentials.md b/docs/stackit_redis_credentials.md index 12508a4bc..37c2a269d 100644 --- a/docs/stackit_redis_credentials.md +++ b/docs/stackit_redis_credentials.md @@ -21,7 +21,7 @@ stackit redis credentials [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_credentials_create.md b/docs/stackit_redis_credentials_create.md index 0097e7eed..18fa56dad 100644 --- a/docs/stackit_redis_credentials_create.md +++ b/docs/stackit_redis_credentials_create.md @@ -33,7 +33,7 @@ stackit redis credentials create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_credentials_delete.md b/docs/stackit_redis_credentials_delete.md index f8f304bee..a975a0a71 100644 --- a/docs/stackit_redis_credentials_delete.md +++ b/docs/stackit_redis_credentials_delete.md @@ -29,7 +29,7 @@ stackit redis credentials delete CREDENTIALS_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_credentials_describe.md b/docs/stackit_redis_credentials_describe.md index 23968aeeb..274c06563 100644 --- a/docs/stackit_redis_credentials_describe.md +++ b/docs/stackit_redis_credentials_describe.md @@ -32,7 +32,7 @@ stackit redis credentials describe CREDENTIALS_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_credentials_list.md b/docs/stackit_redis_credentials_list.md index 7ed152e24..421d09924 100644 --- a/docs/stackit_redis_credentials_list.md +++ b/docs/stackit_redis_credentials_list.md @@ -36,7 +36,7 @@ stackit redis credentials list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_instance.md b/docs/stackit_redis_instance.md index a9fd3ba5b..d5c956ee8 100644 --- a/docs/stackit_redis_instance.md +++ b/docs/stackit_redis_instance.md @@ -21,7 +21,7 @@ stackit redis instance [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_instance_create.md b/docs/stackit_redis_instance_create.md index 3935f3638..92f3892cb 100644 --- a/docs/stackit_redis_instance_create.md +++ b/docs/stackit_redis_instance_create.md @@ -45,7 +45,7 @@ stackit redis instance create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_instance_delete.md b/docs/stackit_redis_instance_delete.md index 46b0cdf08..4ad2da13b 100644 --- a/docs/stackit_redis_instance_delete.md +++ b/docs/stackit_redis_instance_delete.md @@ -28,7 +28,7 @@ stackit redis instance delete INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_instance_describe.md b/docs/stackit_redis_instance_describe.md index 5a2a2f4d9..35c839779 100644 --- a/docs/stackit_redis_instance_describe.md +++ b/docs/stackit_redis_instance_describe.md @@ -31,7 +31,7 @@ stackit redis instance describe INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_instance_list.md b/docs/stackit_redis_instance_list.md index 05ee3442b..e32b8763e 100644 --- a/docs/stackit_redis_instance_list.md +++ b/docs/stackit_redis_instance_list.md @@ -35,7 +35,7 @@ stackit redis instance list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_instance_update.md b/docs/stackit_redis_instance_update.md index bebe8f631..2971e74b6 100644 --- a/docs/stackit_redis_instance_update.md +++ b/docs/stackit_redis_instance_update.md @@ -41,7 +41,7 @@ stackit redis instance update INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_redis_plans.md b/docs/stackit_redis_plans.md index 1926b02a8..5cce98b9a 100644 --- a/docs/stackit_redis_plans.md +++ b/docs/stackit_redis_plans.md @@ -35,7 +35,7 @@ stackit redis plans [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager.md b/docs/stackit_secrets-manager.md index e2e61f6f5..59e7a99d6 100644 --- a/docs/stackit_secrets-manager.md +++ b/docs/stackit_secrets-manager.md @@ -21,7 +21,7 @@ stackit secrets-manager [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_instance.md b/docs/stackit_secrets-manager_instance.md index 66dde69b3..d7857e067 100644 --- a/docs/stackit_secrets-manager_instance.md +++ b/docs/stackit_secrets-manager_instance.md @@ -21,7 +21,7 @@ stackit secrets-manager instance [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_instance_create.md b/docs/stackit_secrets-manager_instance_create.md index e55be6683..d41249ca5 100644 --- a/docs/stackit_secrets-manager_instance_create.md +++ b/docs/stackit_secrets-manager_instance_create.md @@ -33,7 +33,7 @@ stackit secrets-manager instance create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_instance_delete.md b/docs/stackit_secrets-manager_instance_delete.md index fd615bfaa..057e9b1ba 100644 --- a/docs/stackit_secrets-manager_instance_delete.md +++ b/docs/stackit_secrets-manager_instance_delete.md @@ -28,7 +28,7 @@ stackit secrets-manager instance delete INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_instance_describe.md b/docs/stackit_secrets-manager_instance_describe.md index b19e49e06..d0f6756f5 100644 --- a/docs/stackit_secrets-manager_instance_describe.md +++ b/docs/stackit_secrets-manager_instance_describe.md @@ -31,7 +31,7 @@ stackit secrets-manager instance describe INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_instance_list.md b/docs/stackit_secrets-manager_instance_list.md index 76dc7031e..46cbcd4cd 100644 --- a/docs/stackit_secrets-manager_instance_list.md +++ b/docs/stackit_secrets-manager_instance_list.md @@ -35,7 +35,7 @@ stackit secrets-manager instance list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_instance_update.md b/docs/stackit_secrets-manager_instance_update.md index 8393e1c9e..54f4b877c 100644 --- a/docs/stackit_secrets-manager_instance_update.md +++ b/docs/stackit_secrets-manager_instance_update.md @@ -29,7 +29,7 @@ stackit secrets-manager instance update INSTANCE_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_user.md b/docs/stackit_secrets-manager_user.md index a284739db..65899e83f 100644 --- a/docs/stackit_secrets-manager_user.md +++ b/docs/stackit_secrets-manager_user.md @@ -21,7 +21,7 @@ stackit secrets-manager user [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_user_create.md b/docs/stackit_secrets-manager_user_create.md index 6fc635628..043914508 100644 --- a/docs/stackit_secrets-manager_user_create.md +++ b/docs/stackit_secrets-manager_user_create.md @@ -36,7 +36,7 @@ stackit secrets-manager user create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_user_delete.md b/docs/stackit_secrets-manager_user_delete.md index 15e1f9df3..4d0c30091 100644 --- a/docs/stackit_secrets-manager_user_delete.md +++ b/docs/stackit_secrets-manager_user_delete.md @@ -30,7 +30,7 @@ stackit secrets-manager user delete USER_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_user_describe.md b/docs/stackit_secrets-manager_user_describe.md index 75de3d2d0..0d4d77739 100644 --- a/docs/stackit_secrets-manager_user_describe.md +++ b/docs/stackit_secrets-manager_user_describe.md @@ -32,7 +32,7 @@ stackit secrets-manager user describe USER_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_user_list.md b/docs/stackit_secrets-manager_user_list.md index ac502af4c..cb500f260 100644 --- a/docs/stackit_secrets-manager_user_list.md +++ b/docs/stackit_secrets-manager_user_list.md @@ -36,7 +36,7 @@ stackit secrets-manager user list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_secrets-manager_user_update.md b/docs/stackit_secrets-manager_user_update.md index dedbd24a9..a6388f6d1 100644 --- a/docs/stackit_secrets-manager_user_update.md +++ b/docs/stackit_secrets-manager_user_update.md @@ -34,7 +34,7 @@ stackit secrets-manager user update USER_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account.md b/docs/stackit_service-account.md index 17726dcec..c2fed18c5 100644 --- a/docs/stackit_service-account.md +++ b/docs/stackit_service-account.md @@ -21,7 +21,7 @@ stackit service-account [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_create.md b/docs/stackit_service-account_create.md index c3a5c3fd9..8f9d62ba3 100644 --- a/docs/stackit_service-account_create.md +++ b/docs/stackit_service-account_create.md @@ -29,7 +29,7 @@ stackit service-account create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_delete.md b/docs/stackit_service-account_delete.md index 5b0723b71..0e61bef0f 100644 --- a/docs/stackit_service-account_delete.md +++ b/docs/stackit_service-account_delete.md @@ -28,7 +28,7 @@ stackit service-account delete EMAIL [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_get-jwks.md b/docs/stackit_service-account_get-jwks.md index 34837edea..b09aa4771 100644 --- a/docs/stackit_service-account_get-jwks.md +++ b/docs/stackit_service-account_get-jwks.md @@ -28,7 +28,7 @@ stackit service-account get-jwks EMAIL [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_key.md b/docs/stackit_service-account_key.md index d07f25588..40b9c8c26 100644 --- a/docs/stackit_service-account_key.md +++ b/docs/stackit_service-account_key.md @@ -21,7 +21,7 @@ stackit service-account key [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_key_create.md b/docs/stackit_service-account_key_create.md index 1c9cb9f6b..0e33bd90a 100644 --- a/docs/stackit_service-account_key_create.md +++ b/docs/stackit_service-account_key_create.md @@ -39,7 +39,7 @@ stackit service-account key create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_key_delete.md b/docs/stackit_service-account_key_delete.md index 44cac0374..c882dc490 100644 --- a/docs/stackit_service-account_key_delete.md +++ b/docs/stackit_service-account_key_delete.md @@ -29,7 +29,7 @@ stackit service-account key delete KEY_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_key_describe.md b/docs/stackit_service-account_key_describe.md index 469deee4e..21f949d79 100644 --- a/docs/stackit_service-account_key_describe.md +++ b/docs/stackit_service-account_key_describe.md @@ -29,7 +29,7 @@ stackit service-account key describe KEY_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_key_list.md b/docs/stackit_service-account_key_list.md index 66d71702d..c141676ac 100644 --- a/docs/stackit_service-account_key_list.md +++ b/docs/stackit_service-account_key_list.md @@ -36,7 +36,7 @@ stackit service-account key list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_key_update.md b/docs/stackit_service-account_key_update.md index af95f84fa..2c8e2f751 100644 --- a/docs/stackit_service-account_key_update.md +++ b/docs/stackit_service-account_key_update.md @@ -39,7 +39,7 @@ stackit service-account key update KEY_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_list.md b/docs/stackit_service-account_list.md index 649aa3500..1ffec01ad 100644 --- a/docs/stackit_service-account_list.md +++ b/docs/stackit_service-account_list.md @@ -29,7 +29,7 @@ stackit service-account list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_token.md b/docs/stackit_service-account_token.md index f59414260..03888a32c 100644 --- a/docs/stackit_service-account_token.md +++ b/docs/stackit_service-account_token.md @@ -21,7 +21,7 @@ stackit service-account token [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_token_create.md b/docs/stackit_service-account_token_create.md index 3ecf567f9..ebca082ca 100644 --- a/docs/stackit_service-account_token_create.md +++ b/docs/stackit_service-account_token_create.md @@ -35,7 +35,7 @@ stackit service-account token create [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_token_list.md b/docs/stackit_service-account_token_list.md index 21478fbb2..daaa3d06d 100644 --- a/docs/stackit_service-account_token_list.md +++ b/docs/stackit_service-account_token_list.md @@ -38,7 +38,7 @@ stackit service-account token list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_service-account_token_revoke.md b/docs/stackit_service-account_token_revoke.md index 794c0c1ff..57c73899f 100644 --- a/docs/stackit_service-account_token_revoke.md +++ b/docs/stackit_service-account_token_revoke.md @@ -31,7 +31,7 @@ stackit service-account token revoke TOKEN_ID [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske.md b/docs/stackit_ske.md index 117baca74..5e8404f43 100644 --- a/docs/stackit_ske.md +++ b/docs/stackit_ske.md @@ -21,7 +21,7 @@ stackit ske [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_cluster.md b/docs/stackit_ske_cluster.md index 79e768ef3..d98cd3bf9 100644 --- a/docs/stackit_ske_cluster.md +++ b/docs/stackit_ske_cluster.md @@ -21,7 +21,7 @@ stackit ske cluster [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_cluster_create.md b/docs/stackit_ske_cluster_create.md index e27566c41..5b15cb217 100644 --- a/docs/stackit_ske_cluster_create.md +++ b/docs/stackit_ske_cluster_create.md @@ -42,7 +42,7 @@ stackit ske cluster create CLUSTER_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_cluster_delete.md b/docs/stackit_ske_cluster_delete.md index e496aa242..c2bb2ccd8 100644 --- a/docs/stackit_ske_cluster_delete.md +++ b/docs/stackit_ske_cluster_delete.md @@ -28,7 +28,7 @@ stackit ske cluster delete CLUSTER_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_cluster_describe.md b/docs/stackit_ske_cluster_describe.md index 8382dd33a..733a9fa83 100644 --- a/docs/stackit_ske_cluster_describe.md +++ b/docs/stackit_ske_cluster_describe.md @@ -31,7 +31,7 @@ stackit ske cluster describe CLUSTER_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_cluster_generate-payload.md b/docs/stackit_ske_cluster_generate-payload.md index 127be6ef2..dc07bfa22 100644 --- a/docs/stackit_ske_cluster_generate-payload.md +++ b/docs/stackit_ske_cluster_generate-payload.md @@ -37,7 +37,7 @@ stackit ske cluster generate-payload [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_cluster_list.md b/docs/stackit_ske_cluster_list.md index 1a9c25ef6..d0438ef6c 100644 --- a/docs/stackit_ske_cluster_list.md +++ b/docs/stackit_ske_cluster_list.md @@ -35,7 +35,7 @@ stackit ske cluster list [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_cluster_update.md b/docs/stackit_ske_cluster_update.md index 2cb4f65bb..0e0482693 100644 --- a/docs/stackit_ske_cluster_update.md +++ b/docs/stackit_ske_cluster_update.md @@ -39,7 +39,7 @@ stackit ske cluster update CLUSTER_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_credentials.md b/docs/stackit_ske_credentials.md index 70b584bc8..51d65fe36 100644 --- a/docs/stackit_ske_credentials.md +++ b/docs/stackit_ske_credentials.md @@ -21,7 +21,7 @@ stackit ske credentials [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_credentials_complete-rotation.md b/docs/stackit_ske_credentials_complete-rotation.md index 255187290..04fc73052 100644 --- a/docs/stackit_ske_credentials_complete-rotation.md +++ b/docs/stackit_ske_credentials_complete-rotation.md @@ -43,7 +43,7 @@ stackit ske credentials complete-rotation CLUSTER_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_credentials_start-rotation.md b/docs/stackit_ske_credentials_start-rotation.md index 12d47d5f1..35e3a7f5d 100644 --- a/docs/stackit_ske_credentials_start-rotation.md +++ b/docs/stackit_ske_credentials_start-rotation.md @@ -47,7 +47,7 @@ stackit ske credentials start-rotation CLUSTER_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_describe.md b/docs/stackit_ske_describe.md index 3037f6362..d45433c2d 100644 --- a/docs/stackit_ske_describe.md +++ b/docs/stackit_ske_describe.md @@ -28,7 +28,7 @@ stackit ske describe [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_disable.md b/docs/stackit_ske_disable.md index f6cc385c5..c9e973c6b 100644 --- a/docs/stackit_ske_disable.md +++ b/docs/stackit_ske_disable.md @@ -28,7 +28,7 @@ stackit ske disable [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_enable.md b/docs/stackit_ske_enable.md index 44f4256d2..19c88ac2d 100644 --- a/docs/stackit_ske_enable.md +++ b/docs/stackit_ske_enable.md @@ -28,7 +28,7 @@ stackit ske enable [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_kubeconfig.md b/docs/stackit_ske_kubeconfig.md index 306184110..d21edc87f 100644 --- a/docs/stackit_ske_kubeconfig.md +++ b/docs/stackit_ske_kubeconfig.md @@ -21,7 +21,7 @@ stackit ske kubeconfig [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` @@ -30,4 +30,5 @@ stackit ske kubeconfig [flags] * [stackit ske](./stackit_ske.md) - Provides functionality for SKE * [stackit ske kubeconfig create](./stackit_ske_kubeconfig_create.md) - Creates a kubeconfig for an SKE cluster +* [stackit ske kubeconfig login](./stackit_ske_kubeconfig_login.md) - Login plugin for kubernetes clients diff --git a/docs/stackit_ske_kubeconfig_create.md b/docs/stackit_ske_kubeconfig_create.md index d1ef0883d..a779cacc0 100644 --- a/docs/stackit_ske_kubeconfig_create.md +++ b/docs/stackit_ske_kubeconfig_create.md @@ -21,6 +21,9 @@ stackit ske kubeconfig create CLUSTER_NAME [flags] Create a kubeconfig for the SKE cluster with name "my-cluster" $ stackit ske kubeconfig create my-cluster + Get a login kubeconfig for the SKE cluster with name "my-cluster". This kubeconfig does not contain any credentials and instead obtains valid credentials via the `stackit ske kubeconfig login` command. + $ stackit ske kubeconfig create my-cluster --login + Create a kubeconfig for the SKE cluster with name "my-cluster" and set the expiration time to 30 days $ stackit ske kubeconfig create my-cluster --expiration 30d @@ -37,6 +40,7 @@ stackit ske kubeconfig create CLUSTER_NAME [flags] -e, --expiration string Expiration time for the kubeconfig in seconds(s), minutes(m), hours(h), days(d) or months(M). Example: 30d. By default, expiration time is 1h --filepath string Path to create the kubeconfig file. By default, the kubeconfig is created as 'config' in the .kube folder, in the user's home directory. -h, --help Help for "stackit ske kubeconfig create" + -l, --login Create a login kubeconfig that obtains valid credentials via the STACKIT CLI. This flag is mutually exclusive with the expiration flag. ``` ### Options inherited from parent commands @@ -44,7 +48,7 @@ stackit ske kubeconfig create CLUSTER_NAME [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/docs/stackit_ske_kubeconfig_login.md b/docs/stackit_ske_kubeconfig_login.md new file mode 100644 index 000000000..d7e2d7691 --- /dev/null +++ b/docs/stackit_ske_kubeconfig_login.md @@ -0,0 +1,45 @@ +## stackit ske kubeconfig login + +Login plugin for kubernetes clients + +### Synopsis + +Login plugin for kubernetes clients, that creates short-lived credentials to authenticate against a STACKIT Kubernetes Engine (SKE) cluster. +First you need to obtain a kubeconfig for use with the login command (first example). +Secondly you use the kubeconfig with your chosen Kubernetes client (second example), the client will automatically retrieve the credentials via the STACKIT CLI. + +``` +stackit ske kubeconfig login [flags] +``` + +### Examples + +``` + Get a login kubeconfig for the SKE cluster with name "my-cluster". This kubeconfig does not contain any credentials and instead obtains valid credentials via the `stackit ske kubeconfig login` command. + $ stackit ske kubeconfig create my-cluster --login + + Use the previously saved kubeconfig to authenticate to the SKE cluster, in this case with kubectl. + $ kubectl cluster-info + $ kubectl get pods +``` + +### Options + +``` + -h, --help Help for "stackit ske kubeconfig login" +``` + +### Options inherited from parent commands + +``` + -y, --assume-yes If set, skips all confirmation prompts + --async If set, runs the command asynchronously + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] + -p, --project-id string Project ID + --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") +``` + +### SEE ALSO + +* [stackit ske kubeconfig](./stackit_ske_kubeconfig.md) - Provides functionality for SKE kubeconfig + diff --git a/docs/stackit_ske_options.md b/docs/stackit_ske_options.md index e243ca30f..303bbe6e4 100644 --- a/docs/stackit_ske_options.md +++ b/docs/stackit_ske_options.md @@ -40,7 +40,7 @@ stackit ske options [flags] ``` -y, --assume-yes If set, skips all confirmation prompts --async If set, runs the command asynchronously - -o, --output-format string Output format, one of ["json" "pretty" "none"] + -o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"] -p, --project-id string Project ID --verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info") ``` diff --git a/go.mod b/go.mod index 609df8fd8..067795c9c 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/stackitcloud/stackit-cli go 1.22 require ( + github.com/goccy/go-yaml v1.11.3 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 @@ -16,37 +17,55 @@ require ( github.com/stackitcloud/stackit-sdk-go/core v0.12.0 github.com/stackitcloud/stackit-sdk-go/services/authorization v0.2.0 github.com/stackitcloud/stackit-sdk-go/services/dns v0.9.1 - github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.12.0 - github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.13.0 + github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.13.0 + github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.14.0 github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.13.0 github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.8.0 github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.7.0 github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.4.0 - github.com/stackitcloud/stackit-sdk-go/services/ske v0.14.0 + github.com/stackitcloud/stackit-sdk-go/services/ske v0.15.0 github.com/zalando/go-keyring v0.2.4 golang.org/x/mod v0.17.0 golang.org/x/oauth2 v0.20.0 golang.org/x/term v0.20.0 golang.org/x/text v0.15.0 + k8s.io/apimachinery v0.29.2 + k8s.io/client-go v0.29.2 ) -require github.com/mattn/go-isatty v0.0.17 // indirect +require ( + golang.org/x/net v0.23.0 // indirect + golang.org/x/time v0.5.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect +) + +require ( + github.com/fatih/color v1.14.1 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect +) require ( github.com/alessio/shellescape v1.4.2 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/gofuzz v1.2.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/imdario/mergo v0.3.6 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -55,16 +74,22 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/stackitcloud/stackit-sdk-go/services/argus v0.10.0 github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.12.0 - github.com/stackitcloud/stackit-sdk-go/services/logme v0.13.0 - github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.13.0 + github.com/stackitcloud/stackit-sdk-go/services/logme v0.14.0 + github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.14.0 github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.9.0 - github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.13.0 - github.com/stackitcloud/stackit-sdk-go/services/redis v0.13.0 + github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.14.0 + github.com/stackitcloud/stackit-sdk-go/services/redis v0.14.0 github.com/subosito/gotenv v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect golang.org/x/sys v0.20.0 // indirect - gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/api v0.29.2 // indirect + k8s.io/klog/v2 v2.110.1 // indirect + k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index eeec3313b..d99700f5a 100644 --- a/go.sum +++ b/go.sum @@ -8,36 +8,76 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= +github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/goccy/go-yaml v1.11.3 h1:B3W9IdWbvrUu2OYQGwvU1nZtvMQJPBKgBUuweJjLj6I= +github.com/goccy/go-yaml v1.11.3/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= +github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf h1:FtEj8sfIcaaBfAKrE1Cwb61YDtYq9JxChK1c7AKce7s= github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf/go.mod h1:yrqSXGoD/4EKfF26AOGzscPOgTTJcyAwM2rpixWT+t4= github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+UV8OU= github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lmittmann/tint v1.0.4 h1:LeYihpJ9hyGvE0w+K2okPTGUdVLfng1+nDNVR4vWISc= github.com/lmittmann/tint v1.0.4/go.mod h1:HIS3gSy7qNwGCj+5oRjAutErFBl4BzdQP6cJZ0NfMwE= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -47,8 +87,13 @@ github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZ github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -87,62 +132,123 @@ github.com/stackitcloud/stackit-sdk-go/services/dns v0.9.1 h1:pj2nAJvgzFSckA56rC github.com/stackitcloud/stackit-sdk-go/services/dns v0.9.1/go.mod h1:MdZcRbs19s2NLeJmSLSoqTzm9IPIQhE1ZEMpo9gePq0= github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.12.0 h1:LAteZO46XmqTsmPw0QV8n8WiGM205pxrcqHqWznNmyY= github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.12.0/go.mod h1:wsO3+vXe1XiKLeCIctWAptaHQZ07Un7kmLTQ+drbj7w= -github.com/stackitcloud/stackit-sdk-go/services/logme v0.13.0 h1:/wqs+pfHSjFWTakJVQGD/KwArxmFN8qdYrJDUgA1Gxw= -github.com/stackitcloud/stackit-sdk-go/services/logme v0.13.0/go.mod h1:bj9cn1treNSxKTRCEmESwqfENN8vCYn60HUnEA0P83c= -github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.13.0 h1:qioXHNeQ2xdwT5iGOk0c3hQIpct7zlAYzLRqXvsJ7CA= -github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.13.0/go.mod h1:kPetkX9hNm9HkRyiKQL/tlgdi8frZdMP8afg0mEvQ9s= -github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.12.0 h1:/m6N/CdsFxomexsowU7PwT1S4UTmI39PnEvvWGsDh1s= -github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.12.0/go.mod h1:iFerEzGmkg6R13ldFUyHUWHm0ac9cS4ftTDLhP0k/dU= +github.com/stackitcloud/stackit-sdk-go/services/logme v0.14.0 h1:vvQFCN5sKZA9tdzrbDnAVMsaTijX8lvTYnPaKQHmkoI= +github.com/stackitcloud/stackit-sdk-go/services/logme v0.14.0/go.mod h1:bj9cn1treNSxKTRCEmESwqfENN8vCYn60HUnEA0P83c= +github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.14.0 h1:tK6imWrbZ5TgQJbukWCUz7yDgcvvFMX8wamxkPTLuDo= +github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.14.0/go.mod h1:kPetkX9hNm9HkRyiKQL/tlgdi8frZdMP8afg0mEvQ9s= +github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.13.0 h1:Dhanx9aV5VRfpHg22Li07661FbRT5FR9/M6FowN08a8= +github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.13.0/go.mod h1:iFerEzGmkg6R13ldFUyHUWHm0ac9cS4ftTDLhP0k/dU= github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.9.0 h1:rWgy4/eCIgyA2dUuc4a30pldmS6taQDwiLqoeZmyeP8= github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.9.0/go.mod h1:dkVMJI88eJ3Xs0ZV15r4tUpgitUGJXcvrX3RL4Zq2bQ= -github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.13.0 h1:dzt2wd1QkFVctKPQDBlyMCsHEJV4Bf2bRkZTUFFCZhs= -github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.13.0/go.mod h1:ZecMIf9oYj2DGZqWh93l97WdVaRdLl+tW5Fq3YKGwBM= +github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.14.0 h1:zkhm0r0OZ5NbHJFrm+7B+h11QL0bNLC53nzXhqCaLWo= +github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.14.0/go.mod h1:ZecMIf9oYj2DGZqWh93l97WdVaRdLl+tW5Fq3YKGwBM= github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.13.0 h1:PGLjBZxWM7NIrH1+W1+f+/4kZEgwv9DGnXcUzOqM0M8= github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.13.0/go.mod h1:SdrqGLCkilL6wl1+jcxmLtks2IocgIg+bsyeyYUIzR4= -github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.13.0 h1:bdmZhVAuyPiaAeJnBRLMVtVix6DYzNYbpdPiq/Z3XCI= -github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.13.0/go.mod h1:eSgnPBknTJh7t+jVKN+xzeAh+Cg1USOlH3QCyfvG20g= -github.com/stackitcloud/stackit-sdk-go/services/redis v0.13.0 h1:MlREN/9zDntk90kahS0aJa/gPGAoUV4NLNnrTLs9CLc= -github.com/stackitcloud/stackit-sdk-go/services/redis v0.13.0/go.mod h1:3LhiTR/DMbKR2HuleTzlFHltR1MT1KD0DeW46X6K2GE= +github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.14.0 h1:wJ+LSMrRol4wlm/ML4wvVPGwIw51VHMFwMCOtwluvKQ= +github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.14.0/go.mod h1:eSgnPBknTJh7t+jVKN+xzeAh+Cg1USOlH3QCyfvG20g= +github.com/stackitcloud/stackit-sdk-go/services/redis v0.14.0 h1:wcfA/3mTI7UmTFmKX09EKIVsEqflfkiuEoWL/j5cMvg= +github.com/stackitcloud/stackit-sdk-go/services/redis v0.14.0/go.mod h1:3LhiTR/DMbKR2HuleTzlFHltR1MT1KD0DeW46X6K2GE= github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.8.0 h1:7AIvLkB7JZ5lYKtYLwI0rgJ0185hwQC1PFiUrjcinDM= github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.8.0/go.mod h1:p16qz/pAW8b1gEhqMpIgJfutRPeDPqQLlbVGyCo3f8o= github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.7.0 h1:1Ho+M4DyZHrwbDe1peW//x+/hegIuaUdZqbQEbPlr4k= github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.7.0/go.mod h1:LX0Mcyr7/QP77zf7e05fHCJO38RMuTxr7nEDUDZ3oPQ= github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.4.0 h1:JB1O0E9+L50ZaO36uz7azurvUuB5JdX5s2ZXuIdb9t8= github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.4.0/go.mod h1:Ni9RBJvcaXRIrDIuQBpJcuQvCQSj27crQSyc+WM4p0c= -github.com/stackitcloud/stackit-sdk-go/services/ske v0.14.0 h1:GH67aTvjXiXC2XmYhgmqNXfG13JHKB3wsk5JlTErsjg= -github.com/stackitcloud/stackit-sdk-go/services/ske v0.14.0/go.mod h1:0fFs4R7kg+gU7FNAIzzFvlCZJz6gyZ8CFhbK3eSrAwQ= +github.com/stackitcloud/stackit-sdk-go/services/ske v0.15.0 h1:7iTzdiglvJmKMaHlr4JUPvNOmA730rAniry74cnZ8zI= +github.com/stackitcloud/stackit-sdk-go/services/ske v0.15.0/go.mod h1:0fFs4R7kg+gU7FNAIzzFvlCZJz6gyZ8CFhbK3eSrAwQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zalando/go-keyring v0.2.4 h1:wi2xxTqdiwMKbM6TWwi+uJCG/Tum2UV0jqaQhCa9/68= github.com/zalando/go-keyring v0.2.4/go.mod h1:HL4k+OXQfJUWaMnqyuSOc0drfGPX2b51Du6K+MRgZMk= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA= golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.29.2 h1:hBC7B9+MU+ptchxEqTNW2DkUosJpp1P+Wn6YncZ474A= +k8s.io/api v0.29.2/go.mod h1:sdIaaKuU7P44aoyyLlikSLayT6Vb7bvJNCX105xZXY0= +k8s.io/apimachinery v0.29.2 h1:EWGpfJ856oj11C52NRCHuU7rFDwxev48z+6DSlGNsV8= +k8s.io/apimachinery v0.29.2/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= +k8s.io/client-go v0.29.2 h1:FEg85el1TeZp+/vYJM7hkDlSTFZ+c5nnK44DJ4FyoRg= +k8s.io/client-go v0.29.2/go.mod h1:knlvFZE58VpqbQpJNbCbctTVXcd35mMyAAwBdpt4jrA= +k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= +k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/internal/cmd/argus/credentials/list/list.go b/internal/cmd/argus/credentials/list/list.go index c4739d5c9..795b4278e 100644 --- a/internal/cmd/argus/credentials/list/list.go +++ b/internal/cmd/argus/credentials/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -131,6 +132,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials []argus.Ser } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Argus credentials list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/argus/grafana/describe/describe.go b/internal/cmd/argus/grafana/describe/describe.go index ef17e74b2..4c8f930b7 100644 --- a/internal/cmd/argus/grafana/describe/describe.go +++ b/internal/cmd/argus/grafana/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -132,6 +133,14 @@ func outputResult(p *print.Printer, inputModel *inputModel, grafanaConfigs *argu } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(grafanaConfigs, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Grafana configs: %w", err) + } + p.Outputln(string(details)) + return nil default: initialAdminPassword := *instance.Instance.GrafanaAdminPassword diff --git a/internal/cmd/argus/instance/create/create.go b/internal/cmd/argus/instance/create/create.go index 333ad7ac3..b37396bb7 100644 --- a/internal/cmd/argus/instance/create/create.go +++ b/internal/cmd/argus/instance/create/create.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -207,6 +208,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Argus instance: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/argus/instance/describe/describe.go b/internal/cmd/argus/instance/describe/describe.go index c2ff58b7d..c6e8bc197 100644 --- a/internal/cmd/argus/instance/describe/describe.go +++ b/internal/cmd/argus/instance/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -105,6 +106,14 @@ func outputResult(p *print.Printer, outputFormat string, instance *argus.GetInst } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Argus instance: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/argus/instance/list/list.go b/internal/cmd/argus/instance/list/list.go index 13b089afa..98a8e74d5 100644 --- a/internal/cmd/argus/instance/list/list.go +++ b/internal/cmd/argus/instance/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, instances []argus.Proje } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Argus instance list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/argus/plans/plans.go b/internal/cmd/argus/plans/plans.go index 084dfcd04..a80800177 100644 --- a/internal/cmd/argus/plans/plans.go +++ b/internal/cmd/argus/plans/plans.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, plans []argus.Plan) err } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(plans, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Argus plans: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/argus/scrape-config/describe/describe.go b/internal/cmd/argus/scrape-config/describe/describe.go index 940c431c6..2b9d1fb99 100644 --- a/internal/cmd/argus/scrape-config/describe/describe.go +++ b/internal/cmd/argus/scrape-config/describe/describe.go @@ -6,6 +6,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -107,6 +108,14 @@ func outputResult(p *print.Printer, outputFormat string, config *argus.Job) erro } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(config, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal scrape configuration: %w", err) + } + p.Outputln(string(details)) + return nil default: saml2Enabled := "Enabled" diff --git a/internal/cmd/argus/scrape-config/list/list.go b/internal/cmd/argus/scrape-config/list/list.go index c726b53aa..60f6598a0 100644 --- a/internal/cmd/argus/scrape-config/list/list.go +++ b/internal/cmd/argus/scrape-config/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -134,6 +135,14 @@ func outputResult(p *print.Printer, outputFormat string, configs []argus.Job) er } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(configs, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal scrape configurations list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/config/list/list.go b/internal/cmd/config/list/list.go index d6c3e2055..8ba6160f4 100644 --- a/internal/cmd/config/list/list.go +++ b/internal/cmd/config/list/list.go @@ -9,6 +9,7 @@ import ( "strconv" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/config" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -81,6 +82,14 @@ func outputResult(p *print.Printer, outputFormat string, configData map[string]a return fmt.Errorf("marshal config list: %w", err) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(configData, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal config list: %w", err) + } + p.Outputln(string(details)) + return nil default: diff --git a/internal/cmd/dns/record-set/create/create.go b/internal/cmd/dns/record-set/create/create.go index f85e041fb..a6beefdc3 100644 --- a/internal/cmd/dns/record-set/create/create.go +++ b/internal/cmd/dns/record-set/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -174,6 +175,14 @@ func outputResult(p *print.Printer, model *inputModel, zoneLabel string, resp *d } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal DNS record-set: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/dns/record-set/describe/describe.go b/internal/cmd/dns/record-set/describe/describe.go index c10d003eb..221729d91 100644 --- a/internal/cmd/dns/record-set/describe/describe.go +++ b/internal/cmd/dns/record-set/describe/describe.go @@ -6,6 +6,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -121,6 +122,14 @@ func outputResult(p *print.Printer, outputFormat string, recordSet *dns.RecordSe } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(recordSet, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal DNS record set: %w", err) + } + p.Outputln(string(details)) + return nil default: recordsData := make([]string, 0, len(*recordSet.Records)) diff --git a/internal/cmd/dns/record-set/list/list.go b/internal/cmd/dns/record-set/list/list.go index 3b8aa0c6d..a3a842832 100644 --- a/internal/cmd/dns/record-set/list/list.go +++ b/internal/cmd/dns/record-set/list/list.go @@ -6,6 +6,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -242,6 +243,14 @@ func outputResult(p *print.Printer, outputFormat string, recordSets []dns.Record } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(recordSets, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal DNS record set list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/dns/zone/create/create.go b/internal/cmd/dns/zone/create/create.go index 442776e75..95507e40d 100644 --- a/internal/cmd/dns/zone/create/create.go +++ b/internal/cmd/dns/zone/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -203,6 +204,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal DNS zone: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/dns/zone/describe/describe.go b/internal/cmd/dns/zone/describe/describe.go index 1830471b4..578dee03c 100644 --- a/internal/cmd/dns/zone/describe/describe.go +++ b/internal/cmd/dns/zone/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -106,6 +107,14 @@ func outputResult(p *print.Printer, outputFormat string, zone *dns.Zone) error { } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(zone, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal DNS zone: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/dns/zone/list/list.go b/internal/cmd/dns/zone/list/list.go index bc378b10f..49e23a0b0 100644 --- a/internal/cmd/dns/zone/list/list.go +++ b/internal/cmd/dns/zone/list/list.go @@ -6,6 +6,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -231,6 +232,14 @@ func outputResult(p *print.Printer, outputFormat string, zones []dns.Zone) error } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(zones, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal DNS zone list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/load-balancer/describe/describe.go b/internal/cmd/load-balancer/describe/describe.go index ff6defaf0..d5cf4dec9 100644 --- a/internal/cmd/load-balancer/describe/describe.go +++ b/internal/cmd/load-balancer/describe/describe.go @@ -6,6 +6,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -105,6 +106,14 @@ func outputResult(p *print.Printer, outputFormat string, loadBalancer *loadbalan } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(loadBalancer, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal load balancer: %w", err) + } + p.Outputln(string(details)) + return nil default: return outputResultAsTable(p, loadBalancer) diff --git a/internal/cmd/load-balancer/list/list.go b/internal/cmd/load-balancer/list/list.go index d5b568216..a82a0384d 100644 --- a/internal/cmd/load-balancer/list/list.go +++ b/internal/cmd/load-balancer/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -138,6 +139,14 @@ func outputResult(p *print.Printer, outputFormat string, loadBalancers []loadbal } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(loadBalancers, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal load balancer list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/load-balancer/observability-credentials/add/add.go b/internal/cmd/load-balancer/observability-credentials/add/add.go index e97963d9f..b1213eefd 100644 --- a/internal/cmd/load-balancer/observability-credentials/add/add.go +++ b/internal/cmd/load-balancer/observability-credentials/add/add.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/google/uuid" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" @@ -156,6 +157,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Load Balancer observability credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Added Load Balancer observability credentials on project %q. Credentials reference: %q\n", projectLabel, *resp.Credential.CredentialsRef) diff --git a/internal/cmd/load-balancer/observability-credentials/describe/describe.go b/internal/cmd/load-balancer/observability-credentials/describe/describe.go index 31d109501..27d27caf8 100644 --- a/internal/cmd/load-balancer/observability-credentials/describe/describe.go +++ b/internal/cmd/load-balancer/observability-credentials/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -102,6 +103,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials *loadbalanc } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Load Balancer observability credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/load-balancer/observability-credentials/list/list.go b/internal/cmd/load-balancer/observability-credentials/list/list.go index f71ab67a9..226d9f06a 100644 --- a/internal/cmd/load-balancer/observability-credentials/list/list.go +++ b/internal/cmd/load-balancer/observability-credentials/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -174,6 +175,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials []loadbalan } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Load Balancer observability credentials list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/load-balancer/quota/quota.go b/internal/cmd/load-balancer/quota/quota.go index 7762e78bc..593e117b7 100644 --- a/internal/cmd/load-balancer/quota/quota.go +++ b/internal/cmd/load-balancer/quota/quota.go @@ -6,6 +6,7 @@ import ( "fmt" "strconv" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -95,6 +96,14 @@ func outputResult(p *print.Printer, outputFormat string, quota *loadbalancer.Get p.Outputf("Maximum number of load balancers allowed: %s\n", maxLoadBalancers) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(quota, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal quota: %w", err) + } + p.Outputln(string(details)) + return nil default: details, err := json.MarshalIndent(quota, "", " ") diff --git a/internal/cmd/load-balancer/target-pool/describe/describe.go b/internal/cmd/load-balancer/target-pool/describe/describe.go index c1f06d196..e3e5921fc 100644 --- a/internal/cmd/load-balancer/target-pool/describe/describe.go +++ b/internal/cmd/load-balancer/target-pool/describe/describe.go @@ -7,6 +7,7 @@ import ( "strconv" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -119,21 +120,30 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *loadbalance } func outputResult(p *print.Printer, outputFormat string, targetPool loadbalancer.TargetPool, listener *loadbalancer.Listener) error { + output := struct { + *loadbalancer.TargetPool + Listener *loadbalancer.Listener `json:"attached_listener"` + }{ + &targetPool, + listener, + } + switch outputFormat { case print.JSONOutputFormat: - output := struct { - *loadbalancer.TargetPool - Listener *loadbalancer.Listener `json:"attached_listener"` - }{ - &targetPool, - listener, - } details, err := json.MarshalIndent(output, "", " ") if err != nil { return fmt.Errorf("marshal load balancer: %w", err) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(output, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal load balancer: %w", err) + } + p.Outputln(string(details)) + return nil default: return outputResultAsTable(p, targetPool, listener) diff --git a/internal/cmd/logme/credentials/create/create.go b/internal/cmd/logme/credentials/create/create.go index e50efa5c7..76b3b14f1 100644 --- a/internal/cmd/logme/credentials/create/create.go +++ b/internal/cmd/logme/credentials/create/create.go @@ -5,6 +5,8 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" + "github.com/spf13/cobra" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -14,8 +16,6 @@ import ( "github.com/stackitcloud/stackit-cli/internal/pkg/services/logme/client" logmeUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/logme/utils" "github.com/stackitcloud/stackit-cli/internal/pkg/utils" - - "github.com/spf13/cobra" "github.com/stackitcloud/stackit-sdk-go/services/logme" ) @@ -123,17 +123,25 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *logme.APICl } func outputResult(p *print.Printer, model *inputModel, instanceLabel string, resp *logme.CredentialsResponse) error { + if !model.ShowPassword { + resp.Raw.Credentials.Password = utils.Ptr("hidden") + } switch model.OutputFormat { case print.JSONOutputFormat: - if !model.ShowPassword { - resp.Raw.Credentials.Password = utils.Ptr("hidden") - } details, err := json.MarshalIndent(resp, "", " ") if err != nil { return fmt.Errorf("marshal LogMe credentials: %w", err) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal LogMe credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created credentials for instance %q. Credentials ID: %s\n\n", instanceLabel, *resp.Id) diff --git a/internal/cmd/logme/credentials/describe/describe.go b/internal/cmd/logme/credentials/describe/describe.go index e9b5f7987..e2b7551a9 100644 --- a/internal/cmd/logme/credentials/describe/describe.go +++ b/internal/cmd/logme/credentials/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -119,6 +120,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials *logme.Cred } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal LogMe credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/logme/credentials/list/list.go b/internal/cmd/logme/credentials/list/list.go index db24234af..653902d56 100644 --- a/internal/cmd/logme/credentials/list/list.go +++ b/internal/cmd/logme/credentials/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -142,6 +143,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials []logme.Cre } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal LogMe credentials list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/logme/instance/create/create.go b/internal/cmd/logme/instance/create/create.go index 8ad379da4..7e2b15e2f 100644 --- a/internal/cmd/logme/instance/create/create.go +++ b/internal/cmd/logme/instance/create/create.go @@ -7,6 +7,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -259,6 +260,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal LogMe instance: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/logme/instance/describe/describe.go b/internal/cmd/logme/instance/describe/describe.go index 613091bc0..9e477f16a 100644 --- a/internal/cmd/logme/instance/describe/describe.go +++ b/internal/cmd/logme/instance/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -107,6 +108,14 @@ func outputResult(p *print.Printer, outputFormat string, instance *logme.Instanc } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal LogMe instance: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/logme/instance/list/list.go b/internal/cmd/logme/instance/list/list.go index e3b7dd712..24e3cf999 100644 --- a/internal/cmd/logme/instance/list/list.go +++ b/internal/cmd/logme/instance/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, instances []logme.Insta } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal LogMe instance list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/logme/plans/plans.go b/internal/cmd/logme/plans/plans.go index 31094a24d..dfa14ed0e 100644 --- a/internal/cmd/logme/plans/plans.go +++ b/internal/cmd/logme/plans/plans.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, plans []logme.Offering) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(plans, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal LogMe plans: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/mariadb/credentials/create/create.go b/internal/cmd/mariadb/credentials/create/create.go index bddee6b38..4373782ea 100644 --- a/internal/cmd/mariadb/credentials/create/create.go +++ b/internal/cmd/mariadb/credentials/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -123,17 +124,25 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *mariadb.API } func outputResult(p *print.Printer, model *inputModel, instanceLabel string, resp *mariadb.CredentialsResponse) error { + if !model.ShowPassword { + resp.Raw.Credentials.Password = utils.Ptr("hidden") + } switch model.OutputFormat { case print.JSONOutputFormat: - if !model.ShowPassword { - resp.Raw.Credentials.Password = utils.Ptr("hidden") - } details, err := json.MarshalIndent(resp, "", " ") if err != nil { return fmt.Errorf("marshal MariaDB credentials: %w", err) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Argus credentials list: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created credentials for instance %q. Credentials ID: %s\n\n", instanceLabel, *resp.Id) diff --git a/internal/cmd/mariadb/credentials/describe/describe.go b/internal/cmd/mariadb/credentials/describe/describe.go index ef37e64b4..ae5eeece0 100644 --- a/internal/cmd/mariadb/credentials/describe/describe.go +++ b/internal/cmd/mariadb/credentials/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -119,6 +120,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials *mariadb.Cr } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MariaDB credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/mariadb/credentials/list/list.go b/internal/cmd/mariadb/credentials/list/list.go index 7ca6e2f0a..75a438804 100644 --- a/internal/cmd/mariadb/credentials/list/list.go +++ b/internal/cmd/mariadb/credentials/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -142,6 +143,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials []mariadb.C } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MariaDB credentials list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/mariadb/instance/create/create.go b/internal/cmd/mariadb/instance/create/create.go index f92ba4351..754b50fcd 100644 --- a/internal/cmd/mariadb/instance/create/create.go +++ b/internal/cmd/mariadb/instance/create/create.go @@ -7,6 +7,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -259,6 +260,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MariaDB instance: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/mariadb/instance/describe/describe.go b/internal/cmd/mariadb/instance/describe/describe.go index 2affb1a98..94323bc5e 100644 --- a/internal/cmd/mariadb/instance/describe/describe.go +++ b/internal/cmd/mariadb/instance/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -107,6 +108,14 @@ func outputResult(p *print.Printer, outputFormat string, instance *mariadb.Insta } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MariaDB instance: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/mariadb/instance/list/list.go b/internal/cmd/mariadb/instance/list/list.go index b5ba59500..4a3b31672 100644 --- a/internal/cmd/mariadb/instance/list/list.go +++ b/internal/cmd/mariadb/instance/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, instances []mariadb.Ins } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MariaDB instance list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/mariadb/plans/plans.go b/internal/cmd/mariadb/plans/plans.go index 57a575ca4..4fb14c3c2 100644 --- a/internal/cmd/mariadb/plans/plans.go +++ b/internal/cmd/mariadb/plans/plans.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, plans []mariadb.Offerin } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(plans, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MariaDB plans: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/mongodbflex/backup/backup.go b/internal/cmd/mongodbflex/backup/backup.go new file mode 100644 index 000000000..738363d78 --- /dev/null +++ b/internal/cmd/mongodbflex/backup/backup.go @@ -0,0 +1,36 @@ +package backup + +import ( + "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/describe" + "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/list" + "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/restore" + restorejobs "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/restore-jobs" + "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/schedule" + updateschedule "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/update-schedule" + "github.com/stackitcloud/stackit-cli/internal/pkg/args" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + "github.com/stackitcloud/stackit-cli/internal/pkg/utils" + + "github.com/spf13/cobra" +) + +func NewCmd(p *print.Printer) *cobra.Command { + cmd := &cobra.Command{ + Use: "backup", + Short: "Provides functionality for MongoDB Flex instance backups", + Long: "Provides functionality for MongoDB Flex instance backups.", + Args: args.NoArgs, + Run: utils.CmdHelp, + } + addSubcommands(cmd, p) + return cmd +} + +func addSubcommands(cmd *cobra.Command, p *print.Printer) { + cmd.AddCommand(updateschedule.NewCmd(p)) + cmd.AddCommand(schedule.NewCmd(p)) + cmd.AddCommand(restore.NewCmd(p)) + cmd.AddCommand(list.NewCmd(p)) + cmd.AddCommand(describe.NewCmd(p)) + cmd.AddCommand(restorejobs.NewCmd(p)) +} diff --git a/internal/cmd/mongodbflex/backup/describe/describe.go b/internal/cmd/mongodbflex/backup/describe/describe.go new file mode 100644 index 000000000..6488c6ee7 --- /dev/null +++ b/internal/cmd/mongodbflex/backup/describe/describe.go @@ -0,0 +1,165 @@ +package describe + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/goccy/go-yaml" + "github.com/inhies/go-bytesize" + "github.com/spf13/cobra" + "github.com/stackitcloud/stackit-cli/internal/pkg/args" + "github.com/stackitcloud/stackit-cli/internal/pkg/errors" + "github.com/stackitcloud/stackit-cli/internal/pkg/examples" + "github.com/stackitcloud/stackit-cli/internal/pkg/flags" + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/client" + "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils" + "github.com/stackitcloud/stackit-cli/internal/pkg/tables" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" +) + +const ( + backupIdArg = "BACKUP_ID" + + instanceIdFlag = "instance-id" +) + +type inputModel struct { + *globalflags.GlobalFlagModel + + InstanceId string + BackupId string +} + +func NewCmd(p *print.Printer) *cobra.Command { + cmd := &cobra.Command{ + Use: fmt.Sprintf("describe %s", backupIdArg), + Short: "Shows details of a backup for a MongoDB Flex instance", + Long: "Shows details of a backup for a MongoDB Flex instance.", + Example: examples.Build( + examples.NewExample( + `Get details of a backup with ID "xxx" for a MongoDB Flex instance with ID "yyy"`, + "$ stackit mongodbflex backup describe xxx --instance-id yyy"), + examples.NewExample( + `Get details of a backup with ID "xxx" for a MongoDB Flex instance with ID "yyy" in JSON format`, + "$ stackit mongodbflex backup describe xxx --instance-id yyy --output-format json"), + ), + Args: args.SingleArg(backupIdArg, nil), + RunE: func(cmd *cobra.Command, args []string) error { + ctx := context.Background() + model, err := parseInput(p, cmd, args) + if err != nil { + return err + } + + // Configure API client + apiClient, err := client.ConfigureClient(p) + if err != nil { + return err + } + + instanceLabel, err := utils.GetInstanceName(ctx, apiClient, model.ProjectId, model.InstanceId) + if err != nil { + p.Debug(print.ErrorLevel, "get instance name: %v", err) + instanceLabel = model.InstanceId + } + + // Call API + req := buildRequest(ctx, model, apiClient) + resp, err := req.Execute() + + if err != nil { + return fmt.Errorf("describe backup for MongoDB Flex instance: %w", err) + } + + restoreJobs, err := apiClient.ListRestoreJobs(ctx, model.ProjectId, model.InstanceId).Execute() + if err != nil { + return fmt.Errorf("get restore jobs for MongoDB Flex instance %q: %w", instanceLabel, err) + } + + restoreJobState := utils.GetRestoreStatus(model.BackupId, restoreJobs) + return outputResult(p, cmd, model.OutputFormat, restoreJobState, *resp.Item) + }, + } + configureFlags(cmd) + return cmd +} + +func configureFlags(cmd *cobra.Command) { + cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") + + err := flags.MarkFlagsRequired(cmd, instanceIdFlag) + cobra.CheckErr(err) +} + +func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inputModel, error) { + backupId := inputArgs[0] + + globalFlags := globalflags.Parse(p, cmd) + if globalFlags.ProjectId == "" { + return nil, &errors.ProjectIdError{} + } + + model := inputModel{ + GlobalFlagModel: globalFlags, + InstanceId: flags.FlagToStringValue(p, cmd, instanceIdFlag), + BackupId: backupId, + } + + if p.IsVerbosityDebug() { + modelStr, err := print.BuildDebugStrFromInputModel(model) + if err != nil { + p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err) + } else { + p.Debug(print.DebugLevel, "parsed input values: %s", modelStr) + } + } + + return &model, nil +} + +func buildRequest(ctx context.Context, model *inputModel, apiClient *mongodbflex.APIClient) mongodbflex.ApiGetBackupRequest { + req := apiClient.GetBackup(ctx, model.ProjectId, model.InstanceId, model.BackupId) + return req +} + +func outputResult(p *print.Printer, cmd *cobra.Command, outputFormat, restoreStatus string, backup mongodbflex.Backup) error { + switch outputFormat { + case print.JSONOutputFormat: + details, err := json.MarshalIndent(backup, "", " ") + if err != nil { + return fmt.Errorf("marshal MongoDB Flex backup: %w", err) + } + cmd.Println(string(details)) + + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(backup, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDB Flex backup: %w", err) + } + p.Outputln(string(details)) + + return nil + default: + table := tables.NewTable() + table.AddRow("ID", *backup.Id) + table.AddSeparator() + table.AddRow("CREATED AT", *backup.StartTime) + table.AddSeparator() + table.AddRow("EXPIRES AT", *backup.EndTime) + table.AddSeparator() + table.AddRow("BACKUP SIZE", bytesize.New(float64(*backup.Size))) + table.AddSeparator() + table.AddRow("RESTORE STATUS", restoreStatus) + + err := table.Display(p) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + } +} diff --git a/internal/cmd/mongodbflex/backup/describe/describe_test.go b/internal/cmd/mongodbflex/backup/describe/describe_test.go new file mode 100644 index 000000000..1d6dc44e4 --- /dev/null +++ b/internal/cmd/mongodbflex/backup/describe/describe_test.go @@ -0,0 +1,239 @@ +package describe + +import ( + "context" + "testing" + + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" +) + +var projectIdFlag = globalflags.ProjectIdFlag + +type testCtxKey struct{} + +var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") +var testClient = &mongodbflex.APIClient{} +var testProjectId = uuid.NewString() +var testInstanceId = uuid.NewString() +var testBackupId = "backupID" + +func fixtureArgValues(mods ...func(argValues []string)) []string { + argValues := []string{ + testBackupId, + } + for _, mod := range mods { + mod(argValues) + } + return argValues +} + +func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string { + flagValues := map[string]string{ + projectIdFlag: testProjectId, + instanceIdFlag: testInstanceId, + } + for _, mod := range mods { + mod(flagValues) + } + return flagValues +} + +func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { + model := &inputModel{ + GlobalFlagModel: &globalflags.GlobalFlagModel{ + ProjectId: testProjectId, + Verbosity: globalflags.VerbosityDefault, + }, + InstanceId: testInstanceId, + BackupId: testBackupId, + } + for _, mod := range mods { + mod(model) + } + return model +} + +func fixtureRequest(mods ...func(request *mongodbflex.ApiGetBackupRequest)) mongodbflex.ApiGetBackupRequest { + request := testClient.GetBackup(testCtx, testProjectId, testInstanceId, testBackupId) + for _, mod := range mods { + mod(&request) + } + return request +} + +func TestParseInput(t *testing.T) { + tests := []struct { + description string + argValues []string + flagValues map[string]string + isValid bool + expectedModel *inputModel + }{ + { + description: "base", + argValues: fixtureArgValues(), + flagValues: fixtureFlagValues(), + isValid: true, + expectedModel: fixtureInputModel(), + }, + { + description: "no values", + argValues: []string{}, + flagValues: map[string]string{}, + isValid: false, + }, + { + description: "no arg values", + argValues: []string{}, + flagValues: fixtureFlagValues(), + isValid: false, + }, + { + description: "no flag values", + argValues: fixtureArgValues(), + flagValues: map[string]string{}, + isValid: false, + }, + { + description: "project id missing", + argValues: fixtureArgValues(), + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, projectIdFlag) + }), + isValid: false, + }, + { + description: "project id invalid 1", + argValues: fixtureArgValues(), + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "" + }), + isValid: false, + }, + { + description: "project id invalid 2", + argValues: fixtureArgValues(), + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "instance id missing", + argValues: fixtureArgValues(), + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, instanceIdFlag) + }), + isValid: false, + }, + { + description: "instance id invalid 1", + argValues: fixtureArgValues(), + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "" + }), + isValid: false, + }, + { + description: "instance id invalid 2", + argValues: fixtureArgValues(), + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "backup id invalid 1", + argValues: []string{""}, + flagValues: fixtureFlagValues(), + isValid: false, + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + p := print.NewPrinter() + cmd := NewCmd(p) + err := globalflags.Configure(cmd.Flags()) + if err != nil { + t.Fatalf("configure global flags: %v", err) + } + + for flag, value := range tt.flagValues { + err := cmd.Flags().Set(flag, value) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("setting flag --%s=%s: %v", flag, value, err) + } + } + + err = cmd.ValidateArgs(tt.argValues) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error validating args: %v", err) + } + + err = cmd.ValidateRequiredFlags() + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error validating flags: %v", err) + } + + model, err := parseInput(p, cmd, tt.argValues) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error parsing input: %v", err) + } + + if !tt.isValid { + t.Fatalf("did not fail on invalid input") + } + diff := cmp.Diff(model, tt.expectedModel) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} + +func TestBuildRequest(t *testing.T) { + tests := []struct { + description string + model *inputModel + expectedRequest mongodbflex.ApiGetBackupRequest + }{ + { + description: "base", + model: fixtureInputModel(), + expectedRequest: fixtureRequest(), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + request := buildRequest(testCtx, tt.model, testClient) + + diff := cmp.Diff(request, tt.expectedRequest, + cmp.AllowUnexported(tt.expectedRequest), + cmpopts.EquateComparable(testCtx), + ) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} diff --git a/internal/cmd/mongodbflex/backup/list/list.go b/internal/cmd/mongodbflex/backup/list/list.go new file mode 100644 index 000000000..f1a26ce75 --- /dev/null +++ b/internal/cmd/mongodbflex/backup/list/list.go @@ -0,0 +1,180 @@ +package list + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/goccy/go-yaml" + "github.com/inhies/go-bytesize" + "github.com/stackitcloud/stackit-cli/internal/pkg/args" + "github.com/stackitcloud/stackit-cli/internal/pkg/errors" + "github.com/stackitcloud/stackit-cli/internal/pkg/examples" + "github.com/stackitcloud/stackit-cli/internal/pkg/flags" + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/client" + mongodbflexUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils" + "github.com/stackitcloud/stackit-cli/internal/pkg/tables" + + "github.com/spf13/cobra" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" +) + +const ( + instanceIdFlag = "instance-id" + limitFlag = "limit" +) + +type inputModel struct { + *globalflags.GlobalFlagModel + + InstanceId *string + Limit *int64 +} + +func NewCmd(p *print.Printer) *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "Lists all backups which are available for a MongoDB Flex instance", + Long: "Lists all backups which are available for a MongoDB Flex instance.", + Example: examples.Build( + examples.NewExample( + `List all backups of instance with ID "xxx"`, + "$ stackit mongodbflex backup list --instance-id xxx"), + examples.NewExample( + `List all backups of instance with ID "xxx" in JSON format`, + "$ stackit mongodbflex backup list --instance-id xxx --output-format json"), + examples.NewExample( + `List up to 10 backups of instance with ID "xxx"`, + "$ stackit mongodbflex backup list --instance-id xxx --limit 10"), + ), + Args: args.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + ctx := context.Background() + model, err := parseInput(p, cmd) + if err != nil { + return err + } + + // Configure API client + apiClient, err := client.ConfigureClient(p) + if err != nil { + return err + } + + instanceLabel, err := mongodbflexUtils.GetInstanceName(ctx, apiClient, model.ProjectId, *model.InstanceId) + if err != nil { + p.Debug(print.ErrorLevel, "get instance name: %v", err) + instanceLabel = *model.InstanceId + } + + // Call API + req := buildRequest(ctx, model, apiClient) + resp, err := req.Execute() + if err != nil { + return fmt.Errorf("get backups for MongoDB Flex instance %q: %w", instanceLabel, err) + } + if resp.Items == nil || len(*resp.Items) == 0 { + cmd.Printf("No backups found for instance %q\n", instanceLabel) + return nil + } + backups := *resp.Items + + restoreJobs, err := apiClient.ListRestoreJobs(ctx, model.ProjectId, *model.InstanceId).Execute() + if err != nil { + return fmt.Errorf("get restore jobs for MongoDB Flex instance %q: %w", instanceLabel, err) + } + + // Truncate output + if model.Limit != nil && len(backups) > int(*model.Limit) { + backups = backups[:*model.Limit] + } + + return outputResult(p, model.OutputFormat, backups, restoreJobs) + }, + } + + configureFlags(cmd) + return cmd +} + +func configureFlags(cmd *cobra.Command) { + cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") + cmd.Flags().Int64(limitFlag, 0, "Maximum number of entries to list") + + err := flags.MarkFlagsRequired(cmd, instanceIdFlag) + cobra.CheckErr(err) +} + +func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) { + globalFlags := globalflags.Parse(p, cmd) + if globalFlags.ProjectId == "" { + return nil, &errors.ProjectIdError{} + } + + limit := flags.FlagToInt64Pointer(p, cmd, limitFlag) + if limit != nil && *limit < 1 { + return nil, &errors.FlagValidationError{ + Flag: limitFlag, + Details: "must be greater than 0", + } + } + + model := inputModel{ + GlobalFlagModel: globalFlags, + InstanceId: flags.FlagToStringPointer(p, cmd, instanceIdFlag), + Limit: flags.FlagToInt64Pointer(p, cmd, limitFlag), + } + + if p.IsVerbosityDebug() { + modelStr, err := print.BuildDebugStrFromInputModel(model) + if err != nil { + p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err) + } else { + p.Debug(print.DebugLevel, "parsed input values: %s", modelStr) + } + } + + return &model, nil +} + +func buildRequest(ctx context.Context, model *inputModel, apiClient *mongodbflex.APIClient) mongodbflex.ApiListBackupsRequest { + req := apiClient.ListBackups(ctx, model.ProjectId, *model.InstanceId) + return req +} + +func outputResult(p *print.Printer, outputFormat string, backups []mongodbflex.Backup, restoreJobs *mongodbflex.ListRestoreJobsResponse) error { + switch outputFormat { + case print.JSONOutputFormat: + details, err := json.MarshalIndent(backups, "", " ") + if err != nil { + return fmt.Errorf("marshal MongoDB Flex backups list: %w", err) + } + p.Outputln(string(details)) + + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(backups, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDB Flex backups list: %w", err) + } + p.Outputln(string(details)) + + return nil + default: + table := tables.NewTable() + table.SetHeader("ID", "CREATED AT", "EXPIRES AT", "BACKUP SIZE", "RESTORE STATUS") + for i := range backups { + backup := backups[i] + restoreStatus := mongodbflexUtils.GetRestoreStatus(*backup.Id, restoreJobs) + table.AddRow(*backup.Id, *backup.StartTime, *backup.EndTime, bytesize.New(float64(*backup.Size)), restoreStatus) + } + err := table.Display(p) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + } +} diff --git a/internal/cmd/mongodbflex/backup/list/list_test.go b/internal/cmd/mongodbflex/backup/list/list_test.go new file mode 100644 index 000000000..82de1efca --- /dev/null +++ b/internal/cmd/mongodbflex/backup/list/list_test.go @@ -0,0 +1,209 @@ +package list + +import ( + "context" + "testing" + + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + "github.com/stackitcloud/stackit-cli/internal/pkg/utils" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" +) + +var projectIdFlag = globalflags.ProjectIdFlag + +type testCtxKey struct{} + +var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") +var testClient = &mongodbflex.APIClient{} +var testProjectId = uuid.NewString() +var testInstanceId = uuid.NewString() + +func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string { + flagValues := map[string]string{ + projectIdFlag: testProjectId, + instanceIdFlag: testInstanceId, + limitFlag: "10", + } + for _, mod := range mods { + mod(flagValues) + } + return flagValues +} + +func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { + model := &inputModel{ + GlobalFlagModel: &globalflags.GlobalFlagModel{ + ProjectId: testProjectId, + Verbosity: globalflags.VerbosityDefault, + }, + InstanceId: utils.Ptr(testInstanceId), + Limit: utils.Ptr(int64(10)), + } + for _, mod := range mods { + mod(model) + } + return model +} + +func fixtureRequest(mods ...func(request *mongodbflex.ApiListBackupsRequest)) mongodbflex.ApiListBackupsRequest { + request := testClient.ListBackups(testCtx, testProjectId, testInstanceId) + for _, mod := range mods { + mod(&request) + } + return request +} + +func TestParseInput(t *testing.T) { + tests := []struct { + description string + flagValues map[string]string + isValid bool + expectedModel *inputModel + }{ + { + description: "base", + flagValues: fixtureFlagValues(), + isValid: true, + expectedModel: fixtureInputModel(), + }, + { + description: "no values", + flagValues: map[string]string{}, + isValid: false, + }, + { + description: "project id missing", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, projectIdFlag) + }), + isValid: false, + }, + { + description: "project id invalid 1", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "" + }), + isValid: false, + }, + { + description: "project id invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "instance id missing", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, instanceIdFlag) + }), + isValid: false, + }, + { + description: "instance id invalid 1", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "" + }), + isValid: false, + }, + { + description: "instance id invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "limit invalid", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[limitFlag] = "invalid" + }), + isValid: false, + }, + { + description: "limit invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[limitFlag] = "0" + }), + isValid: false, + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + p := print.NewPrinter() + cmd := NewCmd(p) + err := globalflags.Configure(cmd.Flags()) + if err != nil { + t.Fatalf("configure global flags: %v", err) + } + + for flag, value := range tt.flagValues { + err := cmd.Flags().Set(flag, value) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("setting flag --%s=%s: %v", flag, value, err) + } + } + + err = cmd.ValidateRequiredFlags() + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error validating flags: %v", err) + } + + model, err := parseInput(p, cmd) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error parsing input: %v", err) + } + + if !tt.isValid { + t.Fatalf("did not fail on invalid input") + } + diff := cmp.Diff(model, tt.expectedModel) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} + +func TestBuildRequest(t *testing.T) { + tests := []struct { + description string + model *inputModel + expectedRequest mongodbflex.ApiListBackupsRequest + }{ + { + description: "base", + model: fixtureInputModel(), + expectedRequest: fixtureRequest(), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + request := buildRequest(testCtx, tt.model, testClient) + + diff := cmp.Diff(request, tt.expectedRequest, + cmp.AllowUnexported(tt.expectedRequest), + cmpopts.EquateComparable(testCtx), + ) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} diff --git a/internal/cmd/mongodbflex/backup/restore-jobs/restore_jobs.go b/internal/cmd/mongodbflex/backup/restore-jobs/restore_jobs.go new file mode 100644 index 000000000..5d5d0cad8 --- /dev/null +++ b/internal/cmd/mongodbflex/backup/restore-jobs/restore_jobs.go @@ -0,0 +1,174 @@ +package restorejobs + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/goccy/go-yaml" + "github.com/stackitcloud/stackit-cli/internal/pkg/args" + "github.com/stackitcloud/stackit-cli/internal/pkg/errors" + "github.com/stackitcloud/stackit-cli/internal/pkg/examples" + "github.com/stackitcloud/stackit-cli/internal/pkg/flags" + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/client" + mongodbflexUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils" + "github.com/stackitcloud/stackit-cli/internal/pkg/tables" + + "github.com/spf13/cobra" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" +) + +const ( + instanceIdFlag = "instance-id" + limitFlag = "limit" +) + +type inputModel struct { + *globalflags.GlobalFlagModel + + InstanceId *string + Limit *int64 +} + +func NewCmd(p *print.Printer) *cobra.Command { + cmd := &cobra.Command{ + Use: "restore-jobs", + Short: "Lists all restore jobs which have been run for a MongoDB Flex instance", + Long: "Lists all restore jobs which have been run for a MongoDB Flex instance.", + Example: examples.Build( + examples.NewExample( + `List all restore jobs of instance with ID "xxx"`, + "$ stackit mongodbflex backup restore-jobs --instance-id xxx"), + examples.NewExample( + `List all restore jobs of instance with ID "xxx" in JSON format`, + "$ stackit mongodbflex backup restore-jobs --instance-id xxx --output-format json"), + examples.NewExample( + `List up to 10 restore jobs of instance with ID "xxx"`, + "$ stackit mongodbflex backup restore-jobs --instance-id xxx --limit 10"), + ), + Args: args.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + ctx := context.Background() + model, err := parseInput(p, cmd) + if err != nil { + return err + } + + // Configure API client + apiClient, err := client.ConfigureClient(p) + if err != nil { + return err + } + + instanceLabel, err := mongodbflexUtils.GetInstanceName(ctx, apiClient, model.ProjectId, *model.InstanceId) + if err != nil { + p.Debug(print.ErrorLevel, "get instance name: %v", err) + instanceLabel = *model.InstanceId + } + + // Call API + req := buildRequest(ctx, model, apiClient) + resp, err := req.Execute() + if err != nil { + return fmt.Errorf("get restore jobs for MongoDB Flex instance %q: %w", instanceLabel, err) + } + if resp.Items == nil || len(*resp.Items) == 0 { + cmd.Printf("No restore jobs found for instance %q\n", instanceLabel) + return nil + } + restoreJobs := *resp.Items + + // Truncate output + if model.Limit != nil && len(restoreJobs) > int(*model.Limit) { + restoreJobs = restoreJobs[:*model.Limit] + } + + return outputResult(p, model.OutputFormat, restoreJobs) + }, + } + + configureFlags(cmd) + return cmd +} + +func configureFlags(cmd *cobra.Command) { + cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") + cmd.Flags().Int64(limitFlag, 0, "Maximum number of entries to list") + + err := flags.MarkFlagsRequired(cmd, instanceIdFlag) + cobra.CheckErr(err) +} + +func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) { + globalFlags := globalflags.Parse(p, cmd) + if globalFlags.ProjectId == "" { + return nil, &errors.ProjectIdError{} + } + + limit := flags.FlagToInt64Pointer(p, cmd, limitFlag) + if limit != nil && *limit < 1 { + return nil, &errors.FlagValidationError{ + Flag: limitFlag, + Details: "must be greater than 0", + } + } + + model := inputModel{ + GlobalFlagModel: globalFlags, + InstanceId: flags.FlagToStringPointer(p, cmd, instanceIdFlag), + Limit: flags.FlagToInt64Pointer(p, cmd, limitFlag), + } + + if p.IsVerbosityDebug() { + modelStr, err := print.BuildDebugStrFromInputModel(model) + if err != nil { + p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err) + } else { + p.Debug(print.DebugLevel, "parsed input values: %s", modelStr) + } + } + + return &model, nil +} + +func buildRequest(ctx context.Context, model *inputModel, apiClient *mongodbflex.APIClient) mongodbflex.ApiListRestoreJobsRequest { + req := apiClient.ListRestoreJobs(ctx, model.ProjectId, *model.InstanceId) + return req +} + +func outputResult(p *print.Printer, outputFormat string, restoreJobs []mongodbflex.RestoreInstanceStatus) error { + switch outputFormat { + case print.JSONOutputFormat: + details, err := json.MarshalIndent(restoreJobs, "", " ") + if err != nil { + return fmt.Errorf("marshal MongoDB Flex restore jobs list: %w", err) + } + p.Outputln(string(details)) + + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(restoreJobs, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDB Flex restore jobs list: %w", err) + } + p.Outputln(string(details)) + + return nil + default: + table := tables.NewTable() + table.SetHeader("ID", "BACKUP ID", "BACKUP INSTANCE ID", "DATE", "STATUS") + for i := range restoreJobs { + restoreJob := restoreJobs[i] + + table.AddRow(*restoreJob.Id, *restoreJob.BackupID, *restoreJob.InstanceId, *restoreJob.Date, *restoreJob.Status) + } + err := table.Display(p) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + } +} diff --git a/internal/cmd/mongodbflex/backup/restore-jobs/restore_jobs_test.go b/internal/cmd/mongodbflex/backup/restore-jobs/restore_jobs_test.go new file mode 100644 index 000000000..c7c5ec84a --- /dev/null +++ b/internal/cmd/mongodbflex/backup/restore-jobs/restore_jobs_test.go @@ -0,0 +1,209 @@ +package restorejobs + +import ( + "context" + "testing" + + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + "github.com/stackitcloud/stackit-cli/internal/pkg/utils" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" +) + +var projectIdFlag = globalflags.ProjectIdFlag + +type testCtxKey struct{} + +var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") +var testClient = &mongodbflex.APIClient{} +var testProjectId = uuid.NewString() +var testInstanceId = uuid.NewString() + +func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string { + flagValues := map[string]string{ + projectIdFlag: testProjectId, + instanceIdFlag: testInstanceId, + limitFlag: "10", + } + for _, mod := range mods { + mod(flagValues) + } + return flagValues +} + +func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { + model := &inputModel{ + GlobalFlagModel: &globalflags.GlobalFlagModel{ + ProjectId: testProjectId, + Verbosity: globalflags.VerbosityDefault, + }, + InstanceId: utils.Ptr(testInstanceId), + Limit: utils.Ptr(int64(10)), + } + for _, mod := range mods { + mod(model) + } + return model +} + +func fixtureRequest(mods ...func(request *mongodbflex.ApiListRestoreJobsRequest)) mongodbflex.ApiListRestoreJobsRequest { + request := testClient.ListRestoreJobs(testCtx, testProjectId, testInstanceId) + for _, mod := range mods { + mod(&request) + } + return request +} + +func TestParseInput(t *testing.T) { + tests := []struct { + description string + flagValues map[string]string + isValid bool + expectedModel *inputModel + }{ + { + description: "base", + flagValues: fixtureFlagValues(), + isValid: true, + expectedModel: fixtureInputModel(), + }, + { + description: "no values", + flagValues: map[string]string{}, + isValid: false, + }, + { + description: "project id missing", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, projectIdFlag) + }), + isValid: false, + }, + { + description: "project id invalid 1", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "" + }), + isValid: false, + }, + { + description: "project id invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "instance id missing", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, instanceIdFlag) + }), + isValid: false, + }, + { + description: "instance id invalid 1", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "" + }), + isValid: false, + }, + { + description: "instance id invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "limit invalid", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[limitFlag] = "invalid" + }), + isValid: false, + }, + { + description: "limit invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[limitFlag] = "0" + }), + isValid: false, + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + p := print.NewPrinter() + cmd := NewCmd(p) + err := globalflags.Configure(cmd.Flags()) + if err != nil { + t.Fatalf("configure global flags: %v", err) + } + + for flag, value := range tt.flagValues { + err := cmd.Flags().Set(flag, value) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("setting flag --%s=%s: %v", flag, value, err) + } + } + + err = cmd.ValidateRequiredFlags() + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error validating flags: %v", err) + } + + model, err := parseInput(p, cmd) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error parsing input: %v", err) + } + + if !tt.isValid { + t.Fatalf("did not fail on invalid input") + } + diff := cmp.Diff(model, tt.expectedModel) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} + +func TestBuildRequest(t *testing.T) { + tests := []struct { + description string + model *inputModel + expectedRequest mongodbflex.ApiListRestoreJobsRequest + }{ + { + description: "base", + model: fixtureInputModel(), + expectedRequest: fixtureRequest(), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + request := buildRequest(testCtx, tt.model, testClient) + + diff := cmp.Diff(request, tt.expectedRequest, + cmp.AllowUnexported(tt.expectedRequest), + cmpopts.EquateComparable(testCtx), + ) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} diff --git a/internal/cmd/mongodbflex/backup/restore/restore.go b/internal/cmd/mongodbflex/backup/restore/restore.go new file mode 100644 index 000000000..c043e4292 --- /dev/null +++ b/internal/cmd/mongodbflex/backup/restore/restore.go @@ -0,0 +1,205 @@ +package restore + +import ( + "context" + "fmt" + + "github.com/stackitcloud/stackit-cli/internal/pkg/args" + cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" + "github.com/stackitcloud/stackit-cli/internal/pkg/examples" + "github.com/stackitcloud/stackit-cli/internal/pkg/flags" + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/client" + mongodbUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils" + "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" + + "github.com/spf13/cobra" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex/wait" +) + +const ( + instanceIdFlag = "instance-id" + backupInstanceIdFlag = "backup-instance-id" + backupIdFlag = "backup-id" + timestampFlag = "timestamp" +) + +type inputModel struct { + *globalflags.GlobalFlagModel + InstanceId string + BackupInstanceId string + BackupId string + Timestamp string +} + +func NewCmd(p *print.Printer) *cobra.Command { + cmd := &cobra.Command{ + Use: "restore", + Short: "Restores a MongoDB Flex instance from a backup", + Long: fmt.Sprintf("%s\n%s\n%s", + "Restores a MongoDB Flex instance from a backup of an instance or clones a MongoDB Flex instance from a point-in-time snapshot.", + "The backup is specified by a backup ID and the point-in-time snapshot is specified by a timestamp.", + "You can specify the instance to which the backup will be applied. If not specified, the backup will be applied to the same instance from which it was taken.", + ), + Args: args.NoArgs, + Example: examples.Build( + examples.NewExample( + `Restore a MongoDB Flex instance with ID "yyy" using backup with ID "zzz"`, + `$ stackit mongodbflex backup restore --instance-id yyy --backup-id zzz`), + examples.NewExample( + `Clone a MongoDB Flex instance with ID "yyy" via point-in-time restore to timestamp "2024-05-14T14:31:48Z"`, + `$ stackit mongodbflex backup restore --instance-id yyy --timestamp 2024-05-14T14:31:48Z`), + examples.NewExample( + `Restore a MongoDB Flex instance with ID "yyy", using backup from instance with ID "zzz" with backup ID "xxx"`, + `$ stackit mongodbflex backup restore --instance-id zzz --backup-instance-id yyy --backup-id xxx`), + ), + RunE: func(cmd *cobra.Command, args []string) error { + ctx := context.Background() + + model, err := parseInput(p, cmd) + if err != nil { + return err + } + + // Configure API client + apiClient, err := client.ConfigureClient(p) + if err != nil { + return err + } + + instanceLabel, err := mongodbUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.InstanceId) + if err != nil { + p.Debug(print.ErrorLevel, "get instance name: %v", err) + instanceLabel = model.ProjectId + } + + if !model.AssumeYes { + prompt := fmt.Sprintf("Are you sure you want to restore MongoDB Flex instance %q?", instanceLabel) + err = p.PromptForConfirmation(prompt) + if err != nil { + return err + } + } + + // If backupInstanceId is not provided, the target is the same instance as the backup + if model.BackupInstanceId == "" { + model.BackupInstanceId = model.InstanceId + } + + isRestoreOperation := getIsRestoreOperation(model.BackupId, model.Timestamp) + + // If backupId is provided, restore the instance from the backup with the backupId + if isRestoreOperation { + req := buildRestoreRequest(ctx, model, apiClient) + _, err = req.Execute() + if err != nil { + return fmt.Errorf("restore MongoDB Flex instance: %w", err) + } + + if !model.Async { + s := spinner.New(p) + s.Start("Restoring instance") + _, err = wait.RestoreInstanceWaitHandler(ctx, apiClient, model.ProjectId, model.InstanceId, model.BackupId).WaitWithContext(ctx) + if err != nil { + return fmt.Errorf("wait for MongoDB Flex instance restoration: %w", err) + } + s.Stop() + } + + p.Outputf("Restored instance %q with backup %q\n", model.InstanceId, model.BackupId) + return nil + } + + // Else, if timestamp is provided, clone the instance from a point-in-time snapshot + req := buildCloneRequest(ctx, model, apiClient) + _, err = req.Execute() + if err != nil { + return fmt.Errorf("clone MongoDB Flex instance: %w", err) + } + + if !model.Async { + s := spinner.New(p) + s.Start("Cloning instance") + _, err = wait.CloneInstanceWaitHandler(ctx, apiClient, model.ProjectId, model.InstanceId).WaitWithContext(ctx) + if err != nil { + return fmt.Errorf("wait for MongoDB Flex instance cloning: %w", err) + } + s.Stop() + } + + p.Outputf("Cloned instance %q from backup with timestamp %q\n", model.InstanceId, model.Timestamp) + return nil + }, + } + configureFlags(cmd) + return cmd +} + +func configureFlags(cmd *cobra.Command) { + cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") + cmd.Flags().Var(flags.UUIDFlag(), backupInstanceIdFlag, "Instance ID of the target instance to restore the backup to") + cmd.Flags().String(backupIdFlag, "", "Backup ID") + cmd.Flags().String(timestampFlag, "", "Timestamp of the snapshot to use as a source for cloning the instance in a date-time with the RFC3339 layout format, e.g. 2024-01-01T00:00:00Z") + + err := flags.MarkFlagsRequired(cmd, instanceIdFlag) + cobra.CheckErr(err) +} + +func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) { + globalFlags := globalflags.Parse(p, cmd) + if globalFlags.ProjectId == "" { + return nil, &cliErr.ProjectIdError{} + } + + backupId := flags.FlagToStringValue(p, cmd, backupIdFlag) + timestamp := flags.FlagToStringValue(p, cmd, timestampFlag) + + if backupId != "" && timestamp != "" || backupId == "" && timestamp == "" { + return nil, &cliErr.RequiredMutuallyExclusiveFlagsError{ + Flags: []string{backupIdFlag, timestampFlag}, + } + } + + model := inputModel{ + GlobalFlagModel: globalFlags, + InstanceId: flags.FlagToStringValue(p, cmd, instanceIdFlag), + BackupInstanceId: flags.FlagToStringValue(p, cmd, backupInstanceIdFlag), + BackupId: flags.FlagToStringValue(p, cmd, backupIdFlag), + Timestamp: flags.FlagToStringValue(p, cmd, timestampFlag), + } + + if p.IsVerbosityDebug() { + modelStr, err := print.BuildDebugStrFromInputModel(model) + if err != nil { + p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err) + } else { + p.Debug(print.DebugLevel, "parsed input values: %s", modelStr) + } + } + + return &model, nil +} + +func buildRestoreRequest(ctx context.Context, model *inputModel, apiClient *mongodbflex.APIClient) mongodbflex.ApiRestoreInstanceRequest { + req := apiClient.RestoreInstance(ctx, model.ProjectId, model.InstanceId) + req = req.RestoreInstancePayload(mongodbflex.RestoreInstancePayload{ + BackupId: &model.BackupId, + InstanceId: &model.BackupInstanceId, + }) + return req +} + +func buildCloneRequest(ctx context.Context, model *inputModel, apiClient *mongodbflex.APIClient) mongodbflex.ApiCloneInstanceRequest { + req := apiClient.CloneInstance(ctx, model.ProjectId, model.InstanceId) + req = req.CloneInstancePayload(mongodbflex.CloneInstancePayload{ + Timestamp: &model.Timestamp, + InstanceId: &model.BackupInstanceId, + }) + return req +} + +func getIsRestoreOperation(backupId, timestamp string) bool { + return backupId != "" && timestamp == "" +} diff --git a/internal/cmd/mongodbflex/backup/restore/restore_test.go b/internal/cmd/mongodbflex/backup/restore/restore_test.go new file mode 100644 index 000000000..63e06d9af --- /dev/null +++ b/internal/cmd/mongodbflex/backup/restore/restore_test.go @@ -0,0 +1,310 @@ +package restore + +import ( + "context" + "testing" + + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + "github.com/stackitcloud/stackit-cli/internal/pkg/utils" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" +) + +var projectIdFlag = globalflags.ProjectIdFlag + +type testCtxKey struct{} + +const ( + testBackupId = "backupID" + testTimestamp = "2021-01-01T00:00:00Z" +) + +var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") +var testClient = &mongodbflex.APIClient{} + +var testProjectId = uuid.NewString() +var testInstanceId = uuid.NewString() +var testBackupInstanceId = uuid.NewString() + +func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string { + flagValues := map[string]string{ + projectIdFlag: testProjectId, + backupIdFlag: testBackupId, + backupInstanceIdFlag: testBackupInstanceId, + instanceIdFlag: testInstanceId, + } + for _, mod := range mods { + mod(flagValues) + } + return flagValues +} + +func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { + model := &inputModel{ + GlobalFlagModel: &globalflags.GlobalFlagModel{ + ProjectId: testProjectId, + Verbosity: globalflags.VerbosityDefault, + }, + InstanceId: testInstanceId, + BackupId: testBackupId, + BackupInstanceId: testBackupInstanceId, + } + for _, mod := range mods { + mod(model) + } + return model +} + +func fixtureRestoreRequest(mods ...func(request mongodbflex.ApiRestoreInstanceRequest)) mongodbflex.ApiRestoreInstanceRequest { + request := testClient.RestoreInstance(testCtx, testProjectId, testInstanceId) + request = request.RestoreInstancePayload(mongodbflex.RestoreInstancePayload{ + BackupId: utils.Ptr(testBackupId), + InstanceId: utils.Ptr(testBackupInstanceId), + }) + for _, mod := range mods { + mod(request) + } + return request +} + +func fixtureCloneRequest(mods ...func(request mongodbflex.ApiCloneInstanceRequest)) mongodbflex.ApiCloneInstanceRequest { + request := testClient.CloneInstance(testCtx, testProjectId, testInstanceId) + request = request.CloneInstancePayload(mongodbflex.CloneInstancePayload{ + Timestamp: utils.Ptr(testTimestamp), + InstanceId: utils.Ptr(testBackupInstanceId), + }) + for _, mod := range mods { + mod(request) + } + return request +} + +func TestParseInput(t *testing.T) { + tests := []struct { + description string + flagValues map[string]string + aclValues []string + isValid bool + expectedModel *inputModel + }{ + { + description: "no values", + flagValues: map[string]string{}, + isValid: false, + }, + { + description: "base", + flagValues: fixtureFlagValues(), + isValid: true, + expectedModel: fixtureInputModel(), + }, + { + description: "project id missing", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, projectIdFlag) + }), + isValid: false, + }, + { + description: "project id invalid 1", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "" + }), + isValid: false, + }, + { + description: "project id invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "instance id invalid 1", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "" + }), + isValid: false, + }, + { + description: "instance id invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "backup instance id invalid 1", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[backupInstanceIdFlag] = "" + }), + isValid: false, + }, + { + description: "backup instance id invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[backupInstanceIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "timestamp and backup id both provided", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[timestampFlag] = testTimestamp + }), + isValid: false, + }, + { + description: "timestamp and backup id missing", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, backupIdFlag) + }), + isValid: false, + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + p := print.NewPrinter() + cmd := NewCmd(p) + err := globalflags.Configure(cmd.Flags()) + if err != nil { + t.Fatalf("configure global flags: %v", err) + } + + for flag, value := range tt.flagValues { + err := cmd.Flags().Set(flag, value) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("setting flag --%s=%s: %v", flag, value, err) + } + } + + err = cmd.ValidateRequiredFlags() + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error validating flags: %v", err) + } + + err = cmd.ValidateFlagGroups() + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error validating flag groups: %v", err) + } + + model, err := parseInput(p, cmd) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error parsing flags: %v", err) + } + + if !tt.isValid { + t.Fatalf("did not fail on invalid input") + } + diff := cmp.Diff(model, tt.expectedModel) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} + +func TestBuildRestoreRequest(t *testing.T) { + tests := []struct { + description string + model *inputModel + expectedRequest mongodbflex.ApiRestoreInstanceRequest + }{ + { + description: "base", + model: fixtureInputModel(), + expectedRequest: fixtureRestoreRequest(), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + request := buildRestoreRequest(testCtx, tt.model, testClient) + + diff := cmp.Diff(request, tt.expectedRequest, + cmp.AllowUnexported(tt.expectedRequest), + cmpopts.EquateComparable(testCtx)) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} + +func TestBuildCloneRequest(t *testing.T) { + tests := []struct { + description string + model *inputModel + expectedRequest mongodbflex.ApiCloneInstanceRequest + }{ + { + description: "base", + model: fixtureInputModel(func(model *inputModel) { + model.BackupId = "" + model.Timestamp = testTimestamp + }), + expectedRequest: fixtureCloneRequest(), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + request := buildCloneRequest(testCtx, tt.model, testClient) + + diff := cmp.Diff(request, tt.expectedRequest, + cmp.AllowUnexported(tt.expectedRequest), + cmpopts.EquateComparable(testCtx)) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} + +func TestGetIsRestoreOperation(t *testing.T) { + tests := []struct { + description string + model *inputModel + expected bool + }{ + { + description: "true", + model: fixtureInputModel(), + expected: true, + }, + { + description: "false", + model: fixtureInputModel(func(model *inputModel) { + model.BackupId = "" + model.Timestamp = testTimestamp + }), + expected: false, + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + result := getIsRestoreOperation(tt.model.BackupId, tt.model.Timestamp) + if result != tt.expected { + t.Fatalf("Data does not match: %t", result) + } + }) + } +} diff --git a/internal/cmd/mongodbflex/backup/schedule/schedule.go b/internal/cmd/mongodbflex/backup/schedule/schedule.go new file mode 100644 index 000000000..ffd84ca3e --- /dev/null +++ b/internal/cmd/mongodbflex/backup/schedule/schedule.go @@ -0,0 +1,161 @@ +package schedule + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/goccy/go-yaml" + "github.com/stackitcloud/stackit-cli/internal/pkg/args" + "github.com/stackitcloud/stackit-cli/internal/pkg/errors" + "github.com/stackitcloud/stackit-cli/internal/pkg/examples" + "github.com/stackitcloud/stackit-cli/internal/pkg/flags" + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/client" + "github.com/stackitcloud/stackit-cli/internal/pkg/tables" + + "github.com/spf13/cobra" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" +) + +const ( + instanceIdFlag = "instance-id" +) + +type inputModel struct { + *globalflags.GlobalFlagModel + InstanceId string +} + +func NewCmd(p *print.Printer) *cobra.Command { + cmd := &cobra.Command{ + Use: "schedule", + Short: "Shows details of the backup schedule and retention policy of a MongoDB Flex instance", + Long: "Shows details of the backup schedule and retention policy of a MongoDB Flex instance.", + Args: args.NoArgs, + Example: examples.Build( + examples.NewExample( + `Get details of the backup schedule of a MongoDB Flex instance with ID "xxx"`, + "$ stackit mongodbflex backup schedule --instance-id xxx"), + examples.NewExample( + `Get details of the backup schedule of a MongoDB Flex instance with ID "xxx" in JSON format`, + "$ stackit mongodbflex backup schedule --instance-id xxx --output-format json"), + ), + RunE: func(cmd *cobra.Command, args []string) error { + ctx := context.Background() + model, err := parseInput(p, cmd) + if err != nil { + return err + } + // Configure API client + apiClient, err := client.ConfigureClient(p) + if err != nil { + return err + } + + // Call API + req := buildRequest(ctx, model, apiClient) + resp, err := req.Execute() + if err != nil { + return fmt.Errorf("read MongoDB Flex instance: %w", err) + } + + return outputResult(p, model.OutputFormat, resp.Item) + }, + } + configureFlags(cmd) + return cmd +} + +func configureFlags(cmd *cobra.Command) { + cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") + + err := flags.MarkFlagsRequired(cmd, instanceIdFlag) + cobra.CheckErr(err) +} + +func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) { + globalFlags := globalflags.Parse(p, cmd) + if globalFlags.ProjectId == "" { + return nil, &errors.ProjectIdError{} + } + + model := inputModel{ + GlobalFlagModel: globalFlags, + InstanceId: *flags.FlagToStringPointer(p, cmd, instanceIdFlag), + } + + if p.IsVerbosityDebug() { + modelStr, err := print.BuildDebugStrFromInputModel(model) + if err != nil { + p.Debug(print.ErrorLevel, "convert model to string for debugging: %v", err) + } else { + p.Debug(print.DebugLevel, "parsed input values: %s", modelStr) + } + } + + return &model, nil +} + +func buildRequest(ctx context.Context, model *inputModel, apiClient *mongodbflex.APIClient) mongodbflex.ApiGetInstanceRequest { + req := apiClient.GetInstance(ctx, model.ProjectId, model.InstanceId) + return req +} + +func outputResult(p *print.Printer, outputFormat string, instance *mongodbflex.Instance) error { + output := struct { + BackupSchedule string `json:"backup_schedule"` + DailySnaphotRetentionDays string `json:"daily_snapshot_retention_days"` + MonthlySnapshotRetentionMonths string `json:"monthly_snapshot_retention_months"` + PointInTimeWindowHours string `json:"point_in_time_window_hours"` + SnapshotRetentionDays string `json:"snapshot_retention_days"` + WeeklySnapshotRetentionWeeks string `json:"weekly_snapshot_retention_weeks"` + }{ + BackupSchedule: *instance.BackupSchedule, + DailySnaphotRetentionDays: (*instance.Options)["dailySnapshotRetentionDays"], + MonthlySnapshotRetentionMonths: (*instance.Options)["monthlySnapshotRetentionDays"], + PointInTimeWindowHours: (*instance.Options)["pointInTimeWindowHours"], + SnapshotRetentionDays: (*instance.Options)["snapshotRetentionDays"], + WeeklySnapshotRetentionWeeks: (*instance.Options)["weeklySnapshotRetentionWeeks"], + } + + switch outputFormat { + case print.JSONOutputFormat: + details, err := json.MarshalIndent(output, "", " ") + if err != nil { + return fmt.Errorf("marshal MongoDB Flex backup schedule: %w", err) + } + p.Outputln(string(details)) + + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(output, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDB Flex backup schedule: %w", err) + } + p.Outputln(string(details)) + + return nil + default: + table := tables.NewTable() + table.AddRow("BACKUP SCHEDULE", *instance.BackupSchedule) + table.AddSeparator() + table.AddRow("DAILY SNAPSHOT RETENTION (DAYS)", (*instance.Options)["dailySnapshotRetentionDays"]) + table.AddSeparator() + table.AddRow("MONTHLY SNAPSHOT RETENTION (MONTHS)", (*instance.Options)["monthlySnapshotRetentionMonths"]) + table.AddSeparator() + table.AddRow("POINT IN TIME WINDOW (HOURS)", (*instance.Options)["pointInTimeWindowHours"]) + table.AddSeparator() + table.AddRow("SNAPSHOT RETENTION (DAYS)", (*instance.Options)["snapshotRetentionDays"]) + table.AddSeparator() + table.AddRow("WEEKLY SNAPSHOT RETENTION (WEEKS)", (*instance.Options)["weeklySnapshotRetentionWeeks"]) + table.AddSeparator() + err := table.Display(p) + if err != nil { + return fmt.Errorf("render table: %w", err) + } + + return nil + } +} diff --git a/internal/cmd/mongodbflex/backup/schedule/schedule_test.go b/internal/cmd/mongodbflex/backup/schedule/schedule_test.go new file mode 100644 index 000000000..e25957058 --- /dev/null +++ b/internal/cmd/mongodbflex/backup/schedule/schedule_test.go @@ -0,0 +1,195 @@ +package schedule + +import ( + "context" + "testing" + + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/google/uuid" + "github.com/spf13/cobra" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" +) + +var projectIdFlag = globalflags.ProjectIdFlag + +type testCtxKey struct{} + +var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") +var testClient = &mongodbflex.APIClient{} +var testProjectId = uuid.NewString() +var testInstanceId = uuid.NewString() + +func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string { + flagValues := map[string]string{ + projectIdFlag: testProjectId, + instanceIdFlag: testInstanceId, + } + for _, mod := range mods { + mod(flagValues) + } + return flagValues +} + +func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { + model := &inputModel{ + GlobalFlagModel: &globalflags.GlobalFlagModel{ + ProjectId: testProjectId, + Verbosity: globalflags.VerbosityDefault, + }, + InstanceId: testInstanceId, + } + for _, mod := range mods { + mod(model) + } + return model +} + +func fixtureRequest(mods ...func(request *mongodbflex.ApiGetInstanceRequest)) mongodbflex.ApiGetInstanceRequest { + request := testClient.GetInstance(testCtx, testProjectId, testInstanceId) + for _, mod := range mods { + mod(&request) + } + return request +} + +func TestParseInput(t *testing.T) { + tests := []struct { + description string + flagValues map[string]string + isValid bool + expectedModel *inputModel + }{ + { + description: "base", + flagValues: fixtureFlagValues(), + isValid: true, + expectedModel: fixtureInputModel(), + }, + { + description: "no values", + flagValues: map[string]string{}, + isValid: false, + }, + { + description: "project id missing", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, projectIdFlag) + }), + isValid: false, + }, + { + description: "project id invalid 1", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "" + }), + isValid: false, + }, + { + description: "project id invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "instance id missing", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, instanceIdFlag) + }), + isValid: false, + }, + { + description: "instance id invalid 1", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "" + }), + isValid: false, + }, + { + description: "instance id invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + cmd := &cobra.Command{} + err := globalflags.Configure(cmd.Flags()) + if err != nil { + t.Fatalf("configure global flags: %v", err) + } + + configureFlags(cmd) + + for flag, value := range tt.flagValues { + err := cmd.Flags().Set(flag, value) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("setting flag --%s=%s: %v", flag, value, err) + } + } + + err = cmd.ValidateRequiredFlags() + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error validating flags: %v", err) + } + + p := print.NewPrinter() + model, err := parseInput(p, cmd) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error parsing flags: %v", err) + } + + if !tt.isValid { + t.Fatalf("did not fail on invalid input") + } + diff := cmp.Diff(model, tt.expectedModel) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} + +func TestBuildRequest(t *testing.T) { + tests := []struct { + description string + model *inputModel + expectedRequest mongodbflex.ApiGetInstanceRequest + }{ + { + description: "base", + model: fixtureInputModel(), + expectedRequest: fixtureRequest(), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + request := buildRequest(testCtx, tt.model, testClient) + + diff := cmp.Diff(request, tt.expectedRequest, + cmp.AllowUnexported(tt.expectedRequest), + cmpopts.EquateComparable(testCtx), + ) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} diff --git a/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go new file mode 100644 index 000000000..cf296ea92 --- /dev/null +++ b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go @@ -0,0 +1,233 @@ +package updateschedule + +import ( + "context" + "fmt" + "strconv" + + "github.com/spf13/cobra" + "github.com/stackitcloud/stackit-cli/internal/pkg/args" + cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" + "github.com/stackitcloud/stackit-cli/internal/pkg/examples" + "github.com/stackitcloud/stackit-cli/internal/pkg/flags" + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/client" + mongoDBflexUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils" + "github.com/stackitcloud/stackit-cli/internal/pkg/utils" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" +) + +const ( + instanceIdFlag = "instance-id" + scheduleFlag = "schedule" + snapshotRetentionDaysFlag = "save-snapshot-days" + dailySnapshotRetentionDaysFlag = "save-daily-snapshot-days" + weeklySnapshotRetentionWeeksFlag = "save-weekly-snapshot-weeks" + monthlySnapshotRetentionMonthsFlag = "save-monthly-snapshot-months" + + // Default values for the backup schedule options + defaultBackupSchedule = "0 0/6 * * *" + defaultSnapshotRetentionDays int64 = 3 + defaultDailySnapshotRetentionDays int64 = 0 + defaultWeeklySnapshotRetentionWeeks int64 = 3 + defaultMonthlySnapshotRetentionMonths int64 = 1 + defaultPointInTimeWindowHours int64 = 30 +) + +type inputModel struct { + *globalflags.GlobalFlagModel + + InstanceId *string + BackupSchedule *string + SnapshotRetentionDays *int64 + DailySnaphotRetentionDays *int64 + WeeklySnapshotRetentionWeeks *int64 + MonthlySnapshotRetentionMonths *int64 +} + +func NewCmd(p *print.Printer) *cobra.Command { + cmd := &cobra.Command{ + Use: "update-schedule", + Short: "Updates the backup schedule and retention policy for a MongoDB Flex instance", + Long: fmt.Sprintf("%s\n%s\n%s\n%s", + "Updates the backup schedule and retention policy for a MongoDB Flex instance.", + `The current backup schedule and retention policy can be seen in the output of the "stackit mongodbflex backup schedule" command.`, + "The backup schedule is defined in the cron scheduling system format e.g. '0 0 * * *'.", + "See below for more detail on the retention policy options.", + ), + Args: args.NoArgs, + Example: examples.Build( + examples.NewExample( + `Update the backup schedule of a MongoDB Flex instance with ID "xxx"`, + "$ stackit mongodbflex backup update-schedule --instance-id xxx --schedule '6 6 * * *'"), + examples.NewExample( + `Update the retention days for snapshots of a MongoDB Flex instance with ID "xxx" to 5 days`, + "$ stackit mongodbflex backup update-schedule --instance-id xxx --save-snapshot-days 5"), + ), + + RunE: func(cmd *cobra.Command, args []string) error { + ctx := context.Background() + + model, err := parseInput(p, cmd) + if err != nil { + return err + } + + // Configure API client + apiClient, err := client.ConfigureClient(p) + if err != nil { + return err + } + + instanceLabel, err := mongoDBflexUtils.GetInstanceName(ctx, apiClient, model.ProjectId, *model.InstanceId) + if err != nil { + p.Debug(print.ErrorLevel, "get instance name: %v", err) + instanceLabel = *model.InstanceId + } + + if !model.AssumeYes { + prompt := fmt.Sprintf("Are you sure you want to update backup schedule of instance %q?", instanceLabel) + err = p.PromptForConfirmation(prompt) + if err != nil { + return err + } + } + + // Get current instance + getReq := buildGetInstanceRequest(ctx, model, apiClient) + getResp, err := getReq.Execute() + if err != nil { + return fmt.Errorf("get MongoDB Flex instance %q: %w", instanceLabel, err) + } + + instance := getResp.Item + + // Call API + req := buildUpdateBackupScheduleRequest(ctx, model, instance, apiClient) + _, err = req.Execute() + if err != nil { + return fmt.Errorf("update backup schedule of MongoDB Flex instance: %w", err) + } + + cmd.Printf("Updated backup schedule of instance %q\n", instanceLabel) + return nil + }, + } + configureFlags(cmd) + return cmd +} + +func configureFlags(cmd *cobra.Command) { + cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") + cmd.Flags().String(scheduleFlag, "", "Backup schedule, in the cron scheduling system format e.g. '0 0 * * *'") + cmd.Flags().Int64(snapshotRetentionDaysFlag, 0, "Number of days to retain snapshots. Should be less than or equal to the value of the daily backup.") + cmd.Flags().Int64(dailySnapshotRetentionDaysFlag, 0, "Number of days to retain daily snapshots. Should be less than or equal to the number of days of the selected weekly or monthly value.") + cmd.Flags().Int64(weeklySnapshotRetentionWeeksFlag, 0, "Number of weeks to retain weekly snapshots. Should be less than or equal to the number of weeks of the selected monthly value.") + cmd.Flags().Int64(monthlySnapshotRetentionMonthsFlag, 0, "Number of months to retain monthly snapshots") + + err := flags.MarkFlagsRequired(cmd, instanceIdFlag) + cobra.CheckErr(err) +} + +func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) { + globalFlags := globalflags.Parse(p, cmd) + if globalFlags.ProjectId == "" { + return nil, &cliErr.ProjectIdError{} + } + + schedule := flags.FlagToStringPointer(p, cmd, scheduleFlag) + snapshotRetentionDays := flags.FlagToInt64Pointer(p, cmd, snapshotRetentionDaysFlag) + dailySnapshotRetentionDays := flags.FlagToInt64Pointer(p, cmd, dailySnapshotRetentionDaysFlag) + weeklySnapshotRetentionWeeks := flags.FlagToInt64Pointer(p, cmd, weeklySnapshotRetentionWeeksFlag) + monthlySnapshotRetentionMonths := flags.FlagToInt64Pointer(p, cmd, monthlySnapshotRetentionMonthsFlag) + + if schedule == nil && snapshotRetentionDays == nil && dailySnapshotRetentionDays == nil && weeklySnapshotRetentionWeeks == nil && monthlySnapshotRetentionMonths == nil { + return nil, &cliErr.EmptyUpdateError{} + } + + return &inputModel{ + GlobalFlagModel: globalFlags, + InstanceId: flags.FlagToStringPointer(p, cmd, instanceIdFlag), + BackupSchedule: schedule, + DailySnaphotRetentionDays: dailySnapshotRetentionDays, + MonthlySnapshotRetentionMonths: monthlySnapshotRetentionMonths, + SnapshotRetentionDays: snapshotRetentionDays, + WeeklySnapshotRetentionWeeks: weeklySnapshotRetentionWeeks, + }, nil +} + +func buildUpdateBackupScheduleRequest(ctx context.Context, model *inputModel, instance *mongodbflex.Instance, apiClient *mongodbflex.APIClient) mongodbflex.ApiUpdateBackupScheduleRequest { + req := apiClient.UpdateBackupSchedule(ctx, model.ProjectId, *model.InstanceId) + + payload := getUpdateBackupSchedulePayload(instance) + + if model.BackupSchedule != nil { + payload.BackupSchedule = model.BackupSchedule + } + if model.DailySnaphotRetentionDays != nil { + payload.DailySnapshotRetentionDays = model.DailySnaphotRetentionDays + } + if model.MonthlySnapshotRetentionMonths != nil { + payload.MonthlySnapshotRetentionMonths = model.MonthlySnapshotRetentionMonths + } + if model.SnapshotRetentionDays != nil { + payload.SnapshotRetentionDays = model.SnapshotRetentionDays + } + if model.WeeklySnapshotRetentionWeeks != nil { + payload.WeeklySnapshotRetentionWeeks = model.WeeklySnapshotRetentionWeeks + } + + req = req.UpdateBackupSchedulePayload(payload) + return req +} + +// getUpdateBackupSchedulePayload creates a payload for the UpdateBackupSchedule API call +// it will use the values already set in the instance object +// falls back to default values if the values are not set +func getUpdateBackupSchedulePayload(instance *mongodbflex.Instance) mongodbflex.UpdateBackupSchedulePayload { + options := make(map[string]string) + if instance == nil || instance.Options != nil { + options = *instance.Options + } + + backupSchedule := instance.BackupSchedule + if backupSchedule == nil { + backupSchedule = utils.Ptr(defaultBackupSchedule) + } + dailySnapshotRetentionDays, err := strconv.ParseInt(options["dailySnapshotRetentionDays"], 10, 64) + if err != nil { + dailySnapshotRetentionDays = defaultDailySnapshotRetentionDays + } + weeklySnapshotRetentionWeeks, err := strconv.ParseInt(options["weeklySnapshotRetentionWeeks"], 10, 64) + if err != nil { + weeklySnapshotRetentionWeeks = defaultWeeklySnapshotRetentionWeeks + } + monthlySnapshotRetentionMonths, err := strconv.ParseInt(options["monthlySnapshotRetentionMonths"], 10, 64) + if err != nil { + monthlySnapshotRetentionMonths = defaultMonthlySnapshotRetentionMonths + } + pointInTimeWindowHours, err := strconv.ParseInt(options["pointInTimeWindowHours"], 10, 64) + if err != nil { + pointInTimeWindowHours = defaultPointInTimeWindowHours + } + snapshotRetentionDays, err := strconv.ParseInt(options["snapshotRetentionDays"], 10, 64) + if err != nil { + snapshotRetentionDays = defaultSnapshotRetentionDays + } + + defaultPayload := mongodbflex.UpdateBackupSchedulePayload{ + BackupSchedule: backupSchedule, + DailySnapshotRetentionDays: &dailySnapshotRetentionDays, + MonthlySnapshotRetentionMonths: &monthlySnapshotRetentionMonths, + PointInTimeWindowHours: &pointInTimeWindowHours, + SnapshotRetentionDays: &snapshotRetentionDays, + WeeklySnapshotRetentionWeeks: &weeklySnapshotRetentionWeeks, + } + return defaultPayload +} + +func buildGetInstanceRequest(ctx context.Context, model *inputModel, apiClient *mongodbflex.APIClient) mongodbflex.ApiGetInstanceRequest { + req := apiClient.GetInstance(ctx, model.ProjectId, *model.InstanceId) + return req +} diff --git a/internal/cmd/mongodbflex/backup/update-schedule/update_schedule_test.go b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule_test.go new file mode 100644 index 000000000..1f6cc5aa0 --- /dev/null +++ b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule_test.go @@ -0,0 +1,324 @@ +package updateschedule + +import ( + "context" + "testing" + + "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" + "github.com/stackitcloud/stackit-cli/internal/pkg/utils" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" +) + +var projectIdFlag = globalflags.ProjectIdFlag + +type testCtxKey struct{} + +var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") +var testClient = &mongodbflex.APIClient{} +var testProjectId = uuid.NewString() +var testInstanceId = uuid.NewString() +var testSchedule = "0 0/6 * * *" + +func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string { + flagValues := map[string]string{ + projectIdFlag: testProjectId, + scheduleFlag: testSchedule, + instanceIdFlag: testInstanceId, + } + for _, mod := range mods { + mod(flagValues) + } + return flagValues +} + +func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { + model := &inputModel{ + GlobalFlagModel: &globalflags.GlobalFlagModel{ + ProjectId: testProjectId, + Verbosity: globalflags.VerbosityDefault, + }, + InstanceId: utils.Ptr(testInstanceId), + BackupSchedule: &testSchedule, + } + for _, mod := range mods { + mod(model) + } + return model +} + +func fixturePayload(mods ...func(payload *mongodbflex.UpdateBackupSchedulePayload)) mongodbflex.UpdateBackupSchedulePayload { + payload := mongodbflex.UpdateBackupSchedulePayload{ + BackupSchedule: utils.Ptr(testSchedule), + SnapshotRetentionDays: utils.Ptr(int64(3)), + DailySnapshotRetentionDays: utils.Ptr(int64(0)), + WeeklySnapshotRetentionWeeks: utils.Ptr(int64(3)), + MonthlySnapshotRetentionMonths: utils.Ptr(int64(1)), + PointInTimeWindowHours: utils.Ptr(int64(30)), + } + for _, mod := range mods { + mod(&payload) + } + return payload +} + +func fixtureUpdateBackupScheduleRequest(mods ...func(request *mongodbflex.ApiUpdateBackupScheduleRequest)) mongodbflex.ApiUpdateBackupScheduleRequest { + request := testClient.UpdateBackupSchedule(testCtx, testProjectId, testInstanceId) + request = request.UpdateBackupSchedulePayload(fixturePayload()) + for _, mod := range mods { + mod(&request) + } + return request +} + +func fixtureGetInstanceRequest(mods ...func(request *mongodbflex.ApiGetInstanceRequest)) mongodbflex.ApiGetInstanceRequest { + request := testClient.GetInstance(testCtx, testProjectId, testInstanceId) + for _, mod := range mods { + mod(&request) + } + return request +} + +func fixtureInstance(mods ...func(instance *mongodbflex.Instance)) *mongodbflex.Instance { + instance := mongodbflex.Instance{ + BackupSchedule: &testSchedule, + Options: &map[string]string{ + "dailySnapshotRetentionDays": "0", + "weeklySnapshotRetentionWeeks": "3", + "monthlySnapshotRetentionMonths": "1", + "pointInTimeWindowHours": "30", + "snapshotRetentionDays": "3", + }, + } + for _, mod := range mods { + mod(&instance) + } + return &instance +} + +func TestParseInput(t *testing.T) { + tests := []struct { + description string + flagValues map[string]string + aclValues []string + isValid bool + expectedModel *inputModel + }{ + { + description: "base", + flagValues: fixtureFlagValues(), + isValid: true, + expectedModel: fixtureInputModel(), + }, + { + description: "no values", + flagValues: map[string]string{}, + isValid: false, + }, + { + description: "project id missing", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, projectIdFlag) + }), + isValid: false, + }, + { + description: "project id invalid 1", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "" + }), + isValid: false, + }, + { + description: "project id invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[projectIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "instance id missing", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, instanceIdFlag) + }), + isValid: false, + }, + { + description: "instance id invalid 1", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "" + }), + isValid: false, + }, + { + description: "instance id invalid 2", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues[instanceIdFlag] = "invalid-uuid" + }), + isValid: false, + }, + { + description: "backup schedule missing", + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + delete(flagValues, scheduleFlag) + }), + isValid: false, + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + cmd := NewCmd(nil) + err := globalflags.Configure(cmd.Flags()) + if err != nil { + t.Fatalf("configure global flags: %v", err) + } + + for flag, value := range tt.flagValues { + err := cmd.Flags().Set(flag, value) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("setting flag --%s=%s: %v", flag, value, err) + } + } + + err = cmd.ValidateRequiredFlags() + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error validating flags: %v", err) + } + + model, err := parseInput(nil, cmd) + if err != nil { + if !tt.isValid { + return + } + t.Fatalf("error parsing flags: %v", err) + } + + if !tt.isValid { + t.Fatalf("did not fail on invalid input") + } + diff := cmp.Diff(model, tt.expectedModel) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} + +func TestBuildGetInstanceRequest(t *testing.T) { + tests := []struct { + description string + model *inputModel + expectedRequest mongodbflex.ApiGetInstanceRequest + }{ + { + description: "base", + model: fixtureInputModel(), + expectedRequest: fixtureGetInstanceRequest(), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + request := buildGetInstanceRequest(testCtx, tt.model, testClient) + + diff := cmp.Diff(request, tt.expectedRequest, + cmp.AllowUnexported(tt.expectedRequest), + cmpopts.EquateComparable(testCtx), + ) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} + +func TestBuildUpdateBackupScheduleRequest(t *testing.T) { + tests := []struct { + description string + model *inputModel + instance *mongodbflex.Instance + expectedRequest mongodbflex.ApiUpdateBackupScheduleRequest + }{ + { + description: "update backup schedule, read retention policy from instance", + model: fixtureInputModel(), + instance: fixtureInstance(), + expectedRequest: fixtureUpdateBackupScheduleRequest(), + }, + { + description: "update retention policy, read backup schedule from instance", + model: &inputModel{ + GlobalFlagModel: &globalflags.GlobalFlagModel{ + ProjectId: testProjectId, + }, + InstanceId: utils.Ptr(testInstanceId), + DailySnaphotRetentionDays: utils.Ptr(int64(2)), + }, + instance: fixtureInstance(), + expectedRequest: fixtureUpdateBackupScheduleRequest().UpdateBackupSchedulePayload( + fixturePayload(func(payload *mongodbflex.UpdateBackupSchedulePayload) { + payload.DailySnapshotRetentionDays = utils.Ptr(int64(2)) + }), + ), + }, + { + description: "update backup schedule and retention policy", + model: &inputModel{ + GlobalFlagModel: &globalflags.GlobalFlagModel{ + ProjectId: testProjectId, + }, + InstanceId: utils.Ptr(testInstanceId), + BackupSchedule: utils.Ptr("0 0/6 5 2 1"), + DailySnaphotRetentionDays: utils.Ptr(int64(2)), + WeeklySnapshotRetentionWeeks: utils.Ptr(int64(2)), + MonthlySnapshotRetentionMonths: utils.Ptr(int64(2)), + SnapshotRetentionDays: utils.Ptr(int64(2)), + }, + instance: fixtureInstance(), + expectedRequest: fixtureUpdateBackupScheduleRequest().UpdateBackupSchedulePayload( + fixturePayload(func(payload *mongodbflex.UpdateBackupSchedulePayload) { + payload.BackupSchedule = utils.Ptr("0 0/6 5 2 1") + payload.DailySnapshotRetentionDays = utils.Ptr(int64(2)) + payload.WeeklySnapshotRetentionWeeks = utils.Ptr(int64(2)) + payload.MonthlySnapshotRetentionMonths = utils.Ptr(int64(2)) + payload.SnapshotRetentionDays = utils.Ptr(int64(2)) + }), + ), + }, + { + description: "no fields set, empty instance (use defaults)", + model: &inputModel{ + GlobalFlagModel: &globalflags.GlobalFlagModel{ + ProjectId: testProjectId, + }, + InstanceId: utils.Ptr(testInstanceId), + }, + instance: &mongodbflex.Instance{}, + expectedRequest: fixtureUpdateBackupScheduleRequest(), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + request := buildUpdateBackupScheduleRequest(testCtx, tt.model, tt.instance, testClient) + + diff := cmp.Diff(request, tt.expectedRequest, + cmp.AllowUnexported(tt.expectedRequest), + cmpopts.EquateComparable(testCtx), + ) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} diff --git a/internal/cmd/mongodbflex/instance/create/create.go b/internal/cmd/mongodbflex/instance/create/create.go index 7924c00d5..607774a0c 100644 --- a/internal/cmd/mongodbflex/instance/create/create.go +++ b/internal/cmd/mongodbflex/instance/create/create.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -281,6 +282,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDBFlex instance: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/mongodbflex/instance/describe/describe.go b/internal/cmd/mongodbflex/instance/describe/describe.go index 6d7fda1d5..1d1bacb99 100644 --- a/internal/cmd/mongodbflex/instance/describe/describe.go +++ b/internal/cmd/mongodbflex/instance/describe/describe.go @@ -6,6 +6,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -107,6 +108,14 @@ func outputResult(p *print.Printer, outputFormat string, instance *mongodbflex.I } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDB Flex instance: %w", err) + } + p.Outputln(string(details)) + return nil default: aclsArray := *instance.Acl.Items @@ -141,6 +150,8 @@ func outputResult(p *print.Printer, outputFormat string, instance *mongodbflex.I table.AddSeparator() table.AddRow("RAM", *instance.Flavor.Memory) table.AddSeparator() + table.AddRow("BACKUP SCHEDULE", *instance.BackupSchedule) + table.AddSeparator() err = table.Display(p) if err != nil { return fmt.Errorf("render table: %w", err) diff --git a/internal/cmd/mongodbflex/instance/list/list.go b/internal/cmd/mongodbflex/instance/list/list.go index c49bcc781..443c7ef08 100644 --- a/internal/cmd/mongodbflex/instance/list/list.go +++ b/internal/cmd/mongodbflex/instance/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, instances []mongodbflex } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDB Flex instance list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/mongodbflex/instance/update/update.go b/internal/cmd/mongodbflex/instance/update/update.go index 63bf07507..bc3dba632 100644 --- a/internal/cmd/mongodbflex/instance/update/update.go +++ b/internal/cmd/mongodbflex/instance/update/update.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -315,6 +316,14 @@ func outputResult(p *print.Printer, model *inputModel, instanceLabel string, res } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal update MongoDBFlex instance: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Updated" diff --git a/internal/cmd/mongodbflex/mongodbflex.go b/internal/cmd/mongodbflex/mongodbflex.go index 3aa6bf890..e7373b9b9 100644 --- a/internal/cmd/mongodbflex/mongodbflex.go +++ b/internal/cmd/mongodbflex/mongodbflex.go @@ -1,6 +1,7 @@ package mongodbflex import ( + "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup" "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance" "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/options" "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user" @@ -27,4 +28,5 @@ func addSubcommands(cmd *cobra.Command, p *print.Printer) { cmd.AddCommand(instance.NewCmd(p)) cmd.AddCommand(user.NewCmd(p)) cmd.AddCommand(options.NewCmd(p)) + cmd.AddCommand(backup.NewCmd(p)) } diff --git a/internal/cmd/mongodbflex/options/options.go b/internal/cmd/mongodbflex/options/options.go index 217756194..2480e5b10 100644 --- a/internal/cmd/mongodbflex/options/options.go +++ b/internal/cmd/mongodbflex/options/options.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" "github.com/stackitcloud/stackit-cli/internal/pkg/flags" @@ -190,6 +191,14 @@ func outputResult(p *print.Printer, model *inputModel, flavors *mongodbflex.List return fmt.Errorf("marshal MongoDB Flex options: %w", err) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(options, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDB Flex options: %w", err) + } + p.Outputln(string(details)) + return nil default: return outputResultAsTable(p, model, options) diff --git a/internal/cmd/mongodbflex/user/create/create.go b/internal/cmd/mongodbflex/user/create/create.go index cb6d1c9c5..8e8b743c5 100644 --- a/internal/cmd/mongodbflex/user/create/create.go +++ b/internal/cmd/mongodbflex/user/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/spf13/cobra" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" @@ -156,6 +157,14 @@ func outputResult(p *print.Printer, model *inputModel, instanceLabel string, use } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(user, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDB Flex user: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created user for instance %q. User ID: %s\n\n", instanceLabel, *user.Id) diff --git a/internal/cmd/mongodbflex/user/describe/describe.go b/internal/cmd/mongodbflex/user/describe/describe.go index c32eaace7..55d0e4f02 100644 --- a/internal/cmd/mongodbflex/user/describe/describe.go +++ b/internal/cmd/mongodbflex/user/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -125,6 +126,14 @@ func outputResult(p *print.Printer, outputFormat string, user mongodbflex.Instan } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(user, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDB Flex user: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/mongodbflex/user/list/list.go b/internal/cmd/mongodbflex/user/list/list.go index 6e6be06dd..ada4d0f6f 100644 --- a/internal/cmd/mongodbflex/user/list/list.go +++ b/internal/cmd/mongodbflex/user/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -145,6 +146,14 @@ func outputResult(p *print.Printer, outputFormat string, users []mongodbflex.Lis } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(users, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDB Flex user list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/mongodbflex/user/reset-password/reset_password.go b/internal/cmd/mongodbflex/user/reset-password/reset_password.go index d51daeddd..665ad9b8b 100644 --- a/internal/cmd/mongodbflex/user/reset-password/reset_password.go +++ b/internal/cmd/mongodbflex/user/reset-password/reset_password.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -141,6 +142,14 @@ func outputResult(p *print.Printer, model *inputModel, userLabel, instanceLabel } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(user, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal MongoDB Flex reset password: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Reset password for user %q of instance %q\n\n", userLabel, instanceLabel) diff --git a/internal/cmd/object-storage/bucket/create/create.go b/internal/cmd/object-storage/bucket/create/create.go index a052d9b99..5d145819b 100644 --- a/internal/cmd/object-storage/bucket/create/create.go +++ b/internal/cmd/object-storage/bucket/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -122,6 +123,14 @@ func outputResult(p *print.Printer, model *inputModel, resp *objectstorage.Creat } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Object Storage bucket: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/object-storage/bucket/describe/describe.go b/internal/cmd/object-storage/bucket/describe/describe.go index 94220639c..4196de7bc 100644 --- a/internal/cmd/object-storage/bucket/describe/describe.go +++ b/internal/cmd/object-storage/bucket/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -104,6 +105,14 @@ func outputResult(p *print.Printer, outputFormat string, bucket *objectstorage.B } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(bucket, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Object Storage bucket: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/object-storage/bucket/list/list.go b/internal/cmd/object-storage/bucket/list/list.go index d1f5f0e35..13367f035 100644 --- a/internal/cmd/object-storage/bucket/list/list.go +++ b/internal/cmd/object-storage/bucket/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, buckets []objectstorage } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(buckets, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Object Storage bucket list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/object-storage/credentials-group/create/create.go b/internal/cmd/object-storage/credentials-group/create/create.go index 36a1a71e6..d7399e501 100644 --- a/internal/cmd/object-storage/credentials-group/create/create.go +++ b/internal/cmd/object-storage/credentials-group/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -120,6 +121,14 @@ func outputResult(p *print.Printer, model *inputModel, resp *objectstorage.Creat } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Object Storage credentials group: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created credentials group %q. Credentials group ID: %s\n\n", *resp.CredentialsGroup.DisplayName, *resp.CredentialsGroup.CredentialsGroupId) diff --git a/internal/cmd/object-storage/credentials-group/list/list.go b/internal/cmd/object-storage/credentials-group/list/list.go index 821389d34..073a88a9a 100644 --- a/internal/cmd/object-storage/credentials-group/list/list.go +++ b/internal/cmd/object-storage/credentials-group/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -129,6 +130,14 @@ func outputResult(p *print.Printer, outputFormat string, credentialsGroups []obj } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentialsGroups, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Object Storage credentials group list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/object-storage/credentials/create/create.go b/internal/cmd/object-storage/credentials/create/create.go index 076448bb2..2d9387cc3 100644 --- a/internal/cmd/object-storage/credentials/create/create.go +++ b/internal/cmd/object-storage/credentials/create/create.go @@ -6,6 +6,7 @@ import ( "fmt" "time" + "github.com/goccy/go-yaml" objectStorageUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/object-storage/utils" "github.com/spf13/cobra" @@ -145,6 +146,14 @@ func outputResult(p *print.Printer, model *inputModel, credentialsGroupLabel str } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Object Storage credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: expireDate := "Never" diff --git a/internal/cmd/object-storage/credentials/list/list.go b/internal/cmd/object-storage/credentials/list/list.go index ba4a0ec1b..3814a0464 100644 --- a/internal/cmd/object-storage/credentials/list/list.go +++ b/internal/cmd/object-storage/credentials/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" objectStorageUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/object-storage/utils" "github.com/stackitcloud/stackit-cli/internal/pkg/args" @@ -145,6 +146,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials []objectsto } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Object Storage credentials list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/opensearch/credentials/create/create.go b/internal/cmd/opensearch/credentials/create/create.go index 70a5b8561..eebf71bb8 100644 --- a/internal/cmd/opensearch/credentials/create/create.go +++ b/internal/cmd/opensearch/credentials/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -123,17 +124,25 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *opensearch. } func outputResult(p *print.Printer, model *inputModel, instanceLabel string, resp *opensearch.CredentialsResponse) error { + if !model.ShowPassword { + resp.Raw.Credentials.Password = utils.Ptr("hidden") + } switch model.OutputFormat { case print.JSONOutputFormat: - if !model.ShowPassword { - resp.Raw.Credentials.Password = utils.Ptr("hidden") - } details, err := json.MarshalIndent(resp, "", " ") if err != nil { return fmt.Errorf("marshal OpenSearch credentials: %w", err) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal OpenSearch credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created credentials for instance %q. Credentials ID: %s\n\n", instanceLabel, *resp.Id) // The username field cannot be set by the user so we only display it if it's not returned empty diff --git a/internal/cmd/opensearch/credentials/describe/describe.go b/internal/cmd/opensearch/credentials/describe/describe.go index 73f72e1c5..596ffc3eb 100644 --- a/internal/cmd/opensearch/credentials/describe/describe.go +++ b/internal/cmd/opensearch/credentials/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -119,6 +120,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials *opensearch } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal OpenSearch credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/opensearch/credentials/list/list.go b/internal/cmd/opensearch/credentials/list/list.go index b08c5bea5..e4baea08d 100644 --- a/internal/cmd/opensearch/credentials/list/list.go +++ b/internal/cmd/opensearch/credentials/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -142,6 +143,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials []opensearc } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal OpenSearch credentials list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/opensearch/instance/create/create.go b/internal/cmd/opensearch/instance/create/create.go index 09ccfb6b8..0433ce412 100644 --- a/internal/cmd/opensearch/instance/create/create.go +++ b/internal/cmd/opensearch/instance/create/create.go @@ -7,6 +7,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -264,6 +265,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel, instanceId } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal OpenSearch instance: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/opensearch/instance/describe/describe.go b/internal/cmd/opensearch/instance/describe/describe.go index 593b85486..b1f06faff 100644 --- a/internal/cmd/opensearch/instance/describe/describe.go +++ b/internal/cmd/opensearch/instance/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -107,6 +108,14 @@ func outputResult(p *print.Printer, outputFormat string, instance *opensearch.In } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal OpenSearch instance: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/opensearch/instance/list/list.go b/internal/cmd/opensearch/instance/list/list.go index dcb7e62a8..a08b7ed1c 100644 --- a/internal/cmd/opensearch/instance/list/list.go +++ b/internal/cmd/opensearch/instance/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, instances []opensearch. } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal OpenSearch instance list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/opensearch/plans/plans.go b/internal/cmd/opensearch/plans/plans.go index 7e960a2f4..6f8a4ab74 100644 --- a/internal/cmd/opensearch/plans/plans.go +++ b/internal/cmd/opensearch/plans/plans.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, plans []opensearch.Offe } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(plans, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal OpenSearch plans: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/organization/member/list/list.go b/internal/cmd/organization/member/list/list.go index 0091253e9..8b68411cd 100644 --- a/internal/cmd/organization/member/list/list.go +++ b/internal/cmd/organization/member/list/list.go @@ -6,6 +6,7 @@ import ( "fmt" "sort" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -164,6 +165,14 @@ func outputResult(p *print.Printer, model *inputModel, members []authorization.M } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(members, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal members: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/organization/role/list/list.go b/internal/cmd/organization/role/list/list.go index 6d3a55a9f..68352bff1 100644 --- a/internal/cmd/organization/role/list/list.go +++ b/internal/cmd/organization/role/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputRolesResult(p *print.Printer, outputFormat string, roles []authorizat } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(roles, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal roles: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/postgresflex/backup/describe/describe.go b/internal/cmd/postgresflex/backup/describe/describe.go index 4e5d8bd49..9e306e2b4 100644 --- a/internal/cmd/postgresflex/backup/describe/describe.go +++ b/internal/cmd/postgresflex/backup/describe/describe.go @@ -7,6 +7,7 @@ import ( "time" + "github.com/goccy/go-yaml" "github.com/inhies/go-bytesize" "github.com/spf13/cobra" "github.com/stackitcloud/stackit-cli/internal/pkg/args" @@ -121,6 +122,14 @@ func outputResult(p *print.Printer, cmd *cobra.Command, outputFormat string, bac } cmd.Println(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(backup, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal backup for PostgreSQL Flex backup: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/postgresflex/backup/list/list.go b/internal/cmd/postgresflex/backup/list/list.go index b6ff4641b..0ed9a5155 100644 --- a/internal/cmd/postgresflex/backup/list/list.go +++ b/internal/cmd/postgresflex/backup/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/inhies/go-bytesize" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" @@ -137,7 +138,15 @@ func outputResult(p *print.Printer, outputFormat string, backups []postgresflex. case print.JSONOutputFormat: details, err := json.MarshalIndent(backups, "", " ") if err != nil { - return fmt.Errorf("marshal PostgreSQL Flex instance list: %w", err) + return fmt.Errorf("marshal PostgreSQL Flex backup list: %w", err) + } + p.Outputln(string(details)) + + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(backups, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal PostgreSQL Flex backup list: %w", err) } p.Outputln(string(details)) diff --git a/internal/cmd/postgresflex/instance/clone/clone.go b/internal/cmd/postgresflex/instance/clone/clone.go index 2c9442592..b9d10e78b 100644 --- a/internal/cmd/postgresflex/instance/clone/clone.go +++ b/internal/cmd/postgresflex/instance/clone/clone.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -213,6 +214,14 @@ func outputResult(p *print.Printer, model *inputModel, instanceLabel, instanceId } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal PostgresFlex instance clone: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Cloned" diff --git a/internal/cmd/postgresflex/instance/create/create.go b/internal/cmd/postgresflex/instance/create/create.go index de826543e..ed7cec878 100644 --- a/internal/cmd/postgresflex/instance/create/create.go +++ b/internal/cmd/postgresflex/instance/create/create.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -281,6 +282,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel, instanceId } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal PostgresFlex instance: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/postgresflex/instance/describe/describe.go b/internal/cmd/postgresflex/instance/describe/describe.go index 0e5687db1..b47dbc025 100644 --- a/internal/cmd/postgresflex/instance/describe/describe.go +++ b/internal/cmd/postgresflex/instance/describe/describe.go @@ -6,6 +6,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -109,6 +110,14 @@ func outputResult(p *print.Printer, outputFormat string, instance *postgresflex. } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal PostgreSQL Flex instance: %w", err) + } + p.Outputln(string(details)) + return nil default: aclsArray := *instance.Acl.Items diff --git a/internal/cmd/postgresflex/instance/list/list.go b/internal/cmd/postgresflex/instance/list/list.go index e0563d02d..3759061ea 100644 --- a/internal/cmd/postgresflex/instance/list/list.go +++ b/internal/cmd/postgresflex/instance/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -139,6 +140,14 @@ func outputResult(p *print.Printer, outputFormat string, instances []postgresfle } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal PostgreSQL Flex instance list: %w", err) + } + p.Outputln(string(details)) + return nil default: caser := cases.Title(language.English) diff --git a/internal/cmd/postgresflex/instance/update/update.go b/internal/cmd/postgresflex/instance/update/update.go index 8649b4703..975c7c860 100644 --- a/internal/cmd/postgresflex/instance/update/update.go +++ b/internal/cmd/postgresflex/instance/update/update.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -315,6 +316,14 @@ func outputResult(p *print.Printer, model *inputModel, instanceLabel string, res } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal PostgresFlex instance: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Updated" diff --git a/internal/cmd/postgresflex/options/options.go b/internal/cmd/postgresflex/options/options.go index 7341f4ea3..ba94aea08 100644 --- a/internal/cmd/postgresflex/options/options.go +++ b/internal/cmd/postgresflex/options/options.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" "github.com/stackitcloud/stackit-cli/internal/pkg/flags" @@ -190,6 +191,14 @@ func outputResult(p *print.Printer, model *inputModel, flavors *postgresflex.Lis return fmt.Errorf("marshal PostgreSQL Flex options: %w", err) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(options, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal PostgreSQL Flex options: %w", err) + } + p.Outputln(string(details)) + return nil default: return outputResultAsTable(p, model, options) diff --git a/internal/cmd/postgresflex/user/create/create.go b/internal/cmd/postgresflex/user/create/create.go index f72259f84..6a0d1f103 100644 --- a/internal/cmd/postgresflex/user/create/create.go +++ b/internal/cmd/postgresflex/user/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -151,6 +152,14 @@ func outputResult(p *print.Printer, model *inputModel, instanceLabel string, res } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal PostgresFlex user: %w", err) + } + p.Outputln(string(details)) + return nil default: user := resp.Item diff --git a/internal/cmd/postgresflex/user/describe/describe.go b/internal/cmd/postgresflex/user/describe/describe.go index 5b7b07af6..8f177aa18 100644 --- a/internal/cmd/postgresflex/user/describe/describe.go +++ b/internal/cmd/postgresflex/user/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -124,6 +125,14 @@ func outputResult(p *print.Printer, outputFormat string, user postgresflex.UserR } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(user, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal PostgreSQL Flex user: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/postgresflex/user/list/list.go b/internal/cmd/postgresflex/user/list/list.go index a72f0c9eb..62e354334 100644 --- a/internal/cmd/postgresflex/user/list/list.go +++ b/internal/cmd/postgresflex/user/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -145,6 +146,14 @@ func outputResult(p *print.Printer, outputFormat string, users []postgresflex.Li } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(users, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal PostgreSQL Flex user list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/postgresflex/user/reset-password/reset_password.go b/internal/cmd/postgresflex/user/reset-password/reset_password.go index c76c8c400..77c881189 100644 --- a/internal/cmd/postgresflex/user/reset-password/reset_password.go +++ b/internal/cmd/postgresflex/user/reset-password/reset_password.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -140,6 +141,14 @@ func outputResult(p *print.Printer, model *inputModel, userLabel, instanceLabel } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(user, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal PostgresFlex user: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Reset password for user %q of instance %q\n\n", userLabel, instanceLabel) diff --git a/internal/cmd/project/create/create.go b/internal/cmd/project/create/create.go index 09b16313e..59b478584 100644 --- a/internal/cmd/project/create/create.go +++ b/internal/cmd/project/create/create.go @@ -6,6 +6,7 @@ import ( "fmt" "regexp" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/auth" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" @@ -197,6 +198,14 @@ func outputResult(p *print.Printer, model *inputModel, resp *resourcemanager.Pro } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal project: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created project under the parent with ID %q. Project ID: %s\n", *model.ParentId, *resp.ProjectId) diff --git a/internal/cmd/project/describe/describe.go b/internal/cmd/project/describe/describe.go index 2e1e5e94b..9047fec7a 100644 --- a/internal/cmd/project/describe/describe.go +++ b/internal/cmd/project/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" "github.com/stackitcloud/stackit-cli/internal/pkg/flags" @@ -126,6 +127,14 @@ func outputResult(p *print.Printer, outputFormat string, project *resourcemanage } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(project, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal project details: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/project/list/list.go b/internal/cmd/project/list/list.go index bddf41bdd..73b5bdd9a 100644 --- a/internal/cmd/project/list/list.go +++ b/internal/cmd/project/list/list.go @@ -6,6 +6,7 @@ import ( "fmt" "time" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/auth" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" @@ -227,6 +228,14 @@ func outputResult(p *print.Printer, outputFormat string, projects []resourcemana } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(projects, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal projects list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/project/member/list/list.go b/internal/cmd/project/member/list/list.go index ddc2ff08b..6171a0b4e 100644 --- a/internal/cmd/project/member/list/list.go +++ b/internal/cmd/project/member/list/list.go @@ -6,6 +6,7 @@ import ( "fmt" "sort" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -166,6 +167,14 @@ func outputResult(p *print.Printer, model *inputModel, members []authorization.M } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(members, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal members: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/project/role/list/list.go b/internal/cmd/project/role/list/list.go index d6d3545fd..b00c10b4a 100644 --- a/internal/cmd/project/role/list/list.go +++ b/internal/cmd/project/role/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -139,6 +140,14 @@ func outputRolesResult(p *print.Printer, outputFormat string, roles []authorizat } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(roles, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal roles: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/rabbitmq/credentials/create/create.go b/internal/cmd/rabbitmq/credentials/create/create.go index 63199b8af..bed0dafd2 100644 --- a/internal/cmd/rabbitmq/credentials/create/create.go +++ b/internal/cmd/rabbitmq/credentials/create/create.go @@ -5,6 +5,8 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" + "github.com/spf13/cobra" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -14,8 +16,6 @@ import ( "github.com/stackitcloud/stackit-cli/internal/pkg/services/rabbitmq/client" rabbitmqUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/rabbitmq/utils" "github.com/stackitcloud/stackit-cli/internal/pkg/utils" - - "github.com/spf13/cobra" "github.com/stackitcloud/stackit-sdk-go/services/rabbitmq" ) @@ -123,17 +123,25 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *rabbitmq.AP } func outputResult(p *print.Printer, model *inputModel, instanceLabel string, resp *rabbitmq.CredentialsResponse) error { + if !model.ShowPassword { + resp.Raw.Credentials.Password = utils.Ptr("hidden") + } switch model.OutputFormat { case print.JSONOutputFormat: - if !model.ShowPassword { - resp.Raw.Credentials.Password = utils.Ptr("hidden") - } details, err := json.MarshalIndent(resp, "", " ") if err != nil { return fmt.Errorf("marshal RabbitMQ credentials: %w", err) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal RabbitMQ credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created credentials for instance %q. Credentials ID: %s\n\n", instanceLabel, *resp.Id) diff --git a/internal/cmd/rabbitmq/credentials/describe/describe.go b/internal/cmd/rabbitmq/credentials/describe/describe.go index 9b08752e6..175488d16 100644 --- a/internal/cmd/rabbitmq/credentials/describe/describe.go +++ b/internal/cmd/rabbitmq/credentials/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -119,6 +120,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials *rabbitmq.C } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal RabbitMQ credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/rabbitmq/credentials/list/list.go b/internal/cmd/rabbitmq/credentials/list/list.go index d6ba8fe42..54140ec86 100644 --- a/internal/cmd/rabbitmq/credentials/list/list.go +++ b/internal/cmd/rabbitmq/credentials/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -142,6 +143,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials []rabbitmq. } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal RabbitMQ credentials list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/rabbitmq/instance/create/create.go b/internal/cmd/rabbitmq/instance/create/create.go index 9bbd8eaa7..464f587b8 100644 --- a/internal/cmd/rabbitmq/instance/create/create.go +++ b/internal/cmd/rabbitmq/instance/create/create.go @@ -7,6 +7,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -264,6 +265,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel, instanceId } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal RabbitMQ instance: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/rabbitmq/instance/describe/describe.go b/internal/cmd/rabbitmq/instance/describe/describe.go index 65b04e49d..4aeb8fdf8 100644 --- a/internal/cmd/rabbitmq/instance/describe/describe.go +++ b/internal/cmd/rabbitmq/instance/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -107,6 +108,14 @@ func outputResult(p *print.Printer, outputFormat string, instance *rabbitmq.Inst } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal RabbitMQ instance: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/rabbitmq/instance/list/list.go b/internal/cmd/rabbitmq/instance/list/list.go index 0e1daafe1..b09ebd083 100644 --- a/internal/cmd/rabbitmq/instance/list/list.go +++ b/internal/cmd/rabbitmq/instance/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, instances []rabbitmq.In } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal RabbitMQ instance list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/rabbitmq/plans/plans.go b/internal/cmd/rabbitmq/plans/plans.go index 6f7f8be47..ad19ecf18 100644 --- a/internal/cmd/rabbitmq/plans/plans.go +++ b/internal/cmd/rabbitmq/plans/plans.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, plans []rabbitmq.Offeri } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(plans, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal RabbitMQ plans: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/redis/credentials/create/create.go b/internal/cmd/redis/credentials/create/create.go index 508d24130..7906c2885 100644 --- a/internal/cmd/redis/credentials/create/create.go +++ b/internal/cmd/redis/credentials/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -123,21 +124,30 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *redis.APICl } func outputResult(p *print.Printer, model *inputModel, instanceLabel string, resp *redis.CredentialsResponse) error { + if !model.ShowPassword { + resp.Raw.Credentials.Password = utils.Ptr("hidden") + } + switch model.OutputFormat { case print.JSONOutputFormat: - if !model.ShowPassword { - resp.Raw.Credentials.Password = utils.Ptr("hidden") - } details, err := json.MarshalIndent(resp, "", " ") if err != nil { return fmt.Errorf("marshal Redis credentials: %w", err) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Redis credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created credentials for instance %q. Credentials ID: %s\n\n", instanceLabel, *resp.Id) - // The username field cannot be set by the user so we only display it if it's not returned empty + // The username field cannot be set by the user, so we only display it if it's not returned empty username := *resp.Raw.Credentials.Username if username != "" { p.Outputf("Username: %s\n", *resp.Raw.Credentials.Username) diff --git a/internal/cmd/redis/credentials/describe/describe.go b/internal/cmd/redis/credentials/describe/describe.go index a6831e741..48ec11a7c 100644 --- a/internal/cmd/redis/credentials/describe/describe.go +++ b/internal/cmd/redis/credentials/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -119,6 +120,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials *redis.Cred } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Redis credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/redis/credentials/list/list.go b/internal/cmd/redis/credentials/list/list.go index eeb98d7b4..b701a03d8 100644 --- a/internal/cmd/redis/credentials/list/list.go +++ b/internal/cmd/redis/credentials/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -142,6 +143,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials []redis.Cre } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Redis credentials list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/redis/instance/create/create.go b/internal/cmd/redis/instance/create/create.go index d71d03314..cd71a84a4 100644 --- a/internal/cmd/redis/instance/create/create.go +++ b/internal/cmd/redis/instance/create/create.go @@ -7,6 +7,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -259,6 +260,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel, instanceId } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Redis instance: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/redis/instance/describe/describe.go b/internal/cmd/redis/instance/describe/describe.go index eb832bf38..b89ac51f1 100644 --- a/internal/cmd/redis/instance/describe/describe.go +++ b/internal/cmd/redis/instance/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -107,6 +108,14 @@ func outputResult(p *print.Printer, outputFormat string, instance *redis.Instanc } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instance, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Redis instance: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/redis/instance/list/list.go b/internal/cmd/redis/instance/list/list.go index 8d3af2136..969b20058 100644 --- a/internal/cmd/redis/instance/list/list.go +++ b/internal/cmd/redis/instance/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, instances []redis.Insta } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Redis instance list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/redis/plans/plans.go b/internal/cmd/redis/plans/plans.go index 9f8968a3d..292857121 100644 --- a/internal/cmd/redis/plans/plans.go +++ b/internal/cmd/redis/plans/plans.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -137,6 +138,14 @@ func outputResult(p *print.Printer, outputFormat string, plans []redis.Offering) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(plans, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Redis plans: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/secrets-manager/instance/create/create.go b/internal/cmd/secrets-manager/instance/create/create.go index 11254c194..c95cb365f 100644 --- a/internal/cmd/secrets-manager/instance/create/create.go +++ b/internal/cmd/secrets-manager/instance/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -165,6 +166,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel, instanceId } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Secrets Manager instance: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created instance for project %q. Instance ID: %s\n", projectLabel, instanceId) diff --git a/internal/cmd/secrets-manager/instance/describe/describe.go b/internal/cmd/secrets-manager/instance/describe/describe.go index b484bdea6..d3f6e56b9 100644 --- a/internal/cmd/secrets-manager/instance/describe/describe.go +++ b/internal/cmd/secrets-manager/instance/describe/describe.go @@ -6,6 +6,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -110,19 +111,27 @@ func buildListACLsRequest(ctx context.Context, model *inputModel, apiClient *sec } func outputResult(p *print.Printer, outputFormat string, instance *secretsmanager.Instance, aclList *secretsmanager.AclList) error { + output := struct { + *secretsmanager.Instance + *secretsmanager.AclList + }{instance, aclList} + switch outputFormat { case print.JSONOutputFormat: - output := struct { - *secretsmanager.Instance - *secretsmanager.AclList - }{instance, aclList} - details, err := json.MarshalIndent(output, "", " ") if err != nil { return fmt.Errorf("marshal Secrets Manager instance: %w", err) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(output, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Secrets Manager instance: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/secrets-manager/instance/list/list.go b/internal/cmd/secrets-manager/instance/list/list.go index a24611412..9aa3a6a33 100644 --- a/internal/cmd/secrets-manager/instance/list/list.go +++ b/internal/cmd/secrets-manager/instance/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -138,6 +139,14 @@ func outputResult(p *print.Printer, outputFormat string, instances []secretsmana } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(instances, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Secrets Manager instance list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/secrets-manager/user/create/create.go b/internal/cmd/secrets-manager/user/create/create.go index 8bb5120c9..ac919e456 100644 --- a/internal/cmd/secrets-manager/user/create/create.go +++ b/internal/cmd/secrets-manager/user/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -145,6 +146,14 @@ func outputResult(p *print.Printer, model *inputModel, instanceLabel string, res } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Secrets Manager user: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created user for instance %q. User ID: %s\n\n", instanceLabel, *resp.Id) diff --git a/internal/cmd/secrets-manager/user/describe/describe.go b/internal/cmd/secrets-manager/user/describe/describe.go index c3b0c0b96..35b8f927f 100644 --- a/internal/cmd/secrets-manager/user/describe/describe.go +++ b/internal/cmd/secrets-manager/user/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -121,6 +122,14 @@ func outputResult(p *print.Printer, outputFormat string, user secretsmanager.Use } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(user, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Secrets Manager user: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/secrets-manager/user/list/list.go b/internal/cmd/secrets-manager/user/list/list.go index 4d9d37fba..cfc9b1a87 100644 --- a/internal/cmd/secrets-manager/user/list/list.go +++ b/internal/cmd/secrets-manager/user/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -145,6 +146,14 @@ func outputResult(p *print.Printer, outputFormat string, users []secretsmanager. } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(users, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal Secrets Manager user list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/service-account/create/create.go b/internal/cmd/service-account/create/create.go index f776fb483..5314543b8 100644 --- a/internal/cmd/service-account/create/create.go +++ b/internal/cmd/service-account/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -126,6 +127,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, serv } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(serviceAccount, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal service account: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created service account for project %q. Email: %s\n", projectLabel, *serviceAccount.Email) diff --git a/internal/cmd/service-account/key/list/list.go b/internal/cmd/service-account/key/list/list.go index c9db67f72..6c3c29da5 100644 --- a/internal/cmd/service-account/key/list/list.go +++ b/internal/cmd/service-account/key/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -147,6 +148,14 @@ func outputResult(p *print.Printer, outputFormat string, keys []serviceaccount.S } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(keys, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal keys metadata: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/service-account/list/list.go b/internal/cmd/service-account/list/list.go index 9fd2fa0eb..7fc9ffbff 100644 --- a/internal/cmd/service-account/list/list.go +++ b/internal/cmd/service-account/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -130,6 +131,12 @@ func outputResult(p *print.Printer, outputFormat string, serviceAccounts []servi return fmt.Errorf("marshal service accounts list: %w", err) } p.Outputln(string(details)) + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(serviceAccounts, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal service accounts list: %w", err) + } + p.Outputln(string(details)) default: table := tables.NewTable() table.SetHeader("ID", "EMAIL") diff --git a/internal/cmd/service-account/token/create/create.go b/internal/cmd/service-account/token/create/create.go index e14891b11..fdaf09b01 100644 --- a/internal/cmd/service-account/token/create/create.go +++ b/internal/cmd/service-account/token/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -150,6 +151,14 @@ func outputResult(p *print.Printer, model *inputModel, token *serviceaccount.Acc } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(token, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal service account access token: %w", err) + } + p.Outputln(string(details)) + return nil default: p.Outputf("Created access token for service account %s. Token ID: %s\n\n", model.ServiceAccountEmail, *token.Id) diff --git a/internal/cmd/service-account/token/list/list.go b/internal/cmd/service-account/token/list/list.go index 257c61f22..fc345d8cc 100644 --- a/internal/cmd/service-account/token/list/list.go +++ b/internal/cmd/service-account/token/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -151,6 +152,14 @@ func outputResult(p *print.Printer, outputFormat string, tokensMetadata []servic } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(tokensMetadata, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal tokens metadata: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/ske/cluster/create/create.go b/internal/cmd/ske/cluster/create/create.go index c253e85c8..4a9324f3d 100644 --- a/internal/cmd/ske/cluster/create/create.go +++ b/internal/cmd/ske/cluster/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -195,6 +196,14 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel string, resp } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal SKE cluster: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Created" diff --git a/internal/cmd/ske/cluster/describe/describe.go b/internal/cmd/ske/cluster/describe/describe.go index 1d24f4563..75a432bdb 100644 --- a/internal/cmd/ske/cluster/describe/describe.go +++ b/internal/cmd/ske/cluster/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -104,6 +105,14 @@ func outputResult(p *print.Printer, outputFormat string, cluster *ske.Cluster) e } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(cluster, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal SKE cluster: %w", err) + } + p.Outputln(string(details)) + return nil default: acl := []string{} diff --git a/internal/cmd/ske/cluster/list/list.go b/internal/cmd/ske/cluster/list/list.go index 113997c80..d0ee6da45 100644 --- a/internal/cmd/ske/cluster/list/list.go +++ b/internal/cmd/ske/cluster/list/list.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -147,6 +148,14 @@ func outputResult(p *print.Printer, outputFormat string, clusters []ske.Cluster) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(clusters, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal SKE cluster list: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/ske/cluster/update/update.go b/internal/cmd/ske/cluster/update/update.go index 264bd263b..491daf86e 100644 --- a/internal/cmd/ske/cluster/update/update.go +++ b/internal/cmd/ske/cluster/update/update.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -167,6 +168,14 @@ func outputResult(p *print.Printer, model *inputModel, resp *ske.Cluster) error } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(resp, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal SKE cluster: %w", err) + } + p.Outputln(string(details)) + return nil default: operationState := "Updated" diff --git a/internal/cmd/ske/credentials/describe/describe.go b/internal/cmd/ske/credentials/describe/describe.go index cb7233bcd..692bb9ace 100644 --- a/internal/cmd/ske/credentials/describe/describe.go +++ b/internal/cmd/ske/credentials/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -121,6 +122,14 @@ func outputResult(p *print.Printer, outputFormat string, credentials *ske.Creden } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(credentials, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal SKE credentials: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/ske/describe/describe.go b/internal/cmd/ske/describe/describe.go index 4b83c1306..433a60cd3 100644 --- a/internal/cmd/ske/describe/describe.go +++ b/internal/cmd/ske/describe/describe.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -93,6 +94,14 @@ func outputResult(p *print.Printer, outputFormat string, project *ske.ProjectRes } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(project, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal SKE project details: %w", err) + } + p.Outputln(string(details)) + return nil default: table := tables.NewTable() diff --git a/internal/cmd/ske/kubeconfig/create/create.go b/internal/cmd/ske/kubeconfig/create/create.go index c0b2d7a65..d72c54b9c 100644 --- a/internal/cmd/ske/kubeconfig/create/create.go +++ b/internal/cmd/ske/kubeconfig/create/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/errors" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" @@ -21,6 +22,7 @@ import ( const ( clusterNameArg = "CLUSTER_NAME" + loginFlag = "login" expirationFlag = "expiration" filepathFlag = "filepath" ) @@ -30,6 +32,7 @@ type inputModel struct { ClusterName string Filepath *string ExpirationTime *string + Login bool } func NewCmd(p *print.Printer) *cobra.Command { @@ -47,6 +50,10 @@ func NewCmd(p *print.Printer) *cobra.Command { examples.NewExample( `Create a kubeconfig for the SKE cluster with name "my-cluster"`, "$ stackit ske kubeconfig create my-cluster"), + examples.NewExample( + `Get a login kubeconfig for the SKE cluster with name "my-cluster". `+ + "This kubeconfig does not contain any credentials and instead obtains valid credentials via the `stackit ske kubeconfig login` command.", + "$ stackit ske kubeconfig create my-cluster --login"), examples.NewExample( `Create a kubeconfig for the SKE cluster with name "my-cluster" and set the expiration time to 30 days`, "$ stackit ske kubeconfig create my-cluster --expiration 30d"), @@ -79,20 +86,41 @@ func NewCmd(p *print.Printer) *cobra.Command { } // Call API - req, err := buildRequest(ctx, model, apiClient) - if err != nil { - return fmt.Errorf("build kubeconfig create request: %w", err) - } - resp, err := req.Execute() - if err != nil { - return fmt.Errorf("create kubeconfig for SKE cluster: %w", err) + var ( + kubeconfig string + respKubeconfig *ske.Kubeconfig + respLogin *ske.V1LoginKubeconfig + ) + + if !model.Login { + req, err := buildRequestCreate(ctx, model, apiClient) + if err != nil { + return fmt.Errorf("build kubeconfig create request: %w", err) + } + respKubeconfig, err = req.Execute() + if err != nil { + return fmt.Errorf("create kubeconfig for SKE cluster: %w", err) + } + if respKubeconfig.Kubeconfig == nil { + return fmt.Errorf("no kubeconfig returned from the API") + } + kubeconfig = *respKubeconfig.Kubeconfig + } else { + req, err := buildRequestLogin(ctx, model, apiClient) + if err != nil { + return fmt.Errorf("build login kubeconfig create request: %w", err) + } + respLogin, err = req.Execute() + if err != nil { + return fmt.Errorf("create login kubeconfig for SKE cluster: %w", err) + } + if respLogin.Kubeconfig == nil { + return fmt.Errorf("no login kubeconfig returned from the API") + } + kubeconfig = *respLogin.Kubeconfig } // Create the config file - if resp.Kubeconfig == nil { - return fmt.Errorf("no kubeconfig returned from the API") - } - var kubeconfigPath string if model.Filepath == nil { kubeconfigPath, err = skeUtils.GetDefaultKubeconfigPath() @@ -103,12 +131,14 @@ func NewCmd(p *print.Printer) *cobra.Command { kubeconfigPath = *model.Filepath } - err = skeUtils.WriteConfigFile(kubeconfigPath, *resp.Kubeconfig) - if err != nil { - return fmt.Errorf("write kubeconfig file: %w", err) + if model.OutputFormat != print.JSONOutputFormat { + err = skeUtils.WriteConfigFile(kubeconfigPath, kubeconfig) + if err != nil { + return fmt.Errorf("write kubeconfig file: %w", err) + } } - return outputResult(p, model, kubeconfigPath, resp) + return outputResult(p, model, kubeconfigPath, respKubeconfig, respLogin) }, } configureFlags(cmd) @@ -116,8 +146,11 @@ func NewCmd(p *print.Printer) *cobra.Command { } func configureFlags(cmd *cobra.Command) { + cmd.Flags().BoolP(loginFlag, "l", false, "Create a login kubeconfig that obtains valid credentials via the STACKIT CLI. This flag is mutually exclusive with the expiration flag.") cmd.Flags().StringP(expirationFlag, "e", "", "Expiration time for the kubeconfig in seconds(s), minutes(m), hours(h), days(d) or months(M). Example: 30d. By default, expiration time is 1h") cmd.Flags().String(filepathFlag, "", "Path to create the kubeconfig file. By default, the kubeconfig is created as 'config' in the .kube folder, in the user's home directory.") + + cmd.MarkFlagsMutuallyExclusive(loginFlag, expirationFlag) } func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inputModel, error) { @@ -146,6 +179,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu ClusterName: clusterName, Filepath: flags.FlagToStringPointer(p, cmd, filepathFlag), ExpirationTime: expTime, + Login: flags.FlagToBoolValue(p, cmd, loginFlag), } if p.IsVerbosityDebug() { @@ -160,7 +194,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu return &model, nil } -func buildRequest(ctx context.Context, model *inputModel, apiClient *ske.APIClient) (ske.ApiCreateKubeconfigRequest, error) { +func buildRequestCreate(ctx context.Context, model *inputModel, apiClient *ske.APIClient) (ske.ApiCreateKubeconfigRequest, error) { req := apiClient.CreateKubeconfig(ctx, model.ProjectId, model.ClusterName) payload := ske.CreateKubeconfigPayload{} @@ -172,10 +206,34 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *ske.APIClie return req.CreateKubeconfigPayload(payload), nil } -func outputResult(p *print.Printer, model *inputModel, kubeconfigPath string, resp *ske.Kubeconfig) error { +func buildRequestLogin(ctx context.Context, model *inputModel, apiClient *ske.APIClient) (ske.ApiGetLoginKubeconfigRequest, error) { + return apiClient.GetLoginKubeconfig(ctx, model.ProjectId, model.ClusterName), nil +} + +func outputResult(p *print.Printer, model *inputModel, kubeconfigPath string, respKubeconfig *ske.Kubeconfig, respLogin *ske.V1LoginKubeconfig) error { switch model.OutputFormat { case print.JSONOutputFormat: - details, err := json.MarshalIndent(resp, "", " ") + var err error + var details []byte + if respKubeconfig != nil { + details, err = json.MarshalIndent(respKubeconfig, "", " ") + } else if respLogin != nil { + details, err = json.MarshalIndent(respLogin, "", " ") + } + if err != nil { + return fmt.Errorf("marshal SKE Kubeconfig: %w", err) + } + p.Outputln(string(details)) + + return nil + case print.YAMLOutputFormat: + var err error + var details []byte + if respKubeconfig != nil { + details, err = yaml.MarshalWithOptions(respKubeconfig, yaml.IndentSequence(true)) + } else if respLogin != nil { + details, err = yaml.MarshalWithOptions(respLogin, yaml.IndentSequence(true)) + } if err != nil { return fmt.Errorf("marshal SKE Kubeconfig: %w", err) } @@ -183,7 +241,11 @@ func outputResult(p *print.Printer, model *inputModel, kubeconfigPath string, re return nil default: - p.Outputf("Created kubeconfig file for cluster %s in %q, with expiration date %v (UTC)\n", model.ClusterName, kubeconfigPath, *resp.ExpirationTimestamp) + var expiration string + if respKubeconfig != nil { + expiration = fmt.Sprintf(", with expiration date %v (UTC)", *respKubeconfig.ExpirationTimestamp) + } + p.Outputf("Created kubeconfig file for cluster %s in %q%s\n", model.ClusterName, kubeconfigPath, expiration) return nil } diff --git a/internal/cmd/ske/kubeconfig/create/create_test.go b/internal/cmd/ske/kubeconfig/create/create_test.go index 17b30a4f6..86fb29ac4 100644 --- a/internal/cmd/ske/kubeconfig/create/create_test.go +++ b/internal/cmd/ske/kubeconfig/create/create_test.go @@ -92,7 +92,17 @@ func TestParseInput(t *testing.T) { model.ExpirationTime = utils.Ptr("2592000") }), }, - + { + description: "login", + argValues: fixtureArgValues(), + flagValues: fixtureFlagValues(func(flagValues map[string]string) { + flagValues["login"] = "true" + }), + isValid: true, + expectedModel: fixtureInputModel(func(model *inputModel) { + model.Login = true + }), + }, { description: "custom filepath", argValues: fixtureArgValues(), @@ -202,7 +212,7 @@ func TestParseInput(t *testing.T) { } } -func TestBuildRequest(t *testing.T) { +func TestBuildRequestCreate(t *testing.T) { tests := []struct { description string model *inputModel @@ -225,7 +235,7 @@ func TestBuildRequest(t *testing.T) { for _, tt := range tests { t.Run(tt.description, func(t *testing.T) { - request, _ := buildRequest(testCtx, tt.model, testClient) + request, _ := buildRequestCreate(testCtx, tt.model, testClient) diff := cmp.Diff(request, tt.expectedRequest, cmp.AllowUnexported(tt.expectedRequest), diff --git a/internal/cmd/ske/kubeconfig/kubeconfig.go b/internal/cmd/ske/kubeconfig/kubeconfig.go index 3370a8529..44803f14b 100644 --- a/internal/cmd/ske/kubeconfig/kubeconfig.go +++ b/internal/cmd/ske/kubeconfig/kubeconfig.go @@ -2,6 +2,7 @@ package kubeconfig import ( "github.com/stackitcloud/stackit-cli/internal/cmd/ske/kubeconfig/create" + "github.com/stackitcloud/stackit-cli/internal/cmd/ske/kubeconfig/login" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/print" "github.com/stackitcloud/stackit-cli/internal/pkg/utils" @@ -23,4 +24,5 @@ func NewCmd(p *print.Printer) *cobra.Command { func addSubcommands(cmd *cobra.Command, p *print.Printer) { cmd.AddCommand(create.NewCmd(p)) + cmd.AddCommand(login.NewCmd(p)) } diff --git a/internal/cmd/ske/kubeconfig/login/login.go b/internal/cmd/ske/kubeconfig/login/login.go new file mode 100644 index 000000000..568b34c98 --- /dev/null +++ b/internal/cmd/ske/kubeconfig/login/login.go @@ -0,0 +1,253 @@ +package login + +import ( + "context" + "crypto/sha256" + "crypto/x509" + "encoding/json" + "encoding/pem" + "errors" + "fmt" + "os" + "strconv" + "time" + + "github.com/stackitcloud/stackit-cli/internal/pkg/cache" + "k8s.io/client-go/rest" + + "github.com/stackitcloud/stackit-cli/internal/pkg/args" + "github.com/stackitcloud/stackit-cli/internal/pkg/examples" + "github.com/stackitcloud/stackit-cli/internal/pkg/print" + "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" + + "github.com/spf13/cobra" + "github.com/stackitcloud/stackit-sdk-go/services/ske" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes/scheme" + clientauthenticationv1 "k8s.io/client-go/pkg/apis/clientauthentication/v1" + "k8s.io/client-go/tools/auth/exec" + "k8s.io/client-go/tools/clientcmd" +) + +const ( + expirationSeconds = 30 * 60 // 30 min + refreshBeforeDuration = 15 * time.Minute // 15 min +) + +func NewCmd(p *print.Printer) *cobra.Command { + cmd := &cobra.Command{ + Use: "login", + Short: "Login plugin for kubernetes clients", + Long: fmt.Sprintf("%s\n%s\n%s", + "Login plugin for kubernetes clients, that creates short-lived credentials to authenticate against a STACKIT Kubernetes Engine (SKE) cluster.", + "First you need to obtain a kubeconfig for use with the login command (first example).", + "Secondly you use the kubeconfig with your chosen Kubernetes client (second example), the client will automatically retrieve the credentials via the STACKIT CLI.", + ), + Args: args.NoArgs, + Example: examples.Build( + examples.NewExample( + `Get a login kubeconfig for the SKE cluster with name "my-cluster". `+ + "This kubeconfig does not contain any credentials and instead obtains valid credentials via the `stackit ske kubeconfig login` command.", + "$ stackit ske kubeconfig create my-cluster --login"), + examples.NewExample( + "Use the previously saved kubeconfig to authenticate to the SKE cluster, in this case with kubectl.", + "$ kubectl cluster-info", + "$ kubectl get pods"), + ), + RunE: func(cmd *cobra.Command, args []string) error { + ctx := context.Background() + + if err := cache.Init(); err != nil { + return fmt.Errorf("cache init failed: %w", err) + } + + env := os.Getenv("KUBERNETES_EXEC_INFO") + if env == "" { + return fmt.Errorf("%s\n%s\n%s", "KUBERNETES_EXEC_INFO env var is unset or empty.", + "The command probably was not called from a Kubernetes client application!", + "See `stackit ske kubeconfig login --help` for detailed usage instructions.") + } + + clusterConfig, err := parseClusterConfig() + if err != nil { + return fmt.Errorf("parseClusterConfig: %w", err) + } + + // Configure API client + apiClient, err := client.ConfigureClient(p) + if err != nil { + return err + } + + cachedKubeconfig := getCachedKubeConfig(clusterConfig.cacheKey) + + if cachedKubeconfig == nil { + return GetAndOutputKubeconfig(ctx, p, apiClient, clusterConfig, false, nil) + } + + certPem, _ := pem.Decode(cachedKubeconfig.CertData) + if certPem == nil { + _ = cache.DeleteObject(clusterConfig.cacheKey) + return GetAndOutputKubeconfig(ctx, p, apiClient, clusterConfig, false, nil) + } + + certificate, err := x509.ParseCertificate(certPem.Bytes) + if err != nil { + _ = cache.DeleteObject(clusterConfig.cacheKey) + return GetAndOutputKubeconfig(ctx, p, apiClient, clusterConfig, false, nil) + } + + // cert is expired, request new + if time.Now().After(certificate.NotAfter.UTC()) { + _ = cache.DeleteObject(clusterConfig.cacheKey) + return GetAndOutputKubeconfig(ctx, p, apiClient, clusterConfig, false, nil) + } + // cert expires within the next 15min, refresh (try to get a new, use cache on failure) + if time.Now().Add(refreshBeforeDuration).After(certificate.NotAfter.UTC()) { + return GetAndOutputKubeconfig(ctx, p, apiClient, clusterConfig, true, cachedKubeconfig) + } + + // cert not expired, nor will it expire in the next 15min; therefore, use the cached kubeconfig + if err := output(p, clusterConfig.cacheKey, cachedKubeconfig); err != nil { + return err + } + return nil + }, + } + return cmd +} + +type clusterConfig struct { + STACKITProjectID string `json:"stackitProjectId"` + ClusterName string `json:"clusterName"` + + cacheKey string +} + +func parseClusterConfig() (*clusterConfig, error) { + obj, _, err := exec.LoadExecCredentialFromEnv() + if err != nil { + return nil, fmt.Errorf("LoadExecCredentialFromEnv: %w", err) + } + + if err := clientauthenticationv1.AddToScheme(scheme.Scheme); err != nil { + return nil, err + } + + obj, err = scheme.Scheme.ConvertToVersion(obj, clientauthenticationv1.SchemeGroupVersion) + if err != nil { + return nil, fmt.Errorf("ConvertToVersion: %w", err) + } + + execCredential, ok := obj.(*clientauthenticationv1.ExecCredential) + if !ok { + return nil, fmt.Errorf("conversion to ExecCredential failed") + } + if execCredential == nil || execCredential.Spec.Cluster == nil { + return nil, fmt.Errorf("ExecCredential contains not all needed fields") + } + config := &clusterConfig{} + err = json.Unmarshal(execCredential.Spec.Cluster.Config.Raw, config) + if err != nil { + return nil, fmt.Errorf("unmarshal: %w", err) + } + + config.cacheKey = fmt.Sprintf("ske-login-%x", sha256.Sum256([]byte(execCredential.Spec.Cluster.Server))) + + return config, nil +} + +func getCachedKubeConfig(key string) *rest.Config { + cachedKubeconfig, err := cache.GetObject(key) + if err != nil { + return nil + } + + restConfig, err := clientcmd.RESTConfigFromKubeConfig(cachedKubeconfig) + if err != nil { + return nil + } + + return restConfig +} + +func GetAndOutputKubeconfig(ctx context.Context, p *print.Printer, apiClient *ske.APIClient, clusterConfig *clusterConfig, fallbackToCache bool, cachedKubeconfig *rest.Config) error { + req := buildRequest(ctx, apiClient, clusterConfig) + kubeconfigResponse, err := req.Execute() + if err != nil { + if fallbackToCache { + return output(p, clusterConfig.cacheKey, cachedKubeconfig) + } + return fmt.Errorf("request kubeconfig: %w", err) + } + + kubeconfig, err := clientcmd.RESTConfigFromKubeConfig([]byte(*kubeconfigResponse.Kubeconfig)) + if err != nil { + if fallbackToCache { + return output(p, clusterConfig.cacheKey, cachedKubeconfig) + } + return fmt.Errorf("parse kubeconfig: %w", err) + } + if err = cache.PutObject(clusterConfig.cacheKey, []byte(*kubeconfigResponse.Kubeconfig)); err != nil { + if fallbackToCache { + return output(p, clusterConfig.cacheKey, cachedKubeconfig) + } + return fmt.Errorf("cache kubeconfig: %w", err) + } + + return output(p, clusterConfig.cacheKey, kubeconfig) +} + +func buildRequest(ctx context.Context, apiClient *ske.APIClient, clusterConfig *clusterConfig) ske.ApiCreateKubeconfigRequest { + req := apiClient.CreateKubeconfig(ctx, clusterConfig.STACKITProjectID, clusterConfig.ClusterName) + expirationSeconds := strconv.Itoa(expirationSeconds) + + return req.CreateKubeconfigPayload(ske.CreateKubeconfigPayload{ExpirationSeconds: &expirationSeconds}) +} + +func output(p *print.Printer, cacheKey string, kubeconfig *rest.Config) error { + if kubeconfig == nil { + _ = cache.DeleteObject(cacheKey) + return errors.New("kubeconfig is nil") + } + + outputExecCredential, err := parseKubeConfigToExecCredential(kubeconfig) + if err != nil { + _ = cache.DeleteObject(cacheKey) + return fmt.Errorf("convert to ExecCredential: %w", err) + } + + output, err := json.Marshal(outputExecCredential) + if err != nil { + _ = cache.DeleteObject(cacheKey) + return fmt.Errorf("marshal ExecCredential: %w", err) + } + + p.Outputf(string(output)) + return nil +} + +func parseKubeConfigToExecCredential(kubeconfig *rest.Config) (*clientauthenticationv1.ExecCredential, error) { + certPem, _ := pem.Decode(kubeconfig.CertData) + if certPem == nil { + return nil, fmt.Errorf("decoded pem is nil") + } + + certificate, err := x509.ParseCertificate(certPem.Bytes) + if err != nil { + return nil, fmt.Errorf("parse certificate: %w", err) + } + + outputExecCredential := clientauthenticationv1.ExecCredential{ + TypeMeta: v1.TypeMeta{ + APIVersion: clientauthenticationv1.SchemeGroupVersion.String(), + Kind: "ExecCredential", + }, + Status: &clientauthenticationv1.ExecCredentialStatus{ + ExpirationTimestamp: &v1.Time{Time: certificate.NotAfter.Add(-time.Minute * 15)}, + ClientCertificateData: string(kubeconfig.CertData), + ClientKeyData: string(kubeconfig.KeyData), + }, + } + return &outputExecCredential, nil +} diff --git a/internal/cmd/ske/kubeconfig/login/login_test.go b/internal/cmd/ske/kubeconfig/login/login_test.go new file mode 100644 index 000000000..c6b94c9a9 --- /dev/null +++ b/internal/cmd/ske/kubeconfig/login/login_test.go @@ -0,0 +1,140 @@ +package login + +import ( + "context" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/google/uuid" + "github.com/stackitcloud/stackit-cli/internal/pkg/utils" + "github.com/stackitcloud/stackit-sdk-go/services/ske" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clientauthenticationv1 "k8s.io/client-go/pkg/apis/clientauthentication/v1" + "k8s.io/client-go/rest" +) + +type testCtxKey struct{} + +var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") +var testClient = &ske.APIClient{} +var testProjectId = uuid.NewString() +var testClusterName = "cluster" + +func fixtureClusterConfig(mods ...func(clusterConfig *clusterConfig)) *clusterConfig { + clusterConfig := &clusterConfig{ + STACKITProjectID: testProjectId, + ClusterName: testClusterName, + cacheKey: "", + } + for _, mod := range mods { + mod(clusterConfig) + } + return clusterConfig +} + +func fixtureRequest(mods ...func(request *ske.ApiCreateKubeconfigRequest)) ske.ApiCreateKubeconfigRequest { + request := testClient.CreateKubeconfig(testCtx, testProjectId, testClusterName) + request = request.CreateKubeconfigPayload(ske.CreateKubeconfigPayload{}) + for _, mod := range mods { + mod(&request) + } + return request +} + +func TestBuildRequest(t *testing.T) { + tests := []struct { + description string + clusterConfig *clusterConfig + expectedRequest ske.ApiCreateKubeconfigRequest + }{ + { + description: "expiration time", + clusterConfig: fixtureClusterConfig(), + expectedRequest: fixtureRequest().CreateKubeconfigPayload(ske.CreateKubeconfigPayload{ + ExpirationSeconds: utils.Ptr("1800")}), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + request := buildRequest(testCtx, testClient, tt.clusterConfig) + + diff := cmp.Diff(request, tt.expectedRequest, + cmp.AllowUnexported(tt.expectedRequest), + cmpopts.EquateComparable(testCtx), + ) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} + +func TestParseKubeConfigToExecCredential(t *testing.T) { + expectedTime, _ := time.Parse(time.RFC3339, "2024-01-01T00:45:00Z") + + tests := []struct { + description string + kubeconfig *rest.Config + expectedExecCredentialRequest *clientauthenticationv1.ExecCredential + }{ + { + description: "expiration time", + kubeconfig: &rest.Config{ + TLSClientConfig: rest.TLSClientConfig{ + CertData: []byte(`-----BEGIN CERTIFICATE----- +MIIBhTCCASugAwIBAgIIF8+zRM8UalAwCgYIKoZIzj0EAwIwGDEWMBQGA1UEAxMN +Y2EtY2xpZW50LXh5ejAeFw0yNDAxMDEwMDAwMDBaFw0yNDAxMDEwMTAwMDBaMC8x +FzAVBgNVBAoTDnN5c3RlbTptYXN0ZXJzMRQwEgYDVQQDEwtza2U6Y2x1c3RlcjBZ +MBMGByqGSM49AgEGCCqGSM49AwEHA0IABJaxZ8G4wEZ1xf44hMV1pQWsti5SL6PH +QF0bRniQEJHSOcZMwc0OrVIfuSV1qSMyvYIaFtBj1j9f2v8oPux7V02jSDBGMA4G +A1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDAjAfBgNVHSMEGDAWgBQt +Pn1pNgfb8xcdRVxVnHDIvb8abzAKBggqhkjOPQQDAgNIADBFAiEA8gG2l0schbMu +zbRjZmli7cnenEnfnNoFIGbgkbjGXRUCIC5zFtWXFK7kA+B2vDxD0DlLcQodNwi4 +2JKP8gT9ol16 +-----END CERTIFICATE-----`), + KeyData: []byte("keykeykey"), + }, + }, + expectedExecCredentialRequest: &clientauthenticationv1.ExecCredential{ + TypeMeta: v1.TypeMeta{ + APIVersion: clientauthenticationv1.SchemeGroupVersion.String(), + Kind: "ExecCredential", + }, + Status: &clientauthenticationv1.ExecCredentialStatus{ + ExpirationTimestamp: &v1.Time{Time: expectedTime}, + ClientCertificateData: `-----BEGIN CERTIFICATE----- +MIIBhTCCASugAwIBAgIIF8+zRM8UalAwCgYIKoZIzj0EAwIwGDEWMBQGA1UEAxMN +Y2EtY2xpZW50LXh5ejAeFw0yNDAxMDEwMDAwMDBaFw0yNDAxMDEwMTAwMDBaMC8x +FzAVBgNVBAoTDnN5c3RlbTptYXN0ZXJzMRQwEgYDVQQDEwtza2U6Y2x1c3RlcjBZ +MBMGByqGSM49AgEGCCqGSM49AwEHA0IABJaxZ8G4wEZ1xf44hMV1pQWsti5SL6PH +QF0bRniQEJHSOcZMwc0OrVIfuSV1qSMyvYIaFtBj1j9f2v8oPux7V02jSDBGMA4G +A1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDAjAfBgNVHSMEGDAWgBQt +Pn1pNgfb8xcdRVxVnHDIvb8abzAKBggqhkjOPQQDAgNIADBFAiEA8gG2l0schbMu +zbRjZmli7cnenEnfnNoFIGbgkbjGXRUCIC5zFtWXFK7kA+B2vDxD0DlLcQodNwi4 +2JKP8gT9ol16 +-----END CERTIFICATE-----`, + ClientKeyData: "keykeykey", + }, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + execCredential, err := parseKubeConfigToExecCredential(tt.kubeconfig) + if err != nil { + t.Fatalf("func returned error: %s", err) + } + if execCredential == nil { + t.Fatal("execCredential is nil") + } + diff := cmp.Diff(execCredential, tt.expectedExecCredentialRequest) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) + } + }) + } +} diff --git a/internal/cmd/ske/options/options.go b/internal/cmd/ske/options/options.go index b41682e08..7bc3a5607 100644 --- a/internal/cmd/ske/options/options.go +++ b/internal/cmd/ske/options/options.go @@ -6,6 +6,7 @@ import ( "fmt" "strings" + "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" "github.com/stackitcloud/stackit-cli/internal/pkg/examples" "github.com/stackitcloud/stackit-cli/internal/pkg/flags" @@ -141,6 +142,14 @@ func outputResult(p *print.Printer, model *inputModel, options *ske.ProviderOpti return fmt.Errorf("marshal SKE options: %w", err) } p.Outputln(string(details)) + return nil + case print.YAMLOutputFormat: + details, err := yaml.MarshalWithOptions(options, yaml.IndentSequence(true)) + if err != nil { + return fmt.Errorf("marshal SKE options: %w", err) + } + p.Outputln(string(details)) + return nil default: return outputResultAsTable(p, model, options) diff --git a/internal/pkg/cache/cache.go b/internal/pkg/cache/cache.go new file mode 100644 index 000000000..d52670fd4 --- /dev/null +++ b/internal/pkg/cache/cache.go @@ -0,0 +1,73 @@ +package cache + +import ( + "errors" + "fmt" + "os" + "path/filepath" + "regexp" +) + +var ( + cacheFolderPath string + + identifierRegex = regexp.MustCompile("^[a-zA-Z0-9-]+$") + ErrorInvalidCacheIdentifier = fmt.Errorf("invalid cache identifier") +) + +func Init() error { + cacheDir, err := os.UserCacheDir() + if err != nil { + return fmt.Errorf("get user cache dir: %w", err) + } + cacheFolderPath = filepath.Join(cacheDir, "stackit") + return nil +} + +func GetObject(identifier string) ([]byte, error) { + if err := validateCacheFolderPath(); err != nil { + return nil, err + } + if !identifierRegex.MatchString(identifier) { + return nil, ErrorInvalidCacheIdentifier + } + + return os.ReadFile(filepath.Join(cacheFolderPath, identifier)) +} + +func PutObject(identifier string, data []byte) error { + if err := validateCacheFolderPath(); err != nil { + return err + } + if !identifierRegex.MatchString(identifier) { + return ErrorInvalidCacheIdentifier + } + + err := os.MkdirAll(cacheFolderPath, os.ModePerm) + if err != nil { + return err + } + + return os.WriteFile(filepath.Join(cacheFolderPath, identifier), data, 0o600) +} + +func DeleteObject(identifier string) error { + if err := validateCacheFolderPath(); err != nil { + return err + } + if !identifierRegex.MatchString(identifier) { + return ErrorInvalidCacheIdentifier + } + + if err := os.Remove(filepath.Join(cacheFolderPath, identifier)); !errors.Is(err, os.ErrNotExist) { + return err + } + return nil +} + +func validateCacheFolderPath() error { + if cacheFolderPath == "" { + return errors.New("cacheFolderPath not set. Forgot to call Init()?") + } + return nil +} diff --git a/internal/pkg/cache/cache_test.go b/internal/pkg/cache/cache_test.go new file mode 100644 index 000000000..4ea003116 --- /dev/null +++ b/internal/pkg/cache/cache_test.go @@ -0,0 +1,207 @@ +package cache + +import ( + "errors" + "os" + "path/filepath" + "testing" + + "github.com/google/uuid" +) + +func TestGetObject(t *testing.T) { + if err := Init(); err != nil { + t.Fatalf("cache init failed: %s", err) + } + + tests := []struct { + description string + identifier string + expectFile bool + expectedErr error + }{ + { + description: "identifier exists", + identifier: "test-cache-get-exists", + expectFile: true, + expectedErr: nil, + }, + { + description: "identifier does not exist", + identifier: "test-cache-get-not-exists", + expectFile: false, + expectedErr: os.ErrNotExist, + }, + { + description: "identifier is invalid", + identifier: "in../../valid", + expectFile: false, + expectedErr: ErrorInvalidCacheIdentifier, + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + id := tt.identifier + "-" + uuid.NewString() + + // setup + if tt.expectFile { + err := os.MkdirAll(cacheFolderPath, os.ModePerm) + if err != nil { + t.Fatalf("create cache folder: %s", err.Error()) + } + path := filepath.Join(cacheFolderPath, id) + if err := os.WriteFile(path, []byte("dummy"), 0o600); err != nil { + t.Fatalf("setup: WriteFile (%s) failed", path) + } + } + // test + file, err := GetObject(id) + + if !errors.Is(err, tt.expectedErr) { + t.Fatalf("returned error (%q) does not match %q", err.Error(), tt.expectedErr.Error()) + } + + if tt.expectFile { + if len(file) < 1 { + t.Fatalf("expected a file but byte array is empty (len %d)", len(file)) + } + } else { + if len(file) > 0 { + t.Fatalf("didn't expect a file, but byte array is not empty (len %d)", len(file)) + } + } + }) + } +} +func TestPutObject(t *testing.T) { + if err := Init(); err != nil { + t.Fatalf("cache init failed: %s", err) + } + + tests := []struct { + description string + identifier string + existingFile bool + expectFile bool + expectedErr error + customPath string + }{ + { + description: "identifier already exists", + identifier: "test-cache-put-exists", + existingFile: true, + expectFile: true, + expectedErr: nil, + }, + { + description: "identifier does not exist", + identifier: "test-cache-put-not-exists", + expectFile: true, + expectedErr: nil, + }, + { + description: "identifier is invalid", + identifier: "in../../valid", + expectFile: false, + expectedErr: ErrorInvalidCacheIdentifier, + }, + { + description: "directory does not yet exist", + identifier: "test-cache-put-folder-not-exists", + expectFile: true, + expectedErr: nil, + customPath: "/tmp/stackit-cli-test", + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + id := tt.identifier + "-" + uuid.NewString() + if tt.customPath != "" { + cacheFolderPath = tt.customPath + } else { + cacheDir, _ := os.UserCacheDir() + cacheFolderPath = filepath.Join(cacheDir, "stackit") + } + path := filepath.Join(cacheFolderPath, id) + + // setup + if tt.existingFile { + if err := os.WriteFile(path, []byte("dummy"), 0o600); err != nil { + t.Fatalf("setup: WriteFile (%s) failed", path) + } + } + // test + err := PutObject(id, []byte("dummy")) + + if !errors.Is(err, tt.expectedErr) { + t.Fatalf("returned error (%q) does not match %q", err.Error(), tt.expectedErr.Error()) + } + + if tt.expectFile { + if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) { + t.Fatalf("expected file (%q) to exist", path) + } + } + }) + } +} + +func TestDeleteObject(t *testing.T) { + if err := Init(); err != nil { + t.Fatalf("cache init failed: %s", err) + } + + tests := []struct { + description string + identifier string + existingFile bool + expectedErr error + }{ + { + description: "identifier exists", + identifier: "test-cache-delete-exists", + existingFile: true, + expectedErr: nil, + }, + { + description: "identifier does not exist", + identifier: "test-cache-delete-not-exists", + existingFile: false, + expectedErr: nil, + }, + { + description: "identifier is invalid", + identifier: "in../../valid", + existingFile: false, + expectedErr: ErrorInvalidCacheIdentifier, + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + id := tt.identifier + "-" + uuid.NewString() + path := filepath.Join(cacheFolderPath, id) + + // setup + if tt.existingFile { + if err := os.WriteFile(path, []byte("dummy"), 0o600); err != nil { + t.Fatalf("setup: WriteFile (%s) failed", path) + } + } + // test + err := DeleteObject(id) + + if !errors.Is(err, tt.expectedErr) { + t.Fatalf("returned error (%q) does not match %q", err.Error(), tt.expectedErr.Error()) + } + + if tt.existingFile { + if _, err := os.Stat(path); !errors.Is(err, os.ErrNotExist) { + t.Fatalf("expected file (%q) to not exist", path) + } + } + }) + } +} diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 8982352a8..b9abf9b31 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -123,7 +123,8 @@ func InitConfig() { // Write saves the config file (wrapping `viper.WriteConfig`) and ensures that its directory exists func Write() error { - if err := createFolderIfNotExists(configFolderPath); err != nil { + err := os.MkdirAll(configFolderPath, os.ModePerm) + if err != nil { return fmt.Errorf("create config directory: %w", err) } return viper.WriteConfig() diff --git a/internal/pkg/config/file_utils.go b/internal/pkg/config/file_utils.go index 44b0ab38a..0895a9dc5 100644 --- a/internal/pkg/config/file_utils.go +++ b/internal/pkg/config/file_utils.go @@ -5,20 +5,6 @@ import ( "os" ) -// createFolderIfNotExists creates a folder if it does not exist. -func createFolderIfNotExists(folderPath string) error { - _, err := os.Stat(folderPath) - if os.IsNotExist(err) { - err := os.MkdirAll(folderPath, os.ModePerm) - if err != nil { - return err - } - } else if err != nil { - return err - } - return nil -} - // readFileIfExists reads the contents of a file and returns it as a string, along with a boolean indicating if the file exists. // If the file does not exist, it returns an empty string and no error. // If the file exists but cannot be read, it returns an error. diff --git a/internal/pkg/config/file_utils_test.go b/internal/pkg/config/file_utils_test.go index b3453c661..d7f299cb6 100644 --- a/internal/pkg/config/file_utils_test.go +++ b/internal/pkg/config/file_utils_test.go @@ -1,51 +1,9 @@ package config import ( - "os" "testing" ) -func TestCreateFolderIfNotExists(t *testing.T) { - tests := []struct { - description string - folderPath string - needsCleanUp bool - }{ - { - description: "folder exists", - folderPath: "test-data/folder-exists", - }, - { - description: "folder does not exist", - folderPath: "test-data/folder-does-not-exist", - needsCleanUp: true, - }, - } - - for _, tt := range tests { - t.Run(tt.description, func(t *testing.T) { - err := createFolderIfNotExists(tt.folderPath) - if err != nil { - t.Errorf("create folder: %v", err) - } - - // Check if the folder was created - _, err = os.Stat(tt.folderPath) - if os.IsNotExist(err) { - t.Errorf("expected folder to exist but it does not") - } - - // Clean up - if tt.needsCleanUp { - err = os.RemoveAll(tt.folderPath) - if err != nil { - t.Errorf("remove folder: %v", err) - } - } - }) - } -} - func TestReadFileIfExists(t *testing.T) { tests := []struct { description string diff --git a/internal/pkg/config/profiles.go b/internal/pkg/config/profiles.go index 219fa879c..ff07fbd7b 100644 --- a/internal/pkg/config/profiles.go +++ b/internal/pkg/config/profiles.go @@ -52,7 +52,7 @@ func SetProfile(p *print.Printer, profile string) error { p.Debug(print.DebugLevel, "persisted new active profile in: %s", profileFilePath) configFolderPath = filepath.Join(defaultConfigFolderPath, profile) - err = createFolderIfNotExists(configFolderPath) + err = os.MkdirAll(configFolderPath, os.ModePerm) if err != nil { return fmt.Errorf("create config folder: %w", err) } diff --git a/internal/pkg/errors/errors.go b/internal/pkg/errors/errors.go index 0bb41a4ab..1cfe6bce8 100644 --- a/internal/pkg/errors/errors.go +++ b/internal/pkg/errors/errors.go @@ -22,6 +22,8 @@ or you can also set it through the environment variable [STACKIT_PROJECT_ID]` Get details on the available flags by re-running your command with the --help flag.` + REQUIRED_MUTUALLY_EXCLUSIVE_FLAGS = `the following flags are mutually exclusive and at least one of them is required: %s` + FAILED_AUTH = `you are not authenticated. You can authenticate as a user by running: @@ -241,6 +243,14 @@ func (e *FlagValidationError) Error() string { return fmt.Sprintf(FLAG_VALIDATION, e.Flag, e.Details) } +type RequiredMutuallyExclusiveFlagsError struct { + Flags []string +} + +func (e *RequiredMutuallyExclusiveFlagsError) Error() string { + return fmt.Sprintf(REQUIRED_MUTUALLY_EXCLUSIVE_FLAGS, strings.Join(e.Flags, ", ")) +} + type ArgValidationError struct { Arg string Details string diff --git a/internal/pkg/globalflags/global_flags.go b/internal/pkg/globalflags/global_flags.go index aca895991..47c48ea13 100644 --- a/internal/pkg/globalflags/global_flags.go +++ b/internal/pkg/globalflags/global_flags.go @@ -27,7 +27,7 @@ const ( VerbosityDefault = InfoVerbosity ) -var outputFormatFlagOptions = []string{print.JSONOutputFormat, print.PrettyOutputFormat, print.NoneOutputFormat} +var outputFormatFlagOptions = []string{print.JSONOutputFormat, print.PrettyOutputFormat, print.NoneOutputFormat, print.YAMLOutputFormat} var verbosityFlagOptions = []string{DebugVerbosity, InfoVerbosity, WarningVerbosity, ErrorVerbosity} type GlobalFlagModel struct { diff --git a/internal/pkg/print/print.go b/internal/pkg/print/print.go index f9f7ce00a..649590c7c 100644 --- a/internal/pkg/print/print.go +++ b/internal/pkg/print/print.go @@ -34,6 +34,7 @@ const ( JSONOutputFormat = "json" PrettyOutputFormat = "pretty" NoneOutputFormat = "none" + YAMLOutputFormat = "yaml" ) var errAborted = errors.New("operation aborted") @@ -183,9 +184,15 @@ func (p *Printer) PagerDisplay(content string) error { // -R: interprets ANSI color and style sequences pagerCmd := exec.Command("less", "-F", "-S", "-w", "-R") + pager, pagerExists := os.LookupEnv("PAGER") + if pagerExists && pager != "nil" && pager != "" { + pagerCmd = exec.Command(pager) // #nosec G204 + } + pagerCmd.Stdin = strings.NewReader(content) pagerCmd.Stdout = p.Cmd.OutOrStdout() + p.Debug(DebugLevel, "using pager: %s", pagerCmd.Args[0]) err := pagerCmd.Run() if err != nil { p.Debug(ErrorLevel, "run pager command: %v", err) diff --git a/internal/pkg/services/mongodbflex/utils/utils.go b/internal/pkg/services/mongodbflex/utils/utils.go index 30b94369e..c582c8de8 100644 --- a/internal/pkg/services/mongodbflex/utils/utils.go +++ b/internal/pkg/services/mongodbflex/utils/utils.go @@ -1,6 +1,7 @@ package utils import ( + "cmp" "context" "fmt" "slices" @@ -118,6 +119,7 @@ type MongoDBFlexClient interface { ListVersionsExecute(ctx context.Context, projectId string) (*mongodbflex.ListVersionsResponse, error) GetInstanceExecute(ctx context.Context, projectId, instanceId string) (*mongodbflex.GetInstanceResponse, error) GetUserExecute(ctx context.Context, projectId, instanceId, userId string) (*mongodbflex.GetUserResponse, error) + ListRestoreJobsExecute(ctx context.Context, projectId string, instanceId string) (*mongodbflex.ListRestoreJobsResponse, error) } func GetLatestMongoDBVersion(ctx context.Context, apiClient MongoDBFlexClient, projectId string) (string, error) { @@ -157,3 +159,26 @@ func GetUserName(ctx context.Context, apiClient MongoDBFlexClient, projectId, in } return *resp.Item.Username, nil } + +func GetRestoreStatus(backupId string, restoreJobs *mongodbflex.ListRestoreJobsResponse) string { + state := "-" + if restoreJobs.Items == nil { + return state + } + + restoreJobsSlice := *restoreJobs.Items + + // sort array by descending date + slices.SortFunc(restoreJobsSlice, func(i, j mongodbflex.RestoreInstanceStatus) int { + // swap elements to sort by descending order + return cmp.Compare(*j.Date, *i.Date) + }) + + for _, restoreJob := range *restoreJobs.Items { + if *restoreJob.BackupID == backupId { + state = *restoreJob.Status + break + } + } + return state +} diff --git a/internal/pkg/services/mongodbflex/utils/utils_test.go b/internal/pkg/services/mongodbflex/utils/utils_test.go index c8339e822..bdea1a34b 100644 --- a/internal/pkg/services/mongodbflex/utils/utils_test.go +++ b/internal/pkg/services/mongodbflex/utils/utils_test.go @@ -16,6 +16,7 @@ var ( testProjectId = uuid.NewString() testInstanceId = uuid.NewString() testUserId = uuid.NewString() + testBackupId = uuid.NewString() ) const ( @@ -24,12 +25,14 @@ const ( ) type mongoDBFlexClientMocked struct { - listVersionsFails bool - listVersionsResp *mongodbflex.ListVersionsResponse - getInstanceFails bool - getInstanceResp *mongodbflex.GetInstanceResponse - getUserFails bool - getUserResp *mongodbflex.GetUserResponse + listVersionsFails bool + listVersionsResp *mongodbflex.ListVersionsResponse + getInstanceFails bool + getInstanceResp *mongodbflex.GetInstanceResponse + getUserFails bool + getUserResp *mongodbflex.GetUserResponse + listRestoreJobsFails bool + listRestoreJobsResp *mongodbflex.ListRestoreJobsResponse } func (m *mongoDBFlexClientMocked) ListVersionsExecute(_ context.Context, _ string) (*mongodbflex.ListVersionsResponse, error) { @@ -39,6 +42,13 @@ func (m *mongoDBFlexClientMocked) ListVersionsExecute(_ context.Context, _ strin return m.listVersionsResp, nil } +func (m *mongoDBFlexClientMocked) ListRestoreJobsExecute(_ context.Context, _, _ string) (*mongodbflex.ListRestoreJobsResponse, error) { + if m.listRestoreJobsFails { + return nil, fmt.Errorf("could not list versions") + } + return m.listRestoreJobsResp, nil +} + func (m *mongoDBFlexClientMocked) GetInstanceExecute(_ context.Context, _, _ string) (*mongodbflex.GetInstanceResponse, error) { if m.getInstanceFails { return nil, fmt.Errorf("could not get instance") @@ -364,7 +374,7 @@ func TestLoadFlavorId(t *testing.T) { } } -func TestGetLatestPostgreSQLVersion(t *testing.T) { +func TestGetLatestMongoDBFlexVersion(t *testing.T) { tests := []struct { description string listVersionsFails bool @@ -518,3 +528,119 @@ func TestGetUserName(t *testing.T) { }) } } + +func TestGetRestoreStatus(t *testing.T) { + tests := []struct { + description string + listRestoreJobsResp *mongodbflex.ListRestoreJobsResponse + expectedOutput string + }{ + { + description: "base", + listRestoreJobsResp: &mongodbflex.ListRestoreJobsResponse{ + Items: &[]mongodbflex.RestoreInstanceStatus{ + { + BackupID: utils.Ptr(testBackupId), + Date: utils.Ptr("2024-05-14T12:01:11Z"), + Status: utils.Ptr("state"), + }, + { + BackupID: utils.Ptr("bar"), + Date: utils.Ptr("2024-05-14T12:01:11Z"), + Status: utils.Ptr("state 2"), + }, + }, + }, + expectedOutput: "state", + }, + { + description: "get latest restore, ordered array", + listRestoreJobsResp: &mongodbflex.ListRestoreJobsResponse{ + Items: &[]mongodbflex.RestoreInstanceStatus{ + { + BackupID: utils.Ptr(testBackupId), + Date: utils.Ptr("2024-05-14T12:01:11Z"), + Status: utils.Ptr("in progress"), + }, + { + BackupID: utils.Ptr(testBackupId), + Date: utils.Ptr("2024-05-13T12:01:11Z"), + Status: utils.Ptr("finished"), + }, + }, + }, + expectedOutput: "in progress", + }, + { + description: "get latest restore, unordered array", + listRestoreJobsResp: &mongodbflex.ListRestoreJobsResponse{ + Items: &[]mongodbflex.RestoreInstanceStatus{ + { + BackupID: utils.Ptr(testBackupId), + Date: utils.Ptr("2024-05-13T12:01:11Z"), + Status: utils.Ptr("finished"), + }, + { + BackupID: utils.Ptr(testBackupId), + Date: utils.Ptr("2024-05-14T12:01:11Z"), + Status: utils.Ptr("in progress"), + }, + }, + }, + expectedOutput: "in progress", + }, + { + description: "get latest restore, another date format", + listRestoreJobsResp: &mongodbflex.ListRestoreJobsResponse{ + Items: &[]mongodbflex.RestoreInstanceStatus{ + { + BackupID: utils.Ptr(testBackupId), + Date: utils.Ptr("2009-11-10 23:00:00 +0000 UTC m=+0.000000001"), + Status: utils.Ptr("finished"), + }, + { + BackupID: utils.Ptr(testBackupId), + Date: utils.Ptr("2009-11-11 23:00:00 +0000 UTC m=+0.000000001"), + Status: utils.Ptr("in progress"), + }, + }, + }, + expectedOutput: "in progress", + }, + { + description: "no restore job for that backup", + listRestoreJobsResp: &mongodbflex.ListRestoreJobsResponse{ + Items: &[]mongodbflex.RestoreInstanceStatus{ + { + BackupID: utils.Ptr("bar"), + Date: utils.Ptr("2024-05-13T12:01:11Z"), + Status: utils.Ptr("in progress"), + }, + { + BackupID: utils.Ptr("bar"), + Date: utils.Ptr("2024-05-13T12:01:11Z"), + Status: utils.Ptr("finished"), + }, + }, + }, + expectedOutput: "-", + }, + { + description: "no restore jobs", + listRestoreJobsResp: &mongodbflex.ListRestoreJobsResponse{ + Items: nil, + }, + expectedOutput: "-", + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + output := GetRestoreStatus(testBackupId, tt.listRestoreJobsResp) + + if output != tt.expectedOutput { + t.Errorf("expected output to be %s, got %s", tt.expectedOutput, output) + } + }) + } +}