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
@@ -12,6 +12,7 @@ func generateUserTableOutput(in *users.User) 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
@@ -28,10 +28,11 @@ func (c *Command) Synopsis() 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"},
}
func (c *Command) Help() string {
@@ -77,6 +78,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 {
@@ -112,7 +117,7 @@ func (c *Command) Run(args []string) int {
default:
switch c.FlagVersion {
case 0:
opts = append(opts, users.WithAutomaticVersioning())
opts = append(opts, users.WithAutomaticVersioning(true))
default:
version = uint32(c.FlagVersion)
}
@@ -125,7 +130,7 @@ func (c *Command) Run(args []string) int {
switch c.Func {
case "create":
user, apiErr, err = userClient.Create(c.Context, opts...)
user, apiErr, err = userClient.Create(c.Context, c.FlagScopeId, opts...)
case "update":
user, apiErr, err = userClient.Update(c.Context, c.FlagId, version, opts...)
case "read":
@@ -133,7 +138,7 @@ func (c *Command) Run(args []string) int {
case "delete":
existed, apiErr, err = userClient.Delete(c.Context, c.FlagId, opts...)
case "list":
listedUsers, apiErr, err = userClient.List(c.Context, opts...)
listedUsers, apiErr, err = userClient.List(c.Context, c.FlagScopeId, opts...)
}
plural := "user"