Skip to content

Commit 684be2c

Browse files
hcsa73Henrique Santos
and
Henrique Santos
authored
Misc fixes to database commands (#92)
* Add hint to flex services on instance update * Add hint on password reset * Make state capitalized * Fix credentials describe example descriptions * Make state capitalized for describe --------- Co-authored-by: Henrique Santos <[email protected]>
1 parent 9dd2f7f commit 684be2c

File tree

18 files changed

+41
-28
lines changed

18 files changed

+41
-28
lines changed

docs/stackit_logme_credentials_describe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ stackit logme credentials describe CREDENTIALS_ID [flags]
1313
### Examples
1414

1515
```
16-
Get details of credentials of a LogMe instance with ID "xxx" from instance with ID "yyy"
16+
Get details of credentials with ID "xxx" from instance with ID "yyy"
1717
$ stackit logme credentials describe xxx --instance-id yyy
1818
19-
Get details of credentials of a LogMe instance with ID "xxx" from instance with ID "yyy" in a table format
19+
Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format
2020
$ stackit logme credentials describe xxx --instance-id yyy --output-format pretty
2121
```
2222

docs/stackit_mariadb_credentials_describe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ stackit mariadb credentials describe CREDENTIALS_ID [flags]
1313
### Examples
1414

1515
```
16-
Get details of credentials of a MariaDB instance with ID "xxx" from instance with ID "yyy"
16+
Get details of credentials with ID "xxx" from instance with ID "yyy"
1717
$ stackit mariadb credentials describe xxx --instance-id yyy
1818
19-
Get details of credentials of a MariaDB instance with ID "xxx" from instance with ID "yyy" in a table format
19+
Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format
2020
$ stackit mariadb credentials describe xxx --instance-id yyy --output-format pretty
2121
```
2222

docs/stackit_mongodbflex_user_reset-password.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Resets the password of a MongoDB Flex user
44

55
### Synopsis
66

7-
Resets the password of a MongoDB Flex user. The new password is shown in the command's output.
7+
Resets the password of a MongoDB Flex user.
8+
sThe new password is visible after and cannot be retrieved later.
89

910
```
1011
stackit mongodbflex user reset-password USER_ID [flags]

docs/stackit_opensearch_credentials_describe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ stackit opensearch credentials describe CREDENTIALS_ID [flags]
1313
### Examples
1414

1515
```
16-
Get details of credentials of an OpenSearch instance with ID "xxx" from instance with ID "yyy"
16+
Get details of credentials with ID "xxx" from instance with ID "yyy"
1717
$ stackit opensearch credentials describe xxx --instance-id yyy
1818
19-
Get details of credentials of an OpenSearch instance with ID "xxx" from instance with ID "yyy" in a table format
19+
Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format
2020
$ stackit opensearch credentials describe xxx --instance-id yyy --output-format pretty
2121
```
2222

docs/stackit_postgresflex_user_reset-password.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Resets the password of a PostgreSQL Flex user
44

55
### Synopsis
66

7-
Resets the password of a PostgreSQL Flex user. The new password is returned in the response.
7+
Resets the password of a PostgreSQL Flex user.
8+
sThe new password is visible after and cannot be retrieved later.
89

910
```
1011
stackit postgresflex user reset-password USER_ID [flags]

docs/stackit_rabbitmq_credentials_describe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ stackit rabbitmq credentials describe CREDENTIALS_ID [flags]
1313
### Examples
1414

1515
```
16-
Get details of credentials of an RabbitMQ instance with ID "xxx" from instance with ID "yyy"
16+
Get details of credentials with ID "xxx" from instance with ID "yyy"
1717
$ stackit rabbitmq credentials describe xxx --instance-id yyy
1818
19-
Get details of credentials of an RabbitMQ instance with ID "xxx" from instance with ID "yyy" in a table format
19+
Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format
2020
$ stackit rabbitmq credentials describe xxx --instance-id yyy --output-format pretty
2121
```
2222

docs/stackit_redis_credentials_describe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ stackit redis credentials describe CREDENTIALS_ID [flags]
1313
### Examples
1414

1515
```
16-
Get details of credentials of a Redis instance with ID "xxx" from instance with ID "yyy"
16+
Get details of credentials with ID "xxx" from instance with ID "yyy"
1717
$ stackit redis credentials describe xxx --instance-id yyy
1818
19-
Get details of credentials of a Redis instance with ID "xxx" from instance with ID "yyy" in a table format
19+
Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format
2020
$ stackit redis credentials describe xxx --instance-id yyy --output-format pretty
2121
```
2222

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ require (
2222
github.com/zalando/go-keyring v0.2.3
2323
golang.org/x/mod v0.15.0
2424
golang.org/x/oauth2 v0.17.0
25+
golang.org/x/text v0.14.0
2526
)
2627

2728
require (
@@ -56,7 +57,6 @@ require (
5657
go.uber.org/multierr v1.11.0 // indirect
5758
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
5859
golang.org/x/sys v0.16.0 // indirect
59-
golang.org/x/text v0.14.0 // indirect
6060
google.golang.org/appengine v1.6.8 // indirect
6161
google.golang.org/protobuf v1.32.0 // indirect
6262
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect

internal/cmd/logme/credentials/describe/describe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ func NewCmd() *cobra.Command {
3838
Args: args.SingleArg(credentialsIdArg, utils.ValidateUUID),
3939
Example: examples.Build(
4040
examples.NewExample(
41-
`Get details of credentials of a LogMe instance with ID "xxx" from instance with ID "yyy"`,
41+
`Get details of credentials with ID "xxx" from instance with ID "yyy"`,
4242
"$ stackit logme credentials describe xxx --instance-id yyy"),
4343
examples.NewExample(
44-
`Get details of credentials of a LogMe instance with ID "xxx" from instance with ID "yyy" in a table format`,
44+
`Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format`,
4545
"$ stackit logme credentials describe xxx --instance-id yyy --output-format pretty"),
4646
),
4747
RunE: func(cmd *cobra.Command, args []string) error {

internal/cmd/mariadb/credentials/describe/describe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ func NewCmd() *cobra.Command {
3838
Args: args.SingleArg(credentialsIdArg, utils.ValidateUUID),
3939
Example: examples.Build(
4040
examples.NewExample(
41-
`Get details of credentials of a MariaDB instance with ID "xxx" from instance with ID "yyy"`,
41+
`Get details of credentials with ID "xxx" from instance with ID "yyy"`,
4242
"$ stackit mariadb credentials describe xxx --instance-id yyy"),
4343
examples.NewExample(
44-
`Get details of credentials of a MariaDB instance with ID "xxx" from instance with ID "yyy" in a table format`,
44+
`Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format`,
4545
"$ stackit mariadb credentials describe xxx --instance-id yyy --output-format pretty"),
4646
),
4747
RunE: func(cmd *cobra.Command, args []string) error {

internal/cmd/mongodbflex/user/reset-password/reset_password.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ func NewCmd() *cobra.Command {
3535
cmd := &cobra.Command{
3636
Use: fmt.Sprintf("reset-password %s", userIdArg),
3737
Short: "Resets the password of a MongoDB Flex user",
38-
Long: "Resets the password of a MongoDB Flex user. The new password is shown in the command's output.",
38+
Long: fmt.Sprintf("%s\ns%s",
39+
"Resets the password of a MongoDB Flex user.",
40+
"The new password is visible after and cannot be retrieved later.",
41+
),
3942
Example: examples.Build(
4043
examples.NewExample(
4144
`Reset the password of a MongoDB Flex user with ID "xxx" of instance with ID "yyy"`,

internal/cmd/opensearch/credentials/describe/describe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ func NewCmd() *cobra.Command {
3838
Args: args.SingleArg(credentialsIdArg, utils.ValidateUUID),
3939
Example: examples.Build(
4040
examples.NewExample(
41-
`Get details of credentials of an OpenSearch instance with ID "xxx" from instance with ID "yyy"`,
41+
`Get details of credentials with ID "xxx" from instance with ID "yyy"`,
4242
"$ stackit opensearch credentials describe xxx --instance-id yyy"),
4343
examples.NewExample(
44-
`Get details of credentials of an OpenSearch instance with ID "xxx" from instance with ID "yyy" in a table format`,
44+
`Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format`,
4545
"$ stackit opensearch credentials describe xxx --instance-id yyy --output-format pretty"),
4646
),
4747
RunE: func(cmd *cobra.Command, args []string) error {

internal/cmd/postgresflex/instance/describe/describe.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
postgresflexUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/postgresflex/utils"
1515
"github.com/stackitcloud/stackit-cli/internal/pkg/tables"
1616
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
17+
"golang.org/x/text/cases"
18+
"golang.org/x/text/language"
1719

1820
"github.com/spf13/cobra"
1921
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex"
@@ -103,7 +105,7 @@ func outputResult(cmd *cobra.Command, outputFormat string, instance *postgresfle
103105
table.AddSeparator()
104106
table.AddRow("NAME", *instance.Name)
105107
table.AddSeparator()
106-
table.AddRow("STATUS", *instance.Status)
108+
table.AddRow("STATUS", cases.Title(language.English).String(*instance.Status))
107109
table.AddSeparator()
108110
table.AddRow("STORAGE SIZE", *instance.Storage.Size)
109111
table.AddSeparator()

internal/cmd/postgresflex/instance/list/list.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616

1717
"github.com/spf13/cobra"
1818
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex"
19+
"golang.org/x/text/cases"
20+
"golang.org/x/text/language"
1921
)
2022

2123
const (
@@ -126,11 +128,12 @@ func outputResult(cmd *cobra.Command, outputFormat string, instances []postgresf
126128

127129
return nil
128130
default:
131+
caser := cases.Title(language.English)
129132
table := tables.NewTable()
130133
table.SetHeader("ID", "NAME", "STATUS")
131134
for i := range instances {
132135
instance := instances[i]
133-
table.AddRow(*instance.Id, *instance.Name, *instance.Status)
136+
table.AddRow(*instance.Id, *instance.Name, caser.String(*instance.Status))
134137
}
135138
err := table.Display(cmd)
136139
if err != nil {

internal/cmd/postgresflex/instance/update/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func NewCmd() *cobra.Command {
8686
}
8787

8888
if !model.AssumeYes {
89-
prompt := fmt.Sprintf("Are you sure you want to update instance %s?", instanceLabel)
89+
prompt := fmt.Sprintf("Are you sure you want to update instance %s? (This may cause downtime)", instanceLabel)
9090
err = confirm.PromptForConfirmation(cmd, prompt)
9191
if err != nil {
9292
return err

internal/cmd/postgresflex/user/reset-password/reset_password.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ func NewCmd() *cobra.Command {
3434
cmd := &cobra.Command{
3535
Use: fmt.Sprintf("reset-password %s", userIdArg),
3636
Short: "Resets the password of a PostgreSQL Flex user",
37-
Long: "Resets the password of a PostgreSQL Flex user. The new password is returned in the response.",
37+
Long: fmt.Sprintf("%s\ns%s",
38+
"Resets the password of a PostgreSQL Flex user.",
39+
"The new password is visible after and cannot be retrieved later.",
40+
),
3841
Example: examples.Build(
3942
examples.NewExample(
4043
`Reset the password of a PostgreSQL Flex user with ID "xxx" of instance with ID "yyy"`,

internal/cmd/rabbitmq/credentials/describe/describe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ func NewCmd() *cobra.Command {
3838
Args: args.SingleArg(credentialsIdArg, utils.ValidateUUID),
3939
Example: examples.Build(
4040
examples.NewExample(
41-
`Get details of credentials of an RabbitMQ instance with ID "xxx" from instance with ID "yyy"`,
41+
`Get details of credentials with ID "xxx" from instance with ID "yyy"`,
4242
"$ stackit rabbitmq credentials describe xxx --instance-id yyy"),
4343
examples.NewExample(
44-
`Get details of credentials of an RabbitMQ instance with ID "xxx" from instance with ID "yyy" in a table format`,
44+
`Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format`,
4545
"$ stackit rabbitmq credentials describe xxx --instance-id yyy --output-format pretty"),
4646
),
4747
RunE: func(cmd *cobra.Command, args []string) error {

internal/cmd/redis/credentials/describe/describe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ func NewCmd() *cobra.Command {
3838
Args: args.SingleArg(credentialsIdArg, utils.ValidateUUID),
3939
Example: examples.Build(
4040
examples.NewExample(
41-
`Get details of credentials of a Redis instance with ID "xxx" from instance with ID "yyy"`,
41+
`Get details of credentials with ID "xxx" from instance with ID "yyy"`,
4242
"$ stackit redis credentials describe xxx --instance-id yyy"),
4343
examples.NewExample(
44-
`Get details of credentials of a Redis instance with ID "xxx" from instance with ID "yyy" in a table format`,
44+
`Get details of credentials with ID "xxx" from instance with ID "yyy" in a table format`,
4545
"$ stackit redis credentials describe xxx --instance-id yyy --output-format pretty"),
4646
),
4747
RunE: func(cmd *cobra.Command, args []string) error {

0 commit comments

Comments
 (0)