|
|
@@ -122,7 +122,7 @@ func newUserRevokeRoleCommand() *cobra.Command {
|
|
|
// userAddCommandFunc executes the "user add" command.
|
|
|
func userAddCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
if len(args) != 1 {
|
|
|
- ExitWithError(ExitBadArgs, fmt.Errorf("user add command requires user name as its argument."))
|
|
|
+ ExitWithError(ExitBadArgs, fmt.Errorf("user add command requires user name as its argument"))
|
|
|
}
|
|
|
|
|
|
var password string
|
|
|
@@ -144,7 +144,7 @@ func userAddCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
user = splitted[0]
|
|
|
password = splitted[1]
|
|
|
if len(user) == 0 {
|
|
|
- ExitWithError(ExitBadArgs, fmt.Errorf("empty user name is not allowed."))
|
|
|
+ ExitWithError(ExitBadArgs, fmt.Errorf("empty user name is not allowed"))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -160,7 +160,7 @@ func userAddCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
// userDeleteCommandFunc executes the "user delete" command.
|
|
|
func userDeleteCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
if len(args) != 1 {
|
|
|
- ExitWithError(ExitBadArgs, fmt.Errorf("user delete command requires user name as its argument."))
|
|
|
+ ExitWithError(ExitBadArgs, fmt.Errorf("user delete command requires user name as its argument"))
|
|
|
}
|
|
|
|
|
|
resp, err := mustClientFromCmd(cmd).Auth.UserDelete(context.TODO(), args[0])
|
|
|
@@ -173,7 +173,7 @@ func userDeleteCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
// userGetCommandFunc executes the "user get" command.
|
|
|
func userGetCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
if len(args) != 1 {
|
|
|
- ExitWithError(ExitBadArgs, fmt.Errorf("user get command requires user name as its argument."))
|
|
|
+ ExitWithError(ExitBadArgs, fmt.Errorf("user get command requires user name as its argument"))
|
|
|
}
|
|
|
|
|
|
name := args[0]
|
|
|
@@ -201,7 +201,7 @@ func userGetCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
// userListCommandFunc executes the "user list" command.
|
|
|
func userListCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
if len(args) != 0 {
|
|
|
- ExitWithError(ExitBadArgs, fmt.Errorf("user list command requires no arguments."))
|
|
|
+ ExitWithError(ExitBadArgs, fmt.Errorf("user list command requires no arguments"))
|
|
|
}
|
|
|
|
|
|
resp, err := mustClientFromCmd(cmd).Auth.UserList(context.TODO())
|
|
|
@@ -215,7 +215,7 @@ func userListCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
// userChangePasswordCommandFunc executes the "user passwd" command.
|
|
|
func userChangePasswordCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
if len(args) != 1 {
|
|
|
- ExitWithError(ExitBadArgs, fmt.Errorf("user passwd command requires user name as its argument."))
|
|
|
+ ExitWithError(ExitBadArgs, fmt.Errorf("user passwd command requires user name as its argument"))
|
|
|
}
|
|
|
|
|
|
var password string
|
|
|
@@ -237,7 +237,7 @@ func userChangePasswordCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
// userGrantRoleCommandFunc executes the "user grant-role" command.
|
|
|
func userGrantRoleCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
if len(args) != 2 {
|
|
|
- ExitWithError(ExitBadArgs, fmt.Errorf("user grant command requires user name and role name as its argument."))
|
|
|
+ ExitWithError(ExitBadArgs, fmt.Errorf("user grant command requires user name and role name as its argument"))
|
|
|
}
|
|
|
|
|
|
resp, err := mustClientFromCmd(cmd).Auth.UserGrantRole(context.TODO(), args[0], args[1])
|
|
|
@@ -251,7 +251,7 @@ func userGrantRoleCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
// userRevokeRoleCommandFunc executes the "user revoke-role" command.
|
|
|
func userRevokeRoleCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
if len(args) != 2 {
|
|
|
- ExitWithError(ExitBadArgs, fmt.Errorf("user revoke-role requires user name and role name as its argument."))
|
|
|
+ ExitWithError(ExitBadArgs, fmt.Errorf("user revoke-role requires user name and role name as its argument"))
|
|
|
}
|
|
|
|
|
|
resp, err := mustClientFromCmd(cmd).Auth.UserRevokeRole(context.TODO(), args[0], args[1])
|
|
|
@@ -266,7 +266,7 @@ func readPasswordInteractive(name string) string {
|
|
|
prompt1 := fmt.Sprintf("Password of %s: ", name)
|
|
|
password1, err1 := speakeasy.Ask(prompt1)
|
|
|
if err1 != nil {
|
|
|
- ExitWithError(ExitBadArgs, fmt.Errorf("failed to ask password: %s.", err1))
|
|
|
+ ExitWithError(ExitBadArgs, fmt.Errorf("failed to ask password: %s", err1))
|
|
|
}
|
|
|
|
|
|
if len(password1) == 0 {
|
|
|
@@ -276,11 +276,11 @@ func readPasswordInteractive(name string) string {
|
|
|
prompt2 := fmt.Sprintf("Type password of %s again for confirmation: ", name)
|
|
|
password2, err2 := speakeasy.Ask(prompt2)
|
|
|
if err2 != nil {
|
|
|
- ExitWithError(ExitBadArgs, fmt.Errorf("failed to ask password: %s.", err2))
|
|
|
+ ExitWithError(ExitBadArgs, fmt.Errorf("failed to ask password: %s", err2))
|
|
|
}
|
|
|
|
|
|
if password1 != password2 {
|
|
|
- ExitWithError(ExitBadArgs, fmt.Errorf("given passwords are different."))
|
|
|
+ ExitWithError(ExitBadArgs, fmt.Errorf("given passwords are different"))
|
|
|
}
|
|
|
|
|
|
return password1
|