mygithub.libinneed.workers.dev/stackitcloud/stackit-cli
Advanced tools
| ## stackit opensearch credentials create | ||
| Creates credentials for an OpenSearch instance | ||
| ### Synopsis | ||
| Creates credentials (username and password) for an OpenSearch instance. | ||
| ``` | ||
| stackit opensearch credentials create [flags] | ||
| ``` | ||
| ### Examples | ||
| ``` | ||
| Create credentials for an OpenSearch instance | ||
| $ stackit opensearch credentials create --instance-id xxx | ||
| Create credentials for an OpenSearch instance and hide the password in the output | ||
| $ stackit opensearch credentials create --instance-id xxx --hide-password | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| -h, --help Help for "stackit opensearch credentials create" | ||
| --hide-password Hide password in output | ||
| --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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch credentials](./stackit_opensearch_credentials.md) - Provides functionality for OpenSearch credentials | ||
| ## stackit opensearch credentials delete | ||
| Deletes credentials of an OpenSearch instance | ||
| ### Synopsis | ||
| Deletes credentials of an OpenSearch instance. | ||
| ``` | ||
| stackit opensearch credentials delete CREDENTIALS_ID [flags] | ||
| ``` | ||
| ### Examples | ||
| ``` | ||
| Delete credentials with ID "xxx" of OpenSearch instance with ID "yyy" | ||
| $ stackit opensearch credentials delete xxx --instance-id yyy | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| -h, --help Help for "stackit opensearch credentials delete" | ||
| --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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch credentials](./stackit_opensearch_credentials.md) - Provides functionality for OpenSearch credentials | ||
| ## stackit opensearch credentials describe | ||
| Shows details of credentials of an OpenSearch instance | ||
| ### Synopsis | ||
| Shows details of credentials of an OpenSearch instance. The password will be shown in plain text in the output. | ||
| ``` | ||
| stackit opensearch credentials describe CREDENTIALS_ID [flags] | ||
| ``` | ||
| ### Examples | ||
| ``` | ||
| Get details of credentials of an OpenSearch instance with ID "xxx" from instance with ID "yyy" | ||
| $ stackit opensearch credentials describe xxx --instance-id yyy | ||
| Get details of credentials of an OpenSearch instance with ID "xxx" from instance with ID "yyy" in a table format | ||
| $ stackit opensearch credentials describe xxx --instance-id yyy --output-format pretty | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| -h, --help Help for "stackit opensearch credentials 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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch credentials](./stackit_opensearch_credentials.md) - Provides functionality for OpenSearch credentials | ||
| ## stackit opensearch credentials list | ||
| Lists all credentials' IDs for an OpenSearch instance | ||
| ### Synopsis | ||
| Lists all credentials' IDs for an OpenSearch instance. | ||
| ``` | ||
| stackit opensearch credentials list [flags] | ||
| ``` | ||
| ### Examples | ||
| ``` | ||
| List all credentials' IDs for an OpenSearch instance | ||
| $ stackit opensearch credentials list --instance-id xxx | ||
| List all credentials' IDs for an OpenSearch instance in JSON format | ||
| $ stackit opensearch credentials list --instance-id xxx --output-format json | ||
| List up to 10 credentials' IDs for an OpenSearch instance | ||
| $ stackit opensearch credentials list --instance-id xxx --limit 10 | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| -h, --help Help for "stackit opensearch credentials 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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch credentials](./stackit_opensearch_credentials.md) - Provides functionality for OpenSearch credentials | ||
| ## stackit opensearch credentials | ||
| Provides functionality for OpenSearch credentials | ||
| ### Synopsis | ||
| Provides functionality for OpenSearch credentials. | ||
| ``` | ||
| stackit opensearch credentials [flags] | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| -h, --help Help for "stackit opensearch credentials" | ||
| ``` | ||
| ### 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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch](./stackit_opensearch.md) - Provides functionality for OpenSearch | ||
| * [stackit opensearch credentials create](./stackit_opensearch_credentials_create.md) - Creates credentials for an OpenSearch instance | ||
| * [stackit opensearch credentials delete](./stackit_opensearch_credentials_delete.md) - Deletes credentials of an OpenSearch instance | ||
| * [stackit opensearch credentials describe](./stackit_opensearch_credentials_describe.md) - Shows details of credentials of an OpenSearch instance | ||
| * [stackit opensearch credentials list](./stackit_opensearch_credentials_list.md) - Lists all credentials' IDs for an OpenSearch instance | ||
| ## stackit opensearch instance create | ||
| Creates an OpenSearch instance | ||
| ### Synopsis | ||
| Creates an OpenSearch instance. | ||
| ``` | ||
| stackit opensearch instance create [flags] | ||
| ``` | ||
| ### Examples | ||
| ``` | ||
| Create an OpenSearch instance with name "my-instance" and specify plan by name and version | ||
| $ stackit opensearch instance create --name my-instance --plan-name stackit-opensearch-1.2.10-replica --version 2 | ||
| Create an OpenSearch instance with name "my-instance" and specify plan by ID | ||
| $ stackit opensearch instance create --name my-instance --plan-id xxx | ||
| Create an OpenSearch instance with name "my-instance" and specify IP range which is allowed to access it | ||
| $ stackit opensearch instance create --name my-instance --plan-id xxx --acl 192.168.1.0/24 | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| --acl strings List of IP networks in CIDR notation which are allowed to access this instance (default []) | ||
| --enable-monitoring Enable monitoring | ||
| --graphite string Graphite host | ||
| -h, --help Help for "stackit opensearch instance create" | ||
| --metrics-frequency int Metrics frequency | ||
| --metrics-prefix string Metrics prefix | ||
| --monitoring-instance-id string Monitoring instance ID | ||
| -n, --name string Instance name | ||
| --plan-id string Plan ID | ||
| --plan-name string Plan name | ||
| --plugin strings Plugin | ||
| --syslog strings Syslog | ||
| --version string Instance OpenSearch version | ||
| ``` | ||
| ### 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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch instance](./stackit_opensearch_instance.md) - Provides functionality for OpenSearch instances | ||
| ## stackit opensearch instance delete | ||
| Deletes an OpenSearch instance | ||
| ### Synopsis | ||
| Deletes an OpenSearch instance. | ||
| ``` | ||
| stackit opensearch instance delete INSTANCE_ID [flags] | ||
| ``` | ||
| ### Examples | ||
| ``` | ||
| Delete an OpenSearch instance with ID "xxx" | ||
| $ stackit opensearch instance delete xxx | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| -h, --help Help for "stackit opensearch instance delete" | ||
| ``` | ||
| ### 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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch instance](./stackit_opensearch_instance.md) - Provides functionality for OpenSearch instances | ||
| ## stackit opensearch instance describe | ||
| Shows details of an OpenSearch instance | ||
| ### Synopsis | ||
| Shows details of an OpenSearch instance. | ||
| ``` | ||
| stackit opensearch instance describe INSTANCE_ID [flags] | ||
| ``` | ||
| ### Examples | ||
| ``` | ||
| Get details of an OpenSearch instance with ID "xxx" | ||
| $ stackit opensearch instance describe xxx | ||
| Get details of an OpenSearch instance with ID "xxx" in a table format | ||
| $ stackit opensearch instance describe xxx --output-format pretty | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| -h, --help Help for "stackit opensearch instance describe" | ||
| ``` | ||
| ### 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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch instance](./stackit_opensearch_instance.md) - Provides functionality for OpenSearch instances | ||
| ## stackit opensearch instance list | ||
| Lists all OpenSearch instances | ||
| ### Synopsis | ||
| Lists all OpenSearch instances. | ||
| ``` | ||
| stackit opensearch instance list [flags] | ||
| ``` | ||
| ### Examples | ||
| ``` | ||
| List all OpenSearch instances | ||
| $ stackit opensearch instance list | ||
| List all OpenSearch instances in JSON format | ||
| $ stackit opensearch instance list --output-format json | ||
| List up to 10 OpenSearch instances | ||
| $ stackit opensearch instance list --limit 10 | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| -h, --help Help for "stackit opensearch instance list" | ||
| --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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch instance](./stackit_opensearch_instance.md) - Provides functionality for OpenSearch instances | ||
| ## stackit opensearch instance update | ||
| Updates an OpenSearch instance | ||
| ### Synopsis | ||
| Updates an OpenSearch instance. | ||
| ``` | ||
| stackit opensearch instance update INSTANCE_ID [flags] | ||
| ``` | ||
| ### Examples | ||
| ``` | ||
| Update the plan of an OpenSearch instance with ID "xxx" | ||
| $ stackit opensearch instance update xxx --plan-id xxx | ||
| Update the range of IPs allowed to access an OpenSearch instance with ID "xxx" | ||
| $ stackit opensearch instance update xxx --acl 192.168.1.0/24 | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| --acl strings List of IP networks in CIDR notation which are allowed to access this instance (default []) | ||
| --enable-monitoring Enable monitoring | ||
| --graphite string Graphite host | ||
| -h, --help Help for "stackit opensearch instance update" | ||
| --metrics-frequency int Metrics frequency | ||
| --metrics-prefix string Metrics prefix | ||
| --monitoring-instance-id string Monitoring instance ID | ||
| --plan-id string Plan ID | ||
| --plan-name string Plan name | ||
| --plugin strings Plugin | ||
| --syslog strings Syslog | ||
| --version string Instance OpenSearch version | ||
| ``` | ||
| ### 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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch instance](./stackit_opensearch_instance.md) - Provides functionality for OpenSearch instances | ||
| ## stackit opensearch instance | ||
| Provides functionality for OpenSearch instances | ||
| ### Synopsis | ||
| Provides functionality for OpenSearch instances. | ||
| ``` | ||
| stackit opensearch instance [flags] | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| -h, --help Help for "stackit opensearch instance" | ||
| ``` | ||
| ### 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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch](./stackit_opensearch.md) - Provides functionality for OpenSearch | ||
| * [stackit opensearch instance create](./stackit_opensearch_instance_create.md) - Creates an OpenSearch instance | ||
| * [stackit opensearch instance delete](./stackit_opensearch_instance_delete.md) - Deletes an OpenSearch instance | ||
| * [stackit opensearch instance describe](./stackit_opensearch_instance_describe.md) - Shows details of an OpenSearch instance | ||
| * [stackit opensearch instance list](./stackit_opensearch_instance_list.md) - Lists all OpenSearch instances | ||
| * [stackit opensearch instance update](./stackit_opensearch_instance_update.md) - Updates an OpenSearch instance | ||
| ## stackit opensearch plans | ||
| Lists all OpenSearch service plans | ||
| ### Synopsis | ||
| Lists all OpenSearch service plans. | ||
| ``` | ||
| stackit opensearch plans [flags] | ||
| ``` | ||
| ### Examples | ||
| ``` | ||
| List all OpenSearch service plans | ||
| $ stackit opensearch plans | ||
| List all OpenSearch service plans in JSON format | ||
| $ stackit opensearch plans --output-format json | ||
| List up to 10 OpenSearch service plans | ||
| $ stackit opensearch plans --limit 10 | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| -h, --help Help for "stackit opensearch plans" | ||
| --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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit opensearch](./stackit_opensearch.md) - Provides functionality for OpenSearch | ||
| ## stackit opensearch | ||
| Provides functionality for OpenSearch | ||
| ### Synopsis | ||
| Provides functionality for OpenSearch. | ||
| ``` | ||
| stackit opensearch [flags] | ||
| ``` | ||
| ### Options | ||
| ``` | ||
| -h, --help Help for "stackit opensearch" | ||
| ``` | ||
| ### 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"] | ||
| -p, --project-id string Project ID | ||
| ``` | ||
| ### SEE ALSO | ||
| * [stackit](./stackit.md) - Manage STACKIT resources using the command line | ||
| * [stackit opensearch credentials](./stackit_opensearch_credentials.md) - Provides functionality for OpenSearch credentials | ||
| * [stackit opensearch instance](./stackit_opensearch_instance.md) - Provides functionality for OpenSearch instances | ||
| * [stackit opensearch plans](./stackit_opensearch_plans.md) - Lists all OpenSearch service plans | ||
| package create | ||
| import ( | ||
| "context" | ||
| "testing" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/google/go-cmp/cmp" | ||
| "github.com/google/go-cmp/cmp/cmpopts" | ||
| "github.com/google/uuid" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| var projectIdFlag = globalflags.ProjectIdFlag | ||
| type testCtxKey struct{} | ||
| var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") | ||
| var testClient = &opensearch.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, | ||
| }, | ||
| InstanceId: testInstanceId, | ||
| } | ||
| for _, mod := range mods { | ||
| mod(model) | ||
| } | ||
| return model | ||
| } | ||
| func fixtureRequest(mods ...func(request *opensearch.ApiCreateCredentialsRequest)) opensearch.ApiCreateCredentialsRequest { | ||
| request := testClient.CreateCredentials(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 := NewCmd() | ||
| 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(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 opensearch.ApiCreateCredentialsRequest | ||
| }{ | ||
| { | ||
| 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) | ||
| } | ||
| }) | ||
| } | ||
| } |
| package create | ||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/opensearch/client" | ||
| opensearchUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/opensearch/utils" | ||
| "github.com/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| const ( | ||
| instanceIdFlag = "instance-id" | ||
| hidePasswordFlag = "hide-password" | ||
| ) | ||
| type inputModel struct { | ||
| *globalflags.GlobalFlagModel | ||
| InstanceId string | ||
| HidePassword bool | ||
| } | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "create", | ||
| Short: "Creates credentials for an OpenSearch instance", | ||
| Long: "Creates credentials (username and password) for an OpenSearch instance.", | ||
| Args: args.NoArgs, | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `Create credentials for an OpenSearch instance`, | ||
| "$ stackit opensearch credentials create --instance-id xxx"), | ||
| examples.NewExample( | ||
| `Create credentials for an OpenSearch instance and hide the password in the output`, | ||
| "$ stackit opensearch credentials create --instance-id xxx --hide-password"), | ||
| ), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| ctx := context.Background() | ||
| model, err := parseInput(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Configure API client | ||
| apiClient, err := client.ConfigureClient(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| instanceLabel, err := opensearchUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.InstanceId) | ||
| if err != nil { | ||
| instanceLabel = model.InstanceId | ||
| } | ||
| if !model.AssumeYes { | ||
| prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %s?", instanceLabel) | ||
| err = confirm.PromptForConfirmation(cmd, prompt) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| } | ||
| // Call API | ||
| req := buildRequest(ctx, model, apiClient) | ||
| resp, err := req.Execute() | ||
| if err != nil { | ||
| return fmt.Errorf("create OpenSearch credentials: %w", err) | ||
| } | ||
| cmd.Printf("Created credentials for instance %s. Credentials ID: %s\n\n", instanceLabel, *resp.Id) | ||
| cmd.Printf("Username: %s\n", *resp.Raw.Credentials.Username) | ||
| if model.HidePassword { | ||
| cmd.Printf("Password: <hidden>\n") | ||
| } else { | ||
| cmd.Printf("Password: %s\n", *resp.Raw.Credentials.Password) | ||
| } | ||
| cmd.Printf("Host: %s\n", *resp.Raw.Credentials.Host) | ||
| cmd.Printf("Port: %d\n", *resp.Raw.Credentials.Port) | ||
| cmd.Printf("URI: %s\n", *resp.Uri) | ||
| return nil | ||
| }, | ||
| } | ||
| configureFlags(cmd) | ||
| return cmd | ||
| } | ||
| func configureFlags(cmd *cobra.Command) { | ||
| cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") | ||
| cmd.Flags().Bool(hidePasswordFlag, false, "Hide password in output") | ||
| err := flags.MarkFlagsRequired(cmd, instanceIdFlag) | ||
| cobra.CheckErr(err) | ||
| } | ||
| func parseInput(cmd *cobra.Command) (*inputModel, error) { | ||
| globalFlags := globalflags.Parse(cmd) | ||
| if globalFlags.ProjectId == "" { | ||
| return nil, &errors.ProjectIdError{} | ||
| } | ||
| return &inputModel{ | ||
| GlobalFlagModel: globalFlags, | ||
| InstanceId: flags.FlagToStringValue(cmd, instanceIdFlag), | ||
| HidePassword: flags.FlagToBoolValue(cmd, hidePasswordFlag), | ||
| }, nil | ||
| } | ||
| func buildRequest(ctx context.Context, model *inputModel, apiClient *opensearch.APIClient) opensearch.ApiCreateCredentialsRequest { | ||
| req := apiClient.CreateCredentials(ctx, model.ProjectId, model.InstanceId) | ||
| return req | ||
| } |
| package credentials | ||
| import ( | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/credentials/create" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/credentials/delete" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/credentials/describe" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/credentials/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "credentials", | ||
| Short: "Provides functionality for OpenSearch credentials", | ||
| Long: "Provides functionality for OpenSearch credentials.", | ||
| Args: args.NoArgs, | ||
| Run: utils.CmdHelp, | ||
| } | ||
| addSubcommands(cmd) | ||
| return cmd | ||
| } | ||
| func addSubcommands(cmd *cobra.Command) { | ||
| cmd.AddCommand(create.NewCmd()) | ||
| cmd.AddCommand(delete.NewCmd()) | ||
| cmd.AddCommand(describe.NewCmd()) | ||
| cmd.AddCommand(list.NewCmd()) | ||
| } |
| package delete | ||
| import ( | ||
| "context" | ||
| "testing" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/google/go-cmp/cmp" | ||
| "github.com/google/go-cmp/cmp/cmpopts" | ||
| "github.com/google/uuid" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| var projectIdFlag = globalflags.ProjectIdFlag | ||
| type testCtxKey struct{} | ||
| var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") | ||
| var testClient = &opensearch.APIClient{} | ||
| var testProjectId = uuid.NewString() | ||
| var testInstanceId = uuid.NewString() | ||
| var testCredentialsId = uuid.NewString() | ||
| func fixtureArgValues(mods ...func(argValues []string)) []string { | ||
| argValues := []string{ | ||
| testCredentialsId, | ||
| } | ||
| 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, | ||
| }, | ||
| InstanceId: testInstanceId, | ||
| CredentialsId: testCredentialsId, | ||
| } | ||
| for _, mod := range mods { | ||
| mod(model) | ||
| } | ||
| return model | ||
| } | ||
| func fixtureRequest(mods ...func(request *opensearch.ApiDeleteCredentialsRequest)) opensearch.ApiDeleteCredentialsRequest { | ||
| request := testClient.DeleteCredentials(testCtx, testProjectId, testInstanceId, testCredentialsId) | ||
| 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: "credentials id invalid 1", | ||
| argValues: []string{""}, | ||
| flagValues: fixtureFlagValues(), | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "credentials id invalid 2", | ||
| argValues: []string{"invalid-uuid"}, | ||
| flagValues: fixtureFlagValues(), | ||
| isValid: false, | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.description, func(t *testing.T) { | ||
| cmd := NewCmd() | ||
| 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(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 opensearch.ApiDeleteCredentialsRequest | ||
| }{ | ||
| { | ||
| 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) | ||
| } | ||
| }) | ||
| } | ||
| } |
| package delete | ||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/opensearch/client" | ||
| opensearchUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/opensearch/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| const ( | ||
| credentialsIdArg = "CREDENTIALS_ID" //nolint:gosec // linter false positive | ||
| instanceIdFlag = "instance-id" | ||
| ) | ||
| type inputModel struct { | ||
| *globalflags.GlobalFlagModel | ||
| InstanceId string | ||
| CredentialsId string | ||
| } | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: fmt.Sprintf("delete %s", credentialsIdArg), | ||
| Short: "Deletes credentials of an OpenSearch instance", | ||
| Long: "Deletes credentials of an OpenSearch instance.", | ||
| Args: args.SingleArg(credentialsIdArg, utils.ValidateUUID), | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `Delete credentials with ID "xxx" of OpenSearch instance with ID "yyy"`, | ||
| "$ stackit opensearch credentials delete xxx --instance-id yyy"), | ||
| ), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| ctx := context.Background() | ||
| model, err := parseInput(cmd, args) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Configure API client | ||
| apiClient, err := client.ConfigureClient(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| instanceLabel, err := opensearchUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.InstanceId) | ||
| if err != nil { | ||
| instanceLabel = model.InstanceId | ||
| } | ||
| credentialsLabel, err := opensearchUtils.GetCredentialsUsername(ctx, apiClient, model.ProjectId, model.InstanceId, model.CredentialsId) | ||
| if err != nil { | ||
| credentialsLabel = model.CredentialsId | ||
| } | ||
| if !model.AssumeYes { | ||
| prompt := fmt.Sprintf("Are you sure you want to delete credentials %s of instance %s? (This cannot be undone)", credentialsLabel, instanceLabel) | ||
| err = confirm.PromptForConfirmation(cmd, prompt) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| } | ||
| // Call API | ||
| req := buildRequest(ctx, model, apiClient) | ||
| err = req.Execute() | ||
| if err != nil { | ||
| return fmt.Errorf("delete OpenSearch credentials: %w", err) | ||
| } | ||
| cmd.Printf("Deleted credentials %s of instance %s\n", credentialsLabel, instanceLabel) | ||
| return nil | ||
| }, | ||
| } | ||
| 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(cmd *cobra.Command, inputArgs []string) (*inputModel, error) { | ||
| credentialsId := inputArgs[0] | ||
| globalFlags := globalflags.Parse(cmd) | ||
| if globalFlags.ProjectId == "" { | ||
| return nil, &errors.ProjectIdError{} | ||
| } | ||
| return &inputModel{ | ||
| GlobalFlagModel: globalFlags, | ||
| InstanceId: flags.FlagToStringValue(cmd, instanceIdFlag), | ||
| CredentialsId: credentialsId, | ||
| }, nil | ||
| } | ||
| func buildRequest(ctx context.Context, model *inputModel, apiClient *opensearch.APIClient) opensearch.ApiDeleteCredentialsRequest { | ||
| req := apiClient.DeleteCredentials(ctx, model.ProjectId, model.InstanceId, model.CredentialsId) | ||
| return req | ||
| } |
| package describe | ||
| import ( | ||
| "context" | ||
| "testing" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/google/go-cmp/cmp" | ||
| "github.com/google/go-cmp/cmp/cmpopts" | ||
| "github.com/google/uuid" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| var projectIdFlag = globalflags.ProjectIdFlag | ||
| type testCtxKey struct{} | ||
| var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") | ||
| var testClient = &opensearch.APIClient{} | ||
| var testProjectId = uuid.NewString() | ||
| var testInstanceId = uuid.NewString() | ||
| var testCredentialsId = uuid.NewString() | ||
| func fixtureArgValues(mods ...func(argValues []string)) []string { | ||
| argValues := []string{ | ||
| testCredentialsId, | ||
| } | ||
| 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, | ||
| }, | ||
| InstanceId: testInstanceId, | ||
| CredentialsId: testCredentialsId, | ||
| } | ||
| for _, mod := range mods { | ||
| mod(model) | ||
| } | ||
| return model | ||
| } | ||
| func fixtureRequest(mods ...func(request *opensearch.ApiGetCredentialsRequest)) opensearch.ApiGetCredentialsRequest { | ||
| request := testClient.GetCredentials(testCtx, testProjectId, testInstanceId, testCredentialsId) | ||
| 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: "credentials id invalid 1", | ||
| argValues: []string{""}, | ||
| flagValues: fixtureFlagValues(), | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "credentials id invalid 2", | ||
| argValues: []string{"invalid-uuid"}, | ||
| flagValues: fixtureFlagValues(), | ||
| isValid: false, | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.description, func(t *testing.T) { | ||
| cmd := NewCmd() | ||
| 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(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 opensearch.ApiGetCredentialsRequest | ||
| }{ | ||
| { | ||
| 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) | ||
| } | ||
| }) | ||
| } | ||
| } |
| package describe | ||
| import ( | ||
| "context" | ||
| "encoding/json" | ||
| "fmt" | ||
| "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/services/opensearch/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| const ( | ||
| credentialsIdArg = "CREDENTIALS_ID" //nolint:gosec // linter false positive | ||
| instanceIdFlag = "instance-id" | ||
| ) | ||
| type inputModel struct { | ||
| *globalflags.GlobalFlagModel | ||
| InstanceId string | ||
| CredentialsId string | ||
| } | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: fmt.Sprintf("describe %s", credentialsIdArg), | ||
| Short: "Shows details of credentials of an OpenSearch instance", | ||
| Long: "Shows details of credentials of an OpenSearch instance. The password will be shown in plain text in the output.", | ||
| Args: args.SingleArg(credentialsIdArg, utils.ValidateUUID), | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `Get details of credentials of an OpenSearch instance with ID "xxx" from instance with ID "yyy"`, | ||
| "$ stackit opensearch credentials describe xxx --instance-id yyy"), | ||
| examples.NewExample( | ||
| `Get details of credentials of an OpenSearch instance with ID "xxx" from instance with ID "yyy" in a table format`, | ||
| "$ stackit opensearch credentials describe xxx --instance-id yyy --output-format pretty"), | ||
| ), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| ctx := context.Background() | ||
| model, err := parseInput(cmd, args) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Configure API client | ||
| apiClient, err := client.ConfigureClient(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Call API | ||
| req := buildRequest(ctx, model, apiClient) | ||
| resp, err := req.Execute() | ||
| if err != nil { | ||
| return fmt.Errorf("describe OpenSearch credentials: %w", err) | ||
| } | ||
| return outputResult(cmd, model.OutputFormat, resp) | ||
| }, | ||
| } | ||
| 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(cmd *cobra.Command, inputArgs []string) (*inputModel, error) { | ||
| credentialsId := inputArgs[0] | ||
| globalFlags := globalflags.Parse(cmd) | ||
| if globalFlags.ProjectId == "" { | ||
| return nil, &errors.ProjectIdError{} | ||
| } | ||
| return &inputModel{ | ||
| GlobalFlagModel: globalFlags, | ||
| InstanceId: flags.FlagToStringValue(cmd, instanceIdFlag), | ||
| CredentialsId: credentialsId, | ||
| }, nil | ||
| } | ||
| func buildRequest(ctx context.Context, model *inputModel, apiClient *opensearch.APIClient) opensearch.ApiGetCredentialsRequest { | ||
| req := apiClient.GetCredentials(ctx, model.ProjectId, model.InstanceId, model.CredentialsId) | ||
| return req | ||
| } | ||
| func outputResult(cmd *cobra.Command, outputFormat string, credentials *opensearch.CredentialsResponse) error { | ||
| switch outputFormat { | ||
| case globalflags.PrettyOutputFormat: | ||
| table := tables.NewTable() | ||
| table.AddRow("ID", *credentials.Id) | ||
| table.AddSeparator() | ||
| table.AddRow("USERNAME", *credentials.Raw.Credentials.Username) | ||
| table.AddSeparator() | ||
| table.AddRow("PASSWORD", *credentials.Raw.Credentials.Password) | ||
| table.AddSeparator() | ||
| table.AddRow("URI", *credentials.Raw.Credentials.Uri) | ||
| err := table.Display(cmd) | ||
| if err != nil { | ||
| return fmt.Errorf("render table: %w", err) | ||
| } | ||
| return nil | ||
| default: | ||
| details, err := json.MarshalIndent(credentials, "", " ") | ||
| if err != nil { | ||
| return fmt.Errorf("marshal OpenSearch credentials: %w", err) | ||
| } | ||
| cmd.Println(string(details)) | ||
| return nil | ||
| } | ||
| } |
| package list | ||
| 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/opensearch" | ||
| ) | ||
| var projectIdFlag = globalflags.ProjectIdFlag | ||
| type testCtxKey struct{} | ||
| var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") | ||
| var testClient = &opensearch.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, | ||
| }, | ||
| InstanceId: testInstanceId, | ||
| Limit: utils.Ptr(int64(10)), | ||
| } | ||
| for _, mod := range mods { | ||
| mod(model) | ||
| } | ||
| return model | ||
| } | ||
| func fixtureRequest(mods ...func(request *opensearch.ApiListCredentialsRequest)) opensearch.ApiListCredentialsRequest { | ||
| request := testClient.ListCredentials(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) { | ||
| cmd := NewCmd() | ||
| 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(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 opensearch.ApiListCredentialsRequest | ||
| }{ | ||
| { | ||
| 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) | ||
| } | ||
| }) | ||
| } | ||
| } |
| package list | ||
| import ( | ||
| "context" | ||
| "encoding/json" | ||
| "fmt" | ||
| "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/services/opensearch/client" | ||
| opensearchUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/opensearch/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
| "github.com/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| const ( | ||
| instanceIdFlag = "instance-id" | ||
| limitFlag = "limit" | ||
| ) | ||
| type inputModel struct { | ||
| *globalflags.GlobalFlagModel | ||
| InstanceId string | ||
| Limit *int64 | ||
| } | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "list", | ||
| Short: "Lists all credentials' IDs for an OpenSearch instance", | ||
| Long: "Lists all credentials' IDs for an OpenSearch instance.", | ||
| Args: args.NoArgs, | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `List all credentials' IDs for an OpenSearch instance`, | ||
| "$ stackit opensearch credentials list --instance-id xxx"), | ||
| examples.NewExample( | ||
| `List all credentials' IDs for an OpenSearch instance in JSON format`, | ||
| "$ stackit opensearch credentials list --instance-id xxx --output-format json"), | ||
| examples.NewExample( | ||
| `List up to 10 credentials' IDs for an OpenSearch instance`, | ||
| "$ stackit opensearch credentials list --instance-id xxx --limit 10"), | ||
| ), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| ctx := context.Background() | ||
| model, err := parseInput(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Configure API client | ||
| apiClient, err := client.ConfigureClient(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Call API | ||
| req := buildRequest(ctx, model, apiClient) | ||
| resp, err := req.Execute() | ||
| if err != nil { | ||
| return fmt.Errorf("list OpenSearch credentialss: %w", err) | ||
| } | ||
| credentials := *resp.CredentialsList | ||
| if len(credentials) == 0 { | ||
| instanceLabel, err := opensearchUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.InstanceId) | ||
| if err != nil { | ||
| instanceLabel = model.InstanceId | ||
| } | ||
| cmd.Printf("No credentials found for instance %s\n", instanceLabel) | ||
| return nil | ||
| } | ||
| // Truncate output | ||
| if model.Limit != nil && len(credentials) > int(*model.Limit) { | ||
| credentials = credentials[:*model.Limit] | ||
| } | ||
| return outputResult(cmd, model.OutputFormat, credentials) | ||
| }, | ||
| } | ||
| 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(cmd *cobra.Command) (*inputModel, error) { | ||
| globalFlags := globalflags.Parse(cmd) | ||
| if globalFlags.ProjectId == "" { | ||
| return nil, &errors.ProjectIdError{} | ||
| } | ||
| limit := flags.FlagToInt64Pointer(cmd, limitFlag) | ||
| if limit != nil && *limit < 1 { | ||
| return nil, &errors.FlagValidationError{ | ||
| Flag: limitFlag, | ||
| Details: "must be greater than 0", | ||
| } | ||
| } | ||
| return &inputModel{ | ||
| GlobalFlagModel: globalFlags, | ||
| InstanceId: flags.FlagToStringValue(cmd, instanceIdFlag), | ||
| Limit: limit, | ||
| }, nil | ||
| } | ||
| func buildRequest(ctx context.Context, model *inputModel, apiClient *opensearch.APIClient) opensearch.ApiListCredentialsRequest { | ||
| req := apiClient.ListCredentials(ctx, model.ProjectId, model.InstanceId) | ||
| return req | ||
| } | ||
| func outputResult(cmd *cobra.Command, outputFormat string, credentials []opensearch.CredentialsListItem) error { | ||
| switch outputFormat { | ||
| case globalflags.JSONOutputFormat: | ||
| details, err := json.MarshalIndent(credentials, "", " ") | ||
| if err != nil { | ||
| return fmt.Errorf("marshal OpenSearch credentials list: %w", err) | ||
| } | ||
| cmd.Println(string(details)) | ||
| return nil | ||
| default: | ||
| table := tables.NewTable() | ||
| table.SetHeader("ID") | ||
| for i := range credentials { | ||
| c := credentials[i] | ||
| table.AddRow(*c.Id) | ||
| } | ||
| err := table.Display(cmd) | ||
| if err != nil { | ||
| return fmt.Errorf("render table: %w", err) | ||
| } | ||
| return nil | ||
| } | ||
| } |
| package create | ||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "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/opensearch" | ||
| ) | ||
| var projectIdFlag = globalflags.ProjectIdFlag | ||
| type testCtxKey struct{} | ||
| var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") | ||
| var testClient = &opensearch.APIClient{} | ||
| type openSearchClientMocked struct { | ||
| returnError bool | ||
| listOfferingsResp *opensearch.ListOfferingsResponse | ||
| } | ||
| func (c *openSearchClientMocked) CreateInstance(ctx context.Context, projectId string) opensearch.ApiCreateInstanceRequest { | ||
| return testClient.CreateInstance(ctx, projectId) | ||
| } | ||
| func (c *openSearchClientMocked) ListOfferingsExecute(_ context.Context, _ string) (*opensearch.ListOfferingsResponse, error) { | ||
| if c.returnError { | ||
| return nil, fmt.Errorf("list flavors failed") | ||
| } | ||
| return c.listOfferingsResp, nil | ||
| } | ||
| var testProjectId = uuid.NewString() | ||
| var testPlanId = uuid.NewString() | ||
| var testMonitoringInstanceId = uuid.NewString() | ||
| func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string { | ||
| flagValues := map[string]string{ | ||
| projectIdFlag: testProjectId, | ||
| instanceNameFlag: "example-name", | ||
| enableMonitoringFlag: "true", | ||
| graphiteFlag: "example-graphite", | ||
| metricsFrequencyFlag: "100", | ||
| metricsPrefixFlag: "example-prefix", | ||
| monitoringInstanceIdFlag: testMonitoringInstanceId, | ||
| pluginFlag: "example-plugin", | ||
| sgwAclFlag: "198.51.100.14/24", | ||
| syslogFlag: "example-syslog", | ||
| planIdFlag: testPlanId, | ||
| } | ||
| for _, mod := range mods { | ||
| mod(flagValues) | ||
| } | ||
| return flagValues | ||
| } | ||
| func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { | ||
| model := &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| InstanceName: utils.Ptr("example-name"), | ||
| EnableMonitoring: utils.Ptr(true), | ||
| Graphite: utils.Ptr("example-graphite"), | ||
| MetricsFrequency: utils.Ptr(int64(100)), | ||
| MetricsPrefix: utils.Ptr("example-prefix"), | ||
| MonitoringInstanceId: utils.Ptr(testMonitoringInstanceId), | ||
| Plugin: utils.Ptr([]string{"example-plugin"}), | ||
| SgwAcl: utils.Ptr([]string{"198.51.100.14/24"}), | ||
| Syslog: utils.Ptr([]string{"example-syslog"}), | ||
| PlanId: utils.Ptr(testPlanId), | ||
| } | ||
| for _, mod := range mods { | ||
| mod(model) | ||
| } | ||
| return model | ||
| } | ||
| func fixtureRequest(mods ...func(request *opensearch.ApiCreateInstanceRequest)) opensearch.ApiCreateInstanceRequest { | ||
| request := testClient.CreateInstance(testCtx, testProjectId) | ||
| request = request.CreateInstancePayload(opensearch.CreateInstancePayload{ | ||
| InstanceName: utils.Ptr("example-name"), | ||
| Parameters: &opensearch.InstanceParameters{ | ||
| EnableMonitoring: utils.Ptr(true), | ||
| Graphite: utils.Ptr("example-graphite"), | ||
| MetricsFrequency: utils.Ptr(int64(100)), | ||
| MetricsPrefix: utils.Ptr("example-prefix"), | ||
| MonitoringInstanceId: utils.Ptr(testMonitoringInstanceId), | ||
| Plugins: utils.Ptr([]string{"example-plugin"}), | ||
| SgwAcl: utils.Ptr("198.51.100.14/24"), | ||
| Syslog: utils.Ptr([]string{"example-syslog"}), | ||
| }, | ||
| PlanId: utils.Ptr(testPlanId), | ||
| }) | ||
| for _, mod := range mods { | ||
| mod(&request) | ||
| } | ||
| return request | ||
| } | ||
| func TestParseInput(t *testing.T) { | ||
| tests := []struct { | ||
| description string | ||
| flagValues map[string]string | ||
| sgwAclValues []string | ||
| pluginValues []string | ||
| syslogValues []string | ||
| isValid bool | ||
| expectedModel *inputModel | ||
| }{ | ||
| { | ||
| description: "base", | ||
| flagValues: fixtureFlagValues(), | ||
| isValid: true, | ||
| expectedModel: fixtureInputModel(), | ||
| }, | ||
| { | ||
| description: "with plan name and version", | ||
| flagValues: fixtureFlagValues(func(flagValues map[string]string) { | ||
| flagValues[planNameFlag] = "plan-name" | ||
| flagValues[versionFlag] = "6" | ||
| delete(flagValues, planIdFlag) | ||
| }), | ||
| isValid: true, | ||
| expectedModel: fixtureInputModel(func(model *inputModel) { | ||
| model.PlanId = nil | ||
| model.PlanName = "plan-name" | ||
| model.Version = "6" | ||
| }), | ||
| }, | ||
| { | ||
| description: "no values", | ||
| flagValues: map[string]string{}, | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "required fields only", | ||
| flagValues: map[string]string{ | ||
| projectIdFlag: testProjectId, | ||
| instanceNameFlag: "example-name", | ||
| planIdFlag: testPlanId, | ||
| }, | ||
| isValid: true, | ||
| expectedModel: &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| InstanceName: utils.Ptr("example-name"), | ||
| PlanId: utils.Ptr(testPlanId), | ||
| }, | ||
| }, | ||
| { | ||
| description: "zero values", | ||
| flagValues: map[string]string{ | ||
| projectIdFlag: testProjectId, | ||
| planIdFlag: testPlanId, | ||
| instanceNameFlag: "", | ||
| enableMonitoringFlag: "false", | ||
| graphiteFlag: "", | ||
| metricsFrequencyFlag: "0", | ||
| metricsPrefixFlag: "", | ||
| }, | ||
| isValid: true, | ||
| expectedModel: &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| PlanId: utils.Ptr(testPlanId), | ||
| InstanceName: utils.Ptr(""), | ||
| EnableMonitoring: utils.Ptr(false), | ||
| Graphite: utils.Ptr(""), | ||
| MetricsFrequency: utils.Ptr(int64(0)), | ||
| MetricsPrefix: utils.Ptr(""), | ||
| }, | ||
| }, | ||
| { | ||
| 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: "invalid with plan ID, plan name and version", | ||
| flagValues: fixtureFlagValues(func(flagValues map[string]string) { | ||
| flagValues[planNameFlag] = "plan-name" | ||
| flagValues[versionFlag] = "6" | ||
| }), | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "invalid with plan ID and plan name", | ||
| flagValues: fixtureFlagValues(func(flagValues map[string]string) { | ||
| flagValues[planNameFlag] = "plan-name" | ||
| }), | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "invalid with plan name only", | ||
| flagValues: fixtureFlagValues(func(flagValues map[string]string) { | ||
| flagValues[planNameFlag] = "plan-name" | ||
| delete(flagValues, planIdFlag) | ||
| }), | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "repeated acl flags", | ||
| flagValues: fixtureFlagValues(), | ||
| sgwAclValues: []string{"198.51.100.14/24", "198.51.100.14/32"}, | ||
| isValid: true, | ||
| expectedModel: fixtureInputModel(func(model *inputModel) { | ||
| model.SgwAcl = utils.Ptr( | ||
| append(*model.SgwAcl, "198.51.100.14/24", "198.51.100.14/32"), | ||
| ) | ||
| }), | ||
| }, | ||
| { | ||
| description: "repeated acl flag with list value", | ||
| flagValues: fixtureFlagValues(), | ||
| sgwAclValues: []string{"198.51.100.14/24,198.51.100.14/32"}, | ||
| isValid: true, | ||
| expectedModel: fixtureInputModel(func(model *inputModel) { | ||
| model.SgwAcl = utils.Ptr( | ||
| append(*model.SgwAcl, "198.51.100.14/24", "198.51.100.14/32"), | ||
| ) | ||
| }), | ||
| }, | ||
| { | ||
| description: "repeated plugin flags", | ||
| flagValues: fixtureFlagValues(), | ||
| pluginValues: []string{"example-plugin-1", "example-plugin-2"}, | ||
| isValid: true, | ||
| expectedModel: fixtureInputModel(func(model *inputModel) { | ||
| model.Plugin = utils.Ptr( | ||
| append(*model.Plugin, "example-plugin-1", "example-plugin-2"), | ||
| ) | ||
| }), | ||
| }, | ||
| { | ||
| description: "repeated syslog flags", | ||
| flagValues: fixtureFlagValues(), | ||
| syslogValues: []string{"example-syslog-1", "example-syslog-2"}, | ||
| isValid: true, | ||
| expectedModel: fixtureInputModel(func(model *inputModel) { | ||
| model.Syslog = utils.Ptr( | ||
| append(*model.Syslog, "example-syslog-1", "example-syslog-2"), | ||
| ) | ||
| }), | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.description, func(t *testing.T) { | ||
| cmd := NewCmd() | ||
| 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) | ||
| } | ||
| } | ||
| for _, value := range tt.sgwAclValues { | ||
| err := cmd.Flags().Set(sgwAclFlag, value) | ||
| if err != nil { | ||
| if !tt.isValid { | ||
| return | ||
| } | ||
| t.Fatalf("setting flag --%s=%s: %v", sgwAclFlag, value, err) | ||
| } | ||
| } | ||
| for _, value := range tt.pluginValues { | ||
| err := cmd.Flags().Set(pluginFlag, value) | ||
| if err != nil { | ||
| if !tt.isValid { | ||
| return | ||
| } | ||
| t.Fatalf("setting flag --%s=%s: %v", pluginFlag, value, err) | ||
| } | ||
| } | ||
| for _, value := range tt.syslogValues { | ||
| err := cmd.Flags().Set(syslogFlag, value) | ||
| if err != nil { | ||
| if !tt.isValid { | ||
| return | ||
| } | ||
| t.Fatalf("setting flag --%s=%s: %v", syslogFlag, value, err) | ||
| } | ||
| } | ||
| err = cmd.ValidateRequiredFlags() | ||
| if err != nil { | ||
| if !tt.isValid { | ||
| return | ||
| } | ||
| t.Fatalf("error validating flags: %v", err) | ||
| } | ||
| model, err := parseInput(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 opensearch.ApiCreateInstanceRequest | ||
| getOfferingsFails bool | ||
| getOfferingsResp *opensearch.ListOfferingsResponse | ||
| isValid bool | ||
| }{ | ||
| { | ||
| description: "base", | ||
| model: fixtureInputModel(), | ||
| expectedRequest: fixtureRequest(), | ||
| getOfferingsResp: &opensearch.ListOfferingsResponse{ | ||
| Offerings: &[]opensearch.Offering{ | ||
| { | ||
| Version: utils.Ptr("example-version"), | ||
| Plans: &[]opensearch.Plan{ | ||
| { | ||
| Name: utils.Ptr("example-plan-name"), | ||
| Id: utils.Ptr(testPlanId), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| description: "use plan name and version", | ||
| model: fixtureInputModel( | ||
| func(model *inputModel) { | ||
| model.PlanId = nil | ||
| model.PlanName = "example-plan-name" | ||
| model.Version = "example-version" | ||
| }, | ||
| ), | ||
| expectedRequest: fixtureRequest(), | ||
| getOfferingsResp: &opensearch.ListOfferingsResponse{ | ||
| Offerings: &[]opensearch.Offering{ | ||
| { | ||
| Version: utils.Ptr("example-version"), | ||
| Plans: &[]opensearch.Plan{ | ||
| { | ||
| Name: utils.Ptr("example-plan-name"), | ||
| Id: utils.Ptr(testPlanId), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| description: "get offering fails", | ||
| model: fixtureInputModel( | ||
| func(model *inputModel) { | ||
| model.PlanId = nil | ||
| model.PlanName = "example-plan-name" | ||
| model.Version = "example-version" | ||
| }, | ||
| ), | ||
| getOfferingsFails: true, | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "plan name not found", | ||
| model: fixtureInputModel( | ||
| func(model *inputModel) { | ||
| model.PlanId = nil | ||
| model.PlanName = "example-plan-name" | ||
| model.Version = "example-version" | ||
| }, | ||
| ), | ||
| getOfferingsResp: &opensearch.ListOfferingsResponse{ | ||
| Offerings: &[]opensearch.Offering{ | ||
| { | ||
| Version: utils.Ptr("example-version"), | ||
| Plans: &[]opensearch.Plan{ | ||
| { | ||
| Name: utils.Ptr("other-plan-name"), | ||
| Id: utils.Ptr(testPlanId), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "required fields only", | ||
| model: &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| PlanId: utils.Ptr(testPlanId), | ||
| }, | ||
| getOfferingsResp: &opensearch.ListOfferingsResponse{ | ||
| Offerings: &[]opensearch.Offering{ | ||
| { | ||
| Version: utils.Ptr("example-version"), | ||
| Plans: &[]opensearch.Plan{ | ||
| { | ||
| Name: utils.Ptr("example-plan-name"), | ||
| Id: utils.Ptr(testPlanId), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| expectedRequest: testClient.CreateInstance(testCtx, testProjectId). | ||
| CreateInstancePayload(opensearch.CreateInstancePayload{PlanId: utils.Ptr(testPlanId), Parameters: &opensearch.InstanceParameters{}}), | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.description, func(t *testing.T) { | ||
| client := &openSearchClientMocked{ | ||
| returnError: tt.getOfferingsFails, | ||
| listOfferingsResp: tt.getOfferingsResp, | ||
| } | ||
| request, err := buildRequest(testCtx, tt.model, client) | ||
| if err != nil { | ||
| if !tt.isValid { | ||
| return | ||
| } | ||
| t.Fatalf("error building request: %v", err) | ||
| } | ||
| diff := cmp.Diff(request, tt.expectedRequest, | ||
| cmp.AllowUnexported(tt.expectedRequest), | ||
| cmpopts.EquateComparable(testCtx), | ||
| ) | ||
| if diff != "" { | ||
| t.Fatalf("Data does not match: %s", diff) | ||
| } | ||
| }) | ||
| } | ||
| } |
| package create | ||
| import ( | ||
| "context" | ||
| "errors" | ||
| "fmt" | ||
| "strings" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| 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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/opensearch/client" | ||
| opensearchUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/opensearch/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch/wait" | ||
| ) | ||
| const ( | ||
| instanceNameFlag = "name" | ||
| enableMonitoringFlag = "enable-monitoring" | ||
| graphiteFlag = "graphite" | ||
| metricsFrequencyFlag = "metrics-frequency" | ||
| metricsPrefixFlag = "metrics-prefix" | ||
| monitoringInstanceIdFlag = "monitoring-instance-id" | ||
| pluginFlag = "plugin" | ||
| sgwAclFlag = "acl" | ||
| syslogFlag = "syslog" | ||
| planIdFlag = "plan-id" | ||
| planNameFlag = "plan-name" | ||
| versionFlag = "version" | ||
| ) | ||
| type inputModel struct { | ||
| *globalflags.GlobalFlagModel | ||
| PlanName string | ||
| Version string | ||
| InstanceName *string | ||
| EnableMonitoring *bool | ||
| Graphite *string | ||
| MetricsFrequency *int64 | ||
| MetricsPrefix *string | ||
| MonitoringInstanceId *string | ||
| Plugin *[]string | ||
| SgwAcl *[]string | ||
| Syslog *[]string | ||
| PlanId *string | ||
| } | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "create", | ||
| Short: "Creates an OpenSearch instance", | ||
| Long: "Creates an OpenSearch instance.", | ||
| Args: args.NoArgs, | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `Create an OpenSearch instance with name "my-instance" and specify plan by name and version`, | ||
| "$ stackit opensearch instance create --name my-instance --plan-name stackit-opensearch-1.2.10-replica --version 2"), | ||
| examples.NewExample( | ||
| `Create an OpenSearch instance with name "my-instance" and specify plan by ID`, | ||
| "$ stackit opensearch instance create --name my-instance --plan-id xxx"), | ||
| examples.NewExample( | ||
| `Create an OpenSearch instance with name "my-instance" and specify IP range which is allowed to access it`, | ||
| "$ stackit opensearch instance create --name my-instance --plan-id xxx --acl 192.168.1.0/24"), | ||
| ), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| ctx := context.Background() | ||
| model, err := parseInput(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Configure API client | ||
| apiClient, err := client.ConfigureClient(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| projectLabel, err := projectname.GetProjectName(ctx, cmd) | ||
| if err != nil { | ||
| projectLabel = model.ProjectId | ||
| } | ||
| if !model.AssumeYes { | ||
| prompt := fmt.Sprintf("Are you sure you want to create an OpenSearch instance for project %s?", projectLabel) | ||
| err = confirm.PromptForConfirmation(cmd, prompt) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| } | ||
| // Call API | ||
| req, err := buildRequest(ctx, model, apiClient) | ||
| if err != nil { | ||
| var dsaInvalidPlanError *cliErr.DSAInvalidPlanError | ||
| if !errors.As(err, &dsaInvalidPlanError) { | ||
| return fmt.Errorf("build OpenSearch instance creation request: %w", err) | ||
| } | ||
| return err | ||
| } | ||
| resp, err := req.Execute() | ||
| if err != nil { | ||
| return fmt.Errorf("create OpenSearch instance: %w", err) | ||
| } | ||
| instanceId := *resp.InstanceId | ||
| // Wait for async operation, if async mode not enabled | ||
| if !model.Async { | ||
| s := spinner.New(cmd) | ||
| s.Start("Creating instance") | ||
| _, err = wait.CreateInstanceWaitHandler(ctx, apiClient, model.ProjectId, instanceId).WaitWithContext(ctx) | ||
| if err != nil { | ||
| return fmt.Errorf("wait for OpenSearch instance creation: %w", err) | ||
| } | ||
| s.Stop() | ||
| } | ||
| operationState := "Created" | ||
| if model.Async { | ||
| operationState = "Triggered creation of" | ||
| } | ||
| cmd.Printf("%s instance for project %s. Instance ID: %s\n", operationState, projectLabel, instanceId) | ||
| return nil | ||
| }, | ||
| } | ||
| configureFlags(cmd) | ||
| return cmd | ||
| } | ||
| func configureFlags(cmd *cobra.Command) { | ||
| cmd.Flags().StringP(instanceNameFlag, "n", "", "Instance name") | ||
| cmd.Flags().Bool(enableMonitoringFlag, false, "Enable monitoring") | ||
| cmd.Flags().String(graphiteFlag, "", "Graphite host") | ||
| cmd.Flags().Int64(metricsFrequencyFlag, 0, "Metrics frequency") | ||
| cmd.Flags().String(metricsPrefixFlag, "", "Metrics prefix") | ||
| cmd.Flags().Var(flags.UUIDFlag(), monitoringInstanceIdFlag, "Monitoring instance ID") | ||
| cmd.Flags().StringSlice(pluginFlag, []string{}, "Plugin") | ||
| cmd.Flags().Var(flags.CIDRSliceFlag(), sgwAclFlag, "List of IP networks in CIDR notation which are allowed to access this instance") | ||
| cmd.Flags().StringSlice(syslogFlag, []string{}, "Syslog") | ||
| cmd.Flags().Var(flags.UUIDFlag(), planIdFlag, "Plan ID") | ||
| cmd.Flags().String(planNameFlag, "", "Plan name") | ||
| cmd.Flags().String(versionFlag, "", "Instance OpenSearch version") | ||
| err := flags.MarkFlagsRequired(cmd, instanceNameFlag) | ||
| cobra.CheckErr(err) | ||
| } | ||
| func parseInput(cmd *cobra.Command) (*inputModel, error) { | ||
| globalFlags := globalflags.Parse(cmd) | ||
| if globalFlags.ProjectId == "" { | ||
| return nil, &cliErr.ProjectIdError{} | ||
| } | ||
| planId := flags.FlagToStringPointer(cmd, planIdFlag) | ||
| planName := flags.FlagToStringValue(cmd, planNameFlag) | ||
| version := flags.FlagToStringValue(cmd, versionFlag) | ||
| if planId == nil && (planName == "" || version == "") { | ||
| return nil, &cliErr.DSAInputPlanError{ | ||
| Cmd: cmd, | ||
| } | ||
| } | ||
| if planId != nil && (planName != "" || version != "") { | ||
| return nil, &cliErr.DSAInputPlanError{ | ||
| Cmd: cmd, | ||
| } | ||
| } | ||
| return &inputModel{ | ||
| GlobalFlagModel: globalFlags, | ||
| InstanceName: flags.FlagToStringPointer(cmd, instanceNameFlag), | ||
| EnableMonitoring: flags.FlagToBoolPointer(cmd, enableMonitoringFlag), | ||
| MonitoringInstanceId: flags.FlagToStringPointer(cmd, monitoringInstanceIdFlag), | ||
| Graphite: flags.FlagToStringPointer(cmd, graphiteFlag), | ||
| MetricsFrequency: flags.FlagToInt64Pointer(cmd, metricsFrequencyFlag), | ||
| MetricsPrefix: flags.FlagToStringPointer(cmd, metricsPrefixFlag), | ||
| Plugin: flags.FlagToStringSlicePointer(cmd, pluginFlag), | ||
| SgwAcl: flags.FlagToStringSlicePointer(cmd, sgwAclFlag), | ||
| Syslog: flags.FlagToStringSlicePointer(cmd, syslogFlag), | ||
| PlanId: planId, | ||
| PlanName: planName, | ||
| Version: version, | ||
| }, nil | ||
| } | ||
| type openSearchClient interface { | ||
| CreateInstance(ctx context.Context, projectId string) opensearch.ApiCreateInstanceRequest | ||
| ListOfferingsExecute(ctx context.Context, projectId string) (*opensearch.ListOfferingsResponse, error) | ||
| } | ||
| func buildRequest(ctx context.Context, model *inputModel, apiClient openSearchClient) (opensearch.ApiCreateInstanceRequest, error) { | ||
| service := "opensearch" | ||
| req := apiClient.CreateInstance(ctx, model.ProjectId) | ||
| var planId *string | ||
| var err error | ||
| offerings, err := apiClient.ListOfferingsExecute(ctx, model.ProjectId) | ||
| if err != nil { | ||
| return req, fmt.Errorf("get OpenSearch offerings: %w", err) | ||
| } | ||
| if model.PlanId == nil { | ||
| planId, err = opensearchUtils.LoadPlanId(model.PlanName, model.Version, offerings) | ||
| if err != nil { | ||
| var dsaInvalidPlanError *cliErr.DSAInvalidPlanError | ||
| if !errors.As(err, &dsaInvalidPlanError) { | ||
| return req, fmt.Errorf("load plan ID: %w", err) | ||
| } | ||
| return req, err | ||
| } | ||
| } else { | ||
| err := opensearchUtils.ValidatePlanId(service, *model.PlanId, offerings) | ||
| if err != nil { | ||
| return req, err | ||
| } | ||
| planId = model.PlanId | ||
| } | ||
| var sgwAcl *string | ||
| if model.SgwAcl != nil { | ||
| sgwAcl = utils.Ptr(strings.Join(*model.SgwAcl, ",")) | ||
| } | ||
| req = req.CreateInstancePayload(opensearch.CreateInstancePayload{ | ||
| InstanceName: model.InstanceName, | ||
| Parameters: &opensearch.InstanceParameters{ | ||
| EnableMonitoring: model.EnableMonitoring, | ||
| Graphite: model.Graphite, | ||
| MonitoringInstanceId: model.MonitoringInstanceId, | ||
| MetricsFrequency: model.MetricsFrequency, | ||
| MetricsPrefix: model.MetricsPrefix, | ||
| Plugins: model.Plugin, | ||
| SgwAcl: sgwAcl, | ||
| Syslog: model.Syslog, | ||
| }, | ||
| PlanId: planId, | ||
| }) | ||
| return req, nil | ||
| } |
| package delete | ||
| import ( | ||
| "context" | ||
| "testing" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/google/go-cmp/cmp" | ||
| "github.com/google/go-cmp/cmp/cmpopts" | ||
| "github.com/google/uuid" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| var projectIdFlag = globalflags.ProjectIdFlag | ||
| type testCtxKey struct{} | ||
| var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") | ||
| var testClient = &opensearch.APIClient{} | ||
| var testProjectId = uuid.NewString() | ||
| var testInstanceId = uuid.NewString() | ||
| func fixtureArgValues(mods ...func(argValues []string)) []string { | ||
| argValues := []string{ | ||
| testInstanceId, | ||
| } | ||
| 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, | ||
| } | ||
| for _, mod := range mods { | ||
| mod(flagValues) | ||
| } | ||
| return flagValues | ||
| } | ||
| func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { | ||
| model := &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| InstanceId: testInstanceId, | ||
| } | ||
| for _, mod := range mods { | ||
| mod(model) | ||
| } | ||
| return model | ||
| } | ||
| func fixtureRequest(mods ...func(request *opensearch.ApiDeleteInstanceRequest)) opensearch.ApiDeleteInstanceRequest { | ||
| request := testClient.DeleteInstance(testCtx, testProjectId, testInstanceId) | ||
| 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 invalid 1", | ||
| argValues: []string{""}, | ||
| flagValues: fixtureFlagValues(), | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "instance id invalid 2", | ||
| argValues: []string{"invalid-uuid"}, | ||
| flagValues: fixtureFlagValues(), | ||
| isValid: false, | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.description, func(t *testing.T) { | ||
| cmd := NewCmd() | ||
| 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(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 opensearch.ApiDeleteInstanceRequest | ||
| }{ | ||
| { | ||
| 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) | ||
| } | ||
| }) | ||
| } | ||
| } |
| package delete | ||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/opensearch/client" | ||
| opensearchUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/opensearch/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch/wait" | ||
| ) | ||
| const ( | ||
| instanceIdArg = "INSTANCE_ID" | ||
| ) | ||
| type inputModel struct { | ||
| *globalflags.GlobalFlagModel | ||
| InstanceId string | ||
| } | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: fmt.Sprintf("delete %s", instanceIdArg), | ||
| Short: "Deletes an OpenSearch instance", | ||
| Long: "Deletes an OpenSearch instance.", | ||
| Args: args.SingleArg(instanceIdArg, utils.ValidateUUID), | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `Delete an OpenSearch instance with ID "xxx"`, | ||
| "$ stackit opensearch instance delete xxx"), | ||
| ), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| ctx := context.Background() | ||
| model, err := parseInput(cmd, args) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Configure API client | ||
| apiClient, err := client.ConfigureClient(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| instanceLabel, err := opensearchUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.InstanceId) | ||
| if err != nil { | ||
| instanceLabel = model.InstanceId | ||
| } | ||
| if !model.AssumeYes { | ||
| prompt := fmt.Sprintf("Are you sure you want to delete instance %s? (This cannot be undone)", instanceLabel) | ||
| err = confirm.PromptForConfirmation(cmd, prompt) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| } | ||
| // Call API | ||
| req := buildRequest(ctx, model, apiClient) | ||
| err = req.Execute() | ||
| if err != nil { | ||
| return fmt.Errorf("delete OpenSearch instance: %w", err) | ||
| } | ||
| // Wait for async operation, if async mode not enabled | ||
| if !model.Async { | ||
| s := spinner.New(cmd) | ||
| s.Start("Deleting instance") | ||
| _, err = wait.DeleteInstanceWaitHandler(ctx, apiClient, model.ProjectId, model.InstanceId).WaitWithContext(ctx) | ||
| if err != nil { | ||
| return fmt.Errorf("wait for OpenSearch instance deletion: %w", err) | ||
| } | ||
| s.Stop() | ||
| } | ||
| operationState := "Deleted" | ||
| if model.Async { | ||
| operationState = "Triggered deletion of" | ||
| } | ||
| cmd.Printf("%s instance %s\n", operationState, instanceLabel) | ||
| return nil | ||
| }, | ||
| } | ||
| return cmd | ||
| } | ||
| func parseInput(cmd *cobra.Command, inputArgs []string) (*inputModel, error) { | ||
| instanceId := inputArgs[0] | ||
| globalFlags := globalflags.Parse(cmd) | ||
| if globalFlags.ProjectId == "" { | ||
| return nil, &errors.ProjectIdError{} | ||
| } | ||
| return &inputModel{ | ||
| GlobalFlagModel: globalFlags, | ||
| InstanceId: instanceId, | ||
| }, nil | ||
| } | ||
| func buildRequest(ctx context.Context, model *inputModel, apiClient *opensearch.APIClient) opensearch.ApiDeleteInstanceRequest { | ||
| req := apiClient.DeleteInstance(ctx, model.ProjectId, model.InstanceId) | ||
| return req | ||
| } |
| package describe | ||
| import ( | ||
| "context" | ||
| "testing" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/google/go-cmp/cmp" | ||
| "github.com/google/go-cmp/cmp/cmpopts" | ||
| "github.com/google/uuid" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| var projectIdFlag = globalflags.ProjectIdFlag | ||
| type testCtxKey struct{} | ||
| var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") | ||
| var testClient = &opensearch.APIClient{} | ||
| var testProjectId = uuid.NewString() | ||
| var testInstanceId = uuid.NewString() | ||
| func fixtureArgValues(mods ...func(argValues []string)) []string { | ||
| argValues := []string{ | ||
| testInstanceId, | ||
| } | ||
| 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, | ||
| } | ||
| for _, mod := range mods { | ||
| mod(flagValues) | ||
| } | ||
| return flagValues | ||
| } | ||
| func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { | ||
| model := &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| InstanceId: testInstanceId, | ||
| } | ||
| for _, mod := range mods { | ||
| mod(model) | ||
| } | ||
| return model | ||
| } | ||
| func fixtureRequest(mods ...func(request *opensearch.ApiGetInstanceRequest)) opensearch.ApiGetInstanceRequest { | ||
| request := testClient.GetInstance(testCtx, testProjectId, testInstanceId) | ||
| 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 invalid 1", | ||
| argValues: []string{""}, | ||
| flagValues: fixtureFlagValues(), | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "instance id invalid 2", | ||
| argValues: []string{"invalid-uuid"}, | ||
| flagValues: fixtureFlagValues(), | ||
| isValid: false, | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.description, func(t *testing.T) { | ||
| cmd := NewCmd() | ||
| 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(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 opensearch.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) | ||
| } | ||
| }) | ||
| } | ||
| } |
| package describe | ||
| import ( | ||
| "context" | ||
| "encoding/json" | ||
| "fmt" | ||
| "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/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/opensearch/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| const ( | ||
| instanceIdArg = "INSTANCE_ID" | ||
| ) | ||
| type inputModel struct { | ||
| *globalflags.GlobalFlagModel | ||
| InstanceId string | ||
| } | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: fmt.Sprintf("describe %s", instanceIdArg), | ||
| Short: "Shows details of an OpenSearch instance", | ||
| Long: "Shows details of an OpenSearch instance.", | ||
| Args: args.SingleArg(instanceIdArg, utils.ValidateUUID), | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `Get details of an OpenSearch instance with ID "xxx"`, | ||
| "$ stackit opensearch instance describe xxx"), | ||
| examples.NewExample( | ||
| `Get details of an OpenSearch instance with ID "xxx" in a table format`, | ||
| "$ stackit opensearch instance describe xxx --output-format pretty"), | ||
| ), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| ctx := context.Background() | ||
| model, err := parseInput(cmd, args) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Configure API client | ||
| apiClient, err := client.ConfigureClient(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Call API | ||
| req := buildRequest(ctx, model, apiClient) | ||
| resp, err := req.Execute() | ||
| if err != nil { | ||
| return fmt.Errorf("read OpenSearch instance: %w", err) | ||
| } | ||
| return outputResult(cmd, model.OutputFormat, resp) | ||
| }, | ||
| } | ||
| return cmd | ||
| } | ||
| func parseInput(cmd *cobra.Command, inputArgs []string) (*inputModel, error) { | ||
| instanceId := inputArgs[0] | ||
| globalFlags := globalflags.Parse(cmd) | ||
| if globalFlags.ProjectId == "" { | ||
| return nil, &errors.ProjectIdError{} | ||
| } | ||
| return &inputModel{ | ||
| GlobalFlagModel: globalFlags, | ||
| InstanceId: instanceId, | ||
| }, nil | ||
| } | ||
| func buildRequest(ctx context.Context, model *inputModel, apiClient *opensearch.APIClient) opensearch.ApiGetInstanceRequest { | ||
| req := apiClient.GetInstance(ctx, model.ProjectId, model.InstanceId) | ||
| return req | ||
| } | ||
| func outputResult(cmd *cobra.Command, outputFormat string, instance *opensearch.Instance) error { | ||
| switch outputFormat { | ||
| case globalflags.PrettyOutputFormat: | ||
| table := tables.NewTable() | ||
| table.AddRow("ID", *instance.InstanceId) | ||
| table.AddSeparator() | ||
| table.AddRow("NAME", *instance.Name) | ||
| table.AddSeparator() | ||
| table.AddRow("LAST OPERATION TYPE", *instance.LastOperation.Type) | ||
| table.AddSeparator() | ||
| table.AddRow("LAST OPERATION STATE", *instance.LastOperation.State) | ||
| err := table.Display(cmd) | ||
| if err != nil { | ||
| return fmt.Errorf("render table: %w", err) | ||
| } | ||
| return nil | ||
| default: | ||
| details, err := json.MarshalIndent(instance, "", " ") | ||
| if err != nil { | ||
| return fmt.Errorf("marshal OpenSearch instance: %w", err) | ||
| } | ||
| cmd.Println(string(details)) | ||
| return nil | ||
| } | ||
| } |
| package instance | ||
| import ( | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/instance/create" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/instance/delete" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/instance/describe" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/instance/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/instance/update" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "instance", | ||
| Short: "Provides functionality for OpenSearch instances", | ||
| Long: "Provides functionality for OpenSearch instances.", | ||
| Args: args.NoArgs, | ||
| Run: utils.CmdHelp, | ||
| } | ||
| addSubcommands(cmd) | ||
| return cmd | ||
| } | ||
| func addSubcommands(cmd *cobra.Command) { | ||
| cmd.AddCommand(create.NewCmd()) | ||
| cmd.AddCommand(delete.NewCmd()) | ||
| cmd.AddCommand(describe.NewCmd()) | ||
| cmd.AddCommand(list.NewCmd()) | ||
| cmd.AddCommand(update.NewCmd()) | ||
| } |
| package list | ||
| 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/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| var projectIdFlag = globalflags.ProjectIdFlag | ||
| type testCtxKey struct{} | ||
| var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") | ||
| var testClient = &opensearch.APIClient{} | ||
| var testProjectId = uuid.NewString() | ||
| func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string { | ||
| flagValues := map[string]string{ | ||
| projectIdFlag: testProjectId, | ||
| limitFlag: "10", | ||
| } | ||
| for _, mod := range mods { | ||
| mod(flagValues) | ||
| } | ||
| return flagValues | ||
| } | ||
| func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { | ||
| model := &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| Limit: utils.Ptr(int64(10)), | ||
| } | ||
| for _, mod := range mods { | ||
| mod(model) | ||
| } | ||
| return model | ||
| } | ||
| func fixtureRequest(mods ...func(request *opensearch.ApiListInstancesRequest)) opensearch.ApiListInstancesRequest { | ||
| request := testClient.ListInstances(testCtx, testProjectId) | ||
| 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: "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) { | ||
| 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) | ||
| } | ||
| model, err := parseInput(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 opensearch.ApiListInstancesRequest | ||
| }{ | ||
| { | ||
| 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) | ||
| } | ||
| }) | ||
| } | ||
| } |
| package list | ||
| import ( | ||
| "context" | ||
| "encoding/json" | ||
| "fmt" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/opensearch/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
| "github.com/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| const ( | ||
| limitFlag = "limit" | ||
| ) | ||
| type inputModel struct { | ||
| *globalflags.GlobalFlagModel | ||
| Limit *int64 | ||
| } | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "list", | ||
| Short: "Lists all OpenSearch instances", | ||
| Long: "Lists all OpenSearch instances.", | ||
| Args: args.NoArgs, | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `List all OpenSearch instances`, | ||
| "$ stackit opensearch instance list"), | ||
| examples.NewExample( | ||
| `List all OpenSearch instances in JSON format`, | ||
| "$ stackit opensearch instance list --output-format json"), | ||
| examples.NewExample( | ||
| `List up to 10 OpenSearch instances`, | ||
| "$ stackit opensearch instance list --limit 10"), | ||
| ), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| ctx := context.Background() | ||
| model, err := parseInput(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Configure API client | ||
| apiClient, err := client.ConfigureClient(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Call API | ||
| req := buildRequest(ctx, model, apiClient) | ||
| resp, err := req.Execute() | ||
| if err != nil { | ||
| return fmt.Errorf("get OpenSearch instances: %w", err) | ||
| } | ||
| instances := *resp.Instances | ||
| if len(instances) == 0 { | ||
| projectLabel, err := projectname.GetProjectName(ctx, cmd) | ||
| if err != nil { | ||
| projectLabel = model.ProjectId | ||
| } | ||
| cmd.Printf("No instances found for project %s\n", projectLabel) | ||
| return nil | ||
| } | ||
| // Truncate output | ||
| if model.Limit != nil && len(instances) > int(*model.Limit) { | ||
| instances = instances[:*model.Limit] | ||
| } | ||
| return outputResult(cmd, model.OutputFormat, instances) | ||
| }, | ||
| } | ||
| configureFlags(cmd) | ||
| return cmd | ||
| } | ||
| func configureFlags(cmd *cobra.Command) { | ||
| cmd.Flags().Int64(limitFlag, 0, "Maximum number of entries to list") | ||
| } | ||
| func parseInput(cmd *cobra.Command) (*inputModel, error) { | ||
| globalFlags := globalflags.Parse(cmd) | ||
| if globalFlags.ProjectId == "" { | ||
| return nil, &errors.ProjectIdError{} | ||
| } | ||
| limit := flags.FlagToInt64Pointer(cmd, limitFlag) | ||
| if limit != nil && *limit < 1 { | ||
| return nil, &errors.FlagValidationError{ | ||
| Flag: limitFlag, | ||
| Details: "must be greater than 0", | ||
| } | ||
| } | ||
| return &inputModel{ | ||
| GlobalFlagModel: globalFlags, | ||
| Limit: flags.FlagToInt64Pointer(cmd, limitFlag), | ||
| }, nil | ||
| } | ||
| func buildRequest(ctx context.Context, model *inputModel, apiClient *opensearch.APIClient) opensearch.ApiListInstancesRequest { | ||
| req := apiClient.ListInstances(ctx, model.ProjectId) | ||
| return req | ||
| } | ||
| func outputResult(cmd *cobra.Command, outputFormat string, instances []opensearch.Instance) error { | ||
| switch outputFormat { | ||
| case globalflags.JSONOutputFormat: | ||
| details, err := json.MarshalIndent(instances, "", " ") | ||
| if err != nil { | ||
| return fmt.Errorf("marshal OpenSearch instance list: %w", err) | ||
| } | ||
| cmd.Println(string(details)) | ||
| return nil | ||
| default: | ||
| table := tables.NewTable() | ||
| table.SetHeader("ID", "NAME", "LAST OPERATION TYPE", "LAST OPERATION STATE") | ||
| for i := range instances { | ||
| instance := instances[i] | ||
| table.AddRow(*instance.InstanceId, *instance.Name, *instance.LastOperation.Type, *instance.LastOperation.State) | ||
| } | ||
| err := table.Display(cmd) | ||
| if err != nil { | ||
| return fmt.Errorf("render table: %w", err) | ||
| } | ||
| return nil | ||
| } | ||
| } |
| package update | ||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "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/opensearch" | ||
| ) | ||
| var projectIdFlag = globalflags.ProjectIdFlag | ||
| type testCtxKey struct{} | ||
| var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") | ||
| var testClient = &opensearch.APIClient{} | ||
| type openSearchClientMocked struct { | ||
| returnError bool | ||
| listOfferingsResp *opensearch.ListOfferingsResponse | ||
| } | ||
| func (c *openSearchClientMocked) PartialUpdateInstance(ctx context.Context, projectId, instanceId string) opensearch.ApiPartialUpdateInstanceRequest { | ||
| return testClient.PartialUpdateInstance(ctx, projectId, instanceId) | ||
| } | ||
| func (c *openSearchClientMocked) ListOfferingsExecute(_ context.Context, _ string) (*opensearch.ListOfferingsResponse, error) { | ||
| if c.returnError { | ||
| return nil, fmt.Errorf("list flavors failed") | ||
| } | ||
| return c.listOfferingsResp, nil | ||
| } | ||
| var ( | ||
| testProjectId = uuid.NewString() | ||
| testInstanceId = uuid.NewString() | ||
| testPlanId = uuid.NewString() | ||
| testMonitoringInstanceId = uuid.NewString() | ||
| ) | ||
| func fixtureArgValues(mods ...func(argValues []string)) []string { | ||
| argValues := []string{ | ||
| testInstanceId, | ||
| } | ||
| 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, | ||
| enableMonitoringFlag: "true", | ||
| graphiteFlag: "example-graphite", | ||
| metricsFrequencyFlag: "100", | ||
| metricsPrefixFlag: "example-prefix", | ||
| monitoringInstanceIdFlag: testMonitoringInstanceId, | ||
| pluginFlag: "example-plugin", | ||
| sgwAclFlag: "198.51.100.14/24", | ||
| syslogFlag: "example-syslog", | ||
| planIdFlag: testPlanId, | ||
| } | ||
| for _, mod := range mods { | ||
| mod(flagValues) | ||
| } | ||
| return flagValues | ||
| } | ||
| func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { | ||
| model := &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| InstanceId: testInstanceId, | ||
| EnableMonitoring: utils.Ptr(true), | ||
| Graphite: utils.Ptr("example-graphite"), | ||
| MetricsFrequency: utils.Ptr(int64(100)), | ||
| MetricsPrefix: utils.Ptr("example-prefix"), | ||
| MonitoringInstanceId: utils.Ptr(testMonitoringInstanceId), | ||
| Plugin: utils.Ptr([]string{"example-plugin"}), | ||
| SgwAcl: utils.Ptr([]string{"198.51.100.14/24"}), | ||
| Syslog: utils.Ptr([]string{"example-syslog"}), | ||
| PlanId: utils.Ptr(testPlanId), | ||
| } | ||
| for _, mod := range mods { | ||
| mod(model) | ||
| } | ||
| return model | ||
| } | ||
| func fixtureRequest(mods ...func(request *opensearch.ApiPartialUpdateInstanceRequest)) opensearch.ApiPartialUpdateInstanceRequest { | ||
| request := testClient.PartialUpdateInstance(testCtx, testProjectId, testInstanceId) | ||
| request = request.PartialUpdateInstancePayload(opensearch.PartialUpdateInstancePayload{ | ||
| Parameters: &opensearch.InstanceParameters{ | ||
| EnableMonitoring: utils.Ptr(true), | ||
| Graphite: utils.Ptr("example-graphite"), | ||
| MetricsFrequency: utils.Ptr(int64(100)), | ||
| MetricsPrefix: utils.Ptr("example-prefix"), | ||
| MonitoringInstanceId: utils.Ptr(testMonitoringInstanceId), | ||
| Plugins: utils.Ptr([]string{"example-plugin"}), | ||
| SgwAcl: utils.Ptr("198.51.100.14/24"), | ||
| Syslog: utils.Ptr([]string{"example-syslog"}), | ||
| }, | ||
| PlanId: utils.Ptr(testPlanId), | ||
| }) | ||
| for _, mod := range mods { | ||
| mod(&request) | ||
| } | ||
| return request | ||
| } | ||
| func TestParseInput(t *testing.T) { | ||
| tests := []struct { | ||
| description string | ||
| argValues []string | ||
| flagValues map[string]string | ||
| sgwAclValues []string | ||
| pluginValues []string | ||
| syslogValues []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: "required flags only (no values to update)", | ||
| argValues: fixtureArgValues(), | ||
| flagValues: map[string]string{ | ||
| projectIdFlag: testProjectId, | ||
| }, | ||
| isValid: false, | ||
| expectedModel: &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| InstanceId: testInstanceId, | ||
| }, | ||
| }, | ||
| { | ||
| description: "zero values", | ||
| argValues: fixtureArgValues(), | ||
| flagValues: map[string]string{ | ||
| projectIdFlag: testProjectId, | ||
| planIdFlag: testPlanId, | ||
| enableMonitoringFlag: "false", | ||
| graphiteFlag: "", | ||
| metricsFrequencyFlag: "0", | ||
| metricsPrefixFlag: "", | ||
| }, | ||
| isValid: true, | ||
| expectedModel: &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| InstanceId: testInstanceId, | ||
| PlanId: utils.Ptr(testPlanId), | ||
| EnableMonitoring: utils.Ptr(false), | ||
| Graphite: utils.Ptr(""), | ||
| MetricsFrequency: utils.Ptr(int64(0)), | ||
| MetricsPrefix: utils.Ptr(""), | ||
| }, | ||
| }, | ||
| { | ||
| 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 invalid 1", | ||
| argValues: []string{""}, | ||
| flagValues: fixtureFlagValues(), | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "instance id invalid 2", | ||
| argValues: []string{"invalid-uuid"}, | ||
| flagValues: fixtureFlagValues(), | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "repeated acl flags", | ||
| argValues: fixtureArgValues(), | ||
| flagValues: fixtureFlagValues(), | ||
| sgwAclValues: []string{"198.51.100.14/24", "198.51.100.14/32"}, | ||
| isValid: true, | ||
| expectedModel: fixtureInputModel(func(model *inputModel) { | ||
| model.SgwAcl = utils.Ptr( | ||
| append(*model.SgwAcl, "198.51.100.14/24", "198.51.100.14/32"), | ||
| ) | ||
| }), | ||
| }, | ||
| { | ||
| description: "repeated acl flag with list value", | ||
| argValues: fixtureArgValues(), | ||
| flagValues: fixtureFlagValues(), | ||
| sgwAclValues: []string{"198.51.100.14/24,198.51.100.14/32"}, | ||
| isValid: true, | ||
| expectedModel: fixtureInputModel(func(model *inputModel) { | ||
| model.SgwAcl = utils.Ptr( | ||
| append(*model.SgwAcl, "198.51.100.14/24", "198.51.100.14/32"), | ||
| ) | ||
| }), | ||
| }, | ||
| { | ||
| description: "repeated plugin flags", | ||
| argValues: fixtureArgValues(), | ||
| flagValues: fixtureFlagValues(), | ||
| pluginValues: []string{"example-plugin-1", "example-plugin-2"}, | ||
| isValid: true, | ||
| expectedModel: fixtureInputModel(func(model *inputModel) { | ||
| model.Plugin = utils.Ptr( | ||
| append(*model.Plugin, "example-plugin-1", "example-plugin-2"), | ||
| ) | ||
| }), | ||
| }, | ||
| { | ||
| description: "repeated syslog flags", | ||
| argValues: fixtureArgValues(), | ||
| flagValues: fixtureFlagValues(), | ||
| syslogValues: []string{"example-syslog-1", "example-syslog-2"}, | ||
| isValid: true, | ||
| expectedModel: fixtureInputModel(func(model *inputModel) { | ||
| model.Syslog = utils.Ptr( | ||
| append(*model.Syslog, "example-syslog-1", "example-syslog-2"), | ||
| ) | ||
| }), | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.description, func(t *testing.T) { | ||
| cmd := NewCmd() | ||
| 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) | ||
| } | ||
| } | ||
| for _, value := range tt.sgwAclValues { | ||
| err := cmd.Flags().Set(sgwAclFlag, value) | ||
| if err != nil { | ||
| if !tt.isValid { | ||
| return | ||
| } | ||
| t.Fatalf("setting flag --%s=%s: %v", sgwAclFlag, value, err) | ||
| } | ||
| } | ||
| for _, value := range tt.pluginValues { | ||
| err := cmd.Flags().Set(pluginFlag, value) | ||
| if err != nil { | ||
| if !tt.isValid { | ||
| return | ||
| } | ||
| t.Fatalf("setting flag --%s=%s: %v", pluginFlag, value, err) | ||
| } | ||
| } | ||
| for _, value := range tt.syslogValues { | ||
| err := cmd.Flags().Set(syslogFlag, value) | ||
| if err != nil { | ||
| if !tt.isValid { | ||
| return | ||
| } | ||
| t.Fatalf("setting flag --%s=%s: %v", syslogFlag, 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(cmd, tt.argValues) | ||
| 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 opensearch.ApiPartialUpdateInstanceRequest | ||
| getOfferingsFails bool | ||
| listOfferingsResp *opensearch.ListOfferingsResponse | ||
| isValid bool | ||
| }{ | ||
| { | ||
| description: "base", | ||
| model: fixtureInputModel(), | ||
| expectedRequest: fixtureRequest(), | ||
| listOfferingsResp: &opensearch.ListOfferingsResponse{ | ||
| Offerings: &[]opensearch.Offering{ | ||
| { | ||
| Version: utils.Ptr("example-version"), | ||
| Plans: &[]opensearch.Plan{ | ||
| { | ||
| Name: utils.Ptr("example-plan-name"), | ||
| Id: utils.Ptr(testPlanId), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| description: "use plan name and version", | ||
| model: fixtureInputModel( | ||
| func(model *inputModel) { | ||
| model.PlanId = nil | ||
| model.PlanName = "example-plan-name" | ||
| model.Version = "example-version" | ||
| }, | ||
| ), | ||
| expectedRequest: fixtureRequest(), | ||
| listOfferingsResp: &opensearch.ListOfferingsResponse{ | ||
| Offerings: &[]opensearch.Offering{ | ||
| { | ||
| Version: utils.Ptr("example-version"), | ||
| Plans: &[]opensearch.Plan{ | ||
| { | ||
| Name: utils.Ptr("example-plan-name"), | ||
| Id: utils.Ptr(testPlanId), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| description: "get offering fails", | ||
| model: fixtureInputModel( | ||
| func(model *inputModel) { | ||
| model.PlanId = nil | ||
| model.PlanName = "example-plan-name" | ||
| model.Version = "example-version" | ||
| }, | ||
| ), | ||
| getOfferingsFails: true, | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "plan name not found", | ||
| model: fixtureInputModel( | ||
| func(model *inputModel) { | ||
| model.PlanId = nil | ||
| model.PlanName = "example-plan-name" | ||
| model.Version = "example-version" | ||
| }, | ||
| ), | ||
| listOfferingsResp: &opensearch.ListOfferingsResponse{ | ||
| Offerings: &[]opensearch.Offering{ | ||
| { | ||
| Version: utils.Ptr("example-version"), | ||
| Plans: &[]opensearch.Plan{ | ||
| { | ||
| Name: utils.Ptr("other-plan-name"), | ||
| Id: utils.Ptr(testPlanId), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| isValid: false, | ||
| }, | ||
| { | ||
| description: "required fields only", | ||
| model: &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| InstanceId: testInstanceId, | ||
| }, | ||
| expectedRequest: testClient.PartialUpdateInstance(testCtx, testProjectId, testInstanceId). | ||
| PartialUpdateInstancePayload(opensearch.PartialUpdateInstancePayload{Parameters: &opensearch.InstanceParameters{}}), | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.description, func(t *testing.T) { | ||
| client := &openSearchClientMocked{ | ||
| returnError: tt.getOfferingsFails, | ||
| listOfferingsResp: tt.listOfferingsResp, | ||
| } | ||
| request, err := buildRequest(testCtx, tt.model, client) | ||
| if err != nil { | ||
| if !tt.isValid { | ||
| return | ||
| } | ||
| t.Fatalf("error building request: %v", err) | ||
| } | ||
| diff := cmp.Diff(request, tt.expectedRequest, | ||
| cmp.AllowUnexported(tt.expectedRequest), | ||
| cmpopts.EquateComparable(testCtx), | ||
| ) | ||
| if diff != "" { | ||
| t.Fatalf("Data does not match: %s", diff) | ||
| } | ||
| }) | ||
| } | ||
| } |
| package update | ||
| import ( | ||
| "context" | ||
| "errors" | ||
| "fmt" | ||
| "strings" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| 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/services/opensearch/client" | ||
| opensearchUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/opensearch/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch/wait" | ||
| ) | ||
| const ( | ||
| instanceIdArg = "INSTANCE_ID" | ||
| instanceNameFlag = "name" | ||
| enableMonitoringFlag = "enable-monitoring" | ||
| graphiteFlag = "graphite" | ||
| metricsFrequencyFlag = "metrics-frequency" | ||
| metricsPrefixFlag = "metrics-prefix" | ||
| monitoringInstanceIdFlag = "monitoring-instance-id" | ||
| pluginFlag = "plugin" | ||
| sgwAclFlag = "acl" | ||
| syslogFlag = "syslog" | ||
| planIdFlag = "plan-id" | ||
| planNameFlag = "plan-name" | ||
| versionFlag = "version" | ||
| ) | ||
| type inputModel struct { | ||
| *globalflags.GlobalFlagModel | ||
| InstanceId string | ||
| PlanName string | ||
| Version string | ||
| EnableMonitoring *bool | ||
| Graphite *string | ||
| MetricsFrequency *int64 | ||
| MetricsPrefix *string | ||
| MonitoringInstanceId *string | ||
| Plugin *[]string | ||
| SgwAcl *[]string | ||
| Syslog *[]string | ||
| PlanId *string | ||
| } | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: fmt.Sprintf("update %s", instanceIdArg), | ||
| Short: "Updates an OpenSearch instance", | ||
| Long: "Updates an OpenSearch instance.", | ||
| Args: args.SingleArg(instanceIdArg, utils.ValidateUUID), | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `Update the plan of an OpenSearch instance with ID "xxx"`, | ||
| "$ stackit opensearch instance update xxx --plan-id xxx"), | ||
| examples.NewExample( | ||
| `Update the range of IPs allowed to access an OpenSearch instance with ID "xxx"`, | ||
| "$ stackit opensearch instance update xxx --acl 192.168.1.0/24"), | ||
| ), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| ctx := context.Background() | ||
| model, err := parseInput(cmd, args) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Configure API client | ||
| apiClient, err := client.ConfigureClient(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| instanceLabel, err := opensearchUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.InstanceId) | ||
| if err != nil { | ||
| instanceLabel = model.InstanceId | ||
| } | ||
| if !model.AssumeYes { | ||
| prompt := fmt.Sprintf("Are you sure you want to update instance %s?", instanceLabel) | ||
| err = confirm.PromptForConfirmation(cmd, prompt) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| } | ||
| // Call API | ||
| req, err := buildRequest(ctx, model, apiClient) | ||
| if err != nil { | ||
| var dsaInvalidPlanError *cliErr.DSAInvalidPlanError | ||
| if !errors.As(err, &dsaInvalidPlanError) { | ||
| return fmt.Errorf("build OpenSearch instance update request: %w", err) | ||
| } | ||
| return err | ||
| } | ||
| err = req.Execute() | ||
| if err != nil { | ||
| return fmt.Errorf("update OpenSearch instance: %w", err) | ||
| } | ||
| instanceId := model.InstanceId | ||
| // Wait for async operation, if async mode not enabled | ||
| if !model.Async { | ||
| s := spinner.New(cmd) | ||
| s.Start("Updating instance") | ||
| _, err = wait.PartialUpdateInstanceWaitHandler(ctx, apiClient, model.ProjectId, instanceId).WaitWithContext(ctx) | ||
| if err != nil { | ||
| return fmt.Errorf("wait for OpenSearch instance update: %w", err) | ||
| } | ||
| s.Stop() | ||
| } | ||
| operationState := "Updated" | ||
| if model.Async { | ||
| operationState = "Triggered update of" | ||
| } | ||
| cmd.Printf("%s instance %s\n", operationState, instanceLabel) | ||
| return nil | ||
| }, | ||
| } | ||
| configureFlags(cmd) | ||
| return cmd | ||
| } | ||
| func configureFlags(cmd *cobra.Command) { | ||
| cmd.Flags().Bool(enableMonitoringFlag, false, "Enable monitoring") | ||
| cmd.Flags().String(graphiteFlag, "", "Graphite host") | ||
| cmd.Flags().Int64(metricsFrequencyFlag, 0, "Metrics frequency") | ||
| cmd.Flags().String(metricsPrefixFlag, "", "Metrics prefix") | ||
| cmd.Flags().Var(flags.UUIDFlag(), monitoringInstanceIdFlag, "Monitoring instance ID") | ||
| cmd.Flags().StringSlice(pluginFlag, []string{}, "Plugin") | ||
| cmd.Flags().Var(flags.CIDRSliceFlag(), sgwAclFlag, "List of IP networks in CIDR notation which are allowed to access this instance") | ||
| cmd.Flags().StringSlice(syslogFlag, []string{}, "Syslog") | ||
| cmd.Flags().Var(flags.UUIDFlag(), planIdFlag, "Plan ID") | ||
| cmd.Flags().String(planNameFlag, "", "Plan name") | ||
| cmd.Flags().String(versionFlag, "", "Instance OpenSearch version") | ||
| } | ||
| func parseInput(cmd *cobra.Command, inputArgs []string) (*inputModel, error) { | ||
| instanceId := inputArgs[0] | ||
| globalFlags := globalflags.Parse(cmd) | ||
| if globalFlags.ProjectId == "" { | ||
| return nil, &cliErr.ProjectIdError{} | ||
| } | ||
| enableMonitoring := flags.FlagToBoolPointer(cmd, enableMonitoringFlag) | ||
| monitoringInstanceId := flags.FlagToStringPointer(cmd, monitoringInstanceIdFlag) | ||
| graphite := flags.FlagToStringPointer(cmd, graphiteFlag) | ||
| metricsFrequency := flags.FlagToInt64Pointer(cmd, metricsFrequencyFlag) | ||
| metricsPrefix := flags.FlagToStringPointer(cmd, metricsPrefixFlag) | ||
| plugin := flags.FlagToStringSlicePointer(cmd, pluginFlag) | ||
| sgwAcl := flags.FlagToStringSlicePointer(cmd, sgwAclFlag) | ||
| syslog := flags.FlagToStringSlicePointer(cmd, syslogFlag) | ||
| planId := flags.FlagToStringPointer(cmd, planIdFlag) | ||
| planName := flags.FlagToStringValue(cmd, planNameFlag) | ||
| version := flags.FlagToStringValue(cmd, versionFlag) | ||
| if planId != nil && (planName != "" || version != "") { | ||
| return nil, &cliErr.DSAInputPlanError{ | ||
| Cmd: cmd, | ||
| Args: inputArgs, | ||
| } | ||
| } | ||
| if enableMonitoring == nil && monitoringInstanceId == nil && graphite == nil && | ||
| metricsFrequency == nil && metricsPrefix == nil && plugin == nil && | ||
| sgwAcl == nil && syslog == nil && planId == nil && | ||
| planName == "" && version == "" { | ||
| return nil, &cliErr.EmptyUpdateError{} | ||
| } | ||
| return &inputModel{ | ||
| GlobalFlagModel: globalFlags, | ||
| InstanceId: instanceId, | ||
| EnableMonitoring: enableMonitoring, | ||
| MonitoringInstanceId: monitoringInstanceId, | ||
| Graphite: graphite, | ||
| MetricsFrequency: metricsFrequency, | ||
| MetricsPrefix: metricsPrefix, | ||
| Plugin: plugin, | ||
| SgwAcl: sgwAcl, | ||
| Syslog: syslog, | ||
| PlanId: planId, | ||
| PlanName: planName, | ||
| Version: version, | ||
| }, nil | ||
| } | ||
| type openSearchClient interface { | ||
| PartialUpdateInstance(ctx context.Context, projectId, instanceId string) opensearch.ApiPartialUpdateInstanceRequest | ||
| ListOfferingsExecute(ctx context.Context, projectId string) (*opensearch.ListOfferingsResponse, error) | ||
| } | ||
| func buildRequest(ctx context.Context, model *inputModel, apiClient openSearchClient) (opensearch.ApiPartialUpdateInstanceRequest, error) { | ||
| service := "opensearch" | ||
| req := apiClient.PartialUpdateInstance(ctx, model.ProjectId, model.InstanceId) | ||
| var planId *string | ||
| var err error | ||
| offerings, err := apiClient.ListOfferingsExecute(ctx, model.ProjectId) | ||
| if err != nil { | ||
| return req, fmt.Errorf("get OpenSearch offerings: %w", err) | ||
| } | ||
| if model.PlanId == nil && model.PlanName != "" && model.Version != "" { | ||
| planId, err = opensearchUtils.LoadPlanId(model.PlanName, model.Version, offerings) | ||
| if err != nil { | ||
| var dsaInvalidPlanError *cliErr.DSAInvalidPlanError | ||
| if !errors.As(err, &dsaInvalidPlanError) { | ||
| return req, fmt.Errorf("load plan ID: %w", err) | ||
| } | ||
| return req, err | ||
| } | ||
| } else { | ||
| // planId is not required for update operation | ||
| if model.PlanId != nil { | ||
| err := opensearchUtils.ValidatePlanId(service, *model.PlanId, offerings) | ||
| if err != nil { | ||
| return req, err | ||
| } | ||
| } | ||
| planId = model.PlanId | ||
| } | ||
| var sgwAcl *string | ||
| if model.SgwAcl != nil { | ||
| sgwAcl = utils.Ptr(strings.Join(*model.SgwAcl, ",")) | ||
| } | ||
| req = req.PartialUpdateInstancePayload(opensearch.PartialUpdateInstancePayload{ | ||
| Parameters: &opensearch.InstanceParameters{ | ||
| EnableMonitoring: model.EnableMonitoring, | ||
| Graphite: model.Graphite, | ||
| MonitoringInstanceId: model.MonitoringInstanceId, | ||
| MetricsFrequency: model.MetricsFrequency, | ||
| MetricsPrefix: model.MetricsPrefix, | ||
| Plugins: model.Plugin, | ||
| SgwAcl: sgwAcl, | ||
| Syslog: model.Syslog, | ||
| }, | ||
| PlanId: planId, | ||
| }) | ||
| return req, nil | ||
| } |
| package opensearch | ||
| import ( | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/credentials" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/instance" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch/plans" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "opensearch", | ||
| Short: "Provides functionality for OpenSearch", | ||
| Long: "Provides functionality for OpenSearch.", | ||
| Args: args.NoArgs, | ||
| Run: utils.CmdHelp, | ||
| } | ||
| addSubcommands(cmd) | ||
| return cmd | ||
| } | ||
| func addSubcommands(cmd *cobra.Command) { | ||
| cmd.AddCommand(instance.NewCmd()) | ||
| cmd.AddCommand(plans.NewCmd()) | ||
| cmd.AddCommand(credentials.NewCmd()) | ||
| } |
| package plans | ||
| 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/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| var projectIdFlag = globalflags.ProjectIdFlag | ||
| type testCtxKey struct{} | ||
| var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") | ||
| var testClient = &opensearch.APIClient{} | ||
| var testProjectId = uuid.NewString() | ||
| func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string { | ||
| flagValues := map[string]string{ | ||
| projectIdFlag: testProjectId, | ||
| limitFlag: "10", | ||
| } | ||
| for _, mod := range mods { | ||
| mod(flagValues) | ||
| } | ||
| return flagValues | ||
| } | ||
| func fixtureInputModel(mods ...func(model *inputModel)) *inputModel { | ||
| model := &inputModel{ | ||
| GlobalFlagModel: &globalflags.GlobalFlagModel{ | ||
| ProjectId: testProjectId, | ||
| }, | ||
| Limit: utils.Ptr(int64(10)), | ||
| } | ||
| for _, mod := range mods { | ||
| mod(model) | ||
| } | ||
| return model | ||
| } | ||
| func fixtureRequest(mods ...func(request *opensearch.ApiListOfferingsRequest)) opensearch.ApiListOfferingsRequest { | ||
| request := testClient.ListOfferings(testCtx, testProjectId) | ||
| 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: "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) { | ||
| 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) | ||
| } | ||
| model, err := parseInput(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 opensearch.ApiListOfferingsRequest | ||
| }{ | ||
| { | ||
| 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) | ||
| } | ||
| }) | ||
| } | ||
| } |
| package plans | ||
| import ( | ||
| "context" | ||
| "encoding/json" | ||
| "fmt" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/opensearch/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
| "github.com/spf13/cobra" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| const ( | ||
| limitFlag = "limit" | ||
| ) | ||
| type inputModel struct { | ||
| *globalflags.GlobalFlagModel | ||
| Limit *int64 | ||
| } | ||
| func NewCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "plans", | ||
| Short: "Lists all OpenSearch service plans", | ||
| Long: "Lists all OpenSearch service plans.", | ||
| Args: args.NoArgs, | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `List all OpenSearch service plans`, | ||
| "$ stackit opensearch plans"), | ||
| examples.NewExample( | ||
| `List all OpenSearch service plans in JSON format`, | ||
| "$ stackit opensearch plans --output-format json"), | ||
| examples.NewExample( | ||
| `List up to 10 OpenSearch service plans`, | ||
| "$ stackit opensearch plans --limit 10"), | ||
| ), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| ctx := context.Background() | ||
| model, err := parseInput(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Configure API client | ||
| apiClient, err := client.ConfigureClient(cmd) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| // Call API | ||
| req := buildRequest(ctx, model, apiClient) | ||
| resp, err := req.Execute() | ||
| if err != nil { | ||
| return fmt.Errorf("get OpenSearch service plans: %w", err) | ||
| } | ||
| plans := *resp.Offerings | ||
| if len(plans) == 0 { | ||
| projectLabel, err := projectname.GetProjectName(ctx, cmd) | ||
| if err != nil { | ||
| projectLabel = model.ProjectId | ||
| } | ||
| cmd.Printf("No plans found for project %s\n", projectLabel) | ||
| return nil | ||
| } | ||
| // Truncate output | ||
| if model.Limit != nil && len(plans) > int(*model.Limit) { | ||
| plans = plans[:*model.Limit] | ||
| } | ||
| return outputResult(cmd, model.OutputFormat, plans) | ||
| }, | ||
| } | ||
| configureFlags(cmd) | ||
| return cmd | ||
| } | ||
| func configureFlags(cmd *cobra.Command) { | ||
| cmd.Flags().Int64(limitFlag, 0, "Maximum number of entries to list") | ||
| } | ||
| func parseInput(cmd *cobra.Command) (*inputModel, error) { | ||
| globalFlags := globalflags.Parse(cmd) | ||
| if globalFlags.ProjectId == "" { | ||
| return nil, &errors.ProjectIdError{} | ||
| } | ||
| limit := flags.FlagToInt64Pointer(cmd, limitFlag) | ||
| if limit != nil && *limit < 1 { | ||
| return nil, &errors.FlagValidationError{ | ||
| Flag: limitFlag, | ||
| Details: "must be greater than 0", | ||
| } | ||
| } | ||
| return &inputModel{ | ||
| GlobalFlagModel: globalFlags, | ||
| Limit: limit, | ||
| }, nil | ||
| } | ||
| func buildRequest(ctx context.Context, model *inputModel, apiClient *opensearch.APIClient) opensearch.ApiListOfferingsRequest { | ||
| req := apiClient.ListOfferings(ctx, model.ProjectId) | ||
| return req | ||
| } | ||
| func outputResult(cmd *cobra.Command, outputFormat string, plans []opensearch.Offering) error { | ||
| switch outputFormat { | ||
| case globalflags.JSONOutputFormat: | ||
| details, err := json.MarshalIndent(plans, "", " ") | ||
| if err != nil { | ||
| return fmt.Errorf("marshal OpenSearch plans: %w", err) | ||
| } | ||
| cmd.Println(string(details)) | ||
| return nil | ||
| default: | ||
| table := tables.NewTable() | ||
| table.SetHeader("OFFERING NAME", "ID", "NAME", "DESCRIPTION") | ||
| for i := range plans { | ||
| o := plans[i] | ||
| for j := range *o.Plans { | ||
| p := (*o.Plans)[j] | ||
| table.AddRow(*o.Name, *p.Id, *p.Name, *p.Description) | ||
| } | ||
| table.AddSeparator() | ||
| } | ||
| table.EnableAutoMergeOnColumns(1) | ||
| err := table.Display(cmd) | ||
| if err != nil { | ||
| return fmt.Errorf("render table: %w", err) | ||
| } | ||
| return nil | ||
| } | ||
| } |
| package client | ||
| import ( | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/spf13/cobra" | ||
| "github.com/spf13/viper" | ||
| sdkConfig "github.com/stackitcloud/stackit-sdk-go/core/config" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| func ConfigureClient(cmd *cobra.Command) (*opensearch.APIClient, error) { | ||
| var err error | ||
| var apiClient *opensearch.APIClient | ||
| var cfgOptions []sdkConfig.ConfigurationOption | ||
| authCfgOption, err := auth.AuthenticationConfig(cmd, auth.AuthorizeUser) | ||
| if err != nil { | ||
| return nil, &errors.AuthError{} | ||
| } | ||
| cfgOptions = append(cfgOptions, authCfgOption, sdkConfig.WithRegion("eu01")) | ||
| customEndpoint := viper.GetString(config.OpenSearchCustomEndpointKey) | ||
| if customEndpoint != "" { | ||
| cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint)) | ||
| } | ||
| apiClient, err = opensearch.NewAPIClient(cfgOptions...) | ||
| if err != nil { | ||
| return nil, &errors.AuthError{} | ||
| } | ||
| return apiClient, nil | ||
| } |
| package utils | ||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "testing" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/google/uuid" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| var ( | ||
| testProjectId = uuid.NewString() | ||
| testInstanceId = uuid.NewString() | ||
| testCredentialsId = uuid.NewString() | ||
| ) | ||
| const ( | ||
| testInstanceName = "instance" | ||
| testCredentialsUsername = "username" | ||
| ) | ||
| type openSearchClientMocked struct { | ||
| getInstanceFails bool | ||
| getInstanceResp *opensearch.Instance | ||
| getCredentialsFails bool | ||
| getCredentialsResp *opensearch.CredentialsResponse | ||
| } | ||
| func (m *openSearchClientMocked) GetInstanceExecute(_ context.Context, _, _ string) (*opensearch.Instance, error) { | ||
| if m.getInstanceFails { | ||
| return nil, fmt.Errorf("could not get instance") | ||
| } | ||
| return m.getInstanceResp, nil | ||
| } | ||
| func (m *openSearchClientMocked) GetCredentialsExecute(_ context.Context, _, _, _ string) (*opensearch.CredentialsResponse, error) { | ||
| if m.getCredentialsFails { | ||
| return nil, fmt.Errorf("could not get user") | ||
| } | ||
| return m.getCredentialsResp, nil | ||
| } | ||
| func TestGetInstanceName(t *testing.T) { | ||
| tests := []struct { | ||
| description string | ||
| getInstanceFails bool | ||
| getInstanceResp *opensearch.Instance | ||
| isValid bool | ||
| expectedOutput string | ||
| }{ | ||
| { | ||
| description: "base", | ||
| getInstanceResp: &opensearch.Instance{ | ||
| Name: utils.Ptr(testInstanceName), | ||
| }, | ||
| isValid: true, | ||
| expectedOutput: testInstanceName, | ||
| }, | ||
| { | ||
| description: "get instance fails", | ||
| getInstanceFails: true, | ||
| isValid: false, | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.description, func(t *testing.T) { | ||
| client := &openSearchClientMocked{ | ||
| getInstanceFails: tt.getInstanceFails, | ||
| getInstanceResp: tt.getInstanceResp, | ||
| } | ||
| output, err := GetInstanceName(context.Background(), client, testProjectId, testInstanceId) | ||
| if tt.isValid && err != nil { | ||
| t.Errorf("failed on valid input") | ||
| } | ||
| if !tt.isValid && err == nil { | ||
| t.Errorf("did not fail on invalid input") | ||
| } | ||
| if !tt.isValid { | ||
| return | ||
| } | ||
| if output != tt.expectedOutput { | ||
| t.Errorf("expected output to be %s, got %s", tt.expectedOutput, output) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
| func TestGetCredentialsUsername(t *testing.T) { | ||
| tests := []struct { | ||
| description string | ||
| getCredentialsFails bool | ||
| getCredentialsResp *opensearch.CredentialsResponse | ||
| isValid bool | ||
| expectedOutput string | ||
| }{ | ||
| { | ||
| description: "base", | ||
| getCredentialsResp: &opensearch.CredentialsResponse{ | ||
| Raw: &opensearch.RawCredentials{ | ||
| Credentials: &opensearch.Credentials{ | ||
| Username: utils.Ptr(testCredentialsUsername), | ||
| }, | ||
| }, | ||
| }, | ||
| isValid: true, | ||
| expectedOutput: testCredentialsUsername, | ||
| }, | ||
| { | ||
| description: "get credentials fails", | ||
| getCredentialsFails: true, | ||
| isValid: false, | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.description, func(t *testing.T) { | ||
| client := &openSearchClientMocked{ | ||
| getCredentialsFails: tt.getCredentialsFails, | ||
| getCredentialsResp: tt.getCredentialsResp, | ||
| } | ||
| output, err := GetCredentialsUsername(context.Background(), client, testProjectId, testInstanceId, testCredentialsId) | ||
| if tt.isValid && err != nil { | ||
| t.Errorf("failed on valid input") | ||
| } | ||
| if !tt.isValid && err == nil { | ||
| t.Errorf("did not fail on invalid input") | ||
| } | ||
| if !tt.isValid { | ||
| return | ||
| } | ||
| if output != tt.expectedOutput { | ||
| t.Errorf("expected output to be %s, got %s", tt.expectedOutput, output) | ||
| } | ||
| }) | ||
| } | ||
| } |
| package utils | ||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "strings" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/opensearch" | ||
| ) | ||
| func ValidatePlanId(service, planId string, offerings *opensearch.ListOfferingsResponse) error { | ||
| for _, offer := range *offerings.Offerings { | ||
| for _, plan := range *offer.Plans { | ||
| if plan.Id != nil && strings.EqualFold(*plan.Id, planId) { | ||
| return nil | ||
| } | ||
| } | ||
| } | ||
| return &errors.DSAInvalidPlanError{ | ||
| Service: service, | ||
| Details: fmt.Sprintf("You provided plan ID %q, which is invalid.", planId), | ||
| } | ||
| } | ||
| func LoadPlanId(planName, version string, offerings *opensearch.ListOfferingsResponse) (*string, error) { | ||
| service := "opensearch" | ||
| availableVersions := "" | ||
| availablePlanNames := "" | ||
| isValidVersion := false | ||
| for _, offer := range *offerings.Offerings { | ||
| if !strings.EqualFold(*offer.Version, version) { | ||
| availableVersions = fmt.Sprintf("%s\n- %s", availableVersions, *offer.Version) | ||
| continue | ||
| } | ||
| isValidVersion = true | ||
| for _, plan := range *offer.Plans { | ||
| if plan.Name == nil { | ||
| continue | ||
| } | ||
| if strings.EqualFold(*plan.Name, planName) && plan.Id != nil { | ||
| return plan.Id, nil | ||
| } | ||
| availablePlanNames = fmt.Sprintf("%s\n- %s", availablePlanNames, *plan.Name) | ||
| } | ||
| } | ||
| if !isValidVersion { | ||
| details := fmt.Sprintf("You provided version %q, which is invalid. Available versions are: %s", version, availableVersions) | ||
| return nil, &errors.DSAInvalidPlanError{ | ||
| Service: service, | ||
| Details: details, | ||
| } | ||
| } | ||
| details := fmt.Sprintf("You provided plan_name %q for version %s, which is invalid. Available plan names for that version are: %s", planName, version, availablePlanNames) | ||
| return nil, &errors.DSAInvalidPlanError{ | ||
| Service: service, | ||
| Details: details, | ||
| } | ||
| } | ||
| type OpenSearchClient interface { | ||
| GetInstanceExecute(ctx context.Context, projectId, instanceId string) (*opensearch.Instance, error) | ||
| GetCredentialsExecute(ctx context.Context, projectId, instanceId, credentialsId string) (*opensearch.CredentialsResponse, error) | ||
| } | ||
| func GetInstanceName(ctx context.Context, apiClient OpenSearchClient, projectId, instanceId string) (string, error) { | ||
| resp, err := apiClient.GetInstanceExecute(ctx, projectId, instanceId) | ||
| if err != nil { | ||
| return "", fmt.Errorf("get OpenSearch instance: %w", err) | ||
| } | ||
| return *resp.Name, nil | ||
| } | ||
| func GetCredentialsUsername(ctx context.Context, apiClient OpenSearchClient, projectId, instanceId, credentialsId string) (string, error) { | ||
| resp, err := apiClient.GetCredentialsExecute(ctx, projectId, instanceId, credentialsId) | ||
| if err != nil { | ||
| return "", fmt.Errorf("get OpenSearch credentials: %w", err) | ||
| } | ||
| return *resp.Raw.Credentials.Username, nil | ||
| } |
@@ -19,3 +19,3 @@ # STACKIT CLI release workflow. | ||
| goreleaser: | ||
| runs-on: ubuntu-latest | ||
| runs-on: macOS-latest | ||
| env: | ||
@@ -38,2 +38,20 @@ SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} | ||
| passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
| - name: Set up keychain | ||
| run: | | ||
| echo -n $SIGNING_CERTIFICATE_BASE64 | base64 -d -o ./ApplicationID.p12 | ||
| KEYCHAIN_PATH=$RUNNER_TEMP/ios_signing_temp.keychain-db | ||
| security create-keychain -p "${{ secrets.TEMP_KEYCHAIN }}" $KEYCHAIN_PATH | ||
| security default-keychain -s $KEYCHAIN_PATH | ||
| security unlock-keychain -p "${{ secrets.TEMP_KEYCHAIN }}" $KEYCHAIN_PATH | ||
| security import ./ApplicationID.p12 -P "${{ secrets.APPLICATION_ID }}" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | ||
| security list-keychain -d user -s $KEYCHAIN_PATH | ||
| echo -n $AUTHKEY_BASE64 | base64 -d -o ./AuthKey.p8 | ||
| xcrun notarytool store-credentials stackit-cli -i $APPLE_ISSUER -d $APPLE_KEY_ID -k AuthKey.p8 --keychain $KEYCHAIN_PATH | ||
| rm ./ApplicationID.p12 | ||
| rm ./AuthKey.p8 | ||
| env: | ||
| APPLE_ISSUER: ${{ secrets.APPLE_ISSUER }} | ||
| APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }} | ||
| SIGNING_CERTIFICATE_BASE64: ${{ secrets.APPLICATION_ID_CERT }} | ||
| AUTHKEY_BASE64: ${{ secrets.APPLE_API_KEY }} | ||
| - name: Install Snapcraft | ||
@@ -40,0 +58,0 @@ uses: samuelmeuli/action-snapcraft@v2 |
+21
-10
@@ -23,16 +23,26 @@ before: | ||
| - CGO_ENABLED=0 | ||
| - BUNDLE_ID=cloud.stackit.cli | ||
| - 'APPLE_APPLICATION_IDENTITY=Developer ID Application: Schwarz IT KG' | ||
| goos: | ||
| - darwin | ||
| binary: "stackit" | ||
| goarch: | ||
| - arm64 | ||
| - amd64 | ||
| hooks: | ||
| post: | ||
| - | | ||
| sh -c ' | ||
| codesign -s "{{.Env.APPLE_APPLICATION_IDENTITY}}" -f -v --options=runtime "dist/macos-builds_{{.Target}}/{{.Name}}" | ||
| codesign -vvv --deep --strict "dist/macos-builds_{{.Target}}/{{.Name}}" | ||
| ls -l "dist/macos_{{.Target}}" | ||
| hdiutil create -volname "STACKIT-CLI" -srcfolder "dist/macos-builds_{{.Target}}/{{.Name}}" -ov -format UDZO "dist/{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.dmg" | ||
| codesign -s "{{.Env.APPLE_APPLICATION_IDENTITY}}" -f -v --options=runtime "dist/{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.dmg" | ||
| xcrun notarytool submit --keychain-profile "stackit-cli" --wait --progress dist/{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.dmg | ||
| xcrun stapler staple "dist/{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.dmg" | ||
| spctl -a -t open --context context:primary-signature -v dist/{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.dmg | ||
| ' | ||
| archives: | ||
| - format: tar.gz | ||
| # This name template makes the OS and Arch compatible with the results of `uname` | ||
| name_template: >- | ||
| {{ .ProjectName }}_ | ||
| {{- title .Os }}_ | ||
| {{- if eq .Arch "amd64" }}x86_64 | ||
| {{- else if eq .Arch "386" }}i386 | ||
| {{- else }}{{ .Arch }}{{ end }} | ||
| {{- if .Arm }}v{{ .Arm }}{{ end }} | ||
| format_overrides: | ||
@@ -93,3 +103,2 @@ - goos: windows | ||
| title: STACKIT CLI | ||
| publish: true | ||
| summary: A command-line interface to manage STACKIT resources. | ||
@@ -99,2 +108,4 @@ description: "A command-line interface to manage STACKIT resources.\nThis CLI is in a BETA state. More services and functionality will be supported soon." | ||
| # Will only publish to `edge` and `beta` channels | ||
| grade: devel | ||
| grade: devel | ||
| # Skip publishing until we get approval for used interfaces or classic confinement | ||
| publish: false |
+9
-4
@@ -13,2 +13,7 @@ # Contribute to the STACKIT CLI | ||
| Prerequisites: | ||
| - [`Go`](https://go.dev/doc/install) 1.21+ | ||
| - [`yamllint`](https://yamllint.readthedocs.io/en/stable/quickstart.html) | ||
| ### Repository structure | ||
@@ -27,5 +32,5 @@ | ||
| - `make project-tools`: install the required dependencies | ||
| - `make build`: compiles the CLI and saves the binary under _./bin/stackit_ | ||
| - `make lint`: lint the code and examples | ||
| - `make generate-docs`: generates Markdown documentation for every command | ||
| - `make build`: compile the CLI and save the binary under _./bin/stackit_ | ||
| - `make lint`: lint the code | ||
| - `make generate-docs`: generate Markdown documentation for every command | ||
| - `make test`: run unit tests | ||
@@ -59,3 +64,3 @@ | ||
| 1. Check open or recently closed [Pull Requests](https://github.com/stackitcloud/stackit-cli/pulls) and [Issues](https://github.com/stackitcloud/stackit-cli/issues)to make sure the contribution you are making has not been already tackled by someone else. | ||
| 1. Check open or recently closed [Pull Requests](https://github.com/stackitcloud/stackit-cli/pulls) and [Issues](https://github.com/stackitcloud/stackit-cli/issues) to make sure the contribution you are making has not been already tackled by someone else. | ||
| 2. Fork the repo. | ||
@@ -62,0 +67,0 @@ 3. Make your changes in a branch that is up-to-date with the original repo's `main` branch. |
| ## stackit auth activate-service-account | ||
| Activate service account authentication | ||
| Authenticates using a service account | ||
| ### Synopsis | ||
| Activate authentication using service account credentials. | ||
| Authenticates to the CLI using service account credentials. | ||
| Subsequent commands will be authenticated using the service account credentials provided. | ||
@@ -9,0 +9,0 @@ For more details on how to configure your service account, check our Authentication guide at https://github.com/stackitcloud/stackit-cli/blob/main/AUTHENTICATION.md. |
| ## stackit auth login | ||
| Login to the STACKIT CLI | ||
| Logs in to the STACKIT CLI | ||
| ### Synopsis | ||
| Login to the STACKIT CLI | ||
| Logs in to the STACKIT CLI using a user account. | ||
@@ -9,0 +9,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit auth | ||
| Provides authentication functionality | ||
| Provides authentication functionality. | ||
@@ -32,4 +32,4 @@ ``` | ||
| * [stackit](./stackit.md) - Manage STACKIT resources using the command line | ||
| * [stackit auth activate-service-account](./stackit_auth_activate-service-account.md) - Activate service account authentication | ||
| * [stackit auth login](./stackit_auth_login.md) - Login to the STACKIT CLI | ||
| * [stackit auth activate-service-account](./stackit_auth_activate-service-account.md) - Authenticates using a service account | ||
| * [stackit auth login](./stackit_auth_login.md) - Logs in to the STACKIT CLI | ||
| ## stackit config list | ||
| List the current CLI configuration values | ||
| Lists the current CLI configuration values | ||
| ### Synopsis | ||
| List the current CLI configuration values | ||
| Lists the current CLI configuration values. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit config set | ||
| Set CLI configuration options | ||
| Sets CLI configuration options | ||
| ### Synopsis | ||
| Set CLI configuration options. | ||
| All of the configuration options can be set using an environment variable, which takes precedence over what is configured. | ||
| Sets CLI configuration options. | ||
| All of the configuration options can be set using an environment variable, which takes precedence over what is configured. | ||
| The environment variable is the name of the flag, with underscores ("_") instead of dashes ("-") and the "STACKIT" prefix. | ||
| Example: to set the project ID you can set the environment variable STACKIT_PROJECT_ID | ||
| Example: to set the project ID you can set the environment variable STACKIT_PROJECT_ID. | ||
@@ -36,2 +36,3 @@ ``` | ||
| --mongodbflex-custom-endpoint string MongoDB Flex custom endpoint | ||
| --opensearch-custom-endpoint string OpenSearch custom endpoint | ||
| --resource-manager-custom-endpoint string Resource manager custom endpoint | ||
@@ -38,0 +39,0 @@ --service-account-custom-endpoint string Service Account custom endpoint |
| ## stackit config unset | ||
| Unset CLI configuration options | ||
| Unsets CLI configuration options | ||
| ### Synopsis | ||
| Unset CLI configuration options | ||
| Unsets CLI configuration options. | ||
@@ -34,2 +34,3 @@ ``` | ||
| --mongodbflex-custom-endpoint MongoDB Flex custom endpoint | ||
| --opensearch-custom-endpoint OpenSearch custom endpoint | ||
| --output-format Output format | ||
@@ -36,0 +37,0 @@ --project-id Project ID |
@@ -7,3 +7,3 @@ ## stackit config | ||
| CLI configuration options | ||
| CLI configuration options. | ||
@@ -32,5 +32,5 @@ ``` | ||
| * [stackit](./stackit.md) - Manage STACKIT resources using the command line | ||
| * [stackit config list](./stackit_config_list.md) - List the current CLI configuration values | ||
| * [stackit config set](./stackit_config_set.md) - Set CLI configuration options | ||
| * [stackit config unset](./stackit_config_unset.md) - Unset CLI configuration options | ||
| * [stackit config list](./stackit_config_list.md) - Lists the current CLI configuration values | ||
| * [stackit config set](./stackit_config_set.md) - Sets CLI configuration options | ||
| * [stackit config unset](./stackit_config_unset.md) - Unsets CLI configuration options | ||
| ## stackit curl | ||
| Execute an authenticated HTTP request to an endpoint | ||
| Executes an authenticated HTTP request to an endpoint | ||
| ### Synopsis | ||
| Execute an HTTP request to an endpoint, using the authentication provided by the CLI | ||
| Executes an HTTP request to an endpoint, using the authentication provided by the CLI. | ||
@@ -9,0 +9,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit dns record-set create | ||
| Creates a DNS record set | ||
| Creates a DNS record set. | ||
@@ -10,0 +10,0 @@ ``` |
| ## stackit dns record-set delete | ||
| Delete a DNS record set | ||
| Deletes a DNS record set | ||
| ### Synopsis | ||
| Delete a DNS record set | ||
| Deletes a DNS record set. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit dns record-set describe | ||
| Get details of a DNS record set | ||
| Shows details of a DNS record set | ||
| ### Synopsis | ||
| Get details of a DNS record set | ||
| Shows details of a DNS record set. | ||
@@ -9,0 +9,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit dns record-set update | ||
| Updates a DNS record set. Performs a partial update; fields not provided are kept unchanged | ||
| Updates a DNS record set. | ||
@@ -10,0 +10,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit dns record-set | ||
| Provides functionality for DNS record set | ||
| Provides functionality for DNS record set. | ||
@@ -33,6 +33,6 @@ ``` | ||
| * [stackit dns record-set create](./stackit_dns_record-set_create.md) - Creates a DNS record set | ||
| * [stackit dns record-set delete](./stackit_dns_record-set_delete.md) - Delete a DNS record set | ||
| * [stackit dns record-set describe](./stackit_dns_record-set_describe.md) - Get details of a DNS record set | ||
| * [stackit dns record-set delete](./stackit_dns_record-set_delete.md) - Deletes a DNS record set | ||
| * [stackit dns record-set describe](./stackit_dns_record-set_describe.md) - Shows details of a DNS record set | ||
| * [stackit dns record-set list](./stackit_dns_record-set_list.md) - List DNS record sets | ||
| * [stackit dns record-set update](./stackit_dns_record-set_update.md) - Updates a DNS record set | ||
@@ -7,3 +7,3 @@ ## stackit dns zone create | ||
| Creates a DNS zone | ||
| Creates a DNS zone. | ||
@@ -10,0 +10,0 @@ ``` |
| ## stackit dns zone delete | ||
| Delete a DNS zone | ||
| Deletes a DNS zone | ||
| ### Synopsis | ||
| Delete a DNS zone | ||
| Deletes a DNS zone. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit dns zone describe | ||
| Get details of a DNS zone | ||
| Shows details of a DNS zone | ||
| ### Synopsis | ||
| Get details of a DNS zone | ||
| Shows details of a DNS zone. | ||
@@ -9,0 +9,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit dns zone update | ||
| Updates a DNS zone. Performs a partial update; fields not provided are kept unchanged | ||
| Updates a DNS zone. | ||
@@ -10,0 +10,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit dns zone | ||
| Provides functionality for DNS zones | ||
| Provides functionality for DNS zones. | ||
@@ -33,6 +33,6 @@ ``` | ||
| * [stackit dns zone create](./stackit_dns_zone_create.md) - Creates a DNS zone | ||
| * [stackit dns zone delete](./stackit_dns_zone_delete.md) - Delete a DNS zone | ||
| * [stackit dns zone describe](./stackit_dns_zone_describe.md) - Get details of a DNS zone | ||
| * [stackit dns zone delete](./stackit_dns_zone_delete.md) - Deletes a DNS zone | ||
| * [stackit dns zone describe](./stackit_dns_zone_describe.md) - Shows details of a DNS zone | ||
| * [stackit dns zone list](./stackit_dns_zone_list.md) - List DNS zones | ||
| * [stackit dns zone update](./stackit_dns_zone_update.md) - Updates a DNS zone | ||
@@ -7,3 +7,3 @@ ## stackit dns | ||
| Provides functionality for DNS | ||
| Provides functionality for DNS. | ||
@@ -10,0 +10,0 @@ ``` |
| ## stackit mongodbflex instance create | ||
| Create a MongoDB Flex instance | ||
| Creates a MongoDB Flex instance | ||
| ### Synopsis | ||
| Create a MongoDB Flex instance. | ||
| Creates a MongoDB Flex instance. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit mongodbflex instance delete | ||
| Delete a MongoDB Flex instance | ||
| Deletes a MongoDB Flex instance | ||
| ### Synopsis | ||
| Delete a MongoDB Flex instance | ||
| Deletes a MongoDB Flex instance. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit mongodbflex instance describe | ||
| Get details of a MongoDB Flex instance | ||
| Shows details of a MongoDB Flex instance | ||
| ### Synopsis | ||
| Get details of a MongoDB Flex instance | ||
| Shows details of a MongoDB Flex instance. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit mongodbflex instance list | ||
| List all MongoDB Flex instances | ||
| Lists all MongoDB Flex instances | ||
| ### Synopsis | ||
| List all MongoDB Flex instances | ||
| Lists all MongoDB Flex instances. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit mongodbflex instance update | ||
| Update a MongoDB Flex instance | ||
| Updates a MongoDB Flex instance | ||
| ### Synopsis | ||
| Update a MongoDB Flex instance. | ||
| Updates a MongoDB Flex instance. | ||
@@ -26,3 +26,3 @@ ``` | ||
| ``` | ||
| --acl strings List of IP networks in CIDR notation which are allowed to access this instance (default []) | ||
| --acl strings Lists of IP networks in CIDR notation which are allowed to access this instance (default []) | ||
| --backup-schedule string Backup schedule | ||
@@ -29,0 +29,0 @@ --cpu int Number of CPUs |
@@ -7,3 +7,3 @@ ## stackit mongodbflex instance | ||
| Provides functionality for MongoDB Flex instances | ||
| Provides functionality for MongoDB Flex instances. | ||
@@ -32,7 +32,7 @@ ``` | ||
| * [stackit mongodbflex](./stackit_mongodbflex.md) - Provides functionality for MongoDB Flex | ||
| * [stackit mongodbflex instance create](./stackit_mongodbflex_instance_create.md) - Create a MongoDB Flex instance | ||
| * [stackit mongodbflex instance delete](./stackit_mongodbflex_instance_delete.md) - Delete a MongoDB Flex instance | ||
| * [stackit mongodbflex instance describe](./stackit_mongodbflex_instance_describe.md) - Get details of a MongoDB Flex instance | ||
| * [stackit mongodbflex instance list](./stackit_mongodbflex_instance_list.md) - List all MongoDB Flex instances | ||
| * [stackit mongodbflex instance update](./stackit_mongodbflex_instance_update.md) - Update a MongoDB Flex instance | ||
| * [stackit mongodbflex instance create](./stackit_mongodbflex_instance_create.md) - Creates a MongoDB Flex instance | ||
| * [stackit mongodbflex instance delete](./stackit_mongodbflex_instance_delete.md) - Deletes a MongoDB Flex instance | ||
| * [stackit mongodbflex instance describe](./stackit_mongodbflex_instance_describe.md) - Shows details of a MongoDB Flex instance | ||
| * [stackit mongodbflex instance list](./stackit_mongodbflex_instance_list.md) - Lists all MongoDB Flex instances | ||
| * [stackit mongodbflex instance update](./stackit_mongodbflex_instance_update.md) - Updates a MongoDB Flex instance | ||
| ## stackit mongodbflex options | ||
| List MongoDB Flex options | ||
| Lists MongoDB Flex options | ||
| ### Synopsis | ||
| List MongoDB Flex options (flavors, versions and storages for a given flavor) | ||
| Lists MongoDB Flex options (flavors, versions and storages for a given flavor) | ||
| Pass one or more flags to filter what categories are shown. | ||
@@ -9,0 +9,0 @@ |
| ## stackit mongodbflex user create | ||
| Create a MongoDB Flex user | ||
| Creates a MongoDB Flex user | ||
| ### Synopsis | ||
| Create a MongoDB Flex user. | ||
| Creates a MongoDB Flex user. | ||
| The password is only visible upon creation and cannot be retrieved later. | ||
@@ -9,0 +9,0 @@ Alternatively, you can reset the password and access the new one by running: |
| ## stackit mongodbflex user delete | ||
| Delete a MongoDB Flex user | ||
| Deletes a MongoDB Flex user | ||
| ### Synopsis | ||
| Delete a MongoDB Flex user by ID. You can get the IDs of users for an instance by running: | ||
| Deletes a MongoDB Flex user by ID. You can get the IDs of users for an instance by running: | ||
| $ stackit mongodbflex user list --instance-id <INSTANCE_ID> | ||
@@ -9,0 +9,0 @@ |
| ## stackit mongodbflex user describe | ||
| Get details of a MongoDB Flex user | ||
| Shows details of a MongoDB Flex user | ||
| ### Synopsis | ||
| Get details of a MongoDB Flex user. | ||
| Shows details of a MongoDB Flex user. | ||
| The user password is hidden inside the "host" field and replaced with asterisks, as it is only visible upon creation. You can reset it by running: | ||
@@ -9,0 +9,0 @@ $ stackit mongodbflex user reset-password <USER_ID> --instance-id <INSTANCE_ID> |
| ## stackit mongodbflex user list | ||
| List all MongoDB Flex users of an instance | ||
| Lists all MongoDB Flex users of an instance | ||
| ### Synopsis | ||
| List all MongoDB Flex users of an instance. | ||
| Lists all MongoDB Flex users of an instance. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit mongodbflex user reset-password | ||
| Reset the password of a MongoDB Flex user | ||
| Resets the password of a MongoDB Flex user | ||
| ### Synopsis | ||
| Reset the password of a MongoDB Flex user. The new password is returned in the response. | ||
| Resets the password of a MongoDB Flex user. The new password is shown in the command's output. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit mongodbflex user update | ||
| Update a MongoDB Flex user | ||
| Updates a MongoDB Flex user | ||
| ### Synopsis | ||
| Update a MongoDB Flex user. | ||
| Updates a MongoDB Flex user. | ||
@@ -9,0 +9,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit mongodbflex user | ||
| Provides functionality for MongoDB Flex users | ||
| Provides functionality for MongoDB Flex users. | ||
@@ -32,8 +32,8 @@ ``` | ||
| * [stackit mongodbflex](./stackit_mongodbflex.md) - Provides functionality for MongoDB Flex | ||
| * [stackit mongodbflex user create](./stackit_mongodbflex_user_create.md) - Create a MongoDB Flex user | ||
| * [stackit mongodbflex user delete](./stackit_mongodbflex_user_delete.md) - Delete a MongoDB Flex user | ||
| * [stackit mongodbflex user describe](./stackit_mongodbflex_user_describe.md) - Get details of a MongoDB Flex user | ||
| * [stackit mongodbflex user list](./stackit_mongodbflex_user_list.md) - List all MongoDB Flex users of an instance | ||
| * [stackit mongodbflex user reset-password](./stackit_mongodbflex_user_reset-password.md) - Reset the password of a MongoDB Flex user | ||
| * [stackit mongodbflex user update](./stackit_mongodbflex_user_update.md) - Update a MongoDB Flex user | ||
| * [stackit mongodbflex user create](./stackit_mongodbflex_user_create.md) - Creates a MongoDB Flex user | ||
| * [stackit mongodbflex user delete](./stackit_mongodbflex_user_delete.md) - Deletes a MongoDB Flex user | ||
| * [stackit mongodbflex user describe](./stackit_mongodbflex_user_describe.md) - Shows details of a MongoDB Flex user | ||
| * [stackit mongodbflex user list](./stackit_mongodbflex_user_list.md) - Lists all MongoDB Flex users of an instance | ||
| * [stackit mongodbflex user reset-password](./stackit_mongodbflex_user_reset-password.md) - Resets the password of a MongoDB Flex user | ||
| * [stackit mongodbflex user update](./stackit_mongodbflex_user_update.md) - Updates a MongoDB Flex user | ||
@@ -7,3 +7,3 @@ ## stackit mongodbflex | ||
| Provides functionality for MongoDB Flex | ||
| Provides functionality for MongoDB Flex. | ||
@@ -33,4 +33,4 @@ ``` | ||
| * [stackit mongodbflex instance](./stackit_mongodbflex_instance.md) - Provides functionality for MongoDB Flex instances | ||
| * [stackit mongodbflex options](./stackit_mongodbflex_options.md) - List MongoDB Flex options | ||
| * [stackit mongodbflex options](./stackit_mongodbflex_options.md) - Lists MongoDB Flex options | ||
| * [stackit mongodbflex user](./stackit_mongodbflex_user.md) - Provides functionality for MongoDB Flex users | ||
| ## stackit organization member add | ||
| Add a member to an organization | ||
| Adds a member to an organization | ||
| ### Synopsis | ||
| Add a member to an organization. | ||
| Adds a member to an organization. | ||
| A member is a combination of a subject (user, service account or client) and a role. | ||
@@ -9,0 +9,0 @@ The subject is usually email address for users or name in case of clients |
| ## stackit organization member list | ||
| List members of an organization | ||
| Lists members of an organization | ||
| ### Synopsis | ||
| List members of an organization | ||
| Lists members of an organization | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit organization member remove | ||
| Remove a member from an organization. | ||
| Removes a member from an organization | ||
| ### Synopsis | ||
| Remove a member from an organization. | ||
| Removes a member from an organization. | ||
| A member is a combination of a subject (user, service account or client) and a role. | ||
| The subject is usually email address for users or name in case of clients | ||
| The subject is usually email address (for users) or name (for clients). | ||
@@ -11,0 +11,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit organization member | ||
| Provides functionality regarding organization members | ||
| Provides functionality regarding organization members. | ||
@@ -32,5 +32,5 @@ ``` | ||
| * [stackit organization](./stackit_organization.md) - Provides functionality regarding organizations | ||
| * [stackit organization member add](./stackit_organization_member_add.md) - Add a member to an organization | ||
| * [stackit organization member list](./stackit_organization_member_list.md) - List members of an organization | ||
| * [stackit organization member remove](./stackit_organization_member_remove.md) - Remove a member from an organization. | ||
| * [stackit organization member add](./stackit_organization_member_add.md) - Adds a member to an organization | ||
| * [stackit organization member list](./stackit_organization_member_list.md) - Lists members of an organization | ||
| * [stackit organization member remove](./stackit_organization_member_remove.md) - Removes a member from an organization | ||
| ## stackit organization role list | ||
| List roles and permissions of an organization | ||
| Lists roles and permissions of an organization | ||
| ### Synopsis | ||
| List roles and permissions of an organization | ||
| Lists roles and permissions of an organization. | ||
@@ -9,0 +9,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit organization role | ||
| Provides functionality regarding organization roles | ||
| Provides functionality regarding organization roles. | ||
@@ -32,3 +32,3 @@ ``` | ||
| * [stackit organization](./stackit_organization.md) - Provides functionality regarding organizations | ||
| * [stackit organization role list](./stackit_organization_role_list.md) - List roles and permissions of an organization | ||
| * [stackit organization role list](./stackit_organization_role_list.md) - Lists roles and permissions of an organization | ||
@@ -8,3 +8,3 @@ ## stackit organization | ||
| Provides functionality regarding organizations. | ||
| An active STACKIT organization is the root element of the resource hierarchy and a prerequisite to use any STACKIT Cloud Resource / Service | ||
| An active STACKIT organization is the root element of the resource hierarchy and a prerequisite to use any STACKIT Cloud Resource / Service. | ||
@@ -11,0 +11,0 @@ ``` |
| ## stackit project create | ||
| Create STACKIT projects | ||
| Creates a STACKIT project | ||
| ### Synopsis | ||
| Create STACKIT projects | ||
| Creates a STACKIT project. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit project delete | ||
| Delete a STACKIT project | ||
| Deletes a STACKIT project | ||
| ### Synopsis | ||
| Delete a STACKIT project | ||
| Deletes a STACKIT project. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit project describe | ||
| Get the details of a STACKIT project | ||
| Shows details of a STACKIT project | ||
| ### Synopsis | ||
| Get the details of a STACKIT project | ||
| Shows details of a STACKIT project. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit project list | ||
| List STACKIT projects | ||
| Lists STACKIT projects | ||
| ### Synopsis | ||
| List all STACKIT projects that match certain criteria. At least one of parent-id, project-id-like or member flag must be provided | ||
| Lists all STACKIT projects that match certain criteria. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit project member add | ||
| Add a member to a project | ||
| Adds a member to a project | ||
| ### Synopsis | ||
| Add a member to a project. | ||
| Adds a member to a project. | ||
| A member is a combination of a subject (user, service account or client) and a role. | ||
@@ -9,0 +9,0 @@ The subject is usually email address for users or name in case of clients |
| ## stackit project member list | ||
| List members of a project | ||
| Lists members of a project | ||
| ### Synopsis | ||
| List members of a project | ||
| Lists members of a project. | ||
@@ -32,3 +32,3 @@ ``` | ||
| --sort-by string Sort entries by a specific field, one of ["subject" "role"] (default "subject") | ||
| --subject string Filter by subject (Identifier of user, service account or client. Usually email address in case of users or name in case of clients) | ||
| --subject string Filter by subject (the identifier of a user, service account or client). This is usually the email address (for users) or name (for clients) | ||
| ``` | ||
@@ -35,0 +35,0 @@ |
| ## stackit project member remove | ||
| Remove a member from a project. | ||
| Removes a member from a project | ||
| ### Synopsis | ||
| Remove a member from a project. | ||
| Removes a member from a project. | ||
| A member is a combination of a subject (user, service account or client) and a role. | ||
@@ -9,0 +9,0 @@ The subject is usually email address for users or name in case of clients |
@@ -7,3 +7,3 @@ ## stackit project member | ||
| Provides functionality regarding project members | ||
| Provides functionality regarding project members. | ||
@@ -32,5 +32,5 @@ ``` | ||
| * [stackit project](./stackit_project.md) - Provides functionality regarding projects | ||
| * [stackit project member add](./stackit_project_member_add.md) - Add a member to a project | ||
| * [stackit project member list](./stackit_project_member_list.md) - List members of a project | ||
| * [stackit project member remove](./stackit_project_member_remove.md) - Remove a member from a project. | ||
| * [stackit project member add](./stackit_project_member_add.md) - Adds a member to a project | ||
| * [stackit project member list](./stackit_project_member_list.md) - Lists members of a project | ||
| * [stackit project member remove](./stackit_project_member_remove.md) - Removes a member from a project | ||
| ## stackit project role list | ||
| List roles and permissions of a project | ||
| Lists roles and permissions of a project | ||
| ### Synopsis | ||
| List roles and permissions of a project | ||
| Lists roles and permissions of a project. | ||
@@ -9,0 +9,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit project role | ||
| Provides functionality regarding project roles | ||
| Provides functionality regarding project roles. | ||
@@ -32,3 +32,3 @@ ``` | ||
| * [stackit project](./stackit_project.md) - Provides functionality regarding projects | ||
| * [stackit project role list](./stackit_project_role_list.md) - List roles and permissions of a project | ||
| * [stackit project role list](./stackit_project_role_list.md) - Lists roles and permissions of a project | ||
| ## stackit project update | ||
| Update a STACKIT project | ||
| Updates a STACKIT project | ||
| ### Synopsis | ||
| Update a STACKIT project | ||
| Updates a STACKIT project. | ||
@@ -9,0 +9,0 @@ ``` |
@@ -32,9 +32,9 @@ ## stackit project | ||
| * [stackit](./stackit.md) - Manage STACKIT resources using the command line | ||
| * [stackit project create](./stackit_project_create.md) - Create STACKIT projects | ||
| * [stackit project delete](./stackit_project_delete.md) - Delete a STACKIT project | ||
| * [stackit project describe](./stackit_project_describe.md) - Get the details of a STACKIT project | ||
| * [stackit project list](./stackit_project_list.md) - List STACKIT projects | ||
| * [stackit project create](./stackit_project_create.md) - Creates a STACKIT project | ||
| * [stackit project delete](./stackit_project_delete.md) - Deletes a STACKIT project | ||
| * [stackit project describe](./stackit_project_describe.md) - Shows details of a STACKIT project | ||
| * [stackit project list](./stackit_project_list.md) - Lists STACKIT projects | ||
| * [stackit project member](./stackit_project_member.md) - Provides functionality regarding project members | ||
| * [stackit project role](./stackit_project_role.md) - Provides functionality regarding project roles | ||
| * [stackit project update](./stackit_project_update.md) - Update a STACKIT project | ||
| * [stackit project update](./stackit_project_update.md) - Updates a STACKIT project | ||
| ## stackit service-account create | ||
| Create a service account | ||
| Creates a service account | ||
| ### Synopsis | ||
| Create a service account | ||
| Creates a service account. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit service-account delete | ||
| Delete a service account | ||
| Deletes a service account | ||
| ### Synopsis | ||
| Delete a service account | ||
| Deletes a service account. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit service-account get-jwks | ||
| Get JWKS for a service account | ||
| Shows the JWKS for a service account | ||
| ### Synopsis | ||
| Get JSON Web Key set (JWKS) for a service account. Only JSON output is supported | ||
| Shows the JSON Web Key set (JWKS) for a service account. Only JSON output is supported. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit service-account key create | ||
| Create a service account key | ||
| Creates a service account key | ||
| ### Synopsis | ||
| Create a service account key. | ||
| Creates a service account key. | ||
| You can generate an RSA keypair and provide the public key. | ||
@@ -9,0 +9,0 @@ If you do not provide a public key, the service will generate a new key-pair and the private key is included in the response. You won't be able to retrieve it later. |
| ## stackit service-account key delete | ||
| Delete a service account key | ||
| Deletes a service account key | ||
| ### Synopsis | ||
| Delete a service account key. | ||
| Deletes a service account key. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit service-account key describe | ||
| Get details of a service account key | ||
| Shows details of a service account key | ||
| ### Synopsis | ||
| Get details of a service account key. Only JSON output is supported. | ||
| Shows details of a service account key. Only JSON output is supported. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit service-account key list | ||
| List all service account keys | ||
| Lists all service account keys | ||
| ### Synopsis | ||
| List all service account keys. | ||
| Lists all service account keys. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit service-account key update | ||
| Update a service account key | ||
| Updates a service account key | ||
| ### Synopsis | ||
| Update a service account key. | ||
| Updates a service account key. | ||
| You can temporarily activate or deactivate the key and/or update its date of expiration. | ||
@@ -9,0 +9,0 @@ |
@@ -7,3 +7,3 @@ ## stackit service-account key | ||
| Provides functionality regarding service account keys | ||
| Provides functionality regarding service account keys. | ||
@@ -32,7 +32,7 @@ ``` | ||
| * [stackit service-account](./stackit_service-account.md) - Provides functionality for service accounts | ||
| * [stackit service-account key create](./stackit_service-account_key_create.md) - Create a service account key | ||
| * [stackit service-account key delete](./stackit_service-account_key_delete.md) - Delete a service account key | ||
| * [stackit service-account key describe](./stackit_service-account_key_describe.md) - Get details of a service account key | ||
| * [stackit service-account key list](./stackit_service-account_key_list.md) - List all service account keys | ||
| * [stackit service-account key update](./stackit_service-account_key_update.md) - Update a service account key | ||
| * [stackit service-account key create](./stackit_service-account_key_create.md) - Creates a service account key | ||
| * [stackit service-account key delete](./stackit_service-account_key_delete.md) - Deletes a service account key | ||
| * [stackit service-account key describe](./stackit_service-account_key_describe.md) - Shows details of a service account key | ||
| * [stackit service-account key list](./stackit_service-account_key_list.md) - Lists all service account keys | ||
| * [stackit service-account key update](./stackit_service-account_key_update.md) - Updates a service account key | ||
| ## stackit service-account list | ||
| List all service accounts | ||
| Lists all service accounts | ||
| ### Synopsis | ||
| List all service accounts | ||
| Lists all service accounts. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit service-account token create | ||
| Create an access token for a service account | ||
| Creates an access token for a service account | ||
| ### Synopsis | ||
| Create an access token for a service account. | ||
| Creates an access token for a service account. | ||
| The access token can be then used for API calls (where enabled). | ||
@@ -9,0 +9,0 @@ The token is only displayed upon creation, and it will not be recoverable later. |
| ## stackit service-account token list | ||
| List access tokens of a service account | ||
| Lists access tokens of a service account | ||
| ### Synopsis | ||
| List access tokens of a service account. | ||
| Lists access tokens of a service account. | ||
| Only the metadata about the access tokens is shown, and not the tokens themselves. | ||
@@ -9,0 +9,0 @@ Access tokens (including revoked tokens) are returned until they are expired. |
| ## stackit service-account token revoke | ||
| Revoke an access token of a service account | ||
| Revokes an access token of a service account | ||
| ### Synopsis | ||
| Revoke an access token of a service account. | ||
| Revokes an access token of a service account. | ||
| The access token is instantly revoked, any following calls with the token will be unauthorized. | ||
@@ -9,0 +9,0 @@ The token metadata is still stored until the expiration time. |
@@ -7,3 +7,3 @@ ## stackit service-account token | ||
| Provides functionality regarding service account tokens | ||
| Provides functionality regarding service account tokens. | ||
@@ -32,5 +32,5 @@ ``` | ||
| * [stackit service-account](./stackit_service-account.md) - Provides functionality for service accounts | ||
| * [stackit service-account token create](./stackit_service-account_token_create.md) - Create an access token for a service account | ||
| * [stackit service-account token list](./stackit_service-account_token_list.md) - List access tokens of a service account | ||
| * [stackit service-account token revoke](./stackit_service-account_token_revoke.md) - Revoke an access token of a service account | ||
| * [stackit service-account token create](./stackit_service-account_token_create.md) - Creates an access token for a service account | ||
| * [stackit service-account token list](./stackit_service-account_token_list.md) - Lists access tokens of a service account | ||
| * [stackit service-account token revoke](./stackit_service-account_token_revoke.md) - Revokes an access token of a service account | ||
@@ -7,3 +7,3 @@ ## stackit service-account | ||
| Provides functionality for service accounts | ||
| Provides functionality for service accounts. | ||
@@ -32,8 +32,8 @@ ``` | ||
| * [stackit](./stackit.md) - Manage STACKIT resources using the command line | ||
| * [stackit service-account create](./stackit_service-account_create.md) - Create a service account | ||
| * [stackit service-account delete](./stackit_service-account_delete.md) - Delete a service account | ||
| * [stackit service-account get-jwks](./stackit_service-account_get-jwks.md) - Get JWKS for a service account | ||
| * [stackit service-account create](./stackit_service-account_create.md) - Creates a service account | ||
| * [stackit service-account delete](./stackit_service-account_delete.md) - Deletes a service account | ||
| * [stackit service-account get-jwks](./stackit_service-account_get-jwks.md) - Shows the JWKS for a service account | ||
| * [stackit service-account key](./stackit_service-account_key.md) - Provides functionality regarding service account keys | ||
| * [stackit service-account list](./stackit_service-account_list.md) - List all service accounts | ||
| * [stackit service-account list](./stackit_service-account_list.md) - Lists all service accounts | ||
| * [stackit service-account token](./stackit_service-account_token.md) - Provides functionality regarding service account tokens | ||
| ## stackit ske cluster delete | ||
| Delete a SKE cluster | ||
| Deletes a SKE cluster | ||
| ### Synopsis | ||
| Delete a STACKIT Kubernetes Engine (SKE) cluster | ||
| Deletes a STACKIT Kubernetes Engine (SKE) cluster. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit ske cluster describe | ||
| Get details of a SKE cluster | ||
| Shows details of a SKE cluster | ||
| ### Synopsis | ||
| Get details of a STACKIT Kubernetes Engine (SKE) cluster | ||
| Shows details of a STACKIT Kubernetes Engine (SKE) cluster. | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit ske cluster list | ||
| List all SKE clusters | ||
| Lists all SKE clusters | ||
| ### Synopsis | ||
| List all STACKIT Kubernetes Engine (SKE) clusters | ||
| Lists all STACKIT Kubernetes Engine (SKE) clusters. | ||
@@ -9,0 +9,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit ske cluster | ||
| Provides functionality for STACKIT Kubernetes Engine (SKE) cluster | ||
| Provides functionality for STACKIT Kubernetes Engine (SKE) cluster. | ||
@@ -33,7 +33,7 @@ ``` | ||
| * [stackit ske cluster create](./stackit_ske_cluster_create.md) - Creates an SKE cluster | ||
| * [stackit ske cluster delete](./stackit_ske_cluster_delete.md) - Delete a SKE cluster | ||
| * [stackit ske cluster describe](./stackit_ske_cluster_describe.md) - Get details of a SKE cluster | ||
| * [stackit ske cluster delete](./stackit_ske_cluster_delete.md) - Deletes a SKE cluster | ||
| * [stackit ske cluster describe](./stackit_ske_cluster_describe.md) - Shows details of a SKE cluster | ||
| * [stackit ske cluster generate-payload](./stackit_ske_cluster_generate-payload.md) - Generates a payload to create/update SKE clusters | ||
| * [stackit ske cluster list](./stackit_ske_cluster_list.md) - List all SKE clusters | ||
| * [stackit ske cluster list](./stackit_ske_cluster_list.md) - Lists all SKE clusters | ||
| * [stackit ske cluster update](./stackit_ske_cluster_update.md) - Updates an SKE cluster | ||
| ## stackit ske credentials describe | ||
| Get details of the credentials associated to a SKE cluster | ||
| Shows details of the credentials associated to a SKE cluster | ||
| ### Synopsis | ||
| Get details of the credentials associated to a STACKIT Kubernetes Engine (SKE) cluster | ||
| Shows details of the credentials associated to a STACKIT Kubernetes Engine (SKE) cluster | ||
@@ -9,0 +9,0 @@ ``` |
| ## stackit ske credentials rotate | ||
| Rotate credentials associated to a SKE cluster | ||
| Rotates credentials associated to a SKE cluster | ||
| ### Synopsis | ||
| Rotate credentials associated to a STACKIT Kubernetes Engine (SKE) cluster. The old credentials will be invalid after the operation | ||
| Rotates credentials associated to a STACKIT Kubernetes Engine (SKE) cluster. The old credentials will be invalid after the operation. | ||
@@ -9,0 +9,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit ske credentials | ||
| Provides functionality for STACKIT Kubernetes Engine (SKE) credentials | ||
| Provides functionality for STACKIT Kubernetes Engine (SKE) credentials. | ||
@@ -32,4 +32,4 @@ ``` | ||
| * [stackit ske](./stackit_ske.md) - Provides functionality for SKE | ||
| * [stackit ske credentials describe](./stackit_ske_credentials_describe.md) - Get details of the credentials associated to a SKE cluster | ||
| * [stackit ske credentials rotate](./stackit_ske_credentials_rotate.md) - Rotate credentials associated to a SKE cluster | ||
| * [stackit ske credentials describe](./stackit_ske_credentials_describe.md) - Shows details of the credentials associated to a SKE cluster | ||
| * [stackit ske credentials rotate](./stackit_ske_credentials_rotate.md) - Rotates credentials associated to a SKE cluster | ||
| ## stackit ske describe | ||
| Get overall details regarding SKE | ||
| Shows overall details regarding SKE | ||
| ### Synopsis | ||
| Get overall details regarding STACKIT Kubernetes Engine (SKE) | ||
| Shows overall details regarding STACKIT Kubernetes Engine (SKE). | ||
@@ -9,0 +9,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit ske disable | ||
| Disables STACKIT Kubernetes Engine (SKE) for a project. It will delete all associated clusters | ||
| Disables STACKIT Kubernetes Engine (SKE) for a project. It will delete all associated clusters. | ||
@@ -10,0 +10,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit ske enable | ||
| Enables STACKIT Kubernetes Engine (SKE) for a project | ||
| Enables STACKIT Kubernetes Engine (SKE) for a project. | ||
@@ -10,0 +10,0 @@ ``` |
| ## stackit ske options | ||
| List SKE provider options | ||
| Lists SKE provider options | ||
| ### Synopsis | ||
| List STACKIT Kubernetes Engine (SKE) provider options (availability zones, Kubernetes versions, machine images and types, volume types) | ||
| Pass one or more flags to filter what categories are shown | ||
| Lists STACKIT Kubernetes Engine (SKE) provider options (availability zones, Kubernetes versions, machine images and types, volume types). | ||
| Pass one or more flags to filter what categories are shown. | ||
@@ -10,0 +10,0 @@ ``` |
@@ -7,3 +7,3 @@ ## stackit ske | ||
| Provides functionality for STACKIT Kubernetes Engine (SKE) | ||
| Provides functionality for STACKIT Kubernetes Engine (SKE). | ||
@@ -34,6 +34,6 @@ ``` | ||
| * [stackit ske credentials](./stackit_ske_credentials.md) - Provides functionality for SKE credentials | ||
| * [stackit ske describe](./stackit_ske_describe.md) - Get overall details regarding SKE | ||
| * [stackit ske describe](./stackit_ske_describe.md) - Shows overall details regarding SKE | ||
| * [stackit ske disable](./stackit_ske_disable.md) - Disables SKE for a project | ||
| * [stackit ske enable](./stackit_ske_enable.md) - Enables SKE for a project | ||
| * [stackit ske options](./stackit_ske_options.md) - List SKE provider options | ||
| * [stackit ske options](./stackit_ske_options.md) - Lists SKE provider options | ||
+8
-1
@@ -5,2 +5,8 @@ ## stackit | ||
| ### Synopsis | ||
| Manage STACKIT resources using the command line. | ||
| This CLI is in a BETA state. | ||
| More services and functionality will be supported soon. Your feedback is appreciated! | ||
| ``` | ||
@@ -25,5 +31,6 @@ stackit [flags] | ||
| * [stackit config](./stackit_config.md) - CLI configuration options | ||
| * [stackit curl](./stackit_curl.md) - Execute an authenticated HTTP request to an endpoint | ||
| * [stackit curl](./stackit_curl.md) - Executes an authenticated HTTP request to an endpoint | ||
| * [stackit dns](./stackit_dns.md) - Provides functionality for DNS | ||
| * [stackit mongodbflex](./stackit_mongodbflex.md) - Provides functionality for MongoDB Flex | ||
| * [stackit opensearch](./stackit_opensearch.md) - Provides functionality for OpenSearch | ||
| * [stackit organization](./stackit_organization.md) - Provides functionality regarding organizations | ||
@@ -30,0 +37,0 @@ * [stackit project](./stackit_project.md) - Provides functionality regarding projects |
+2
-1
@@ -1,2 +0,2 @@ | ||
| module stackit | ||
| module github.com/stackitcloud/stackit-cli | ||
@@ -17,2 +17,3 @@ go 1.21 | ||
| github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.10.3 | ||
| github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.9.2 | ||
| github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.7.5 | ||
@@ -19,0 +20,0 @@ github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.3.4 |
+2
-0
@@ -88,2 +88,4 @@ github.com/MicahParks/keyfunc/v2 v2.1.0 h1:6ZXKb9Rp6qp1bDbJefnG7cTH8yMN1IC/4nf+GVjO99k= | ||
| github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.10.3/go.mod h1:LWfUBjGQWF3SZivQdUdAC/WxJkx8ImJKy5GFMV3tXHY= | ||
| github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.9.2 h1:dwZ1NDD+AxTaZqAeR/0PY7yt32dbABhQH1Vsnt8A+hg= | ||
| github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.9.2/go.mod h1:M8mjTS5yR0XXoH9EpuULme9fEkLhUz4UOT7XSHUSRQ8= | ||
| github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.7.5 h1:Gu0z8MpErzBHxb9xx8B/4DduxckDmBRPWNaeoVcE8cQ= | ||
@@ -90,0 +92,0 @@ github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.7.5/go.mod h1:MQ5eGWFmnDf9wUArqZ2g+nwJgMDkYDQUkoRVutaHrms= |
+28
-16
| # Installation | ||
| ## macOS | ||
| ## Package managers | ||
| The STACKIT CLI is available to download and install through the [Homebrew](https://brew.sh/) package manager. | ||
| ### macOS | ||
| The STACKIT CLI can be installed through the [Homebrew](https://brew.sh/) package manager. | ||
| 1. First, you need to register the [STACKIT tap](https://github.com/stackitcloud/homebrew-tap) via: | ||
@@ -16,25 +18,29 @@ | ||
| ```shell | ||
| brew install stackit-cli | ||
| brew install stackit | ||
| ``` | ||
| ## Linux | ||
| ### Linux | ||
| We will soon distribute the STACKIT CLI via [Snap](https://snapcraft.io/). For the moment, you can either install via [Homebrew](https://brew.sh/) or refer to the [manual installation](#manual-installation) guide. | ||
| We are working on distributing the CLI using a package manager for Linux. For the moment, you can either install via [Homebrew](https://brew.sh/) or refer to the [manual installation](#manual-installation) guide. | ||
| ## Windows | ||
| ### Windows | ||
| We will soon distribute the STACKIT CLI via [Chocolatey](https://chocolatey.org/). For the moment, please refer to the [manual installation](#manual-installation) guide. | ||
| We are working on distributing the CLI using a package manager for Windows. For the moment, please refer to the [manual installation](#manual-installation) guide. | ||
| ## Manual installation | ||
| Alternatively, you can get the STACKIT CLI by downloading a pre-compiled binary or compiling it from source. | ||
| You can also get the STACKIT CLI by compiling it from source or downloading a pre-compiled binary. | ||
| ### Pre-compiled binary | ||
| ### Compile from source | ||
| 1. Download the binary corresponding to your operating system and CPU architecture from our [Releases](https://github.com/stackitcloud/stackit-cli/releases) page | ||
| 2. Extract the contents of the file to your file system and move it to your preferred location (e.g. your home directory) | ||
| 3. (For macOS only) Right click on the executable, select "Open". You will see a dialog stating the identity of the developer cannot be confirmed. Click on "Open" to allow the app to run on your Mac. We soon plan to certificate the STACKIT CLI to be trusted by macOS | ||
| If you have Go 1.16+ installed, you can directly install via: | ||
| ### Compile from source | ||
| ```shell | ||
| go install github.com/stackitcloud/stackit-cli@latest | ||
| ``` | ||
| > For more information, please refer to the [`go install` documentation](https://go.dev/ref/mod#go-install) | ||
| Alternativelly, you can: | ||
| 1. Clone the repository | ||
@@ -44,3 +50,3 @@ 2. Build the application locally by running: | ||
| ```bash | ||
| $ make build | ||
| make build | ||
| ``` | ||
@@ -51,3 +57,3 @@ | ||
| ```bash | ||
| $ ./bin/stackit <GROUP> <SUB-GROUP> <COMMAND> <ARGUMENT> <FLAGS> | ||
| ./bin/stackit <GROUP> <SUB-GROUP> <COMMAND> <ARGUMENT> <FLAGS> | ||
| ``` | ||
@@ -58,3 +64,9 @@ | ||
| ```bash | ||
| $ go run . <GROUP> <SUB-GROUP> <COMMAND> <ARGUMENT> <FLAGS> | ||
| go run . <GROUP> <SUB-GROUP> <COMMAND> <ARGUMENT> <FLAGS> | ||
| ``` | ||
| ### Pre-compiled binary | ||
| 1. Download the binary corresponding to your operating system and CPU architecture from our [Releases](https://github.com/stackitcloud/stackit-cli/releases) page | ||
| 2. Extract the contents of the file to your file system and move it to your preferred location (e.g. your home directory) | ||
| 3. (For macOS only) Right click on the executable, select "Open". You will see a dialog stating the identity of the developer cannot be confirmed. Click on "Open" to allow the app to run on your Mac. We soon plan to certificate the STACKIT CLI to be trusted by macOS |
| package activateserviceaccount | ||
| import ( | ||
| "stackit/internal/pkg/globalflags" | ||
| "testing" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/google/go-cmp/cmp" | ||
@@ -8,0 +9,0 @@ ) |
@@ -6,8 +6,9 @@ package activateserviceaccount | ||
| "fmt" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/auth" | ||
| cliErr "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| 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/spf13/cobra" | ||
@@ -37,5 +38,5 @@ sdkAuth "github.com/stackitcloud/stackit-sdk-go/core/auth" | ||
| Use: "activate-service-account", | ||
| Short: "Activate service account authentication", | ||
| Short: "Authenticates using a service account", | ||
| Long: fmt.Sprintf("%s\n%s\n%s", | ||
| "Activate authentication using service account credentials.", | ||
| "Authenticates to the CLI using service account credentials.", | ||
| "Subsequent commands will be authenticated using the service account credentials provided.", | ||
@@ -42,0 +43,0 @@ "For more details on how to configure your service account, check our Authentication guide at https://github.com/stackitcloud/stackit-cli/blob/main/AUTHENTICATION.md.", |
| package auth | ||
| import ( | ||
| activateserviceaccount "stackit/internal/cmd/auth/activate-service-account" | ||
| "stackit/internal/cmd/auth/login" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| activateserviceaccount "github.com/stackitcloud/stackit-cli/internal/cmd/auth/activate-service-account" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/auth/login" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -16,3 +16,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides authentication functionality", | ||
| Long: "Provides authentication functionality", | ||
| Long: "Provides authentication functionality.", | ||
| Args: args.NoArgs, | ||
@@ -19,0 +19,0 @@ Run: utils.CmdHelp, |
@@ -6,5 +6,5 @@ package login | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/auth" | ||
| "stackit/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
@@ -17,4 +17,4 @@ "github.com/spf13/cobra" | ||
| Use: "login", | ||
| Short: "Login to the STACKIT CLI", | ||
| Long: "Login to the STACKIT CLI", | ||
| Short: "Logs in to the STACKIT CLI", | ||
| Long: "Logs in to the STACKIT CLI using a user account.", | ||
| Args: args.NoArgs, | ||
@@ -21,0 +21,0 @@ Example: examples.Build( |
| package config | ||
| import ( | ||
| "stackit/internal/cmd/config/list" | ||
| "stackit/internal/cmd/config/set" | ||
| "stackit/internal/cmd/config/unset" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/config/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/config/set" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/config/unset" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -17,3 +17,3 @@ "github.com/spf13/cobra" | ||
| Short: "CLI configuration options", | ||
| Long: "CLI configuration options", | ||
| Long: "CLI configuration options.", | ||
| Args: args.NoArgs, | ||
@@ -20,0 +20,0 @@ Run: utils.CmdHelp, |
@@ -7,8 +7,9 @@ package list | ||
| "sort" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/config" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/tables" | ||
| "strings" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
| "github.com/spf13/cobra" | ||
@@ -21,4 +22,4 @@ "github.com/spf13/viper" | ||
| Use: "list", | ||
| Short: "List the current CLI configuration values", | ||
| Long: "List the current CLI configuration values", | ||
| Short: "Lists the current CLI configuration values", | ||
| Long: "Lists the current CLI configuration values.", | ||
| Args: args.NoArgs, | ||
@@ -25,0 +26,0 @@ Example: examples.Build( |
| package set | ||
| import ( | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "testing" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/google/go-cmp/cmp" | ||
@@ -9,0 +10,0 @@ "github.com/google/uuid" |
@@ -7,8 +7,8 @@ package set | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/config" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "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" | ||
@@ -27,2 +27,3 @@ "github.com/spf13/cobra" | ||
| resourceManagerCustomEndpointFlag = "resource-manager-custom-endpoint" | ||
| openSearchCustomEndpointFlag = "opensearch-custom-endpoint" | ||
| ) | ||
@@ -39,7 +40,9 @@ | ||
| Use: "set", | ||
| Short: "Set CLI configuration options", | ||
| Long: `Set CLI configuration options. | ||
| All of the configuration options can be set using an environment variable, which takes precedence over what is configured. | ||
| The environment variable is the name of the flag, with underscores ("_") instead of dashes ("-") and the "STACKIT" prefix. | ||
| Example: to set the project ID you can set the environment variable STACKIT_PROJECT_ID`, | ||
| Short: "Sets CLI configuration options", | ||
| Long: fmt.Sprintf("%s\n%s\n%s\n%s", | ||
| "Sets CLI configuration options.", | ||
| "All of the configuration options can be set using an environment variable, which takes precedence over what is configured.", | ||
| `The environment variable is the name of the flag, with underscores ("_") instead of dashes ("-") and the "STACKIT" prefix.`, | ||
| "Example: to set the project ID you can set the environment variable STACKIT_PROJECT_ID.", | ||
| ), | ||
| Args: args.NoArgs, | ||
@@ -92,2 +95,3 @@ Example: examples.Build( | ||
| cmd.Flags().String(resourceManagerCustomEndpointFlag, "", "Resource manager custom endpoint") | ||
| cmd.Flags().String(openSearchCustomEndpointFlag, "", "OpenSearch custom endpoint") | ||
@@ -106,2 +110,4 @@ err := viper.BindPFlag(config.DNSCustomEndpointKey, cmd.Flags().Lookup(dnsCustomEndpointFlag)) | ||
| cobra.CheckErr(err) | ||
| err = viper.BindPFlag(config.OpenSearchCustomEndpointKey, cmd.Flags().Lookup(openSearchCustomEndpointFlag)) | ||
| cobra.CheckErr(err) | ||
| } | ||
@@ -108,0 +114,0 @@ |
@@ -18,2 +18,3 @@ package unset | ||
| resourceManagerCustomEndpointFlag: true, | ||
| openSearchCustomEndpointFlag: true, | ||
| } | ||
@@ -34,2 +35,3 @@ for _, mod := range mods { | ||
| ResourceManagerCustomEndpoint: true, | ||
| OpenSearchCustomEndpoint: true, | ||
| } | ||
@@ -66,2 +68,3 @@ for _, mod := range mods { | ||
| model.ResourceManagerCustomEndpoint = false | ||
| model.OpenSearchCustomEndpoint = false | ||
| }), | ||
@@ -68,0 +71,0 @@ }, |
@@ -6,7 +6,7 @@ package unset | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/config" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/flags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -28,2 +28,3 @@ "github.com/spf13/cobra" | ||
| resourceManagerCustomEndpointFlag = "resource-manager-custom-endpoint" | ||
| openSearchCustomEndpointFlag = "opensearch-custom-endpoint" | ||
| ) | ||
@@ -42,2 +43,3 @@ | ||
| ResourceManagerCustomEndpoint bool | ||
| OpenSearchCustomEndpoint bool | ||
| } | ||
@@ -48,4 +50,4 @@ | ||
| Use: "unset", | ||
| Short: "Unset CLI configuration options", | ||
| Long: "Unset CLI configuration options", | ||
| Short: "Unsets CLI configuration options", | ||
| Long: "Unsets CLI configuration options.", | ||
| Args: args.NoArgs, | ||
@@ -94,2 +96,5 @@ Example: examples.Build( | ||
| } | ||
| if model.OpenSearchCustomEndpoint { | ||
| viper.Set(config.OpenSearchCustomEndpointKey, "") | ||
| } | ||
@@ -118,2 +123,3 @@ err := viper.WriteConfig() | ||
| cmd.Flags().Bool(resourceManagerCustomEndpointFlag, false, "Resource Manager custom endpoint") | ||
| cmd.Flags().Bool(openSearchCustomEndpointFlag, false, "OpenSearch custom endpoint") | ||
| } | ||
@@ -133,3 +139,4 @@ | ||
| ResourceManagerCustomEndpoint: flags.FlagToBoolValue(cmd, resourceManagerCustomEndpointFlag), | ||
| OpenSearchCustomEndpoint: flags.FlagToBoolValue(cmd, openSearchCustomEndpointFlag), | ||
| } | ||
| } |
@@ -8,6 +8,7 @@ package curl | ||
| "net/http" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "testing" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/google/go-cmp/cmp" | ||
@@ -14,0 +15,0 @@ "github.com/google/go-cmp/cmp/cmpopts" |
@@ -14,7 +14,7 @@ package curl | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/auth" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/flags" | ||
@@ -50,4 +50,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("curl %s", urlArg), | ||
| Short: "Execute an authenticated HTTP request to an endpoint", | ||
| Long: "Execute an HTTP request to an endpoint, using the authentication provided by the CLI", | ||
| Short: "Executes an authenticated HTTP request to an endpoint", | ||
| Long: "Executes an HTTP request to an endpoint, using the authentication provided by the CLI.", | ||
| Example: examples.Build( | ||
@@ -54,0 +54,0 @@ examples.NewExample( |
| package dns | ||
| import ( | ||
| recordset "stackit/internal/cmd/dns/record-set" | ||
| "stackit/internal/cmd/dns/zone" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| recordset "github.com/stackitcloud/stackit-cli/internal/cmd/dns/record-set" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns/zone" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -16,3 +16,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality for DNS", | ||
| Long: "Provides functionality for DNS", | ||
| Long: "Provides functionality for DNS.", | ||
| Args: args.NoArgs, | ||
@@ -19,0 +19,0 @@ Run: utils.CmdHelp, |
@@ -7,4 +7,4 @@ package create | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,12 +7,12 @@ package create | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/dns/client" | ||
| dnsUtils "stackit/internal/pkg/services/dns/utils" | ||
| "stackit/internal/pkg/spinner" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/dns/client" | ||
| dnsUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -49,3 +49,3 @@ "github.com/spf13/cobra" | ||
| Short: "Creates a DNS record set", | ||
| Long: "Creates a DNS record set", | ||
| Long: "Creates a DNS record set.", | ||
| Args: args.NoArgs, | ||
@@ -52,0 +52,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package delete | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,12 +7,12 @@ package delete | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/dns/client" | ||
| dnsUtils "stackit/internal/pkg/services/dns/utils" | ||
| "stackit/internal/pkg/spinner" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/dns/client" | ||
| dnsUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -39,4 +39,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("delete %s", recordSetIdArg), | ||
| Short: "Delete a DNS record set", | ||
| Long: "Delete a DNS record set", | ||
| Short: "Deletes a DNS record set", | ||
| Long: "Deletes a DNS record set.", | ||
| Args: args.SingleArg(recordSetIdArg, utils.ValidateUUID), | ||
@@ -43,0 +43,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package describe | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -9,10 +9,10 @@ package describe | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/dns/client" | ||
| "stackit/internal/pkg/tables" | ||
| "stackit/internal/pkg/utils" | ||
| "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/services/dns/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -38,4 +38,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("describe %s", recordSetIdArg), | ||
| Short: "Get details of a DNS record set", | ||
| Long: "Get details of a DNS record set", | ||
| Short: "Shows details of a DNS record set", | ||
| Long: "Shows details of a DNS record set.", | ||
| Args: args.SingleArg(recordSetIdArg, utils.ValidateUUID), | ||
@@ -42,0 +42,0 @@ Example: examples.Build( |
@@ -11,4 +11,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -15,0 +15,0 @@ "github.com/google/go-cmp/cmp" |
@@ -9,10 +9,10 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/dns/client" | ||
| dnsUtils "stackit/internal/pkg/services/dns/utils" | ||
| "stackit/internal/pkg/tables" | ||
| "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/services/dns/client" | ||
| dnsUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -19,0 +19,0 @@ "github.com/spf13/cobra" |
| package recordset | ||
| import ( | ||
| "stackit/internal/cmd/dns/record-set/create" | ||
| "stackit/internal/cmd/dns/record-set/delete" | ||
| "stackit/internal/cmd/dns/record-set/describe" | ||
| "stackit/internal/cmd/dns/record-set/list" | ||
| "stackit/internal/cmd/dns/record-set/update" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns/record-set/create" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns/record-set/delete" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns/record-set/describe" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns/record-set/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns/record-set/update" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -19,3 +19,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality for DNS record set", | ||
| Long: "Provides functionality for DNS record set", | ||
| Long: "Provides functionality for DNS record set.", | ||
| Args: args.NoArgs, | ||
@@ -22,0 +22,0 @@ Run: utils.CmdHelp, |
@@ -7,4 +7,4 @@ package update | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,12 +7,12 @@ package update | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/dns/client" | ||
| dnsUtils "stackit/internal/pkg/services/dns/utils" | ||
| "stackit/internal/pkg/spinner" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/dns/client" | ||
| dnsUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -48,3 +48,3 @@ "github.com/spf13/cobra" | ||
| Short: "Updates a DNS record set", | ||
| Long: "Updates a DNS record set. Performs a partial update; fields not provided are kept unchanged", | ||
| Long: "Updates a DNS record set.", | ||
| Args: args.SingleArg(recordSetIdArg, utils.ValidateUUID), | ||
@@ -51,0 +51,0 @@ Example: examples.Build( |
@@ -7,4 +7,4 @@ package create | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,11 +7,11 @@ package create | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/dns/client" | ||
| "stackit/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
@@ -60,3 +60,3 @@ "github.com/spf13/cobra" | ||
| Short: "Creates a DNS zone", | ||
| Long: "Creates a DNS zone", | ||
| Long: "Creates a DNS zone.", | ||
| Args: args.NoArgs, | ||
@@ -63,0 +63,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package delete | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,11 +7,11 @@ package delete | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/dns/client" | ||
| dnsUtils "stackit/internal/pkg/services/dns/utils" | ||
| "stackit/internal/pkg/spinner" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/client" | ||
| dnsUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -35,4 +35,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("delete %s", zoneIdArg), | ||
| Short: "Delete a DNS zone", | ||
| Long: "Delete a DNS zone", | ||
| Short: "Deletes a DNS zone", | ||
| Long: "Deletes a DNS zone.", | ||
| Args: args.SingleArg(zoneIdArg, utils.ValidateUUID), | ||
@@ -39,0 +39,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package describe | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,9 +8,9 @@ package describe | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/dns/client" | ||
| "stackit/internal/pkg/tables" | ||
| "stackit/internal/pkg/utils" | ||
| "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/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -33,4 +33,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("describe %s", zoneIdArg), | ||
| Short: "Get details of a DNS zone", | ||
| Long: "Get details of a DNS zone", | ||
| Short: "Shows details of a DNS zone", | ||
| Long: "Shows details of a DNS zone.", | ||
| Args: args.SingleArg(zoneIdArg, utils.ValidateUUID), | ||
@@ -37,0 +37,0 @@ Example: examples.Build( |
@@ -11,4 +11,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -15,0 +15,0 @@ "github.com/google/go-cmp/cmp" |
@@ -9,10 +9,10 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/dns/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -19,0 +19,0 @@ "github.com/spf13/cobra" |
@@ -7,4 +7,4 @@ package update | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,12 +7,12 @@ package update | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/dns/client" | ||
| dnsUtils "stackit/internal/pkg/services/dns/utils" | ||
| "stackit/internal/pkg/spinner" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/dns/client" | ||
| dnsUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/dns/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -58,3 +58,3 @@ "github.com/spf13/cobra" | ||
| Short: "Updates a DNS zone", | ||
| Long: "Updates a DNS zone. Performs a partial update; fields not provided are kept unchanged", | ||
| Long: "Updates a DNS zone.", | ||
| Args: args.SingleArg(zoneIdArg, utils.ValidateUUID), | ||
@@ -61,0 +61,0 @@ Example: examples.Build( |
| package zone | ||
| import ( | ||
| "stackit/internal/cmd/dns/zone/create" | ||
| "stackit/internal/cmd/dns/zone/delete" | ||
| "stackit/internal/cmd/dns/zone/describe" | ||
| "stackit/internal/cmd/dns/zone/list" | ||
| "stackit/internal/cmd/dns/zone/update" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns/zone/create" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns/zone/delete" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns/zone/describe" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns/zone/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns/zone/update" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -19,3 +19,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality for DNS zones", | ||
| Long: "Provides functionality for DNS zones", | ||
| Long: "Provides functionality for DNS zones.", | ||
| Args: args.NoArgs, | ||
@@ -22,0 +22,0 @@ Run: utils.CmdHelp, |
@@ -8,4 +8,4 @@ package create | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -12,0 +12,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,15 +7,14 @@ package create | ||
| "fmt" | ||
| "strings" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| cliErr "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| mongodbflexUtils "stackit/internal/pkg/services/mongodbflex/utils" | ||
| "stackit/internal/pkg/spinner" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| 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/projectname" | ||
| "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/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -64,4 +63,4 @@ "github.com/spf13/cobra" | ||
| Use: "create", | ||
| Short: "Create a MongoDB Flex instance", | ||
| Long: "Create a MongoDB Flex instance.", | ||
| Short: "Creates a MongoDB Flex instance", | ||
| Long: "Creates a MongoDB Flex instance.", | ||
| Args: args.NoArgs, | ||
@@ -82,3 +81,3 @@ Example: examples.Build( | ||
| // Service name and operation needed for error handling | ||
| service := strings.Split(cmd.Parent().Parent().Use, " ")[0] | ||
| service := "mongodbflex" | ||
| operation := cmd.Use | ||
@@ -85,0 +84,0 @@ model, err := parseInput(cmd, service, operation) |
@@ -7,3 +7,3 @@ package delete | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,11 +7,11 @@ package delete | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| mongodbflexUtils "stackit/internal/pkg/services/mongodbflex/utils" | ||
| "stackit/internal/pkg/spinner" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "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/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -35,4 +35,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("delete %s", instanceIdArg), | ||
| Short: "Delete a MongoDB Flex instance", | ||
| Long: "Delete a MongoDB Flex instance", | ||
| Short: "Deletes a MongoDB Flex instance", | ||
| Long: "Deletes a MongoDB Flex instance.", | ||
| Args: args.SingleArg(instanceIdArg, utils.ValidateUUID), | ||
@@ -39,0 +39,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package describe | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -9,10 +9,10 @@ package describe | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| mongodbflexUtils "stackit/internal/pkg/services/mongodbflex/utils" | ||
| "stackit/internal/pkg/tables" | ||
| "stackit/internal/pkg/utils" | ||
| "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/globalflags" | ||
| "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/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -35,4 +35,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("describe %s", instanceIdArg), | ||
| Short: "Get details of a MongoDB Flex instance", | ||
| Long: "Get details of a MongoDB Flex instance", | ||
| Short: "Shows details of a MongoDB Flex instance", | ||
| Long: "Shows details of a MongoDB Flex instance.", | ||
| Args: args.SingleArg(instanceIdArg, utils.ValidateUUID), | ||
@@ -39,0 +39,0 @@ Example: examples.Build( |
| package instance | ||
| import ( | ||
| "stackit/internal/cmd/mongodbflex/instance/create" | ||
| "stackit/internal/cmd/mongodbflex/instance/delete" | ||
| "stackit/internal/cmd/mongodbflex/instance/describe" | ||
| "stackit/internal/cmd/mongodbflex/instance/list" | ||
| "stackit/internal/cmd/mongodbflex/instance/update" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/create" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/delete" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/describe" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/instance/update" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -19,3 +19,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality for MongoDB Flex instances", | ||
| Long: "Provides functionality for MongoDB Flex instances", | ||
| Long: "Provides functionality for MongoDB Flex instances.", | ||
| Args: args.NoArgs, | ||
@@ -22,0 +22,0 @@ Run: utils.CmdHelp, |
@@ -7,4 +7,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,10 +8,10 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -34,4 +34,4 @@ "github.com/spf13/cobra" | ||
| Use: "list", | ||
| Short: "List all MongoDB Flex instances", | ||
| Long: "List all MongoDB Flex instances", | ||
| Short: "Lists all MongoDB Flex instances", | ||
| Long: "Lists all MongoDB Flex instances.", | ||
| Args: args.NoArgs, | ||
@@ -38,0 +38,0 @@ Example: examples.Build( |
@@ -8,4 +8,4 @@ package update | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -12,0 +12,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,14 +7,13 @@ package update | ||
| "fmt" | ||
| "strings" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| cliErr "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| mongodbflexUtils "stackit/internal/pkg/services/mongodbflex/utils" | ||
| "stackit/internal/pkg/spinner" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| 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/services/mongodbflex/client" | ||
| mongodbflexUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -62,4 +61,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("update %s", instanceIdArg), | ||
| Short: "Update a MongoDB Flex instance", | ||
| Long: "Update a MongoDB Flex instance.", | ||
| Short: "Updates a MongoDB Flex instance", | ||
| Long: "Updates a MongoDB Flex instance.", | ||
| Example: examples.Build( | ||
@@ -77,3 +76,3 @@ examples.NewExample( | ||
| // Service name and operation needed for error handling | ||
| service := strings.Split(cmd.Parent().Parent().Use, " ")[0] | ||
| service := "mongodbflex" | ||
| operation := cmd.Use | ||
@@ -142,3 +141,3 @@ model, err := parseInput(cmd, args, service, operation) | ||
| cmd.Flags().StringP(instanceNameFlag, "n", "", "Instance name") | ||
| cmd.Flags().Var(flags.CIDRSliceFlag(), aclFlag, "List of IP networks in CIDR notation which are allowed to access this instance") | ||
| cmd.Flags().Var(flags.CIDRSliceFlag(), aclFlag, "Lists of IP networks in CIDR notation which are allowed to access this instance") | ||
| cmd.Flags().String(backupScheduleFlag, "", "Backup schedule") | ||
@@ -145,0 +144,0 @@ cmd.Flags().String(flavorIdFlag, "", "ID of the flavor") |
| package mongodbflex | ||
| import ( | ||
| "stackit/internal/cmd/mongodbflex/instance" | ||
| "stackit/internal/cmd/mongodbflex/options" | ||
| "stackit/internal/cmd/mongodbflex/user" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "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" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -17,3 +17,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality for MongoDB Flex", | ||
| Long: "Provides functionality for MongoDB Flex", | ||
| Long: "Provides functionality for MongoDB Flex.", | ||
| Args: args.NoArgs, | ||
@@ -20,0 +20,0 @@ Run: utils.CmdHelp, |
@@ -6,6 +6,7 @@ package options | ||
| "fmt" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "testing" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/google/go-cmp/cmp" | ||
@@ -12,0 +13,0 @@ "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" |
@@ -8,9 +8,9 @@ package options | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/pager" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| "stackit/internal/pkg/tables" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "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/pager" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -51,4 +51,4 @@ "github.com/spf13/cobra" | ||
| Use: "options", | ||
| Short: "List MongoDB Flex options", | ||
| Long: "List MongoDB Flex options (flavors, versions and storages for a given flavor)\nPass one or more flags to filter what categories are shown.", | ||
| Short: "Lists MongoDB Flex options", | ||
| Long: "Lists MongoDB Flex options (flavors, versions and storages for a given flavor)\nPass one or more flags to filter what categories are shown.", | ||
| Args: args.NoArgs, | ||
@@ -55,0 +55,0 @@ Example: examples.Build( |
@@ -7,4 +7,4 @@ package create | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,10 +7,10 @@ package create | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| mongodbflexUtils "stackit/internal/pkg/services/mongodbflex/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/mongodbflex/client" | ||
| mongodbflexUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils" | ||
@@ -44,5 +44,5 @@ "github.com/spf13/cobra" | ||
| Use: "create", | ||
| Short: "Create a MongoDB Flex user", | ||
| Short: "Creates a MongoDB Flex user", | ||
| Long: fmt.Sprintf("%s\n%s\n%s\n%s", | ||
| "Create a MongoDB Flex user.", | ||
| "Creates a MongoDB Flex user.", | ||
| "The password is only visible upon creation and cannot be retrieved later.", | ||
@@ -49,0 +49,0 @@ "Alternatively, you can reset the password and access the new one by running:", |
@@ -7,3 +7,3 @@ package delete | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,11 +7,11 @@ package delete | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| mongodbflexUtils "stackit/internal/pkg/services/mongodbflex/utils" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/mongodbflex/client" | ||
| mongodbflexUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -38,5 +38,5 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("delete %s", userIdArg), | ||
| Short: "Delete a MongoDB Flex user", | ||
| Short: "Deletes a MongoDB Flex user", | ||
| Long: fmt.Sprintf("%s\n%s", | ||
| "Delete a MongoDB Flex user by ID. You can get the IDs of users for an instance by running:", | ||
| "Deletes a MongoDB Flex user by ID. You can get the IDs of users for an instance by running:", | ||
| " $ stackit mongodbflex user list --instance-id <INSTANCE_ID>", | ||
@@ -43,0 +43,0 @@ ), |
@@ -7,3 +7,3 @@ package describe | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,10 +8,10 @@ package describe | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| "stackit/internal/pkg/tables" | ||
| "stackit/internal/pkg/utils" | ||
| "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/services/mongodbflex/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -38,5 +38,5 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("describe %s", userIdArg), | ||
| Short: "Get details of a MongoDB Flex user", | ||
| Short: "Shows details of a MongoDB Flex user", | ||
| Long: fmt.Sprintf("%s\n%s\n%s", | ||
| "Get details of a MongoDB Flex user.", | ||
| "Shows details of a MongoDB Flex user.", | ||
| `The user password is hidden inside the "host" field and replaced with asterisks, as it is only visible upon creation. You can reset it by running:`, | ||
@@ -43,0 +43,0 @@ " $ stackit mongodbflex user reset-password <USER_ID> --instance-id <INSTANCE_ID>", |
@@ -7,4 +7,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,10 +8,10 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| mongodbflexUtils "stackit/internal/pkg/services/mongodbflex/utils" | ||
| "stackit/internal/pkg/tables" | ||
| "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/services/mongodbflex/client" | ||
| mongodbflexUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -37,4 +37,4 @@ "github.com/spf13/cobra" | ||
| Use: "list", | ||
| Short: "List all MongoDB Flex users of an instance", | ||
| Long: "List all MongoDB Flex users of an instance.", | ||
| Short: "Lists all MongoDB Flex users of an instance", | ||
| Long: "Lists all MongoDB Flex users of an instance.", | ||
| Example: examples.Build( | ||
@@ -41,0 +41,0 @@ examples.NewExample( |
@@ -7,3 +7,3 @@ package resetpassword | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,11 +7,11 @@ package resetpassword | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| mongodbflexUtils "stackit/internal/pkg/services/mongodbflex/utils" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/mongodbflex/client" | ||
| mongodbflexUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -38,4 +38,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("reset-password %s", userIdArg), | ||
| Short: "Reset the password of a MongoDB Flex user", | ||
| Long: "Reset the password of a MongoDB Flex user. The new password is returned in the response.", | ||
| Short: "Resets the password of a MongoDB Flex user", | ||
| Long: "Resets the password of a MongoDB Flex user. The new password is shown in the command's output.", | ||
| Example: examples.Build( | ||
@@ -42,0 +42,0 @@ examples.NewExample( |
@@ -7,4 +7,4 @@ package update | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,11 +7,11 @@ package update | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/mongodbflex/client" | ||
| mongodbflexUtils "stackit/internal/pkg/services/mongodbflex/utils" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/mongodbflex/client" | ||
| mongodbflexUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/mongodbflex/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -42,4 +42,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("update %s", userIdArg), | ||
| Short: "Update a MongoDB Flex user", | ||
| Long: "Update a MongoDB Flex user.", | ||
| Short: "Updates a MongoDB Flex user", | ||
| Long: "Updates a MongoDB Flex user.", | ||
| Example: examples.Build( | ||
@@ -46,0 +46,0 @@ examples.NewExample( |
| package user | ||
| import ( | ||
| "stackit/internal/cmd/mongodbflex/user/create" | ||
| "stackit/internal/cmd/mongodbflex/user/delete" | ||
| "stackit/internal/cmd/mongodbflex/user/describe" | ||
| "stackit/internal/cmd/mongodbflex/user/list" | ||
| resetpassword "stackit/internal/cmd/mongodbflex/user/reset-password" | ||
| "stackit/internal/cmd/mongodbflex/user/update" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/create" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/delete" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/describe" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/list" | ||
| resetpassword "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/reset-password" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/user/update" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -20,3 +20,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality for MongoDB Flex users", | ||
| Long: "Provides functionality for MongoDB Flex users", | ||
| Long: "Provides functionality for MongoDB Flex users.", | ||
| Args: args.NoArgs, | ||
@@ -23,0 +23,0 @@ Run: utils.CmdHelp, |
@@ -7,4 +7,4 @@ package add | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,9 +7,9 @@ package add | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/membership/client" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/membership/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -40,5 +40,5 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("add %s", subjectArg), | ||
| Short: "Add a member to an organization", | ||
| Short: "Adds a member to an organization", | ||
| Long: fmt.Sprintf("%s\n%s\n%s\n%s\n%s", | ||
| "Add a member to an organization.", | ||
| "Adds a member to an organization.", | ||
| "A member is a combination of a subject (user, service account or client) and a role.", | ||
@@ -45,0 +45,0 @@ "The subject is usually email address for users or name in case of clients", |
@@ -7,4 +7,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -9,9 +9,9 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/membership/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/services/membership/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -43,4 +43,4 @@ "github.com/spf13/cobra" | ||
| Use: "list", | ||
| Short: "List members of an organization", | ||
| Long: "List members of an organization", | ||
| Short: "Lists members of an organization", | ||
| Long: "Lists members of an organization", | ||
| Args: args.NoArgs, | ||
@@ -47,0 +47,0 @@ Example: examples.Build( |
| package member | ||
| import ( | ||
| "stackit/internal/cmd/organization/member/add" | ||
| "stackit/internal/cmd/organization/member/list" | ||
| "stackit/internal/cmd/organization/member/remove" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/organization/member/add" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/organization/member/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/organization/member/remove" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -17,3 +17,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality regarding organization members", | ||
| Long: "Provides functionality regarding organization members", | ||
| Long: "Provides functionality regarding organization members.", | ||
| Args: args.NoArgs, | ||
@@ -20,0 +20,0 @@ Run: utils.CmdHelp, |
@@ -7,4 +7,4 @@ package remove | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,9 +7,9 @@ package remove | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/membership/client" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/membership/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -42,7 +42,7 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("remove %s", subjectArg), | ||
| Short: "Remove a member from an organization.", | ||
| Short: "Removes a member from an organization", | ||
| Long: fmt.Sprintf("%s\n%s\n%s", | ||
| "Remove a member from an organization.", | ||
| "Removes a member from an organization.", | ||
| "A member is a combination of a subject (user, service account or client) and a role.", | ||
| "The subject is usually email address for users or name in case of clients", | ||
| "The subject is usually email address (for users) or name (for clients).", | ||
| ), | ||
@@ -49,0 +49,0 @@ Args: args.SingleArg(subjectArg, nil), |
@@ -5,7 +5,8 @@ package organization | ||
| "fmt" | ||
| "stackit/internal/cmd/organization/member" | ||
| "stackit/internal/cmd/organization/role" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/organization/member" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/organization/role" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/cobra" | ||
@@ -20,3 +21,3 @@ ) | ||
| "Provides functionality regarding organizations.", | ||
| "An active STACKIT organization is the root element of the resource hierarchy and a prerequisite to use any STACKIT Cloud Resource / Service", | ||
| "An active STACKIT organization is the root element of the resource hierarchy and a prerequisite to use any STACKIT Cloud Resource / Service.", | ||
| ), | ||
@@ -23,0 +24,0 @@ Args: args.NoArgs, |
@@ -7,4 +7,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,9 +8,9 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/membership/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/services/membership/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -38,4 +38,4 @@ "github.com/spf13/cobra" | ||
| Use: "list", | ||
| Short: "List roles and permissions of an organization", | ||
| Long: "List roles and permissions of an organization", | ||
| Short: "Lists roles and permissions of an organization", | ||
| Long: "Lists roles and permissions of an organization.", | ||
| Args: args.NoArgs, | ||
@@ -42,0 +42,0 @@ Example: examples.Build( |
| package role | ||
| import ( | ||
| "stackit/internal/cmd/organization/role/list" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/organization/role/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -15,3 +15,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality regarding organization roles", | ||
| Long: "Provides functionality regarding organization roles", | ||
| Long: "Provides functionality regarding organization roles.", | ||
| Args: args.NoArgs, | ||
@@ -18,0 +18,0 @@ Run: utils.CmdHelp, |
@@ -7,5 +7,5 @@ package create | ||
| "stackit/internal/pkg/auth" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -12,0 +12,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,11 +8,11 @@ package create | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/auth" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/resourcemanager/client" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/resourcemanager/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -43,4 +43,4 @@ "github.com/spf13/cobra" | ||
| Use: "create", | ||
| Short: "Create STACKIT projects", | ||
| Long: "Create STACKIT projects", | ||
| Short: "Creates a STACKIT project", | ||
| Long: "Creates a STACKIT project.", | ||
| Args: args.NoArgs, | ||
@@ -47,0 +47,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package delete | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,9 +7,9 @@ package delete | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/resourcemanager/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/resourcemanager/client" | ||
@@ -27,4 +27,4 @@ "github.com/spf13/cobra" | ||
| Use: "delete", | ||
| Short: "Delete a STACKIT project", | ||
| Long: "Delete a STACKIT project", | ||
| Short: "Deletes a STACKIT project", | ||
| Long: "Deletes a STACKIT project.", | ||
| Args: args.NoArgs, | ||
@@ -31,0 +31,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package describe | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,9 +8,9 @@ package describe | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/resourcemanager/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/services/resourcemanager/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -33,4 +33,4 @@ "github.com/spf13/cobra" | ||
| Use: "describe", | ||
| Short: "Get the details of a STACKIT project", | ||
| Long: "Get the details of a STACKIT project", | ||
| Short: "Shows details of a STACKIT project", | ||
| Long: "Shows details of a STACKIT project.", | ||
| Args: args.NoArgs, | ||
@@ -37,0 +37,0 @@ Example: examples.Build( |
@@ -12,4 +12,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -16,0 +16,0 @@ "github.com/google/go-cmp/cmp" |
@@ -9,9 +9,9 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/resourcemanager/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/services/resourcemanager/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -47,4 +47,4 @@ "github.com/spf13/cobra" | ||
| Use: "list", | ||
| Short: "List STACKIT projects", | ||
| Long: "List all STACKIT projects that match certain criteria. At least one of parent-id, project-id-like or member flag must be provided", | ||
| Short: "Lists STACKIT projects", | ||
| Long: "Lists all STACKIT projects that match certain criteria.", | ||
| Args: args.NoArgs, | ||
@@ -51,0 +51,0 @@ Example: examples.Build( |
@@ -7,4 +7,4 @@ package add | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,11 +7,11 @@ package add | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/membership/client" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/membership/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -40,5 +40,5 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("add %s", subjectArg), | ||
| Short: "Add a member to a project", | ||
| Short: "Adds a member to a project", | ||
| Long: fmt.Sprintf("%s\n%s\n%s\n%s\n%s", | ||
| "Add a member to a project.", | ||
| "Adds a member to a project.", | ||
| "A member is a combination of a subject (user, service account or client) and a role.", | ||
@@ -45,0 +45,0 @@ "The subject is usually email address for users or name in case of clients", |
@@ -7,4 +7,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -9,10 +9,10 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/membership/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/membership/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -42,4 +42,4 @@ "github.com/spf13/cobra" | ||
| Use: "list", | ||
| Short: "List members of a project", | ||
| Long: "List members of a project", | ||
| Short: "Lists members of a project", | ||
| Long: "Lists members of a project.", | ||
| Args: args.NoArgs, | ||
@@ -101,3 +101,3 @@ Example: examples.Build( | ||
| cmd.Flags().String(subjectFlag, "", "Filter by subject (Identifier of user, service account or client. Usually email address in case of users or name in case of clients)") | ||
| cmd.Flags().String(subjectFlag, "", "Filter by subject (the identifier of a user, service account or client). This is usually the email address (for users) or name (for clients)") | ||
| cmd.Flags().Int64(limitFlag, 0, "Maximum number of entries to list") | ||
@@ -104,0 +104,0 @@ cmd.Flags().Var(flags.EnumFlag(false, "subject", sortByFlagOptions...), sortByFlag, fmt.Sprintf("Sort entries by a specific field, one of %q", sortByFlagOptions)) |
| package member | ||
| import ( | ||
| "stackit/internal/cmd/project/member/add" | ||
| "stackit/internal/cmd/project/member/list" | ||
| "stackit/internal/cmd/project/member/remove" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project/member/add" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project/member/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project/member/remove" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -17,3 +17,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality regarding project members", | ||
| Long: "Provides functionality regarding project members", | ||
| Long: "Provides functionality regarding project members.", | ||
| Args: args.NoArgs, | ||
@@ -20,0 +20,0 @@ Run: utils.CmdHelp, |
@@ -7,4 +7,4 @@ package remove | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,11 +7,11 @@ package remove | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/membership/client" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/membership/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -42,5 +42,5 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("remove %s", subjectArg), | ||
| Short: "Remove a member from a project.", | ||
| Short: "Removes a member from a project", | ||
| Long: fmt.Sprintf("%s\n%s\n%s", | ||
| "Remove a member from a project.", | ||
| "Removes a member from a project.", | ||
| "A member is a combination of a subject (user, service account or client) and a role.", | ||
@@ -47,0 +47,0 @@ "The subject is usually email address for users or name in case of clients", |
@@ -5,12 +5,13 @@ package project | ||
| "fmt" | ||
| "stackit/internal/cmd/project/create" | ||
| "stackit/internal/cmd/project/delete" | ||
| "stackit/internal/cmd/project/describe" | ||
| "stackit/internal/cmd/project/list" | ||
| "stackit/internal/cmd/project/member" | ||
| "stackit/internal/cmd/project/role" | ||
| "stackit/internal/cmd/project/update" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project/create" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project/delete" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project/describe" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project/member" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project/role" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project/update" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/cobra" | ||
@@ -17,0 +18,0 @@ ) |
@@ -7,4 +7,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,10 +8,10 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/membership/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/membership/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -37,4 +37,4 @@ "github.com/spf13/cobra" | ||
| Use: "list", | ||
| Short: "List roles and permissions of a project", | ||
| Long: "List roles and permissions of a project", | ||
| Short: "Lists roles and permissions of a project", | ||
| Long: "Lists roles and permissions of a project.", | ||
| Args: args.NoArgs, | ||
@@ -41,0 +41,0 @@ Example: examples.Build( |
| package role | ||
| import ( | ||
| "stackit/internal/cmd/project/role/list" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project/role/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -15,3 +15,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality regarding project roles", | ||
| Long: "Provides functionality regarding project roles", | ||
| Long: "Provides functionality regarding project roles.", | ||
| Args: args.NoArgs, | ||
@@ -18,0 +18,0 @@ Run: utils.CmdHelp, |
@@ -7,4 +7,4 @@ package update | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,10 +8,10 @@ package update | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/resourcemanager/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/resourcemanager/client" | ||
@@ -42,4 +42,4 @@ "github.com/spf13/cobra" | ||
| Use: "update", | ||
| Short: "Update a STACKIT project", | ||
| Long: "Update a STACKIT project", | ||
| Short: "Updates a STACKIT project", | ||
| Long: "Updates a STACKIT project.", | ||
| Args: args.NoArgs, | ||
@@ -46,0 +46,0 @@ Example: examples.Build( |
+18
-16
@@ -9,15 +9,16 @@ package cmd | ||
| "stackit/internal/cmd/auth" | ||
| "stackit/internal/cmd/config" | ||
| "stackit/internal/cmd/curl" | ||
| "stackit/internal/cmd/dns" | ||
| "stackit/internal/cmd/mongodbflex" | ||
| "stackit/internal/cmd/organization" | ||
| "stackit/internal/cmd/project" | ||
| serviceaccount "stackit/internal/cmd/service-account" | ||
| "stackit/internal/cmd/ske" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/curl" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/dns" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/opensearch" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/organization" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/project" | ||
| serviceaccount "github.com/stackitcloud/stackit-cli/internal/cmd/service-account" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/flags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -81,8 +82,9 @@ "github.com/spf13/cobra" | ||
| cmd.AddCommand(auth.NewCmd()) | ||
| cmd.AddCommand(config.NewCmd()) | ||
| cmd.AddCommand(curl.NewCmd()) | ||
| cmd.AddCommand(config.NewCmd()) | ||
| cmd.AddCommand(dns.NewCmd()) | ||
| cmd.AddCommand(mongodbflex.NewCmd()) | ||
| cmd.AddCommand(opensearch.NewCmd()) | ||
| cmd.AddCommand(organization.NewCmd()) | ||
| cmd.AddCommand(project.NewCmd()) | ||
| cmd.AddCommand(dns.NewCmd()) | ||
| cmd.AddCommand(mongodbflex.NewCmd()) | ||
| cmd.AddCommand(serviceaccount.NewCmd()) | ||
@@ -89,0 +91,0 @@ cmd.AddCommand(ske.NewCmd()) |
@@ -7,4 +7,4 @@ package create | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,10 +7,10 @@ package create | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/service-account/client" | ||
@@ -33,4 +33,4 @@ "github.com/spf13/cobra" | ||
| Use: "create", | ||
| Short: "Create a service account", | ||
| Long: "Create a service account", | ||
| Short: "Creates a service account", | ||
| Long: "Creates a service account.", | ||
| Args: args.NoArgs, | ||
@@ -37,0 +37,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package delete | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,8 +7,8 @@ package delete | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/service-account/client" | ||
@@ -31,4 +31,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("delete %s", emailArg), | ||
| Short: "Delete a service account", | ||
| Long: "Delete a service account", | ||
| Short: "Deletes a service account", | ||
| Long: "Deletes a service account.", | ||
| Args: args.SingleArg(emailArg, nil), | ||
@@ -35,0 +35,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package getjwks | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,5 +8,5 @@ package getjwks | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/service-account/client" | ||
@@ -28,4 +28,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("get-jwks %s", emailArg), | ||
| Short: "Get JWKS for a service account", | ||
| Long: "Get JSON Web Key set (JWKS) for a service account. Only JSON output is supported", | ||
| Short: "Shows the JWKS for a service account", | ||
| Long: "Shows the JSON Web Key set (JWKS) for a service account. Only JSON output is supported.", | ||
| Args: args.SingleArg(emailArg, nil), | ||
@@ -32,0 +32,0 @@ Example: examples.Build( |
@@ -8,4 +8,4 @@ package create | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -12,0 +12,0 @@ "github.com/google/go-cmp/cmp" |
@@ -9,10 +9,10 @@ package create | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -40,5 +40,5 @@ "github.com/spf13/cobra" | ||
| Use: "create", | ||
| Short: "Create a service account key", | ||
| Short: "Creates a service account key", | ||
| Long: fmt.Sprintf("%s\n%s\n%s", | ||
| "Create a service account key.", | ||
| "Creates a service account key.", | ||
| "You can generate an RSA keypair and provide the public key.", | ||
@@ -45,0 +45,0 @@ "If you do not provide a public key, the service will generate a new key-pair and the private key is included in the response. You won't be able to retrieve it later.", |
@@ -7,3 +7,3 @@ package delete | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,10 +7,10 @@ package delete | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -37,4 +37,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("delete %s", keyIdArg), | ||
| Short: "Delete a service account key", | ||
| Long: "Delete a service account key.", | ||
| Short: "Deletes a service account key", | ||
| Long: "Deletes a service account key.", | ||
| Args: args.SingleArg(keyIdArg, utils.ValidateUUID), | ||
@@ -41,0 +41,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package describe | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,9 +8,9 @@ package describe | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "stackit/internal/pkg/utils" | ||
| "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/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -37,4 +37,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("describe %s", keyIdArg), | ||
| Short: "Get details of a service account key", | ||
| Long: "Get details of a service account key. Only JSON output is supported.", | ||
| Short: "Shows details of a service account key", | ||
| Long: "Shows details of a service account key. Only JSON output is supported.", | ||
| Args: args.SingleArg(keyIdArg, utils.ValidateUUID), | ||
@@ -41,0 +41,0 @@ Example: examples.Build( |
| package key | ||
| import ( | ||
| "stackit/internal/cmd/service-account/key/create" | ||
| "stackit/internal/cmd/service-account/key/delete" | ||
| "stackit/internal/cmd/service-account/key/describe" | ||
| "stackit/internal/cmd/service-account/key/list" | ||
| "stackit/internal/cmd/service-account/key/update" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/key/create" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/key/delete" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/key/describe" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/key/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/key/update" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -19,3 +19,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality regarding service account keys", | ||
| Long: "Provides functionality regarding service account keys", | ||
| Long: "Provides functionality regarding service account keys.", | ||
| Args: args.NoArgs, | ||
@@ -22,0 +22,0 @@ Run: utils.CmdHelp, |
@@ -7,4 +7,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,9 +8,9 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -36,4 +36,4 @@ "github.com/spf13/cobra" | ||
| Use: "list", | ||
| Short: "List all service account keys", | ||
| Long: "List all service account keys.", | ||
| Short: "Lists all service account keys", | ||
| Long: "Lists all service account keys.", | ||
| Args: args.NoArgs, | ||
@@ -40,0 +40,0 @@ Example: examples.Build( |
@@ -8,4 +8,4 @@ package update | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -12,0 +12,0 @@ "github.com/google/go-cmp/cmp" |
@@ -9,10 +9,10 @@ package update | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -45,5 +45,5 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("update %s", keyIdArg), | ||
| Short: "Update a service account key", | ||
| Short: "Updates a service account key", | ||
| Long: fmt.Sprintf("%s\n%s", | ||
| "Update a service account key.", | ||
| "Updates a service account key.", | ||
| "You can temporarily activate or deactivate the key and/or update its date of expiration.", | ||
@@ -50,0 +50,0 @@ ), |
@@ -7,4 +7,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,10 +8,10 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -34,4 +34,4 @@ "github.com/spf13/cobra" | ||
| Use: "list", | ||
| Short: "List all service accounts", | ||
| Long: "List all service accounts", | ||
| Short: "Lists all service accounts", | ||
| Long: "Lists all service accounts.", | ||
| Args: args.NoArgs, | ||
@@ -38,0 +38,0 @@ Example: examples.Build( |
| package serviceaccount | ||
| import ( | ||
| "stackit/internal/cmd/service-account/create" | ||
| "stackit/internal/cmd/service-account/delete" | ||
| getjwks "stackit/internal/cmd/service-account/get-jwks" | ||
| "stackit/internal/cmd/service-account/key" | ||
| "stackit/internal/cmd/service-account/list" | ||
| "stackit/internal/cmd/service-account/token" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/create" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/delete" | ||
| getjwks "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/get-jwks" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/key" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/token" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -20,3 +20,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality for service accounts", | ||
| Long: "Provides functionality for service accounts", | ||
| Long: "Provides functionality for service accounts.", | ||
| Args: args.NoArgs, | ||
@@ -23,0 +23,0 @@ Run: utils.CmdHelp, |
@@ -7,4 +7,4 @@ package create | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,9 +7,9 @@ package create | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/service-account/client" | ||
@@ -37,5 +37,5 @@ "github.com/spf13/cobra" | ||
| Use: "create", | ||
| Short: "Create an access token for a service account", | ||
| Short: "Creates an access token for a service account", | ||
| Long: fmt.Sprintf("%s\n%s\n%s", | ||
| "Create an access token for a service account.", | ||
| "Creates an access token for a service account.", | ||
| "The access token can be then used for API calls (where enabled).", | ||
@@ -42,0 +42,0 @@ "The token is only displayed upon creation, and it will not be recoverable later.", |
@@ -7,4 +7,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,9 +8,9 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -36,5 +36,5 @@ "github.com/spf13/cobra" | ||
| Use: "list", | ||
| Short: "List access tokens of a service account", | ||
| Short: "Lists access tokens of a service account", | ||
| Long: fmt.Sprintf("%s\n%s\n%s", | ||
| "List access tokens of a service account.", | ||
| "Lists access tokens of a service account.", | ||
| "Only the metadata about the access tokens is shown, and not the tokens themselves.", | ||
@@ -41,0 +41,0 @@ "Access tokens (including revoked tokens) are returned until they are expired.", |
@@ -7,3 +7,3 @@ package revoke | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,10 +7,10 @@ package revoke | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/service-account/client" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/services/service-account/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -36,5 +36,5 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("revoke %s", tokenIdArg), | ||
| Short: "Revoke an access token of a service account", | ||
| Short: "Revokes an access token of a service account", | ||
| Long: fmt.Sprintf("%s\n%s\n%s", | ||
| "Revoke an access token of a service account.", | ||
| "Revokes an access token of a service account.", | ||
| "The access token is instantly revoked, any following calls with the token will be unauthorized.", | ||
@@ -41,0 +41,0 @@ "The token metadata is still stored until the expiration time.", |
| package token | ||
| import ( | ||
| "stackit/internal/cmd/service-account/token/create" | ||
| "stackit/internal/cmd/service-account/token/list" | ||
| "stackit/internal/cmd/service-account/token/revoke" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/token/create" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/token/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/service-account/token/revoke" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -17,3 +17,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality regarding service account tokens", | ||
| Long: "Provides functionality regarding service account tokens", | ||
| Long: "Provides functionality regarding service account tokens.", | ||
| Args: args.NoArgs, | ||
@@ -20,0 +20,0 @@ Run: utils.CmdHelp, |
| package cluster | ||
| import ( | ||
| "stackit/internal/cmd/ske/cluster/create" | ||
| "stackit/internal/cmd/ske/cluster/delete" | ||
| "stackit/internal/cmd/ske/cluster/describe" | ||
| generatepayload "stackit/internal/cmd/ske/cluster/generate-payload" | ||
| "stackit/internal/cmd/ske/cluster/list" | ||
| "stackit/internal/cmd/ske/cluster/update" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/cluster/create" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/cluster/delete" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/cluster/describe" | ||
| generatepayload "github.com/stackitcloud/stackit-cli/internal/cmd/ske/cluster/generate-payload" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/cluster/list" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/cluster/update" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -20,3 +20,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality for SKE cluster", | ||
| Long: "Provides functionality for STACKIT Kubernetes Engine (SKE) cluster", | ||
| Long: "Provides functionality for STACKIT Kubernetes Engine (SKE) cluster.", | ||
| Args: args.NoArgs, | ||
@@ -23,0 +23,0 @@ Run: utils.CmdHelp, |
@@ -7,4 +7,4 @@ package create | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,12 +8,12 @@ package create | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| skeUtils "stackit/internal/pkg/services/ske/utils" | ||
| "stackit/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" | ||
| skeUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
@@ -20,0 +20,0 @@ "github.com/spf13/cobra" |
@@ -7,3 +7,3 @@ package delete | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,9 +7,9 @@ package delete | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| "stackit/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
@@ -33,4 +33,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("delete %s", clusterNameArg), | ||
| Short: "Delete a SKE cluster", | ||
| Long: "Delete a STACKIT Kubernetes Engine (SKE) cluster", | ||
| Short: "Deletes a SKE cluster", | ||
| Long: "Deletes a STACKIT Kubernetes Engine (SKE) cluster.", | ||
| Args: args.SingleArg(clusterNameArg, nil), | ||
@@ -37,0 +37,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package describe | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,8 +8,8 @@ package describe | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -32,4 +32,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("describe %s", clusterNameArg), | ||
| Short: "Get details of a SKE cluster", | ||
| Long: "Get details of a STACKIT Kubernetes Engine (SKE) cluster", | ||
| Short: "Shows details of a SKE cluster", | ||
| Long: "Shows details of a STACKIT Kubernetes Engine (SKE) cluster.", | ||
| Args: args.SingleArg(clusterNameArg, nil), | ||
@@ -36,0 +36,0 @@ Example: examples.Build( |
@@ -7,4 +7,4 @@ package generatepayload | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,9 +8,9 @@ package generatepayload | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| skeUtils "stackit/internal/pkg/services/ske/utils" | ||
| "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/services/ske/client" | ||
| skeUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/utils" | ||
@@ -17,0 +17,0 @@ "github.com/spf13/cobra" |
@@ -7,4 +7,4 @@ package list | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,11 +8,11 @@ package list | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| skeUtils "stackit/internal/pkg/services/ske/utils" | ||
| "stackit/internal/pkg/tables" | ||
| "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/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" | ||
| skeUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -35,4 +35,4 @@ "github.com/spf13/cobra" | ||
| Use: "list", | ||
| Short: "List all SKE clusters", | ||
| Long: "List all STACKIT Kubernetes Engine (SKE) clusters", | ||
| Short: "Lists all SKE clusters", | ||
| Long: "Lists all STACKIT Kubernetes Engine (SKE) clusters.", | ||
| Args: args.NoArgs, | ||
@@ -39,0 +39,0 @@ Example: examples.Build( |
@@ -7,4 +7,4 @@ package update | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,10 +8,10 @@ package update | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| skeUtils "stackit/internal/pkg/services/ske/utils" | ||
| "stackit/internal/pkg/spinner" | ||
| "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/services/ske/client" | ||
| skeUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
@@ -18,0 +18,0 @@ "github.com/spf13/cobra" |
| package credentials | ||
| import ( | ||
| "stackit/internal/cmd/ske/credentials/describe" | ||
| "stackit/internal/cmd/ske/credentials/rotate" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/credentials/describe" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/credentials/rotate" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -16,3 +16,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality for SKE credentials", | ||
| Long: "Provides functionality for STACKIT Kubernetes Engine (SKE) credentials", | ||
| Long: "Provides functionality for STACKIT Kubernetes Engine (SKE) credentials.", | ||
| Args: args.NoArgs, | ||
@@ -19,0 +19,0 @@ Run: utils.CmdHelp, |
@@ -7,3 +7,3 @@ package describe | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,9 +8,9 @@ package describe | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| skeUtils "stackit/internal/pkg/services/ske/utils" | ||
| "stackit/internal/pkg/tables" | ||
| "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/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" | ||
| skeUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -33,4 +33,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("describe %s", clusterNameArg), | ||
| Short: "Get details of the credentials associated to a SKE cluster", | ||
| Long: "Get details of the credentials associated to a STACKIT Kubernetes Engine (SKE) cluster", | ||
| Short: "Shows details of the credentials associated to a SKE cluster", | ||
| Long: "Shows details of the credentials associated to a STACKIT Kubernetes Engine (SKE) cluster", | ||
| Args: args.SingleArg(clusterNameArg, nil), | ||
@@ -99,9 +99,9 @@ Example: examples.Build( | ||
| func outputResult(cmd *cobra.Command, outputFormat string, credential *ske.Credentials) error { | ||
| func outputResult(cmd *cobra.Command, outputFormat string, credentials *ske.Credentials) error { | ||
| switch outputFormat { | ||
| case globalflags.PrettyOutputFormat: | ||
| table := tables.NewTable() | ||
| table.AddRow("SERVER", *credential.Server) | ||
| table.AddRow("SERVER", *credentials.Server) | ||
| table.AddSeparator() | ||
| table.AddRow("TOKEN", *credential.Token) | ||
| table.AddRow("TOKEN", *credentials.Token) | ||
| err := table.Display(cmd) | ||
@@ -114,3 +114,3 @@ if err != nil { | ||
| default: | ||
| details, err := json.MarshalIndent(credential, "", " ") | ||
| details, err := json.MarshalIndent(credentials, "", " ") | ||
| if err != nil { | ||
@@ -117,0 +117,0 @@ return fmt.Errorf("marshal SKE credentials: %w", err) |
@@ -7,3 +7,3 @@ package rotate | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,9 +7,9 @@ package rotate | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| "stackit/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
@@ -33,4 +33,4 @@ "github.com/spf13/cobra" | ||
| Use: fmt.Sprintf("rotate %s", clusterNameArg), | ||
| Short: "Rotate credentials associated to a SKE cluster", | ||
| Long: "Rotate credentials associated to a STACKIT Kubernetes Engine (SKE) cluster. The old credentials will be invalid after the operation", | ||
| Short: "Rotates credentials associated to a SKE cluster", | ||
| Long: "Rotates credentials associated to a STACKIT Kubernetes Engine (SKE) cluster. The old credentials will be invalid after the operation.", | ||
| Args: args.SingleArg(clusterNameArg, nil), | ||
@@ -37,0 +37,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package describe | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -8,8 +8,8 @@ package describe | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| "stackit/internal/pkg/tables" | ||
| "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/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -27,4 +27,4 @@ "github.com/spf13/cobra" | ||
| Use: "describe", | ||
| Short: "Get overall details regarding SKE", | ||
| Long: "Get overall details regarding STACKIT Kubernetes Engine (SKE)", | ||
| Short: "Shows overall details regarding SKE", | ||
| Long: "Shows overall details regarding STACKIT Kubernetes Engine (SKE).", | ||
| Args: args.NoArgs, | ||
@@ -31,0 +31,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package disable | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,10 +7,10 @@ package disable | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| "stackit/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
@@ -30,3 +30,3 @@ "github.com/spf13/cobra" | ||
| Short: "Disables SKE for a project", | ||
| Long: "Disables STACKIT Kubernetes Engine (SKE) for a project. It will delete all associated clusters", | ||
| Long: "Disables STACKIT Kubernetes Engine (SKE) for a project. It will delete all associated clusters.", | ||
| Args: args.NoArgs, | ||
@@ -33,0 +33,0 @@ Example: examples.Build( |
@@ -7,3 +7,3 @@ package enable | ||
| "stackit/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
@@ -10,0 +10,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,10 +7,10 @@ package enable | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/confirm" | ||
| "stackit/internal/pkg/errors" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/projectname" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| "stackit/internal/pkg/spinner" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/confirm" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/examples" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/projectname" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/spinner" | ||
@@ -30,3 +30,3 @@ "github.com/spf13/cobra" | ||
| Short: "Enables SKE for a project", | ||
| Long: "Enables STACKIT Kubernetes Engine (SKE) for a project", | ||
| Long: "Enables STACKIT Kubernetes Engine (SKE) for a project.", | ||
| Args: args.NoArgs, | ||
@@ -33,0 +33,0 @@ Example: examples.Build( |
@@ -5,5 +5,6 @@ package options | ||
| "context" | ||
| "stackit/internal/pkg/globalflags" | ||
| "testing" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/google/go-cmp/cmp" | ||
@@ -10,0 +11,0 @@ "github.com/google/go-cmp/cmp/cmpopts" |
@@ -9,9 +9,9 @@ package options | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/examples" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/pager" | ||
| "stackit/internal/pkg/services/ske/client" | ||
| "stackit/internal/pkg/tables" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "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/pager" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/tables" | ||
@@ -42,5 +42,8 @@ "github.com/spf13/cobra" | ||
| Use: "options", | ||
| Short: "List SKE provider options", | ||
| Long: "List STACKIT Kubernetes Engine (SKE) provider options (availability zones, Kubernetes versions, machine images and types, volume types)\nPass one or more flags to filter what categories are shown", | ||
| Args: args.NoArgs, | ||
| Short: "Lists SKE provider options", | ||
| Long: fmt.Sprintf("%s\n%s", | ||
| "Lists STACKIT Kubernetes Engine (SKE) provider options (availability zones, Kubernetes versions, machine images and types, volume types).", | ||
| "Pass one or more flags to filter what categories are shown.", | ||
| ), | ||
| Args: args.NoArgs, | ||
| Example: examples.Build( | ||
@@ -47,0 +50,0 @@ examples.NewExample( |
| package ske | ||
| import ( | ||
| "stackit/internal/cmd/ske/cluster" | ||
| "stackit/internal/cmd/ske/credentials" | ||
| "stackit/internal/cmd/ske/describe" | ||
| "stackit/internal/cmd/ske/disable" | ||
| "stackit/internal/cmd/ske/enable" | ||
| "stackit/internal/cmd/ske/options" | ||
| "stackit/internal/pkg/args" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/cluster" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/credentials" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/describe" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/disable" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/enable" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd/ske/options" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/args" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -20,3 +20,3 @@ "github.com/spf13/cobra" | ||
| Short: "Provides functionality for SKE", | ||
| Long: "Provides functionality for STACKIT Kubernetes Engine (SKE)", | ||
| Long: "Provides functionality for STACKIT Kubernetes Engine (SKE).", | ||
| Args: args.NoArgs, | ||
@@ -23,0 +23,0 @@ Run: utils.CmdHelp, |
| package args | ||
| import ( | ||
| "stackit/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
@@ -6,0 +6,0 @@ "github.com/spf13/cobra" |
@@ -8,3 +8,3 @@ package auth | ||
| "stackit/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
@@ -11,0 +11,0 @@ "github.com/golang-jwt/jwt/v5" |
@@ -8,3 +8,3 @@ package auth | ||
| "stackit/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
@@ -11,0 +11,0 @@ "github.com/golang-jwt/jwt/v5" |
@@ -7,4 +7,5 @@ package auth | ||
| "net/http" | ||
| "stackit/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-sdk-go/core/clients" | ||
@@ -11,0 +12,0 @@ ) |
@@ -25,2 +25,3 @@ package config | ||
| ResourceManagerEndpointKey = "resource_manager_custom_endpoint" | ||
| OpenSearchCustomEndpointKey = "opensearch_custom_endpoint" | ||
@@ -50,2 +51,3 @@ AsyncDefault = "false" | ||
| ResourceManagerEndpointKey, | ||
| OpenSearchCustomEndpointKey, | ||
| } | ||
@@ -119,3 +121,4 @@ | ||
| viper.SetDefault(SKECustomEndpointKey, "") | ||
| viper.SetDefault(OpenSearchCustomEndpointKey, "") | ||
| viper.SetDefault(ResourceManagerEndpointKey, "") | ||
| } |
@@ -5,2 +5,3 @@ package errors | ||
| "fmt" | ||
| "strings" | ||
@@ -41,10 +42,10 @@ "github.com/spf13/cobra" | ||
| Either provide plan-id by running: | ||
| $ stackit %[1]s instance %[2]s --project-id xxx --name my-instance --plan-id <PLAN ID> | ||
| Either provide the plan ID: | ||
| $ %[1]s --plan-id <PLAN ID> [flags] | ||
| or provide plan-name and version: | ||
| $ stackit %[1]s instance %[2]s --project-id xxx --name my-instance --plan-name <PLAN NAME> --version <VERSION> | ||
| or provide plan name and version: | ||
| $ %[1]s --plan-name <PLAN NAME> --version <VERSION> [flags] | ||
| For more details on the available plans, run: | ||
| $ stackit %[1]s plans` | ||
| $ stackit %[2]s plans` | ||
@@ -60,3 +61,3 @@ DSA_INVALID_PLAN = `the provided instance plan is not valid. | ||
| Either provide flavor-id by running: | ||
| Either provide flavor ID by: | ||
| $ stackit %[1]s instance %[2]s --project-id xxx --flavor-id <FLAVOR ID> [flags] | ||
@@ -127,8 +128,14 @@ | ||
| type DSAInputPlanError struct { | ||
| Service string | ||
| Operation string | ||
| Cmd *cobra.Command | ||
| Args []string | ||
| } | ||
| func (e *DSAInputPlanError) Error() string { | ||
| return fmt.Sprintf(DSA_INVALID_INPUT_PLAN, e.Service, e.Operation) | ||
| fullCommandPath := e.Cmd.CommandPath() | ||
| if len(e.Args) > 0 { | ||
| fullCommandPath = fmt.Sprintf("%s %s", fullCommandPath, strings.Join(e.Args, " ")) | ||
| } | ||
| service := e.Cmd.Parent().Parent().Use | ||
| return fmt.Sprintf(DSA_INVALID_INPUT_PLAN, fullCommandPath, service) | ||
| } | ||
@@ -135,0 +142,0 @@ |
@@ -9,3 +9,3 @@ package flags | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -12,0 +12,0 @@ "github.com/google/uuid" |
@@ -5,4 +5,5 @@ package flags | ||
| "fmt" | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/pflag" | ||
@@ -9,0 +10,0 @@ ) |
@@ -5,5 +5,6 @@ package flags | ||
| "fmt" | ||
| "stackit/internal/pkg/utils" | ||
| "strings" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
| "github.com/spf13/pflag" | ||
@@ -10,0 +11,0 @@ ) |
@@ -6,4 +6,4 @@ package globalflags | ||
| "stackit/internal/pkg/config" | ||
| "stackit/internal/pkg/flags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/flags" | ||
@@ -10,0 +10,0 @@ "github.com/spf13/cobra" |
@@ -6,7 +6,8 @@ package projectname | ||
| "fmt" | ||
| "stackit/internal/pkg/config" | ||
| "stackit/internal/pkg/flags" | ||
| "stackit/internal/pkg/globalflags" | ||
| "stackit/internal/pkg/services/resourcemanager/client" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/flags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/services/resourcemanager/client" | ||
| "github.com/spf13/cobra" | ||
@@ -13,0 +14,0 @@ "github.com/spf13/viper" |
| package client | ||
| import ( | ||
| "stackit/internal/pkg/auth" | ||
| "stackit/internal/pkg/config" | ||
| "stackit/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
@@ -8,0 +8,0 @@ "github.com/spf13/cobra" |
@@ -8,3 +8,3 @@ package utils | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/uuid" |
| package client | ||
| import ( | ||
| "stackit/internal/pkg/auth" | ||
| "stackit/internal/pkg/config" | ||
| "stackit/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
@@ -8,0 +8,0 @@ "github.com/spf13/cobra" |
| package client | ||
| import ( | ||
| "stackit/internal/pkg/auth" | ||
| "stackit/internal/pkg/config" | ||
| "stackit/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
@@ -8,0 +8,0 @@ "github.com/spf13/cobra" |
@@ -8,3 +8,3 @@ package utils | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/uuid" |
@@ -6,5 +6,6 @@ package utils | ||
| "fmt" | ||
| "stackit/internal/pkg/errors" | ||
| "strings" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-sdk-go/services/mongodbflex" | ||
@@ -11,0 +12,0 @@ ) |
| package client | ||
| import ( | ||
| "stackit/internal/pkg/auth" | ||
| "stackit/internal/pkg/config" | ||
| "stackit/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
@@ -8,0 +8,0 @@ "github.com/spf13/cobra" |
| package client | ||
| import ( | ||
| "stackit/internal/pkg/auth" | ||
| "stackit/internal/pkg/config" | ||
| "stackit/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
@@ -8,0 +8,0 @@ "github.com/spf13/cobra" |
| package client | ||
| import ( | ||
| "stackit/internal/pkg/auth" | ||
| "stackit/internal/pkg/config" | ||
| "stackit/internal/pkg/errors" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/auth" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/errors" | ||
@@ -8,0 +8,0 @@ "github.com/spf13/cobra" |
@@ -8,3 +8,3 @@ package utils | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -11,0 +11,0 @@ "github.com/google/go-cmp/cmp" |
@@ -7,3 +7,3 @@ package utils | ||
| "stackit/internal/pkg/utils" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/utils" | ||
@@ -10,0 +10,0 @@ "github.com/stackitcloud/stackit-sdk-go/services/ske" |
@@ -5,4 +5,5 @@ package tables | ||
| "fmt" | ||
| "stackit/internal/pkg/pager" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/pager" | ||
| "github.com/jedib0t/go-pretty/v6/table" | ||
@@ -9,0 +10,0 @@ "github.com/spf13/cobra" |
+2
-2
| package main | ||
| import ( | ||
| "stackit/internal/cmd" | ||
| "stackit/internal/pkg/config" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd" | ||
| "github.com/stackitcloud/stackit-cli/internal/pkg/config" | ||
| ) | ||
@@ -7,0 +7,0 @@ |
+28
-6
@@ -46,2 +46,24 @@ # STACKIT CLI (BETA) | ||
| ## Available services | ||
| Below you can find a list of the STACKIT services already available in the CLI (along with their respective command names) and the ones that are currently planned to be integrated. | ||
| | Service | CLI Commands | Status | | ||
| | ----------------------- | ------------------------- | ----------------------- | | ||
| | Argus | | Will be integrated soon | | ||
| | Authorization | `project`, `organization` | :white_check_mark: | | ||
| | DNS | `dns` | :white_check_mark: | | ||
| | Kubernetes Engine (SKE) | `ske` | :white_check_mark: | | ||
| | Load Balancer | | Will be integrated soon | | ||
| | LogMe | | Will be integrated soon | | ||
| | MariaDB | | Will be integrated soon | | ||
| | MongoDB Flex | `mongodbflex` | :white_check_mark: | | ||
| | Object Storage | | Will be integrated soon | | ||
| | OpenSearch | | Will be integrated soon | | ||
| | PostgreSQL Flex | | Will be integrated soon | | ||
| | RabbitMQ | | Will be integrated soon | | ||
| | Resource Manager | `project` | :white_check_mark: | | ||
| | Secrets Manager | | Will be integrated soon | | ||
| | Service Account | `service-account` | :white_check_mark: | | ||
| ## Authentication | ||
@@ -58,3 +80,3 @@ | ||
| ```bash | ||
| $ stackit auth login | ||
| stackit auth login | ||
| ``` | ||
@@ -67,3 +89,3 @@ | ||
| ```bash | ||
| $ stackit auth activate-service-account | ||
| stackit auth activate-service-account | ||
| ``` | ||
@@ -78,3 +100,3 @@ | ||
| ```bash | ||
| $ stackit config | ||
| stackit config | ||
| ``` | ||
@@ -85,3 +107,3 @@ | ||
| ```bash | ||
| $ stackit config set --project-id xxxx-xxxx-xxxxx | ||
| stackit config set --project-id xxxx-xxxx-xxxxx | ||
| ``` | ||
@@ -92,3 +114,3 @@ | ||
| ```bash | ||
| $ stackit config unset --project-id | ||
| stackit config unset --project-id | ||
| ``` | ||
@@ -101,3 +123,3 @@ | ||
| ```bash | ||
| $ stackit config list | ||
| stackit config list | ||
| ``` | ||
@@ -104,0 +126,0 @@ |
@@ -9,5 +9,6 @@ package main | ||
| "path/filepath" | ||
| "stackit/internal/cmd" | ||
| "strings" | ||
| "github.com/stackitcloud/stackit-cli/internal/cmd" | ||
| "github.com/spf13/cobra/doc" | ||
@@ -14,0 +15,0 @@ ) |
@@ -16,15 +16,6 @@ #!/bin/bash | ||
| cd ${ROOT_DIR} | ||
| go mod download | ||
| go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 | ||
| PIP_COMMAND="pip" | ||
| if ! command -v yamllint &>/dev/null; then | ||
| if command -v pip3 &>/dev/null; then | ||
| PIP_COMMAND="pip3" | ||
| fi | ||
| $PIP_COMMAND install yamllint | ||
| fi | ||
| else | ||
| echo "Invalid action: '$action', please use $0 help for help" | ||
| fi |