diff --git a/docs/stackit_logme_instance_create.md b/docs/stackit_logme_instance_create.md index 1fa58e59e..ba315784b 100644 --- a/docs/stackit_logme_instance_create.md +++ b/docs/stackit_logme_instance_create.md @@ -20,7 +20,7 @@ stackit logme instance create [flags] $ stackit logme instance create --name my-instance --plan-id xxx Create a LogMe instance with name "my-instance" and specify IP range which is allowed to access it - $ stackit logme instance create --name my-instance --plan-id xxx --acl 192.168.1.0/24 + $ stackit logme instance create --name my-instance --plan-id xxx --acl 1.2.3.0/24 ``` ### Options diff --git a/docs/stackit_logme_instance_update.md b/docs/stackit_logme_instance_update.md index d2d891842..afac87e8f 100644 --- a/docs/stackit_logme_instance_update.md +++ b/docs/stackit_logme_instance_update.md @@ -17,7 +17,7 @@ stackit logme instance update INSTANCE_ID [flags] $ stackit logme instance update xxx --plan-id yyy Update the range of IPs allowed to access a LogMe instance with ID "xxx" - $ stackit logme instance update xxx --acl 192.168.1.0/24 + $ stackit logme instance update xxx --acl 1.2.3.0/24 ``` ### Options diff --git a/docs/stackit_mariadb_instance_create.md b/docs/stackit_mariadb_instance_create.md index e0c2befe1..bbc0ddcac 100644 --- a/docs/stackit_mariadb_instance_create.md +++ b/docs/stackit_mariadb_instance_create.md @@ -20,7 +20,7 @@ stackit mariadb instance create [flags] $ stackit mariadb instance create --name my-instance --plan-id xxx Create a MariaDB instance with name "my-instance" and specify IP range which is allowed to access it - $ stackit mariadb instance create --name my-instance --plan-id xxx --acl 192.168.1.0/24 + $ stackit mariadb instance create --name my-instance --plan-id xxx --acl 1.2.3.0/24 ``` ### Options diff --git a/docs/stackit_mariadb_instance_update.md b/docs/stackit_mariadb_instance_update.md index f4d6655bd..e6056f920 100644 --- a/docs/stackit_mariadb_instance_update.md +++ b/docs/stackit_mariadb_instance_update.md @@ -17,7 +17,7 @@ stackit mariadb instance update INSTANCE_ID [flags] $ stackit mariadb instance update xxx --plan-id yyy Update the range of IPs allowed to access a MariaDB instance with ID "xxx" - $ stackit mariadb instance update xxx --acl 192.168.1.0/24 + $ stackit mariadb instance update xxx --acl 1.2.3.0/24 ``` ### Options diff --git a/docs/stackit_opensearch_instance_create.md b/docs/stackit_opensearch_instance_create.md index 6e1e04301..285522c68 100644 --- a/docs/stackit_opensearch_instance_create.md +++ b/docs/stackit_opensearch_instance_create.md @@ -20,7 +20,7 @@ stackit opensearch instance create [flags] $ 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 + $ stackit opensearch instance create --name my-instance --plan-id xxx --acl 1.2.3.0/24 ``` ### Options diff --git a/docs/stackit_opensearch_instance_update.md b/docs/stackit_opensearch_instance_update.md index 2847cdf45..d8d1fd7af 100644 --- a/docs/stackit_opensearch_instance_update.md +++ b/docs/stackit_opensearch_instance_update.md @@ -17,7 +17,7 @@ stackit opensearch instance update INSTANCE_ID [flags] $ stackit opensearch instance update xxx --plan-id yyy 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 + $ stackit opensearch instance update xxx --acl 1.2.3.0/24 ``` ### Options diff --git a/docs/stackit_rabbitmq_instance_create.md b/docs/stackit_rabbitmq_instance_create.md index 4243e5519..375bcf2e4 100644 --- a/docs/stackit_rabbitmq_instance_create.md +++ b/docs/stackit_rabbitmq_instance_create.md @@ -20,7 +20,7 @@ stackit rabbitmq instance create [flags] $ stackit rabbitmq instance create --name my-instance --plan-id xxx Create an RabbitMQ instance with name "my-instance" and specify IP range which is allowed to access it - $ stackit rabbitmq instance create --name my-instance --plan-id xxx --acl 192.168.1.0/24 + $ stackit rabbitmq instance create --name my-instance --plan-id xxx --acl 1.2.3.0/24 ``` ### Options diff --git a/docs/stackit_rabbitmq_instance_update.md b/docs/stackit_rabbitmq_instance_update.md index fe1228272..8322cb502 100644 --- a/docs/stackit_rabbitmq_instance_update.md +++ b/docs/stackit_rabbitmq_instance_update.md @@ -17,7 +17,7 @@ stackit rabbitmq instance update INSTANCE_ID [flags] $ stackit rabbitmq instance update xxx --plan-id yyy Update the range of IPs allowed to access an RabbitMQ instance with ID "xxx" - $ stackit rabbitmq instance update xxx --acl 192.168.1.0/24 + $ stackit rabbitmq instance update xxx --acl 1.2.3.0/24 ``` ### Options diff --git a/docs/stackit_redis_instance_create.md b/docs/stackit_redis_instance_create.md index 20bba5da7..2c5616448 100644 --- a/docs/stackit_redis_instance_create.md +++ b/docs/stackit_redis_instance_create.md @@ -20,7 +20,7 @@ stackit redis instance create [flags] $ stackit redis instance create --name my-instance --plan-id xxx Create a Redis instance with name "my-instance" and specify IP range which is allowed to access it - $ stackit redis instance create --name my-instance --plan-id xxx --acl 192.168.1.0/24 + $ stackit redis instance create --name my-instance --plan-id xxx --acl 1.2.3.0/24 ``` ### Options diff --git a/docs/stackit_redis_instance_update.md b/docs/stackit_redis_instance_update.md index 8af6b3fc9..7087eaec8 100644 --- a/docs/stackit_redis_instance_update.md +++ b/docs/stackit_redis_instance_update.md @@ -17,7 +17,7 @@ stackit redis instance update INSTANCE_ID [flags] $ stackit redis instance update xxx --plan-id yyy Update the range of IPs allowed to access a Redis instance with ID "xxx" - $ stackit redis instance update xxx --acl 192.168.1.0/24 + $ stackit redis instance update xxx --acl 1.2.3.0/24 ``` ### Options diff --git a/internal/cmd/logme/credentials/create/create.go b/internal/cmd/logme/credentials/create/create.go index 8feb5d910..7a3ec9c88 100644 --- a/internal/cmd/logme/credentials/create/create.go +++ b/internal/cmd/logme/credentials/create/create.go @@ -76,7 +76,11 @@ func NewCmd() *cobra.Command { } cmd.Printf("Created credentials for instance %s. Credentials ID: %s\n\n", instanceLabel, *resp.Id) - cmd.Printf("Username: %s\n", *resp.Raw.Credentials.Username) + // The username field cannot be set by the user so we only display it if it's not returned empty + username := *resp.Raw.Credentials.Username + if username != "" { + cmd.Printf("Username: %s\n", *resp.Raw.Credentials.Username) + } if model.HidePassword { cmd.Printf("Password: \n") } else { diff --git a/internal/cmd/logme/credentials/describe/describe.go b/internal/cmd/logme/credentials/describe/describe.go index 2f4c6d9af..9c710d19b 100644 --- a/internal/cmd/logme/credentials/describe/describe.go +++ b/internal/cmd/logme/credentials/describe/describe.go @@ -104,8 +104,12 @@ func outputResult(cmd *cobra.Command, outputFormat string, credentials *logme.Cr table := tables.NewTable() table.AddRow("ID", *credentials.Id) table.AddSeparator() - table.AddRow("USERNAME", *credentials.Raw.Credentials.Username) - table.AddSeparator() + // The username field cannot be set by the user so we only display it if it's not returned empty + username := *credentials.Raw.Credentials.Username + if username != "" { + 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) diff --git a/internal/cmd/logme/instance/create/create.go b/internal/cmd/logme/instance/create/create.go index a3fb1efcf..17008c64b 100644 --- a/internal/cmd/logme/instance/create/create.go +++ b/internal/cmd/logme/instance/create/create.go @@ -70,7 +70,7 @@ func NewCmd() *cobra.Command { "$ stackit logme instance create --name my-instance --plan-id xxx"), examples.NewExample( `Create a LogMe instance with name "my-instance" and specify IP range which is allowed to access it`, - "$ stackit logme instance create --name my-instance --plan-id xxx --acl 192.168.1.0/24"), + "$ stackit logme instance create --name my-instance --plan-id xxx --acl 1.2.3.0/24"), ), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() diff --git a/internal/cmd/logme/instance/describe/describe.go b/internal/cmd/logme/instance/describe/describe.go index 0b77041a3..30d054776 100644 --- a/internal/cmd/logme/instance/describe/describe.go +++ b/internal/cmd/logme/instance/describe/describe.go @@ -19,6 +19,8 @@ import ( const ( instanceIdArg = "INSTANCE_ID" + + aclParameterKey = "sgw_acl" ) type inputModel struct { @@ -95,6 +97,17 @@ func outputResult(cmd *cobra.Command, outputFormat string, instance *logme.Insta table.AddRow("LAST OPERATION TYPE", *instance.LastOperation.Type) table.AddSeparator() table.AddRow("LAST OPERATION STATE", *instance.LastOperation.State) + table.AddSeparator() + table.AddRow("PLAN ID", *instance.PlanId) + // Only show ACL if it's present and not empty + acl := (*instance.Parameters)[aclParameterKey] + aclStr, ok := acl.(string) + if ok { + if aclStr != "" { + table.AddSeparator() + table.AddRow("ACL", aclStr) + } + } err := table.Display(cmd) if err != nil { return fmt.Errorf("render table: %w", err) diff --git a/internal/cmd/logme/instance/update/update.go b/internal/cmd/logme/instance/update/update.go index a8186c714..4c79dd721 100644 --- a/internal/cmd/logme/instance/update/update.go +++ b/internal/cmd/logme/instance/update/update.go @@ -68,7 +68,7 @@ func NewCmd() *cobra.Command { "$ stackit logme instance update xxx --plan-id yyy"), examples.NewExample( `Update the range of IPs allowed to access a LogMe instance with ID "xxx"`, - "$ stackit logme instance update xxx --acl 192.168.1.0/24"), + "$ stackit logme instance update xxx --acl 1.2.3.0/24"), ), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() diff --git a/internal/cmd/mariadb/credentials/create/create.go b/internal/cmd/mariadb/credentials/create/create.go index a9b1467fc..7264898b3 100644 --- a/internal/cmd/mariadb/credentials/create/create.go +++ b/internal/cmd/mariadb/credentials/create/create.go @@ -76,7 +76,11 @@ func NewCmd() *cobra.Command { } cmd.Printf("Created credentials for instance %s. Credentials ID: %s\n\n", instanceLabel, *resp.Id) - cmd.Printf("Username: %s\n", *resp.Raw.Credentials.Username) + // The username field cannot be set by the user so we only display it if it's not returned empty + username := *resp.Raw.Credentials.Username + if username != "" { + cmd.Printf("Username: %s\n", *resp.Raw.Credentials.Username) + } if model.HidePassword { cmd.Printf("Password: \n") } else { diff --git a/internal/cmd/mariadb/credentials/describe/describe.go b/internal/cmd/mariadb/credentials/describe/describe.go index 87180f8ba..ab6f797ef 100644 --- a/internal/cmd/mariadb/credentials/describe/describe.go +++ b/internal/cmd/mariadb/credentials/describe/describe.go @@ -104,8 +104,12 @@ func outputResult(cmd *cobra.Command, outputFormat string, credentials *mariadb. table := tables.NewTable() table.AddRow("ID", *credentials.Id) table.AddSeparator() - table.AddRow("USERNAME", *credentials.Raw.Credentials.Username) - table.AddSeparator() + // The username field cannot be set by the user so we only display it if it's not returned empty + username := *credentials.Raw.Credentials.Username + if username != "" { + 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) diff --git a/internal/cmd/mariadb/instance/create/create.go b/internal/cmd/mariadb/instance/create/create.go index cc1b865e3..af764b530 100644 --- a/internal/cmd/mariadb/instance/create/create.go +++ b/internal/cmd/mariadb/instance/create/create.go @@ -70,7 +70,7 @@ func NewCmd() *cobra.Command { "$ stackit mariadb instance create --name my-instance --plan-id xxx"), examples.NewExample( `Create a MariaDB instance with name "my-instance" and specify IP range which is allowed to access it`, - "$ stackit mariadb instance create --name my-instance --plan-id xxx --acl 192.168.1.0/24"), + "$ stackit mariadb instance create --name my-instance --plan-id xxx --acl 1.2.3.0/24"), ), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() diff --git a/internal/cmd/mariadb/instance/describe/describe.go b/internal/cmd/mariadb/instance/describe/describe.go index c9e0bf7a4..aa02f63a0 100644 --- a/internal/cmd/mariadb/instance/describe/describe.go +++ b/internal/cmd/mariadb/instance/describe/describe.go @@ -19,6 +19,8 @@ import ( const ( instanceIdArg = "INSTANCE_ID" + + aclParameterKey = "sgw_acl" ) type inputModel struct { @@ -95,6 +97,17 @@ func outputResult(cmd *cobra.Command, outputFormat string, instance *mariadb.Ins table.AddRow("LAST OPERATION TYPE", *instance.LastOperation.Type) table.AddSeparator() table.AddRow("LAST OPERATION STATE", *instance.LastOperation.State) + table.AddSeparator() + table.AddRow("PLAN ID", *instance.PlanId) + // Only show ACL if it's present and not empty + acl := (*instance.Parameters)[aclParameterKey] + aclStr, ok := acl.(string) + if ok { + if aclStr != "" { + table.AddSeparator() + table.AddRow("ACL", aclStr) + } + } err := table.Display(cmd) if err != nil { return fmt.Errorf("render table: %w", err) diff --git a/internal/cmd/mariadb/instance/update/update.go b/internal/cmd/mariadb/instance/update/update.go index 52b2dc7f8..6cb2852e5 100644 --- a/internal/cmd/mariadb/instance/update/update.go +++ b/internal/cmd/mariadb/instance/update/update.go @@ -68,7 +68,7 @@ func NewCmd() *cobra.Command { "$ stackit mariadb instance update xxx --plan-id yyy"), examples.NewExample( `Update the range of IPs allowed to access a MariaDB instance with ID "xxx"`, - "$ stackit mariadb instance update xxx --acl 192.168.1.0/24"), + "$ stackit mariadb instance update xxx --acl 1.2.3.0/24"), ), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() diff --git a/internal/cmd/opensearch/credentials/create/create.go b/internal/cmd/opensearch/credentials/create/create.go index 64b3c6c56..bf8538a4c 100644 --- a/internal/cmd/opensearch/credentials/create/create.go +++ b/internal/cmd/opensearch/credentials/create/create.go @@ -75,8 +75,11 @@ func NewCmd() *cobra.Command { 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) + cmd.Printf("Created credentials for instance %s. Credentials ID: %s\n\n", instanceLabel, *resp.Id) // The username field cannot be set by the user so we only display it if it's not returned empty + username := *resp.Raw.Credentials.Username + if username != "" { + cmd.Printf("Username: %s\n", *resp.Raw.Credentials.Username) + } if model.HidePassword { cmd.Printf("Password: \n") } else { diff --git a/internal/cmd/opensearch/credentials/describe/describe.go b/internal/cmd/opensearch/credentials/describe/describe.go index 39f7f2cc6..7eb8c0aa6 100644 --- a/internal/cmd/opensearch/credentials/describe/describe.go +++ b/internal/cmd/opensearch/credentials/describe/describe.go @@ -104,8 +104,12 @@ func outputResult(cmd *cobra.Command, outputFormat string, credentials *opensear table := tables.NewTable() table.AddRow("ID", *credentials.Id) table.AddSeparator() - table.AddRow("USERNAME", *credentials.Raw.Credentials.Username) - table.AddSeparator() + // The username field cannot be set by the user so we only display it if it's not returned empty + username := *credentials.Raw.Credentials.Username + if username != "" { + 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) diff --git a/internal/cmd/opensearch/instance/create/create.go b/internal/cmd/opensearch/instance/create/create.go index f523127b5..0b433abe7 100644 --- a/internal/cmd/opensearch/instance/create/create.go +++ b/internal/cmd/opensearch/instance/create/create.go @@ -70,7 +70,7 @@ func NewCmd() *cobra.Command { "$ 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"), + "$ stackit opensearch instance create --name my-instance --plan-id xxx --acl 1.2.3.0/24"), ), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() diff --git a/internal/cmd/opensearch/instance/describe/describe.go b/internal/cmd/opensearch/instance/describe/describe.go index 45dd2c058..13e189ec8 100644 --- a/internal/cmd/opensearch/instance/describe/describe.go +++ b/internal/cmd/opensearch/instance/describe/describe.go @@ -19,6 +19,8 @@ import ( const ( instanceIdArg = "INSTANCE_ID" + + aclParameterKey = "sgw_acl" ) type inputModel struct { @@ -95,6 +97,17 @@ func outputResult(cmd *cobra.Command, outputFormat string, instance *opensearch. table.AddRow("LAST OPERATION TYPE", *instance.LastOperation.Type) table.AddSeparator() table.AddRow("LAST OPERATION STATE", *instance.LastOperation.State) + table.AddSeparator() + table.AddRow("PLAN ID", *instance.PlanId) + // Only show ACL if it's present and not empty + acl := (*instance.Parameters)[aclParameterKey] + aclStr, ok := acl.(string) + if ok { + if aclStr != "" { + table.AddSeparator() + table.AddRow("ACL", aclStr) + } + } err := table.Display(cmd) if err != nil { return fmt.Errorf("render table: %w", err) diff --git a/internal/cmd/opensearch/instance/update/update.go b/internal/cmd/opensearch/instance/update/update.go index 9271f911c..4bb00723c 100644 --- a/internal/cmd/opensearch/instance/update/update.go +++ b/internal/cmd/opensearch/instance/update/update.go @@ -68,7 +68,7 @@ func NewCmd() *cobra.Command { "$ stackit opensearch instance update xxx --plan-id yyy"), 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"), + "$ stackit opensearch instance update xxx --acl 1.2.3.0/24"), ), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() diff --git a/internal/cmd/rabbitmq/credentials/create/create.go b/internal/cmd/rabbitmq/credentials/create/create.go index fa25bfe19..c3e7acc52 100644 --- a/internal/cmd/rabbitmq/credentials/create/create.go +++ b/internal/cmd/rabbitmq/credentials/create/create.go @@ -76,7 +76,11 @@ func NewCmd() *cobra.Command { } cmd.Printf("Created credentials for instance %s. Credentials ID: %s\n\n", instanceLabel, *resp.Id) - cmd.Printf("Username: %s\n", *resp.Raw.Credentials.Username) + // The username field cannot be set by the user so we only display it if it's not returned empty + username := *resp.Raw.Credentials.Username + if username != "" { + cmd.Printf("Username: %s\n", *resp.Raw.Credentials.Username) + } if model.HidePassword { cmd.Printf("Password: \n") } else { diff --git a/internal/cmd/rabbitmq/credentials/describe/describe.go b/internal/cmd/rabbitmq/credentials/describe/describe.go index d152a8dd4..aa09bf735 100644 --- a/internal/cmd/rabbitmq/credentials/describe/describe.go +++ b/internal/cmd/rabbitmq/credentials/describe/describe.go @@ -104,8 +104,12 @@ func outputResult(cmd *cobra.Command, outputFormat string, credentials *rabbitmq table := tables.NewTable() table.AddRow("ID", *credentials.Id) table.AddSeparator() - table.AddRow("USERNAME", *credentials.Raw.Credentials.Username) - table.AddSeparator() + // The username field cannot be set by the user so we only display it if it's not returned empty + username := *credentials.Raw.Credentials.Username + if username != "" { + 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) diff --git a/internal/cmd/rabbitmq/instance/create/create.go b/internal/cmd/rabbitmq/instance/create/create.go index 8b694a9b9..3fc1720c3 100644 --- a/internal/cmd/rabbitmq/instance/create/create.go +++ b/internal/cmd/rabbitmq/instance/create/create.go @@ -70,7 +70,7 @@ func NewCmd() *cobra.Command { "$ stackit rabbitmq instance create --name my-instance --plan-id xxx"), examples.NewExample( `Create an RabbitMQ instance with name "my-instance" and specify IP range which is allowed to access it`, - "$ stackit rabbitmq instance create --name my-instance --plan-id xxx --acl 192.168.1.0/24"), + "$ stackit rabbitmq instance create --name my-instance --plan-id xxx --acl 1.2.3.0/24"), ), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() diff --git a/internal/cmd/rabbitmq/instance/describe/describe.go b/internal/cmd/rabbitmq/instance/describe/describe.go index c9ca21c43..386aad28e 100644 --- a/internal/cmd/rabbitmq/instance/describe/describe.go +++ b/internal/cmd/rabbitmq/instance/describe/describe.go @@ -19,6 +19,8 @@ import ( const ( instanceIdArg = "INSTANCE_ID" + + aclParameterKey = "sgw_acl" ) type inputModel struct { @@ -95,6 +97,17 @@ func outputResult(cmd *cobra.Command, outputFormat string, instance *rabbitmq.In table.AddRow("LAST OPERATION TYPE", *instance.LastOperation.Type) table.AddSeparator() table.AddRow("LAST OPERATION STATE", *instance.LastOperation.State) + table.AddSeparator() + table.AddRow("PLAN ID", *instance.PlanId) + // Only show ACL if it's present and not empty + acl := (*instance.Parameters)[aclParameterKey] + aclStr, ok := acl.(string) + if ok { + if aclStr != "" { + table.AddSeparator() + table.AddRow("ACL", aclStr) + } + } err := table.Display(cmd) if err != nil { return fmt.Errorf("render table: %w", err) diff --git a/internal/cmd/rabbitmq/instance/update/update.go b/internal/cmd/rabbitmq/instance/update/update.go index 3ccd31380..1bc87f70d 100644 --- a/internal/cmd/rabbitmq/instance/update/update.go +++ b/internal/cmd/rabbitmq/instance/update/update.go @@ -68,7 +68,7 @@ func NewCmd() *cobra.Command { "$ stackit rabbitmq instance update xxx --plan-id yyy"), examples.NewExample( `Update the range of IPs allowed to access an RabbitMQ instance with ID "xxx"`, - "$ stackit rabbitmq instance update xxx --acl 192.168.1.0/24"), + "$ stackit rabbitmq instance update xxx --acl 1.2.3.0/24"), ), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() diff --git a/internal/cmd/redis/credentials/create/create.go b/internal/cmd/redis/credentials/create/create.go index 19ce067c1..a5eafad25 100644 --- a/internal/cmd/redis/credentials/create/create.go +++ b/internal/cmd/redis/credentials/create/create.go @@ -76,7 +76,11 @@ func NewCmd() *cobra.Command { } cmd.Printf("Created credentials for instance %s. Credentials ID: %s\n\n", instanceLabel, *resp.Id) - cmd.Printf("Username: %s\n", *resp.Raw.Credentials.Username) + // The username field cannot be set by the user so we only display it if it's not returned empty + username := *resp.Raw.Credentials.Username + if username != "" { + cmd.Printf("Username: %s\n", *resp.Raw.Credentials.Username) + } if model.HidePassword { cmd.Printf("Password: \n") } else { diff --git a/internal/cmd/redis/credentials/describe/describe.go b/internal/cmd/redis/credentials/describe/describe.go index 5b44b7c84..230a83ba8 100644 --- a/internal/cmd/redis/credentials/describe/describe.go +++ b/internal/cmd/redis/credentials/describe/describe.go @@ -104,8 +104,12 @@ func outputResult(cmd *cobra.Command, outputFormat string, credentials *redis.Cr table := tables.NewTable() table.AddRow("ID", *credentials.Id) table.AddSeparator() - table.AddRow("USERNAME", *credentials.Raw.Credentials.Username) - table.AddSeparator() + // The username field cannot be set by the user so we only display it if it's not returned empty + username := *credentials.Raw.Credentials.Username + if username != "" { + 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) diff --git a/internal/cmd/redis/instance/create/create.go b/internal/cmd/redis/instance/create/create.go index 4757cf90c..d27e02264 100644 --- a/internal/cmd/redis/instance/create/create.go +++ b/internal/cmd/redis/instance/create/create.go @@ -70,7 +70,7 @@ func NewCmd() *cobra.Command { "$ stackit redis instance create --name my-instance --plan-id xxx"), examples.NewExample( `Create a Redis instance with name "my-instance" and specify IP range which is allowed to access it`, - "$ stackit redis instance create --name my-instance --plan-id xxx --acl 192.168.1.0/24"), + "$ stackit redis instance create --name my-instance --plan-id xxx --acl 1.2.3.0/24"), ), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() diff --git a/internal/cmd/redis/instance/describe/describe.go b/internal/cmd/redis/instance/describe/describe.go index 463f40c38..b7207c54b 100644 --- a/internal/cmd/redis/instance/describe/describe.go +++ b/internal/cmd/redis/instance/describe/describe.go @@ -19,6 +19,8 @@ import ( const ( instanceIdArg = "INSTANCE_ID" + + aclParameterKey = "sgw_acl" ) type inputModel struct { @@ -95,6 +97,17 @@ func outputResult(cmd *cobra.Command, outputFormat string, instance *redis.Insta table.AddRow("LAST OPERATION TYPE", *instance.LastOperation.Type) table.AddSeparator() table.AddRow("LAST OPERATION STATE", *instance.LastOperation.State) + table.AddSeparator() + table.AddRow("PLAN ID", *instance.PlanId) + // Only show ACL if it's present and not empty + acl := (*instance.Parameters)[aclParameterKey] + aclStr, ok := acl.(string) + if ok { + if aclStr != "" { + table.AddSeparator() + table.AddRow("ACL", aclStr) + } + } err := table.Display(cmd) if err != nil { return fmt.Errorf("render table: %w", err) diff --git a/internal/cmd/redis/instance/update/update.go b/internal/cmd/redis/instance/update/update.go index 797bb0186..235521658 100644 --- a/internal/cmd/redis/instance/update/update.go +++ b/internal/cmd/redis/instance/update/update.go @@ -68,7 +68,7 @@ func NewCmd() *cobra.Command { "$ stackit redis instance update xxx --plan-id yyy"), examples.NewExample( `Update the range of IPs allowed to access a Redis instance with ID "xxx"`, - "$ stackit redis instance update xxx --acl 192.168.1.0/24"), + "$ stackit redis instance update xxx --acl 1.2.3.0/24"), ), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background()