Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/stackit_object-storage_credentials_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Creates credentials for an Object Storage credentials group

### Synopsis

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

```
stackit object-storage credentials create [flags]
Expand All @@ -13,10 +13,10 @@ stackit object-storage credentials create [flags]
### Examples

```
Create credentials for a credentials group with ID xxx
Create credentials for a credentials group with ID "xxx"
$ stackit object-storage credentials create --credentials-group-id xxx

Create credentials for a credentials group with ID xxx, including a specific expiration date
Create credentials for a credentials group with ID "xxx", including a specific expiration date
$ stackit object-storage credentials create --credentials-group-id xxx --expire-date 2024-03-06T00:00:00.000Z
```

Expand Down
6 changes: 1 addition & 5 deletions docs/stackit_secrets-manager_user_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Creates a Secrets Manager user
### Synopsis

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

```
Expand All @@ -18,9 +18,6 @@ stackit secrets-manager user create [flags]
Create a Secrets Manager user for instance with ID "xxx" and description "yyy"
$ stackit secrets-manager user create --instance-id xxx --description yyy

Create a Secrets Manager user for instance with ID "xxx" and hides the generated password
$ stackit secrets-manager user create --instance-id xxx --hide-password

Create a Secrets Manager user for instance with ID "xxx" with write access to the secrets engine
$ stackit secrets-manager user create --instance-id xxx --write
```
Expand All @@ -30,7 +27,6 @@ stackit secrets-manager user create [flags]
```
--description string A user chosen description to differentiate between multiple users
-h, --help Help for "stackit secrets-manager user create"
--hide-password Hide password in output
--instance-id string ID of the instance
--write User write access to the secrets engine. If unset, user is read-only
```
Expand Down
2 changes: 1 addition & 1 deletion docs/stackit_secrets-manager_user_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Deletes a Secrets Manager user
### Synopsis

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

```
stackit secrets-manager user delete USER_ID [flags]
Expand Down
4 changes: 2 additions & 2 deletions docs/stackit_secrets-manager_user_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ stackit secrets-manager user describe USER_ID [flags]

```
Get details of a Secrets Manager user with ID "xxx" of instance with ID "yyy"
$ stackit secrets-manager user list xxx --instance-id yyy
$ stackit secrets-manager user describe xxx --instance-id yyy

Get details of a Secrets Manager user with ID "xxx" of instance with ID "yyy" in table format
$ stackit secrets-manager user list xxx --instance-id yyy --output-format pretty
$ stackit secrets-manager user describe xxx --instance-id yyy --output-format pretty
```

### Options
Expand Down
27 changes: 8 additions & 19 deletions internal/cmd/secrets-manager/user/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@ import (
)

const (
instanceIdFlag = "instance-id"
descriptionFlag = "description"
writeFlag = "write"
hidePasswordFlag = "hide-password"
instanceIdFlag = "instance-id"
descriptionFlag = "description"
writeFlag = "write"
)

type inputModel struct {
*globalflags.GlobalFlagModel

InstanceId string
Description *string
Write *bool
HidePassword bool
InstanceId string
Description *string
Write *bool
}

func NewCmd() *cobra.Command {
Expand All @@ -40,16 +38,13 @@ func NewCmd() *cobra.Command {
Short: "Creates a Secrets Manager user",
Long: fmt.Sprintf("%s\n%s\n%s",
"Creates a Secrets Manager user.",
"The username and password are auto-generated and provided upon creation.",
"The username and password are auto-generated and provided upon creation. The password cannot be retrieved later.",
"A description can be provided to identify a user.",
),
Example: examples.Build(
examples.NewExample(
`Create a Secrets Manager user for instance with ID "xxx" and description "yyy"`,
"$ stackit secrets-manager user create --instance-id xxx --description yyy"),
examples.NewExample(
`Create a Secrets Manager user for instance with ID "xxx" and hides the generated password`,
"$ stackit secrets-manager user create --instance-id xxx --hide-password"),
examples.NewExample(
`Create a Secrets Manager user for instance with ID "xxx" with write access to the secrets engine`,
"$ stackit secrets-manager user create --instance-id xxx --write"),
Expand Down Expand Up @@ -90,11 +85,7 @@ func NewCmd() *cobra.Command {

cmd.Printf("Created user for instance %q. User ID: %s\n\n", instanceLabel, *resp.Id)
cmd.Printf("Username: %s\n", *resp.Username)
if model.HidePassword {
cmd.Printf("Password: <hidden>\n")
} else {
cmd.Printf("Password: %s\n", *resp.Password)
}
cmd.Printf("Password: %s\n", *resp.Password)
cmd.Printf("Description: %s\n", *resp.Description)
cmd.Printf("Write Access: %t\n", *resp.Write)

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

err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
cobra.CheckErr(err)
Expand All @@ -127,7 +117,6 @@ func parseInput(cmd *cobra.Command) (*inputModel, error) {
InstanceId: flags.FlagToStringValue(cmd, instanceIdFlag),
Description: utils.Ptr(flags.FlagToStringValue(cmd, descriptionFlag)),
Write: utils.Ptr(flags.FlagToBoolValue(cmd, writeFlag)),
HidePassword: flags.FlagToBoolValue(cmd, hidePasswordFlag),
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/secrets-manager/user/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewCmd() *cobra.Command {
Short: "Deletes a Secrets Manager user",
Long: fmt.Sprintf("%s\n%s",
"Deletes a Secrets Manager user by ID. You can get the IDs of users for an instance by running:",
" $ stackit secrets-manager user list --instance-id <INSTANCE_ID>",
" $ stackit secrets-manager user delete --instance-id <INSTANCE_ID>",
),
Example: examples.Build(
examples.NewExample(
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/secrets-manager/user/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ func NewCmd() *cobra.Command {
Example: examples.Build(
examples.NewExample(
`Get details of a Secrets Manager user with ID "xxx" of instance with ID "yyy"`,
"$ stackit secrets-manager user list xxx --instance-id yyy"),
"$ stackit secrets-manager user describe xxx --instance-id yyy"),
examples.NewExample(
`Get details of a Secrets Manager user with ID "xxx" of instance with ID "yyy" in table format`,
"$ stackit secrets-manager user list xxx --instance-id yyy --output-format pretty"),
"$ stackit secrets-manager user describe xxx --instance-id yyy --output-format pretty"),
),
Args: args.SingleArg(userIdArg, utils.ValidateUUID),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down