Skip to content

Commit

Permalink
Make role name an argument to create command
Browse files Browse the repository at this point in the history
  • Loading branch information
kobajagi committed Nov 23, 2023
1 parent 7985907 commit 6bf20a3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd/iam_role_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"encoding/json"
"errors"
"fmt"
"io"
"strings"
Expand All @@ -20,10 +21,10 @@ type iamRoleCreateCmd struct {

_ bool `cli-cmd:"create"`

Name string `cli-flag:"name" cli-usage:"Role name (required)"`
Name string `cli-arg:"#" cli-usage:"NAME"`
Description string `cli-flag:"description" cli-usage:"Role description"`
Permissions []string `cli-flag:"permissions" cli-usage:"Role permissions"`
Editable bool `cli-flag:"editable" cli-usage:"Sets if the Role Policy is editable or not (default: true). This setting cannot be changed after creation"`
Editable bool `cli-flag:"editable" cli-usage:"Set --editable=false do prevent editing Policy after creation"`
Labels map[string]string `cli-flag:"label" cli-usage:"Role labels (format: key=value)"`
Policy string `cli-flag:"policy" cli-usage:"Role policy (use '-' to read from STDIN)"`
}
Expand Down Expand Up @@ -51,6 +52,10 @@ func (c *iamRoleCreateCmd) cmdPreRun(cmd *cobra.Command, args []string) error {
}

func (c *iamRoleCreateCmd) cmdRun(cmd *cobra.Command, _ []string) error {
if c.Name == "" {
return errors.New("NAME not provided")
}

zone := account.CurrentAccount.DefaultZone
ctx := exoapi.WithEndpoint(
gContext,
Expand Down

0 comments on commit 6bf20a3

Please sign in to comment.