Skip to content

Commit f6e7263

Browse files
authored
Onboard Secrets Manager (user): remove option to hide password in create command (#128)
* removed option to hide password in create command * update create command examples * update examples
1 parent 73d7542 commit f6e7263

File tree

7 files changed

+18
-33
lines changed

7 files changed

+18
-33
lines changed

docs/stackit_object-storage_credentials_create.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Creates credentials for an Object Storage credentials group
44

55
### Synopsis
66

7-
Creates credentials for an Object Storage credentials group. The credentials are only displayed upon creation, and it will not be retrievable later.
7+
Creates credentials for an Object Storage credentials group. The credentials are only displayed upon creation, and will not be retrievable later.
88

99
```
1010
stackit object-storage credentials create [flags]
@@ -13,10 +13,10 @@ stackit object-storage credentials create [flags]
1313
### Examples
1414

1515
```
16-
Create credentials for a credentials group with ID xxx
16+
Create credentials for a credentials group with ID "xxx"
1717
$ stackit object-storage credentials create --credentials-group-id xxx
1818
19-
Create credentials for a credentials group with ID xxx, including a specific expiration date
19+
Create credentials for a credentials group with ID "xxx", including a specific expiration date
2020
$ stackit object-storage credentials create --credentials-group-id xxx --expire-date 2024-03-06T00:00:00.000Z
2121
```
2222

docs/stackit_secrets-manager_user_create.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Creates a Secrets Manager user
55
### Synopsis
66

77
Creates a Secrets Manager user.
8-
The username and password are auto-generated and provided upon creation.
8+
The username and password are auto-generated and provided upon creation. The password cannot be retrieved later.
99
A description can be provided to identify a user.
1010

1111
```
@@ -18,9 +18,6 @@ stackit secrets-manager user create [flags]
1818
Create a Secrets Manager user for instance with ID "xxx" and description "yyy"
1919
$ stackit secrets-manager user create --instance-id xxx --description yyy
2020
21-
Create a Secrets Manager user for instance with ID "xxx" and hides the generated password
22-
$ stackit secrets-manager user create --instance-id xxx --hide-password
23-
2421
Create a Secrets Manager user for instance with ID "xxx" with write access to the secrets engine
2522
$ stackit secrets-manager user create --instance-id xxx --write
2623
```
@@ -30,7 +27,6 @@ stackit secrets-manager user create [flags]
3027
```
3128
--description string A user chosen description to differentiate between multiple users
3229
-h, --help Help for "stackit secrets-manager user create"
33-
--hide-password Hide password in output
3430
--instance-id string ID of the instance
3531
--write User write access to the secrets engine. If unset, user is read-only
3632
```

docs/stackit_secrets-manager_user_delete.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Deletes a Secrets Manager user
55
### Synopsis
66

77
Deletes a Secrets Manager user by ID. You can get the IDs of users for an instance by running:
8-
$ stackit secrets-manager user list --instance-id <INSTANCE_ID>
8+
$ stackit secrets-manager user delete --instance-id <INSTANCE_ID>
99

1010
```
1111
stackit secrets-manager user delete USER_ID [flags]

docs/stackit_secrets-manager_user_describe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ stackit secrets-manager user describe USER_ID [flags]
1414

1515
```
1616
Get details of a Secrets Manager user with ID "xxx" of instance with ID "yyy"
17-
$ stackit secrets-manager user list xxx --instance-id yyy
17+
$ stackit secrets-manager user describe xxx --instance-id yyy
1818
1919
Get details of a Secrets Manager user with ID "xxx" of instance with ID "yyy" in table format
20-
$ stackit secrets-manager user list xxx --instance-id yyy --output-format pretty
20+
$ stackit secrets-manager user describe xxx --instance-id yyy --output-format pretty
2121
```
2222

2323
### Options

internal/cmd/secrets-manager/user/create/create.go

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,17 @@ import (
1919
)
2020

2121
const (
22-
instanceIdFlag = "instance-id"
23-
descriptionFlag = "description"
24-
writeFlag = "write"
25-
hidePasswordFlag = "hide-password"
22+
instanceIdFlag = "instance-id"
23+
descriptionFlag = "description"
24+
writeFlag = "write"
2625
)
2726

2827
type inputModel struct {
2928
*globalflags.GlobalFlagModel
3029

31-
InstanceId string
32-
Description *string
33-
Write *bool
34-
HidePassword bool
30+
InstanceId string
31+
Description *string
32+
Write *bool
3533
}
3634

3735
func NewCmd() *cobra.Command {
@@ -40,16 +38,13 @@ func NewCmd() *cobra.Command {
4038
Short: "Creates a Secrets Manager user",
4139
Long: fmt.Sprintf("%s\n%s\n%s",
4240
"Creates a Secrets Manager user.",
43-
"The username and password are auto-generated and provided upon creation.",
41+
"The username and password are auto-generated and provided upon creation. The password cannot be retrieved later.",
4442
"A description can be provided to identify a user.",
4543
),
4644
Example: examples.Build(
4745
examples.NewExample(
4846
`Create a Secrets Manager user for instance with ID "xxx" and description "yyy"`,
4947
"$ stackit secrets-manager user create --instance-id xxx --description yyy"),
50-
examples.NewExample(
51-
`Create a Secrets Manager user for instance with ID "xxx" and hides the generated password`,
52-
"$ stackit secrets-manager user create --instance-id xxx --hide-password"),
5348
examples.NewExample(
5449
`Create a Secrets Manager user for instance with ID "xxx" with write access to the secrets engine`,
5550
"$ stackit secrets-manager user create --instance-id xxx --write"),
@@ -90,11 +85,7 @@ func NewCmd() *cobra.Command {
9085

9186
cmd.Printf("Created user for instance %q. User ID: %s\n\n", instanceLabel, *resp.Id)
9287
cmd.Printf("Username: %s\n", *resp.Username)
93-
if model.HidePassword {
94-
cmd.Printf("Password: <hidden>\n")
95-
} else {
96-
cmd.Printf("Password: %s\n", *resp.Password)
97-
}
88+
cmd.Printf("Password: %s\n", *resp.Password)
9889
cmd.Printf("Description: %s\n", *resp.Description)
9990
cmd.Printf("Write Access: %t\n", *resp.Write)
10091

@@ -110,7 +101,6 @@ func configureFlags(cmd *cobra.Command) {
110101
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the instance")
111102
cmd.Flags().String(descriptionFlag, "", "A user chosen description to differentiate between multiple users")
112103
cmd.Flags().Bool(writeFlag, false, "User write access to the secrets engine. If unset, user is read-only")
113-
cmd.Flags().Bool(hidePasswordFlag, false, "Hide password in output")
114104

115105
err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
116106
cobra.CheckErr(err)
@@ -127,7 +117,6 @@ func parseInput(cmd *cobra.Command) (*inputModel, error) {
127117
InstanceId: flags.FlagToStringValue(cmd, instanceIdFlag),
128118
Description: utils.Ptr(flags.FlagToStringValue(cmd, descriptionFlag)),
129119
Write: utils.Ptr(flags.FlagToBoolValue(cmd, writeFlag)),
130-
HidePassword: flags.FlagToBoolValue(cmd, hidePasswordFlag),
131120
}, nil
132121
}
133122

internal/cmd/secrets-manager/user/delete/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func NewCmd() *cobra.Command {
3737
Short: "Deletes a Secrets Manager user",
3838
Long: fmt.Sprintf("%s\n%s",
3939
"Deletes a Secrets Manager user by ID. You can get the IDs of users for an instance by running:",
40-
" $ stackit secrets-manager user list --instance-id <INSTANCE_ID>",
40+
" $ stackit secrets-manager user delete --instance-id <INSTANCE_ID>",
4141
),
4242
Example: examples.Build(
4343
examples.NewExample(

internal/cmd/secrets-manager/user/describe/describe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ func NewCmd() *cobra.Command {
3939
Example: examples.Build(
4040
examples.NewExample(
4141
`Get details of a Secrets Manager user with ID "xxx" of instance with ID "yyy"`,
42-
"$ stackit secrets-manager user list xxx --instance-id yyy"),
42+
"$ stackit secrets-manager user describe xxx --instance-id yyy"),
4343
examples.NewExample(
4444
`Get details of a Secrets Manager user with ID "xxx" of instance with ID "yyy" in table format`,
45-
"$ stackit secrets-manager user list xxx --instance-id yyy --output-format pretty"),
45+
"$ stackit secrets-manager user describe xxx --instance-id yyy --output-format pretty"),
4646
),
4747
Args: args.SingleArg(userIdArg, utils.ValidateUUID),
4848
RunE: func(cmd *cobra.Command, args []string) error {

0 commit comments

Comments
 (0)