Generate new version of SDK resources and Add Tests (#331)

This commit is contained in:
Todd Knight authored and GitHub committed 2020-09-08 16:27:51 -04:00
1 parent 96e4b1cdba
commit c3ecea172d
93 files changed
+3414 -2826

No files matched your search

+1
View File
@@ -75,6 +75,7 @@ func generateGroupTableOutput(in *groups.Group) string {
nonAttributeMap := map[string]interface{}{
"ID": in.Id,
"Scope ID": in.Scope.Id,
"Version": in.Version,
"Created Time": in.CreatedTime.Local().Format(time.RFC3339),
"Updated Time": in.UpdatedTime.Local().Format(time.RFC3339),
+9 -4
View File
@@ -43,10 +43,11 @@ var helpMap = func() map[string]func() string {
}
var flagsMap = map[string][]string{
"create": {"name", "description"},
"create": {"scope-id", "name", "description"},
"update": {"id", "name", "description", "version"},
"read": {"id"},
"delete": {"id"},
"list": {"scope-id"},
"add-members": {"id", "member", "version"},
"set-members": {"id", "member", "version"},
"remove-members": {"id", "member", "version"},
@@ -95,6 +96,10 @@ func (c *Command) Run(args []string) int {
c.UI.Error("ID is required but not passed in via -id")
return 1
}
if strutil.StrListContains(flagsMap[c.Func], "scope-id") && c.FlagScopeId == "" {
c.UI.Error("Scope ID must be passed in via -scope-id")
return 1
}
client, err := c.Client()
if err != nil {
@@ -151,7 +156,7 @@ func (c *Command) Run(args []string) int {
default:
switch c.FlagVersion {
case 0:
opts = append(opts, groups.WithAutomaticVersioning())
opts = append(opts, groups.WithAutomaticVersioning(true))
default:
version = uint32(c.FlagVersion)
}
@@ -164,7 +169,7 @@ func (c *Command) Run(args []string) int {
switch c.Func {
case "create":
group, apiErr, err = groupClient.Create(c.Context, opts...)
group, apiErr, err = groupClient.Create(c.Context, c.FlagScopeId, opts...)
case "update":
group, apiErr, err = groupClient.Update(c.Context, c.FlagId, version, opts...)
case "read":
@@ -172,7 +177,7 @@ func (c *Command) Run(args []string) int {
case "delete":
existed, apiErr, err = groupClient.Delete(c.Context, c.FlagId, opts...)
case "list":
listedGroups, apiErr, err = groupClient.List(c.Context, opts...)
listedGroups, apiErr, err = groupClient.List(c.Context, c.FlagScopeId, opts...)
case "add-members":
group, apiErr, err = groupClient.AddMembers(c.Context, c.FlagId, version, members, opts...)
case "set-members":