api: remove deprecated grant_scope_id field (#4886)

* api: remove deprecated grant_scope_id field

The grant_scope_id field was deprecated in 0.15.0, so we can remove
it for 0.17.0.

* Fix tests

* Fix more tests

* Remove an option and some related code that stuck around

* Fix bats tests

---------

Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
This commit is contained in:
Johan Brandhorst-SatzkornandJeff Mitchell authored and GitHub committed 2024-06-17 12:09:33 -07:00
1 parent d547e0d459
commit c6f3c375f3
21 files changed
+107 -297

No files matched your search

-19
View File
@@ -32,8 +32,6 @@ type extraCmdVars struct {
func extraActionsFlagsMapFuncImpl() map[string][]string {
return map[string][]string{
"create": {"grant-scope-id"},
"update": {"grant-scope-id"},
"add-principals": {"id", "principal", "version"},
"set-principals": {"id", "principal", "version"},
"remove-principals": {"id", "principal", "version"},
@@ -207,20 +205,6 @@ func extraFlagsFuncImpl(c *Command, _ *base.FlagSets, f *base.FlagSet) {
func extraFlagsHandlingFuncImpl(c *Command, _ *base.FlagSets, opts *[]roles.Option) bool {
switch c.Func {
case "create", "update":
switch len(c.flagGrantScopeIds) {
case 0:
case 1:
if c.flagGrantScopeIds[0] == "null" {
*opts = append(*opts, roles.DefaultGrantScopeId())
} else {
*opts = append(*opts, roles.WithGrantScopeId(c.flagGrantScopeIds[0]))
}
default:
c.UI.Error("-grant-scope-id cannot be specified multiple times when using the deprecated create/update grant_scope_id mechanism")
return false
}
case "add-principals", "remove-principals":
if len(c.flagPrincipals) == 0 {
c.UI.Error("No principals supplied via -principal")
@@ -427,9 +411,6 @@ func printItemTable(item *roles.Role, resp *api.Response) string {
if item.Description != "" {
nonAttributeMap["Description"] = item.Description
}
if item.GrantScopeId != "" {
nonAttributeMap["Grant Scope ID"] = item.GrantScopeId
}
maxLength := base.MaxAttributesLength(nonAttributeMap, nil, nil)