Skip to content

Commit

Permalink
Merge pull request #25 from apigee/issue24
Browse files Browse the repository at this point in the history
support other built-in roles #24
  • Loading branch information
srinandan authored Jun 29, 2022
2 parents 9611a00 + 8f5f865 commit a205b5f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
10 changes: 10 additions & 0 deletions apiclient/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ func CreateIAMServiceAccount(name string, iamRole string) (err error) {
role = "roles/apigeeconnect.Agent"
case "watcher":
role = "roles/apigee.runtimeAgent"
case "admin":
role = "roles/apigee.admin"
case "readonly-admin":
role = "roles/apigee.readOnlyAdmin"
case "api-admin":
role = "roles/apigee.apiAdminV2"
case "dev-admin":
role = "roles/apigee.developerAdmin"
case "env-admin":
role = "roles/apigee.environmentAdmin"
case "all":
role = "not-necessary-to-add-this"
default:
Expand Down
3 changes: 2 additions & 1 deletion cmd/iam/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package iam

import (
"fmt"
"strings"

"github.com/apigee/apigeecli/apiclient"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -53,7 +54,7 @@ func init() {
CallCmd.Flags().BoolVarP(&generateName, "gen", "g",
false, "Generate account name")
CallCmd.Flags().StringVarP(&roleType, "role", "r",
"", "IAM Role Type")
"", "IAM Role Type, must be one of: "+strings.Join(roles, ", "))

_ = CallCmd.MarkFlagRequired("prj")
_ = CallCmd.MarkFlagRequired("role")
Expand Down
3 changes: 2 additions & 1 deletion cmd/iam/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ var Cmd = &cobra.Command{
var name, projectID, roleType string
var generateName, wid bool

var roles = []string{"mart", "analytics", "all", "logger", "connect", "cassandra", "watcher", "sync"}
var roles = []string{"mart", "analytics", "all", "logger", "connect", "cassandra", "watcher",
"sync", "admin", "api-admin", "env-admin", "dev-admin", "readonly-admin"}

func init() {
Cmd.AddCommand(CallCmd)
Expand Down

0 comments on commit a205b5f

Please sign in to comment.