Skip to content

Commit

Permalink
Merge pull request #1031 from Scalingo/feat/1030/db_users_management_…
Browse files Browse the repository at this point in the history
…command_consistency

feat(cmd): add aliases for database user management
  • Loading branch information
curzolapierre authored Jan 24, 2024
2 parents 6845dcf + 2eecaf8 commit dc45956
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### To be Released

* feat(addons): add aliases for database user management (i.e. using format: `database-users-<action>`) ([PR#1031](https://github.com/Scalingo/cli/pull/1031))

### 1.30.0

* feat(addons): add user management commands ([PR#1019](https://github.com/Scalingo/cli/pull/1019))
Expand All @@ -11,7 +13,7 @@
* feat: add database maintenance listing with the new `database-maintenance-list` command ([PR#982](https://github.com/Scalingo/cli/pull/982))
* feat(addons): add maintenance windows manipulation with the new `addon-config` command ([PR#955](https://github.com/Scalingo/cli/pull/955))
* feat(install.sh): verify the archive checksum ([PR#988](https://github.com/Scalingo/cli/pull/988))
* feat(region): more debug logs ([PR#1007](https://github.com/Scalingo/cli/pull/1008))
* feat(region): more debug logs ([PR#1007](https://github.com/Scalingo/cli/pull/1007))
* fix(events): `link_scm` data types

### 1.29.1
Expand Down
21 changes: 12 additions & 9 deletions cmd/databases.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ var (
}

databaseListUsers = cli.Command{
Name: "database-list-users",
Name: "database-users-list",
Aliases: []string{"database-list-users"},
Category: "Addons",
Usage: "Print database's users",
Flags: []cli.Flag{&appFlag, &addonFlag},
Expand All @@ -150,7 +151,7 @@ var (
Only available on ` + fmt.Sprintf("%s", dbUsers.SupportedAddons),
Examples: []string{
"scalingo --app myapp --addon addon-uuid database-list-users",
"scalingo --app myapp --addon addon-uuid database-users-list",
},
}.Render(),

Expand All @@ -168,7 +169,8 @@ Only available on ` + fmt.Sprintf("%s", dbUsers.SupportedAddons),
}

databaseDeleteUser = cli.Command{
Name: "database-delete-user",
Name: "database-users-delete",
Aliases: []string{"database-delete-user"},
Category: "Addons",
ArgsUsage: "user",
Usage: "Delete a database's user",
Expand All @@ -178,13 +180,13 @@ Only available on ` + fmt.Sprintf("%s", dbUsers.SupportedAddons),
Only available on ` + fmt.Sprintf("%s", dbUsers.SupportedAddons),
Examples: []string{
"scalingo --app myapp --addon addon-uuid database-delete-user my_user",
"scalingo --app myapp --addon addon-uuid database-users-delete my_user",
},
}.Render(),

Action: func(c *cli.Context) error {
if c.Args().Len() != 1 {
return cli.ShowCommandHelp(c, "database-delete-user")
return cli.ShowCommandHelp(c, "database-users-delete")
}

currentApp := detect.CurrentApp(c)
Expand All @@ -202,7 +204,8 @@ Only available on ` + fmt.Sprintf("%s", dbUsers.SupportedAddons),
}

databaseCreateUser = cli.Command{
Name: "database-create-user",
Name: "database-users-create",
Aliases: []string{"database-create-user"},
Category: "Addons",
ArgsUsage: "user",
Usage: "Create new database user",
Expand All @@ -216,14 +219,14 @@ Only available on ` + fmt.Sprintf("%s", dbUsers.SupportedAddons),
Only available on ` + fmt.Sprintf("%s", dbUsers.SupportedAddons),
Examples: []string{
"scalingo --app myapp --addon addon-uuid database-create-user my_user",
"scalingo --app myapp --addon addon-uuid database-create-user --read-only my_user",
"scalingo --app myapp --addon addon-uuid database-users-create my_user",
"scalingo --app myapp --addon addon-uuid database-users-create --read-only my_user",
},
}.Render(),

Action: func(c *cli.Context) error {
if c.NArg() != 1 {
return cli.ShowCommandHelp(c, "database-create-user")
return cli.ShowCommandHelp(c, "database-users-create")
}

currentApp := detect.CurrentApp(c)
Expand Down

0 comments on commit dc45956

Please sign in to comment.