diff --git a/internal/cmd/dns/record-set/update/update.go b/internal/cmd/dns/record-set/update/update.go index 3874ef20..a79d2a55 100644 --- a/internal/cmd/dns/record-set/update/update.go +++ b/internal/cmd/dns/record-set/update/update.go @@ -93,14 +93,25 @@ func parseFlags(cmd *cobra.Command) (*flagModel, error) { return nil, fmt.Errorf("project ID not set") } + zoneId := utils.FlagToStringValue(cmd, zoneIdFlag) + recordSetId := utils.FlagToStringValue(cmd, recordSetIdFlag) + comment := utils.FlagToStringPointer(cmd, commentFlag) + name := utils.FlagToStringPointer(cmd, nameFlag) + records := utils.FlagToStringSlicePointer(cmd, recordFlag) + ttl := utils.FlagToInt64Pointer(cmd, ttlFlag) + + if comment == nil && name == nil && records == nil && ttl == nil { + return nil, fmt.Errorf("please specify at least one field to update") + } + return &flagModel{ ProjectId: projectId, - ZoneId: utils.FlagToStringValue(cmd, zoneIdFlag), - RecordSetId: utils.FlagToStringValue(cmd, recordSetIdFlag), - Comment: utils.FlagToStringPointer(cmd, commentFlag), - Name: utils.FlagToStringPointer(cmd, nameFlag), - Records: utils.FlagToStringSlicePointer(cmd, recordFlag), - TTL: utils.FlagToInt64Pointer(cmd, ttlFlag), + ZoneId: zoneId, + RecordSetId: recordSetId, + Comment: comment, + Name: name, + Records: records, + TTL: ttl, }, nil } diff --git a/internal/cmd/dns/record-set/update/update_test.go b/internal/cmd/dns/record-set/update/update_test.go index 355a4a35..2d263115 100644 --- a/internal/cmd/dns/record-set/update/update_test.go +++ b/internal/cmd/dns/record-set/update/update_test.go @@ -91,13 +91,13 @@ func TestParseFlags(t *testing.T) { isValid: false, }, { - description: "required fields only", + description: "required flags only (no values to update)", flagValues: map[string]string{ projectIdFlag: testProjectId, zoneIdFlag: testZoneId, recordSetIdFlag: testRecordSetId, }, - isValid: true, + isValid: false, expectedModel: &flagModel{ ProjectId: testProjectId, ZoneId: testZoneId, diff --git a/internal/cmd/dns/zone/update/update.go b/internal/cmd/dns/zone/update/update.go index e600f831..1cda11fa 100644 --- a/internal/cmd/dns/zone/update/update.go +++ b/internal/cmd/dns/zone/update/update.go @@ -111,19 +111,38 @@ func parseFlags(cmd *cobra.Command) (*flagModel, error) { return nil, fmt.Errorf("project ID not set") } + zoneId := utils.FlagToStringValue(cmd, zoneIdFlag) + name := utils.FlagToStringPointer(cmd, nameFlag) + defaultTTL := utils.FlagToInt64Pointer(cmd, defaultTTLFlag) + primaries := utils.FlagToStringSlicePointer(cmd, primaryFlag) + acl := utils.FlagToStringPointer(cmd, aclFlag) + retryTime := utils.FlagToInt64Pointer(cmd, retryTimeFlag) + refreshTime := utils.FlagToInt64Pointer(cmd, refreshTimeFlag) + negativeCache := utils.FlagToInt64Pointer(cmd, negativeCacheFlag) + expireTime := utils.FlagToInt64Pointer(cmd, expireTimeFlag) + description := utils.FlagToStringPointer(cmd, descriptionFlag) + contactEmail := utils.FlagToStringPointer(cmd, contactEmailFlag) + + if name == nil && defaultTTL == nil && primaries == nil && + acl == nil && retryTime == nil && refreshTime == nil && + negativeCache == nil && expireTime == nil && description == nil && + contactEmail == nil { + return nil, fmt.Errorf("please specify at least one field to update") + } + return &flagModel{ ProjectId: projectId, - ZoneId: utils.FlagToStringValue(cmd, zoneIdFlag), - Name: utils.FlagToStringPointer(cmd, nameFlag), - DefaultTTL: utils.FlagToInt64Pointer(cmd, defaultTTLFlag), - Primaries: utils.FlagToStringSlicePointer(cmd, primaryFlag), - Acl: utils.FlagToStringPointer(cmd, aclFlag), - RetryTime: utils.FlagToInt64Pointer(cmd, retryTimeFlag), - RefreshTime: utils.FlagToInt64Pointer(cmd, refreshTimeFlag), - NegativeCache: utils.FlagToInt64Pointer(cmd, negativeCacheFlag), - ExpireTime: utils.FlagToInt64Pointer(cmd, expireTimeFlag), - Description: utils.FlagToStringPointer(cmd, descriptionFlag), - ContactEmail: utils.FlagToStringPointer(cmd, contactEmailFlag), + ZoneId: zoneId, + Name: name, + DefaultTTL: defaultTTL, + Primaries: primaries, + Acl: acl, + RetryTime: retryTime, + RefreshTime: refreshTime, + NegativeCache: negativeCache, + ExpireTime: expireTime, + Description: description, + ContactEmail: contactEmail, }, nil } diff --git a/internal/cmd/dns/zone/update/update_test.go b/internal/cmd/dns/zone/update/update_test.go index 359a0f75..4894337b 100644 --- a/internal/cmd/dns/zone/update/update_test.go +++ b/internal/cmd/dns/zone/update/update_test.go @@ -104,12 +104,12 @@ func TestParseFlags(t *testing.T) { isValid: false, }, { - description: "required fields only", + description: "required flags only (no values to update)", flagValues: map[string]string{ projectIdFlag: testProjectId, zoneIdFlag: testZoneId, }, - isValid: true, + isValid: false, expectedModel: &flagModel{ ProjectId: testProjectId, ZoneId: testZoneId, diff --git a/internal/cmd/postgresql/credential/create/create.go b/internal/cmd/postgresql/credential/create/create.go index 156a7712..5ac89be2 100644 --- a/internal/cmd/postgresql/credential/create/create.go +++ b/internal/cmd/postgresql/credential/create/create.go @@ -15,13 +15,15 @@ import ( ) const ( - projectIdFlag = "project-id" - instanceIdFlag = "instance-id" + projectIdFlag = "project-id" + instanceIdFlag = "instance-id" + hidePasswordFlag = "hide-password" ) type flagModel struct { - ProjectId string - InstanceId string + ProjectId string + InstanceId string + HidePassword bool } func NewCmd() *cobra.Command { @@ -47,10 +49,15 @@ func NewCmd() *cobra.Command { req := buildRequest(ctx, model, apiClient) resp, err := req.Execute() if err != nil { - return fmt.Errorf("create PostgreSQL credentials: %w", err) + return fmt.Errorf("create PostgreSQL credential: %w", err) } - cmd.Printf("Created credentials with ID %s\n", *resp.Id) + cmd.Printf("Created credential with ID %s\n\nUsername: %s\n", *resp.Id, *resp.Raw.Credentials.Username) + if model.HidePassword { + cmd.Printf("Password: \n") + } else { + cmd.Printf("Password: %s\n", *resp.Raw.Credentials.Password) + } return nil }, } @@ -60,6 +67,7 @@ func NewCmd() *cobra.Command { func configureFlags(cmd *cobra.Command) { cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") + cmd.Flags().Bool(hidePasswordFlag, false, "Hide password in output") err := utils.MarkFlagsRequired(cmd, instanceIdFlag) cobra.CheckErr(err) @@ -72,8 +80,9 @@ func parseFlags(cmd *cobra.Command) (*flagModel, error) { } return &flagModel{ - ProjectId: projectId, - InstanceId: utils.FlagToStringValue(cmd, instanceIdFlag), + ProjectId: projectId, + InstanceId: utils.FlagToStringValue(cmd, instanceIdFlag), + HidePassword: utils.FlagToBoolValue(cmd, hidePasswordFlag), }, nil } diff --git a/internal/cmd/postgresql/credential/delete/delete.go b/internal/cmd/postgresql/credential/delete/delete.go index 6e18a13d..8d4e8fe8 100644 --- a/internal/cmd/postgresql/credential/delete/delete.go +++ b/internal/cmd/postgresql/credential/delete/delete.go @@ -15,15 +15,15 @@ import ( ) const ( - projectIdFlag = "project-id" - instanceIdFlag = "instance-id" - credentialsIdFlag = "credentials-id" + projectIdFlag = "project-id" + instanceIdFlag = "instance-id" + credentialIdFlag = "credential-id" //nolint:gosec // linter false positive ) type flagModel struct { - ProjectId string - InstanceId string - CredentialsId string + ProjectId string + InstanceId string + CredentialId string } func NewCmd() *cobra.Command { @@ -31,7 +31,7 @@ func NewCmd() *cobra.Command { Use: "delete", Short: "Delete a PostgreSQL instance credential", Long: "Delete a PostgreSQL instance credential", - Example: `$ stackit postgresql credential delete --project-id xxx --instance-id xxx --credentials-id xxx`, + Example: `$ stackit postgresql credential delete --project-id xxx --instance-id xxx --credential-id xxx`, RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() model, err := parseFlags(cmd) @@ -49,10 +49,10 @@ func NewCmd() *cobra.Command { req := buildRequest(ctx, model, apiClient) err = req.Execute() if err != nil { - return fmt.Errorf("delete PostgreSQL credentials: %w", err) + return fmt.Errorf("delete PostgreSQL credential: %w", err) } - cmd.Printf("Deleted credentials with ID %s\n", model.CredentialsId) + cmd.Printf("Deleted credential with ID %s\n", model.CredentialId) return nil }, } @@ -62,11 +62,11 @@ func NewCmd() *cobra.Command { func configureFlags(cmd *cobra.Command) { cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") - cmd.Flags().Var(flags.UUIDFlag(), credentialsIdFlag, "Credentials ID") + cmd.Flags().Var(flags.UUIDFlag(), credentialIdFlag, "Credentials ID") err := utils.MarkFlagsRequired(cmd, instanceIdFlag) cobra.CheckErr(err) - err = utils.MarkFlagsRequired(cmd, credentialsIdFlag) + err = utils.MarkFlagsRequired(cmd, credentialIdFlag) cobra.CheckErr(err) } @@ -77,13 +77,13 @@ func parseFlags(cmd *cobra.Command) (*flagModel, error) { } return &flagModel{ - ProjectId: projectId, - InstanceId: utils.FlagToStringValue(cmd, instanceIdFlag), - CredentialsId: utils.FlagToStringValue(cmd, credentialsIdFlag), + ProjectId: projectId, + InstanceId: utils.FlagToStringValue(cmd, instanceIdFlag), + CredentialId: utils.FlagToStringValue(cmd, credentialIdFlag), }, nil } func buildRequest(ctx context.Context, model *flagModel, apiClient *postgresql.APIClient) postgresql.ApiDeleteCredentialsRequest { - req := apiClient.DeleteCredentials(ctx, model.ProjectId, model.InstanceId, model.CredentialsId) + req := apiClient.DeleteCredentials(ctx, model.ProjectId, model.InstanceId, model.CredentialId) return req } diff --git a/internal/cmd/postgresql/credential/delete/delete_test.go b/internal/cmd/postgresql/credential/delete/delete_test.go index 74517b1a..c4403f70 100644 --- a/internal/cmd/postgresql/credential/delete/delete_test.go +++ b/internal/cmd/postgresql/credential/delete/delete_test.go @@ -20,13 +20,13 @@ var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") var testClient = &postgresql.APIClient{} var testProjectId = uuid.NewString() var testInstanceId = uuid.NewString() -var testCredentialsId = uuid.NewString() +var testCredentialId = uuid.NewString() func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string { flagValues := map[string]string{ - projectIdFlag: testProjectId, - instanceIdFlag: testInstanceId, - credentialsIdFlag: testCredentialsId, + projectIdFlag: testProjectId, + instanceIdFlag: testInstanceId, + credentialIdFlag: testCredentialId, } for _, mod := range mods { mod(flagValues) @@ -36,9 +36,9 @@ func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]st func fixtureFlagModel(mods ...func(model *flagModel)) *flagModel { model := &flagModel{ - ProjectId: testProjectId, - InstanceId: testInstanceId, - CredentialsId: testCredentialsId, + ProjectId: testProjectId, + InstanceId: testInstanceId, + CredentialId: testCredentialId, } for _, mod := range mods { mod(model) @@ -47,7 +47,7 @@ func fixtureFlagModel(mods ...func(model *flagModel)) *flagModel { } func fixtureRequest(mods ...func(request *postgresql.ApiDeleteCredentialsRequest)) postgresql.ApiDeleteCredentialsRequest { - request := testClient.DeleteCredentials(testCtx, testProjectId, testInstanceId, testCredentialsId) + request := testClient.DeleteCredentials(testCtx, testProjectId, testInstanceId, testCredentialId) for _, mod := range mods { mod(&request) } @@ -117,21 +117,21 @@ func TestParseFlags(t *testing.T) { { description: "credentials id missing", flagValues: fixtureFlagValues(func(flagValues map[string]string) { - delete(flagValues, credentialsIdFlag) + delete(flagValues, credentialIdFlag) }), isValid: false, }, { description: "credentials id invalid 1", flagValues: fixtureFlagValues(func(flagValues map[string]string) { - flagValues[credentialsIdFlag] = "" + flagValues[credentialIdFlag] = "" }), isValid: false, }, { description: "credentials id invalid 2", flagValues: fixtureFlagValues(func(flagValues map[string]string) { - flagValues[credentialsIdFlag] = "invalid-uuid" + flagValues[credentialIdFlag] = "invalid-uuid" }), isValid: false, }, diff --git a/internal/cmd/postgresql/credential/describe/describe.go b/internal/cmd/postgresql/credential/describe/describe.go index 537cfb03..3000503e 100644 --- a/internal/cmd/postgresql/credential/describe/describe.go +++ b/internal/cmd/postgresql/credential/describe/describe.go @@ -16,15 +16,15 @@ import ( ) const ( - projectIdFlag = "project-id" - instanceIdFlag = "instance-id" - credentialsIdFlag = "credentials-id" + projectIdFlag = "project-id" + instanceIdFlag = "instance-id" + credentialIdFlag = "credential-id" //nolint:gosec // linter false positive ) type flagModel struct { - ProjectId string - InstanceId string - CredentialsId string + ProjectId string + InstanceId string + CredentialId string } func NewCmd() *cobra.Command { @@ -32,7 +32,7 @@ func NewCmd() *cobra.Command { Use: "describe", Short: "Get details of a PostgreSQL instance credential", Long: "Get details of a PostgreSQL instance credential", - Example: `$ stackit postgresql credential describe --project-id xxx --instance-id xxx --credentials-id xxx`, + Example: `$ stackit postgresql credential describe --project-id xxx --instance-id xxx --credential-id xxx`, RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() model, err := parseFlags(cmd) @@ -50,13 +50,13 @@ func NewCmd() *cobra.Command { req := buildRequest(ctx, model, apiClient) resp, err := req.Execute() if err != nil { - return fmt.Errorf("describe PostgreSQL credentials: %w", err) + return fmt.Errorf("describe PostgreSQL credential: %w", err) } // Show details details, err := json.MarshalIndent(resp, "", " ") if err != nil { - return fmt.Errorf("marshal PostgreSQL credentials: %w", err) + return fmt.Errorf("marshal PostgreSQL credential: %w", err) } cmd.Println(string(details)) @@ -69,11 +69,11 @@ func NewCmd() *cobra.Command { func configureFlags(cmd *cobra.Command) { cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") - cmd.Flags().Var(flags.UUIDFlag(), credentialsIdFlag, "Credentials ID") + cmd.Flags().Var(flags.UUIDFlag(), credentialIdFlag, "Credentials ID") err := utils.MarkFlagsRequired(cmd, instanceIdFlag) cobra.CheckErr(err) - err = utils.MarkFlagsRequired(cmd, credentialsIdFlag) + err = utils.MarkFlagsRequired(cmd, credentialIdFlag) cobra.CheckErr(err) } @@ -84,13 +84,13 @@ func parseFlags(cmd *cobra.Command) (*flagModel, error) { } return &flagModel{ - ProjectId: projectId, - InstanceId: utils.FlagToStringValue(cmd, instanceIdFlag), - CredentialsId: utils.FlagToStringValue(cmd, credentialsIdFlag), + ProjectId: projectId, + InstanceId: utils.FlagToStringValue(cmd, instanceIdFlag), + CredentialId: utils.FlagToStringValue(cmd, credentialIdFlag), }, nil } func buildRequest(ctx context.Context, model *flagModel, apiClient *postgresql.APIClient) postgresql.ApiGetCredentialsRequest { - req := apiClient.GetCredentials(ctx, model.ProjectId, model.InstanceId, model.CredentialsId) + req := apiClient.GetCredentials(ctx, model.ProjectId, model.InstanceId, model.CredentialId) return req } diff --git a/internal/cmd/postgresql/credential/describe/describe_test.go b/internal/cmd/postgresql/credential/describe/describe_test.go index 3ed48019..5910af6c 100644 --- a/internal/cmd/postgresql/credential/describe/describe_test.go +++ b/internal/cmd/postgresql/credential/describe/describe_test.go @@ -20,13 +20,13 @@ var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") var testClient = &postgresql.APIClient{} var testProjectId = uuid.NewString() var testInstanceId = uuid.NewString() -var testCredentialsId = uuid.NewString() +var testCredentialId = uuid.NewString() func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string { flagValues := map[string]string{ - projectIdFlag: testProjectId, - instanceIdFlag: testInstanceId, - credentialsIdFlag: testCredentialsId, + projectIdFlag: testProjectId, + instanceIdFlag: testInstanceId, + credentialIdFlag: testCredentialId, } for _, mod := range mods { mod(flagValues) @@ -36,9 +36,9 @@ func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]st func fixtureFlagModel(mods ...func(model *flagModel)) *flagModel { model := &flagModel{ - ProjectId: testProjectId, - InstanceId: testInstanceId, - CredentialsId: testCredentialsId, + ProjectId: testProjectId, + InstanceId: testInstanceId, + CredentialId: testCredentialId, } for _, mod := range mods { mod(model) @@ -47,7 +47,7 @@ func fixtureFlagModel(mods ...func(model *flagModel)) *flagModel { } func fixtureRequest(mods ...func(request *postgresql.ApiGetCredentialsRequest)) postgresql.ApiGetCredentialsRequest { - request := testClient.GetCredentials(testCtx, testProjectId, testInstanceId, testCredentialsId) + request := testClient.GetCredentials(testCtx, testProjectId, testInstanceId, testCredentialId) for _, mod := range mods { mod(&request) } @@ -117,21 +117,21 @@ func TestParseFlags(t *testing.T) { { description: "credentials id missing", flagValues: fixtureFlagValues(func(flagValues map[string]string) { - delete(flagValues, credentialsIdFlag) + delete(flagValues, credentialIdFlag) }), isValid: false, }, { description: "credentials id invalid 1", flagValues: fixtureFlagValues(func(flagValues map[string]string) { - flagValues[credentialsIdFlag] = "" + flagValues[credentialIdFlag] = "" }), isValid: false, }, { description: "credentials id invalid 2", flagValues: fixtureFlagValues(func(flagValues map[string]string) { - flagValues[credentialsIdFlag] = "invalid-uuid" + flagValues[credentialIdFlag] = "invalid-uuid" }), isValid: false, }, diff --git a/internal/cmd/postgresql/instance/create/create.go b/internal/cmd/postgresql/instance/create/create.go index 47d5131a..fdd921ec 100644 --- a/internal/cmd/postgresql/instance/create/create.go +++ b/internal/cmd/postgresql/instance/create/create.go @@ -55,7 +55,7 @@ func NewCmd() *cobra.Command { Use: "create", Short: "Creates a PostgreSQL instance", Long: "Creates a PostgreSQL instance", - Example: `$ stackit postgresql instance create --project-id xxx --name my-instance --plan-name plan-name --version version`, + Example: `$ stackit postgresql instance create --project-id xxx --name my-instance --plan-name plan-name --version 13`, RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() model, err := parseFlags(cmd) diff --git a/internal/cmd/postgresql/instance/update/update.go b/internal/cmd/postgresql/instance/update/update.go index 3ecab8de..c00cf205 100644 --- a/internal/cmd/postgresql/instance/update/update.go +++ b/internal/cmd/postgresql/instance/update/update.go @@ -123,6 +123,15 @@ func parseFlags(cmd *cobra.Command) (*flagModel, error) { return nil, fmt.Errorf("project ID not set") } + instanceId := utils.FlagToStringValue(cmd, instanceIdFlag) + enableMonitoring := utils.FlagToBoolPointer(cmd, enableMonitoringFlag) + monitoringInstanceId := utils.FlagToStringPointer(cmd, monitoringInstanceIdFlag) + graphite := utils.FlagToStringPointer(cmd, graphiteFlag) + metricsFrequency := utils.FlagToInt64Pointer(cmd, metricsFrequencyFlag) + metricsPrefix := utils.FlagToStringPointer(cmd, metricsPrefixFlag) + plugin := utils.FlagToStringSlicePointer(cmd, pluginFlag) + sgwAcl := utils.FlagToStringSlicePointer(cmd, sgwAclFlag) + syslog := utils.FlagToStringSlicePointer(cmd, syslogFlag) planId := utils.FlagToStringPointer(cmd, planIdFlag) planName := utils.FlagToStringValue(cmd, planNameFlag) version := utils.FlagToStringValue(cmd, versionFlag) @@ -131,17 +140,24 @@ func parseFlags(cmd *cobra.Command) (*flagModel, error) { return nil, fmt.Errorf("please specify either plan-id or plan-name and version but not both") } + if enableMonitoring == nil && monitoringInstanceId == nil && graphite == nil && + metricsFrequency == nil && metricsPrefix == nil && plugin == nil && + sgwAcl == nil && syslog == nil && planId == nil && + planName == "" && version == "" { + return nil, fmt.Errorf("please specify at least one field to update") + } + return &flagModel{ ProjectId: projectId, - InstanceId: utils.FlagToStringValue(cmd, instanceIdFlag), - EnableMonitoring: utils.FlagToBoolPointer(cmd, enableMonitoringFlag), - MonitoringInstanceId: utils.FlagToStringPointer(cmd, monitoringInstanceIdFlag), - Graphite: utils.FlagToStringPointer(cmd, graphiteFlag), - MetricsFrequency: utils.FlagToInt64Pointer(cmd, metricsFrequencyFlag), - MetricsPrefix: utils.FlagToStringPointer(cmd, metricsPrefixFlag), - Plugin: utils.FlagToStringSlicePointer(cmd, pluginFlag), - SgwAcl: utils.FlagToStringSlicePointer(cmd, sgwAclFlag), - Syslog: utils.FlagToStringSlicePointer(cmd, syslogFlag), + InstanceId: instanceId, + EnableMonitoring: enableMonitoring, + MonitoringInstanceId: monitoringInstanceId, + Graphite: graphite, + MetricsFrequency: metricsFrequency, + MetricsPrefix: metricsPrefix, + Plugin: plugin, + SgwAcl: sgwAcl, + Syslog: syslog, PlanId: planId, PlanName: planName, Version: version, diff --git a/internal/cmd/postgresql/instance/update/update_test.go b/internal/cmd/postgresql/instance/update/update_test.go index 7a5b88ca..cbd381d6 100644 --- a/internal/cmd/postgresql/instance/update/update_test.go +++ b/internal/cmd/postgresql/instance/update/update_test.go @@ -131,12 +131,12 @@ func TestParseFlags(t *testing.T) { isValid: false, }, { - description: "required fields only", + description: "required flags only (no values to update)", flagValues: map[string]string{ projectIdFlag: testProjectId, instanceIdFlag: testInstanceId, }, - isValid: true, + isValid: false, expectedModel: &flagModel{ ProjectId: testProjectId, InstanceId: testInstanceId, diff --git a/internal/cmd/postgresql/offerings/list/list.go b/internal/cmd/postgresql/offering/list/list.go similarity index 100% rename from internal/cmd/postgresql/offerings/list/list.go rename to internal/cmd/postgresql/offering/list/list.go diff --git a/internal/cmd/postgresql/offerings/list/list_test.go b/internal/cmd/postgresql/offering/list/list_test.go similarity index 100% rename from internal/cmd/postgresql/offerings/list/list_test.go rename to internal/cmd/postgresql/offering/list/list_test.go diff --git a/internal/cmd/postgresql/offerings/offerings.go b/internal/cmd/postgresql/offering/offering.go similarity index 89% rename from internal/cmd/postgresql/offerings/offerings.go rename to internal/cmd/postgresql/offering/offering.go index 54956e2e..a0179fbc 100644 --- a/internal/cmd/postgresql/offerings/offerings.go +++ b/internal/cmd/postgresql/offering/offering.go @@ -1,14 +1,14 @@ -package offerings +package offering import ( - "github.com/stackitcloud/stackit-cli/internal/cmd/postgresql/offerings/list" + "github.com/stackitcloud/stackit-cli/internal/cmd/postgresql/offering/list" "github.com/spf13/cobra" ) func NewCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "offerings", + Use: "offering", Short: "Provides information regarding the PostgreSQL service offerings", Long: "Provides information regarding the PostgreSQL service offerings", Example: list.NewCmd().Example, diff --git a/internal/cmd/postgresql/postgresql.go b/internal/cmd/postgresql/postgresql.go index 38b78a8d..e994a0d8 100644 --- a/internal/cmd/postgresql/postgresql.go +++ b/internal/cmd/postgresql/postgresql.go @@ -5,7 +5,7 @@ import ( "github.com/stackitcloud/stackit-cli/internal/cmd/postgresql/credential" "github.com/stackitcloud/stackit-cli/internal/cmd/postgresql/instance" - "github.com/stackitcloud/stackit-cli/internal/cmd/postgresql/offerings" + "github.com/stackitcloud/stackit-cli/internal/cmd/postgresql/offering" "github.com/spf13/cobra" ) @@ -23,6 +23,6 @@ func NewCmd() *cobra.Command { func addSubcommands(cmd *cobra.Command) { cmd.AddCommand(instance.NewCmd()) - cmd.AddCommand(offerings.NewCmd()) + cmd.AddCommand(offering.NewCmd()) cmd.AddCommand(credential.NewCmd()) }