mygithub.libinneed.workers.dev/stackitcloud/stackit-cli
Advanced tools
@@ -7,3 +7,9 @@ ## stackit config list | ||
| Lists the current CLI configuration values. | ||
| Lists the current CLI configuration values, based on the following sources (in order of precedence): | ||
| - Environment variable | ||
| The environment variable is the name of the setting, with underscores ("_") instead of dashes ("-") and the "STACKIT" prefix. | ||
| Example: you can set the project ID by setting the environment variable STACKIT_PROJECT_ID. | ||
| - Configuration set in CLI | ||
| These are set using the "stackit config set" command | ||
| Example: you can set the project ID by running "stackit config set --project-id xxx" | ||
@@ -38,3 +44,3 @@ ``` | ||
| * [stackit config](./stackit_config.md) - CLI configuration options | ||
| * [stackit config](./stackit_config.md) - Provides functionality for CLI configuration options | ||
@@ -8,3 +8,3 @@ ## stackit config set | ||
| Sets CLI configuration options. | ||
| All of the configuration options can be set using an environment variable, which takes precedence over what is configured. | ||
| All of the configuration options can be set using an environment variable, which takes precedence over what is configured using this command. | ||
| The environment variable is the name of the flag, with underscores ("_") instead of dashes ("-") and the "STACKIT" prefix. | ||
@@ -20,9 +20,9 @@ Example: to set the project ID you can set the environment variable STACKIT_PROJECT_ID. | ||
| ``` | ||
| Set a project ID in your active configuration. This project ID will be used by every command, as long as it's not overridden by the "STACKIT_PROJECT_ID" environment variable or the command flag | ||
| Set a project ID in your active configuration. This project ID will be used by every command (unless overridden by the "STACKIT_PROJECT_ID" environment variable) | ||
| $ stackit config set --project-id xxx | ||
| Set the session time limit to 1 hour. After this time you will be prompted to login again to be able to execute commands that need authentication | ||
| Set the session time limit to 1 hour | ||
| $ stackit config set --session-time-limit 1h | ||
| Set the DNS custom endpoint. This endpoint will be used on all calls to the DNS API, unless overridden by the "STACKIT_DNS_CUSTOM_ENDPOINT" environment variable | ||
| Set the DNS custom endpoint. This endpoint will be used on all calls to the DNS API (unless overridden by the "STACKIT_DNS_CUSTOM_ENDPOINT" environment variable) | ||
| $ stackit config set --dns-custom-endpoint https://dns.stackit.cloud | ||
@@ -34,16 +34,16 @@ ``` | ||
| ``` | ||
| --authorization-custom-endpoint string Authorization custom endpoint | ||
| --dns-custom-endpoint string DNS custom endpoint | ||
| --authorization-custom-endpoint string Authorization API base URL, used in calls to this API | ||
| --dns-custom-endpoint string DNS API base URL, used in calls to this API | ||
| -h, --help Help for "stackit config set" | ||
| --logme-custom-endpoint string LogMe custom endpoint | ||
| --mariadb-custom-endpoint string MariaDB custom endpoint | ||
| --mongodbflex-custom-endpoint string MongoDB Flex custom endpoint | ||
| --opensearch-custom-endpoint string OpenSearch custom endpoint | ||
| --postgresflex-custom-endpoint string PostgreSQL Flex custom endpoint | ||
| --rabbitmq-custom-endpoint string RabbitMQ custom endpoint | ||
| --redis-custom-endpoint string Redis custom endpoint | ||
| --resource-manager-custom-endpoint string Resource manager custom endpoint | ||
| --service-account-custom-endpoint string Service Account custom endpoint | ||
| --session-time-limit string Maximum time before authentication is required again. Can't be larger than 24h. Examples: 3h, 5h30m40s (BETA: currently values greater than 2h have no effect) | ||
| --ske-custom-endpoint string SKE custom endpoint | ||
| --logme-custom-endpoint string LogMe API base URL, used in calls to this API | ||
| --mariadb-custom-endpoint string MariaDB API base URL, used in calls to this API | ||
| --mongodbflex-custom-endpoint string MongoDB Flex API base URL, used in calls to this API | ||
| --opensearch-custom-endpoint string OpenSearch API base URL, used in calls to this API | ||
| --postgresflex-custom-endpoint string PostgreSQL Flex API base URL, used in calls to this API | ||
| --rabbitmq-custom-endpoint string RabbitMQ API base URL, used in calls to this API | ||
| --redis-custom-endpoint string Redis API base URL, used in calls to this API | ||
| --resource-manager-custom-endpoint string Resource Manager API base URL, used in calls to this API | ||
| --service-account-custom-endpoint string Service Account API base URL, used in calls to this API | ||
| --session-time-limit string Maximum time before authentication is required again. After this time, you will be prompted to login again to execute commands that require authentication. Can't be larger than 24h. Requires authentication after being set to take effect. Examples: 3h, 5h30m40s (BETA: currently values greater than 2h have no effect) | ||
| --ske-custom-endpoint string SKE API base URL, used in calls to this API | ||
| ``` | ||
@@ -62,3 +62,3 @@ | ||
| * [stackit config](./stackit_config.md) - CLI configuration options | ||
| * [stackit config](./stackit_config.md) - Provides functionality for CLI configuration options | ||
@@ -7,3 +7,3 @@ ## stackit config unset | ||
| Unsets CLI configuration options. | ||
| Unsets CLI configuration options, undoing past usages of the `stackit config set` command. | ||
@@ -31,17 +31,18 @@ ``` | ||
| --async Configuration option to run commands asynchronously | ||
| --authorization-custom-endpoint Authorization custom endpoint | ||
| --dns-custom-endpoint DNS custom endpoint | ||
| --authorization-custom-endpoint Authorization API base URL. If unset, uses the default base URL | ||
| --dns-custom-endpoint DNS API base URL. If unset, uses the default base URL | ||
| -h, --help Help for "stackit config unset" | ||
| --logme-custom-endpoint LogMe custom endpoint | ||
| --mariadb-custom-endpoint MariaDB custom endpoint | ||
| --mongodbflex-custom-endpoint MongoDB Flex custom endpoint | ||
| --opensearch-custom-endpoint OpenSearch custom endpoint | ||
| --logme-custom-endpoint LogMe API base URL. If unset, uses the default base URL | ||
| --mariadb-custom-endpoint MariaDB API base URL. If unset, uses the default base URL | ||
| --mongodbflex-custom-endpoint MongoDB Flex API base URL. If unset, uses the default base URL | ||
| --opensearch-custom-endpoint OpenSearch API base URL. If unset, uses the default base URL | ||
| --output-format Output format | ||
| --postgresflex-custom-endpoint PostgreSQL Flex custom endpoint | ||
| --postgresflex-custom-endpoint PostgreSQL Flex API base URL. If unset, uses the default base URL | ||
| --project-id Project ID | ||
| --rabbitmq-custom-endpoint RabbitMQ custom endpoint | ||
| --redis-custom-endpoint Redis custom endpoint | ||
| --resource-manager-custom-endpoint Resource Manager custom endpoint | ||
| --service-account-custom-endpoint SKE custom endpoint | ||
| --ske-custom-endpoint SKE custom endpoint | ||
| --rabbitmq-custom-endpoint RabbitMQ API base URL. If unset, uses the default base URL | ||
| --redis-custom-endpoint Redis API base URL. If unset, uses the default base URL | ||
| --resource-manager-custom-endpoint Resource Manager API base URL. If unset, uses the default base URL | ||
| --service-account-custom-endpoint SKE API base URL. If unset, uses the default base URL | ||
| --session-time-limit Maximum time before authentication is required again. If unset, defaults to 2h | ||
| --ske-custom-endpoint SKE API base URL. If unset, uses the default base URL | ||
| ``` | ||
@@ -57,3 +58,3 @@ | ||
| * [stackit config](./stackit_config.md) - CLI configuration options | ||
| * [stackit config](./stackit_config.md) - Provides functionality for CLI configuration options | ||
| ## stackit config | ||
| CLI configuration options | ||
| Provides functionality for CLI configuration options | ||
| ### Synopsis | ||
| CLI configuration options. | ||
| Provides functionality for CLI configuration options. | ||
@@ -9,0 +9,0 @@ ``` |
@@ -16,13 +16,13 @@ ## stackit curl | ||
| ``` | ||
| Make a GET request to http://locahost:8000 | ||
| $ stackit curl http://locahost:8000 | ||
| Get all the DNS zones for project with ID xxx via GET request to https://dns.api.stackit.cloud/v1/projects/xxx/zones | ||
| $ stackit curl https://dns.api.stackit.cloud/v1/projects/xxx/zones | ||
| Make a GET request to http://locahost:8000, write complete response (headers and body) to file "./output.txt" | ||
| $ stackit curl http://locahost:8000 -include --output ./output.txt | ||
| Get all the DNS zones for project with ID xxx via GET request to https://dns.api.stackit.cloud/v1/projects/xxx/zones, write complete response (headers and body) to file "./output.txt" | ||
| $ stackit curl https://dns.api.stackit.cloud/v1/projects/xxx/zones -include --output ./output.txt | ||
| Make a POST request to http://locahost:8000 with payload from file "./payload.json" | ||
| $ stackit curl http://locahost:8000 -X POST --data @./payload.json | ||
| Create a new DNS zone for project with ID xxx via POST request to https://dns.api.stackit.cloud/v1/projects/xxx/zones with payload from file "./payload.json" | ||
| $ stackit curl https://dns.api.stackit.cloud/v1/projects/xxx/zones -X POST --data @./payload.json | ||
| Make a POST request to http://locahost:8000 with header "Foo: Bar", fail if server returns error (such as 403 Forbidden) | ||
| $ stackit curl http://locahost:8000 -X POST -H "Foo: Bar" --fail | ||
| Get all the DNS zones for project with ID xxx via GET request to https://dns.api.stackit.cloud/v1/projects/xxx/zones, with header "Authorization: Bearer yyy", fail if server returns error (such as 403 Forbidden) | ||
| $ stackit curl https://dns.api.stackit.cloud/v1/projects/xxx/zones -X POST -H "Authorization: Bearer yyy" --fail | ||
| ``` | ||
@@ -29,0 +29,0 @@ |
@@ -25,4 +25,4 @@ ## stackit dns zone list | ||
| List the deleted DNS zones | ||
| $ stackit dns zone list --deleted | ||
| List DNS zones, including deleted | ||
| $ stackit dns zone list --include-deleted | ||
| ``` | ||
@@ -34,5 +34,5 @@ | ||
| --active Filter for active zones | ||
| --deleted Filter for deleted zones | ||
| -h, --help Help for "stackit dns zone list" | ||
| --inactive Filter for inactive zones. Deleted zones are always inactive and will be included when this flag is set | ||
| --inactive Filter for inactive zones | ||
| --include-deleted Includes successfully deleted zones (if unset, these are filtered out) | ||
| --limit int Maximum number of entries to list | ||
@@ -39,0 +39,0 @@ --name-like string Filter by name |
@@ -17,9 +17,9 @@ ## stackit organization member list | ||
| List all members of an organization | ||
| $ stackit organization role list --organization-id xxx | ||
| $ stackit organization member list --organization-id xxx | ||
| List all members of an organization in JSON format | ||
| $ stackit organization role list --organization-id xxx --output-format json | ||
| $ stackit organization member list --organization-id xxx --output-format json | ||
| List up to 10 members of an organization | ||
| $ stackit organization role list --organization-id xxx --limit 10 | ||
| $ stackit organization member list --organization-id xxx --limit 10 | ||
| ``` | ||
@@ -26,0 +26,0 @@ |
@@ -19,3 +19,3 @@ ## stackit service-account token create | ||
| Create an access token for the service account with email "my-service-account-1234567@sa.stackit.cloud" with a default time to live | ||
| $ stackit service-account token create --sa-email my-service-account-1234567@sa.stackit.cloud | ||
| $ stackit service-account token create --email my-service-account-1234567@sa.stackit.cloud | ||
@@ -22,0 +22,0 @@ Create an access token for the service account with email "my-service-account-1234567@sa.stackit.cloud" with a time to live of 10 days |
+1
-1
@@ -29,3 +29,3 @@ ## stackit | ||
| * [stackit auth](./stackit_auth.md) - Provides authentication functionality | ||
| * [stackit config](./stackit_config.md) - CLI configuration options | ||
| * [stackit config](./stackit_config.md) - Provides functionality for CLI configuration options | ||
| * [stackit curl](./stackit_curl.md) - Executes an authenticated HTTP request to an endpoint | ||
@@ -32,0 +32,0 @@ * [stackit dns](./stackit_dns.md) - Provides functionality for DNS |
@@ -16,4 +16,4 @@ package config | ||
| Use: "config", | ||
| Short: "CLI configuration options", | ||
| Long: "CLI configuration options.", | ||
| Short: "Provides functionality for CLI configuration options", | ||
| Long: "Provides functionality for CLI configuration options.", | ||
| Args: args.NoArgs, | ||
@@ -20,0 +20,0 @@ Run: utils.CmdHelp, |
@@ -7,2 +7,3 @@ package list | ||
| "sort" | ||
| "strconv" | ||
| "strings" | ||
@@ -23,4 +24,12 @@ | ||
| Short: "Lists the current CLI configuration values", | ||
| Long: "Lists the current CLI configuration values.", | ||
| Args: args.NoArgs, | ||
| Long: fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s", | ||
| "Lists the current CLI configuration values, based on the following sources (in order of precedence):", | ||
| "- Environment variable", | ||
| ` The environment variable is the name of the setting, with underscores ("_") instead of dashes ("-") and the "STACKIT" prefix.`, | ||
| " Example: you can set the project ID by setting the environment variable STACKIT_PROJECT_ID.", | ||
| "- Configuration set in CLI", | ||
| ` These are set using the "stackit config set" command`, | ||
| ` Example: you can set the project ID by running "stackit config set --project-id xxx"`, | ||
| ), | ||
| Args: args.NoArgs, | ||
| Example: examples.Build( | ||
@@ -50,4 +59,16 @@ examples.NewExample( | ||
| value := configData[key] | ||
| // Convert value to string | ||
| // (Assuming value is either string or bool) | ||
| valueString, ok := value.(string) | ||
| if !ok || valueString == "" { | ||
| if !ok { | ||
| valueBool, ok := value.(bool) | ||
| if !ok { | ||
| continue | ||
| } | ||
| valueString = strconv.FormatBool(valueBool) | ||
| } | ||
| // Don't show unset values | ||
| if valueString == "" { | ||
| continue | ||
@@ -54,0 +75,0 @@ } |
@@ -47,3 +47,3 @@ package set | ||
| "Sets CLI configuration options.", | ||
| "All of the configuration options can be set using an environment variable, which takes precedence over what is configured.", | ||
| "All of the configuration options can be set using an environment variable, which takes precedence over what is configured using this command.", | ||
| `The environment variable is the name of the flag, with underscores ("_") instead of dashes ("-") and the "STACKIT" prefix.`, | ||
@@ -55,9 +55,9 @@ "Example: to set the project ID you can set the environment variable STACKIT_PROJECT_ID.", | ||
| examples.NewExample( | ||
| `Set a project ID in your active configuration. This project ID will be used by every command, as long as it's not overridden by the "STACKIT_PROJECT_ID" environment variable or the command flag`, | ||
| `Set a project ID in your active configuration. This project ID will be used by every command (unless overridden by the "STACKIT_PROJECT_ID" environment variable)`, | ||
| "$ stackit config set --project-id xxx"), | ||
| examples.NewExample( | ||
| `Set the session time limit to 1 hour. After this time you will be prompted to login again to be able to execute commands that need authentication`, | ||
| `Set the session time limit to 1 hour`, | ||
| "$ stackit config set --session-time-limit 1h"), | ||
| examples.NewExample( | ||
| `Set the DNS custom endpoint. This endpoint will be used on all calls to the DNS API, unless overridden by the "STACKIT_DNS_CUSTOM_ENDPOINT" environment variable`, | ||
| `Set the DNS custom endpoint. This endpoint will be used on all calls to the DNS API (unless overridden by the "STACKIT_DNS_CUSTOM_ENDPOINT" environment variable)`, | ||
| "$ stackit config set --dns-custom-endpoint https://dns.stackit.cloud"), | ||
@@ -93,16 +93,16 @@ ), | ||
| func configureFlags(cmd *cobra.Command) { | ||
| cmd.Flags().String(sessionTimeLimitFlag, "", "Maximum time before authentication is required again. Can't be larger than 24h. Examples: 3h, 5h30m40s (BETA: currently values greater than 2h have no effect)") | ||
| cmd.Flags().String(sessionTimeLimitFlag, "", "Maximum time before authentication is required again. After this time, you will be prompted to login again to execute commands that require authentication. Can't be larger than 24h. Requires authentication after being set to take effect. Examples: 3h, 5h30m40s (BETA: currently values greater than 2h have no effect)") | ||
| cmd.Flags().String(authorizationCustomEndpointFlag, "", "Authorization custom endpoint") | ||
| cmd.Flags().String(dnsCustomEndpointFlag, "", "DNS custom endpoint") | ||
| cmd.Flags().String(logMeCustomEndpointFlag, "", "LogMe custom endpoint") | ||
| cmd.Flags().String(mariaDBCustomEndpointFlag, "", "MariaDB custom endpoint") | ||
| cmd.Flags().String(mongoDBFlexCustomEndpointFlag, "", "MongoDB Flex custom endpoint") | ||
| cmd.Flags().String(openSearchCustomEndpointFlag, "", "OpenSearch custom endpoint") | ||
| cmd.Flags().String(postgresFlexCustomEndpointFlag, "", "PostgreSQL Flex custom endpoint") | ||
| cmd.Flags().String(rabbitMQCustomEndpointFlag, "", "RabbitMQ custom endpoint") | ||
| cmd.Flags().String(redisCustomEndpointFlag, "", "Redis custom endpoint") | ||
| cmd.Flags().String(resourceManagerCustomEndpointFlag, "", "Resource manager custom endpoint") | ||
| cmd.Flags().String(serviceAccountCustomEndpointFlag, "", "Service Account custom endpoint") | ||
| cmd.Flags().String(skeCustomEndpointFlag, "", "SKE custom endpoint") | ||
| cmd.Flags().String(authorizationCustomEndpointFlag, "", "Authorization API base URL, used in calls to this API") | ||
| cmd.Flags().String(dnsCustomEndpointFlag, "", "DNS API base URL, used in calls to this API") | ||
| cmd.Flags().String(logMeCustomEndpointFlag, "", "LogMe API base URL, used in calls to this API") | ||
| cmd.Flags().String(mariaDBCustomEndpointFlag, "", "MariaDB API base URL, used in calls to this API") | ||
| cmd.Flags().String(mongoDBFlexCustomEndpointFlag, "", "MongoDB Flex API base URL, used in calls to this API") | ||
| cmd.Flags().String(openSearchCustomEndpointFlag, "", "OpenSearch API base URL, used in calls to this API") | ||
| cmd.Flags().String(postgresFlexCustomEndpointFlag, "", "PostgreSQL Flex API base URL, used in calls to this API") | ||
| cmd.Flags().String(rabbitMQCustomEndpointFlag, "", "RabbitMQ API base URL, used in calls to this API") | ||
| cmd.Flags().String(redisCustomEndpointFlag, "", "Redis API base URL, used in calls to this API") | ||
| cmd.Flags().String(resourceManagerCustomEndpointFlag, "", "Resource Manager API base URL, used in calls to this API") | ||
| cmd.Flags().String(serviceAccountCustomEndpointFlag, "", "Service Account API base URL, used in calls to this API") | ||
| cmd.Flags().String(skeCustomEndpointFlag, "", "SKE API base URL, used in calls to this API") | ||
@@ -109,0 +109,0 @@ err := viper.BindPFlag(config.AuthorizationCustomEndpointKey, cmd.Flags().Lookup(authorizationCustomEndpointFlag)) |
@@ -21,2 +21,4 @@ package unset | ||
| sessionTimeLimitFlag = "session-time-limit" | ||
| authorizationCustomEndpointFlag = "authorization-custom-endpoint" | ||
@@ -41,2 +43,4 @@ dnsCustomEndpointFlag = "dns-custom-endpoint" | ||
| SessionTimeLimit bool | ||
| AuthorizationCustomEndpoint bool | ||
@@ -60,3 +64,3 @@ DNSCustomEndpoint bool | ||
| Short: "Unsets CLI configuration options", | ||
| Long: "Unsets CLI configuration options.", | ||
| Long: "Unsets CLI configuration options, undoing past usages of the `stackit config set` command.", | ||
| Args: args.NoArgs, | ||
@@ -78,3 +82,3 @@ Example: examples.Build( | ||
| if model.AsyncFlag { | ||
| viper.Set(config.AsyncKey, "") | ||
| viper.Set(config.AsyncKey, config.AsyncDefault) | ||
| } | ||
@@ -88,2 +92,6 @@ if model.OutputFormat { | ||
| if model.SessionTimeLimit { | ||
| viper.Set(config.SessionTimeLimitKey, config.SessionTimeLimitDefault) | ||
| } | ||
| if model.AuthorizationCustomEndpoint { | ||
@@ -142,14 +150,16 @@ viper.Set(config.AuthorizationCustomEndpointKey, "") | ||
| cmd.Flags().Bool(authorizationCustomEndpointFlag, false, "Authorization custom endpoint") | ||
| cmd.Flags().Bool(dnsCustomEndpointFlag, false, "DNS custom endpoint") | ||
| cmd.Flags().Bool(logMeCustomEndpointFlag, false, "LogMe custom endpoint") | ||
| cmd.Flags().Bool(mariaDBCustomEndpointFlag, false, "MariaDB custom endpoint") | ||
| cmd.Flags().Bool(mongoDBFlexCustomEndpointFlag, false, "MongoDB Flex custom endpoint") | ||
| cmd.Flags().Bool(openSearchCustomEndpointFlag, false, "OpenSearch custom endpoint") | ||
| cmd.Flags().Bool(postgresFlexCustomEndpointFlag, false, "PostgreSQL Flex custom endpoint") | ||
| cmd.Flags().Bool(rabbitMQCustomEndpointFlag, false, "RabbitMQ custom endpoint") | ||
| cmd.Flags().Bool(redisCustomEndpointFlag, false, "Redis custom endpoint") | ||
| cmd.Flags().Bool(resourceManagerCustomEndpointFlag, false, "Resource Manager custom endpoint") | ||
| cmd.Flags().Bool(serviceAccountCustomEndpointFlag, false, "SKE custom endpoint") | ||
| cmd.Flags().Bool(skeCustomEndpointFlag, false, "SKE custom endpoint") | ||
| cmd.Flags().Bool(sessionTimeLimitFlag, false, fmt.Sprintf("Maximum time before authentication is required again. If unset, defaults to %s", config.SessionTimeLimitDefault)) | ||
| cmd.Flags().Bool(authorizationCustomEndpointFlag, false, "Authorization API base URL. If unset, uses the default base URL") | ||
| cmd.Flags().Bool(dnsCustomEndpointFlag, false, "DNS API base URL. If unset, uses the default base URL") | ||
| cmd.Flags().Bool(logMeCustomEndpointFlag, false, "LogMe API base URL. If unset, uses the default base URL") | ||
| cmd.Flags().Bool(mariaDBCustomEndpointFlag, false, "MariaDB API base URL. If unset, uses the default base URL") | ||
| cmd.Flags().Bool(mongoDBFlexCustomEndpointFlag, false, "MongoDB Flex API base URL. If unset, uses the default base URL") | ||
| cmd.Flags().Bool(openSearchCustomEndpointFlag, false, "OpenSearch API base URL. If unset, uses the default base URL") | ||
| cmd.Flags().Bool(postgresFlexCustomEndpointFlag, false, "PostgreSQL Flex API base URL. If unset, uses the default base URL") | ||
| cmd.Flags().Bool(rabbitMQCustomEndpointFlag, false, "RabbitMQ API base URL. If unset, uses the default base URL") | ||
| cmd.Flags().Bool(redisCustomEndpointFlag, false, "Redis API base URL. If unset, uses the default base URL") | ||
| cmd.Flags().Bool(resourceManagerCustomEndpointFlag, false, "Resource Manager API base URL. If unset, uses the default base URL") | ||
| cmd.Flags().Bool(serviceAccountCustomEndpointFlag, false, "SKE API base URL. If unset, uses the default base URL") | ||
| cmd.Flags().Bool(skeCustomEndpointFlag, false, "SKE API base URL. If unset, uses the default base URL") | ||
| } | ||
@@ -163,2 +173,3 @@ | ||
| SessionTimeLimit: flags.FlagToBoolValue(cmd, sessionTimeLimitFlag), | ||
| AuthorizationCustomEndpoint: flags.FlagToBoolValue(cmd, authorizationCustomEndpointFlag), | ||
@@ -165,0 +176,0 @@ DNSCustomEndpoint: flags.FlagToBoolValue(cmd, dnsCustomEndpointFlag), |
@@ -53,16 +53,16 @@ package curl | ||
| examples.NewExample( | ||
| "Make a GET request to http://locahost:8000", | ||
| "$ stackit curl http://locahost:8000", | ||
| "Get all the DNS zones for project with ID xxx via GET request to https://dns.api.stackit.cloud/v1/projects/xxx/zones", | ||
| "$ stackit curl https://dns.api.stackit.cloud/v1/projects/xxx/zones", | ||
| ), | ||
| examples.NewExample( | ||
| `Make a GET request to http://locahost:8000, write complete response (headers and body) to file "./output.txt"`, | ||
| "$ stackit curl http://locahost:8000 -include --output ./output.txt", | ||
| `Get all the DNS zones for project with ID xxx via GET request to https://dns.api.stackit.cloud/v1/projects/xxx/zones, write complete response (headers and body) to file "./output.txt"`, | ||
| "$ stackit curl https://dns.api.stackit.cloud/v1/projects/xxx/zones -include --output ./output.txt", | ||
| ), | ||
| examples.NewExample( | ||
| `Make a POST request to http://locahost:8000 with payload from file "./payload.json"`, | ||
| `$ stackit curl http://locahost:8000 -X POST --data @./payload.json`, | ||
| `Create a new DNS zone for project with ID xxx via POST request to https://dns.api.stackit.cloud/v1/projects/xxx/zones with payload from file "./payload.json"`, | ||
| `$ stackit curl https://dns.api.stackit.cloud/v1/projects/xxx/zones -X POST --data @./payload.json`, | ||
| ), | ||
| examples.NewExample( | ||
| `Make a POST request to http://locahost:8000 with header "Foo: Bar", fail if server returns error (such as 403 Forbidden)`, | ||
| `$ stackit curl http://locahost:8000 -X POST -H "Foo: Bar" --fail`, | ||
| `Get all the DNS zones for project with ID xxx via GET request to https://dns.api.stackit.cloud/v1/projects/xxx/zones, with header "Authorization: Bearer yyy", fail if server returns error (such as 403 Forbidden)`, | ||
| `$ stackit curl https://dns.api.stackit.cloud/v1/projects/xxx/zones -X POST -H "Authorization: Bearer yyy" --fail`, | ||
| ), | ||
@@ -126,3 +126,3 @@ ), | ||
| if !strings.HasSuffix(urlHost, "stackit.cloud") { | ||
| return fmt.Errorf("only urls belonging to STACKIT are permitted") | ||
| return fmt.Errorf("only urls belonging to STACKIT are permitted, hostname must end in stackit.cloud") | ||
| } | ||
@@ -129,0 +129,0 @@ return nil |
@@ -81,9 +81,9 @@ package list | ||
| { | ||
| description: "deleted zones", | ||
| description: "include deleted zones", | ||
| flagValues: fixtureFlagValues(func(flagValues map[string]string) { | ||
| flagValues[deletedFlag] = "true" | ||
| flagValues[includeDeletedFlag] = "true" | ||
| }), | ||
| isValid: true, | ||
| expectedModel: fixtureInputModel(func(model *inputModel) { | ||
| model.Deleted = true | ||
| model.IncludeDeleted = true | ||
| }), | ||
@@ -273,8 +273,8 @@ }, | ||
| { | ||
| description: "deleted zones", | ||
| description: "include deleted zones", | ||
| model: fixtureInputModel(func(model *inputModel) { | ||
| model.Deleted = true | ||
| model.IncludeDeleted = true | ||
| }), | ||
| page: 1, | ||
| expectedRequest: fixtureRequest().StateEq(deleteSucceededState).Page(1), | ||
| expectedRequest: fixtureRequest().Page(1), | ||
| }, | ||
@@ -295,3 +295,3 @@ { | ||
| page: 1, | ||
| expectedRequest: fixtureRequest().ActiveEq(false).Page(1), | ||
| expectedRequest: fixtureRequest().ActiveEq(false).StateNeq(deleteSucceededState).Page(1), | ||
| }, | ||
@@ -298,0 +298,0 @@ { |
@@ -23,9 +23,9 @@ package list | ||
| const ( | ||
| activeFlag = "active" | ||
| inactiveFlag = "inactive" | ||
| deletedFlag = "deleted" | ||
| nameLikeFlag = "name-like" | ||
| orderByNameFlag = "order-by-name" | ||
| limitFlag = "limit" | ||
| pageSizeFlag = "page-size" | ||
| activeFlag = "active" | ||
| inactiveFlag = "inactive" | ||
| nameLikeFlag = "name-like" | ||
| orderByNameFlag = "order-by-name" | ||
| includeDeletedFlag = "include-deleted" | ||
| limitFlag = "limit" | ||
| pageSizeFlag = "page-size" | ||
@@ -39,9 +39,9 @@ pageSizeDefault = 100 | ||
| Active bool | ||
| Inactive bool | ||
| Deleted bool | ||
| NameLike *string | ||
| OrderByName *string | ||
| Limit *int64 | ||
| PageSize int64 | ||
| Active bool | ||
| Inactive bool | ||
| NameLike *string | ||
| OrderByName *string | ||
| IncludeDeleted bool | ||
| Limit *int64 | ||
| PageSize int64 | ||
| } | ||
@@ -66,4 +66,4 @@ | ||
| examples.NewExample( | ||
| `List the deleted DNS zones`, | ||
| "$ stackit dns zone list --deleted"), | ||
| `List DNS zones, including deleted`, | ||
| "$ stackit dns zone list --include-deleted"), | ||
| ), | ||
@@ -108,6 +108,6 @@ RunE: func(cmd *cobra.Command, args []string) error { | ||
| cmd.Flags().Bool(activeFlag, false, "Filter for active zones") | ||
| cmd.Flags().Bool(inactiveFlag, false, "Filter for inactive zones. Deleted zones are always inactive and will be included when this flag is set") | ||
| cmd.Flags().Bool(deletedFlag, false, "Filter for deleted zones") | ||
| cmd.Flags().Bool(inactiveFlag, false, "Filter for inactive zones") | ||
| cmd.Flags().String(nameLikeFlag, "", "Filter by name") | ||
| cmd.Flags().Var(flags.EnumFlag(true, "", orderByNameFlagOptions...), orderByNameFlag, fmt.Sprintf("Order by name, one of %q", orderByNameFlagOptions)) | ||
| cmd.Flags().Bool(includeDeletedFlag, false, "Includes successfully deleted zones (if unset, these are filtered out)") | ||
| cmd.Flags().Int64(limitFlag, 0, "Maximum number of entries to list") | ||
@@ -149,3 +149,3 @@ cmd.Flags().Int64(pageSizeFlag, pageSizeDefault, "Number of items fetched in each API call. Does not affect the number of items in the command output") | ||
| Inactive: inactive, | ||
| Deleted: flags.FlagToBoolValue(cmd, deletedFlag), | ||
| IncludeDeleted: flags.FlagToBoolValue(cmd, includeDeletedFlag), | ||
| NameLike: flags.FlagToStringPointer(cmd, nameLikeFlag), | ||
@@ -166,7 +166,2 @@ OrderByName: flags.FlagToStringPointer(cmd, orderByNameFlag), | ||
| } | ||
| if model.Deleted { | ||
| req = req.StateEq(deleteSucceededState) | ||
| } else if !model.Inactive { | ||
| req = req.StateNeq(deleteSucceededState) | ||
| } | ||
| if model.NameLike != nil { | ||
@@ -178,2 +173,5 @@ req = req.NameLike(*model.NameLike) | ||
| } | ||
| if !model.IncludeDeleted { | ||
| req = req.StateNeq(deleteSucceededState) | ||
| } | ||
| req = req.PageSize(int32(model.PageSize)) | ||
@@ -180,0 +178,0 @@ req = req.Page(int32(page)) |
@@ -48,9 +48,9 @@ package list | ||
| `List all members of an organization`, | ||
| "$ stackit organization role list --organization-id xxx"), | ||
| "$ stackit organization member list --organization-id xxx"), | ||
| examples.NewExample( | ||
| `List all members of an organization in JSON format`, | ||
| "$ stackit organization role list --organization-id xxx --output-format json"), | ||
| "$ stackit organization member list --organization-id xxx --output-format json"), | ||
| examples.NewExample( | ||
| `List up to 10 members of an organization`, | ||
| "$ stackit organization role list --organization-id xxx --limit 10"), | ||
| "$ stackit organization member list --organization-id xxx --limit 10"), | ||
| ), | ||
@@ -57,0 +57,0 @@ RunE: func(cmd *cobra.Command, args []string) error { |
@@ -69,3 +69,3 @@ package delete | ||
| cmd.Printf("Service account %s deleted", model.Email) | ||
| cmd.Printf("Service account %s deleted\n", model.Email) | ||
| return nil | ||
@@ -72,0 +72,0 @@ }, |
@@ -89,3 +89,3 @@ package create | ||
| cmd.PrintErrf("Created key for service account %s\n", model.ServiceAccountEmail) | ||
| cmd.PrintErrf("Created key for service account %s with id %s\n", model.ServiceAccountEmail, *resp.Id) | ||
@@ -92,0 +92,0 @@ key, err := json.MarshalIndent(resp, "", " ") |
@@ -46,3 +46,3 @@ package create | ||
| `Create an access token for the service account with email "my-service-account-1234567@sa.stackit.cloud" with a default time to live`, | ||
| "$ stackit service-account token create --sa-email my-service-account-1234567@sa.stackit.cloud"), | ||
| "$ stackit service-account token create --email my-service-account-1234567@sa.stackit.cloud"), | ||
| examples.NewExample( | ||
@@ -49,0 +49,0 @@ `Create an access token for the service account with email "my-service-account-1234567@sa.stackit.cloud" with a time to live of 10 days`, |
@@ -9,2 +9,3 @@ package update | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
@@ -71,2 +72,10 @@ "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| if !model.AssumeYes { | ||
| prompt := fmt.Sprintf("Are you sure you want to update cluster %s?", model.ClusterName) | ||
| err = confirm.PromptForConfirmation(cmd, prompt) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| } | ||
| // Check if cluster exists | ||
@@ -73,0 +82,0 @@ exists, err := skeUtils.ClusterExists(ctx, apiClient, model.ProjectId, model.ClusterName) |
@@ -32,3 +32,3 @@ package config | ||
| AsyncDefault = "false" | ||
| AsyncDefault = false | ||
| SessionTimeLimitDefault = "2h" | ||
@@ -35,0 +35,0 @@ ) |