Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cmd): add aliases for database user management #1031

Merged
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
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