diff --git a/client/management/v3/zz_generated_principal.go b/client/management/v3/zz_generated_principal.go index d5fc8a76..907580e1 100644 --- a/client/management/v3/zz_generated_principal.go +++ b/client/management/v3/zz_generated_principal.go @@ -59,6 +59,8 @@ type PrincipalOperations interface { Update(existing *Principal, updates interface{}) (*Principal, error) ByID(id string) (*Principal, error) Delete(container *Principal) error + + ActionSearch(resource *Principal, input *SearchPrincipalsInput) (*PrincipalCollection, error) } func newPrincipalClient(apiClient *Client) *PrincipalClient { @@ -105,3 +107,10 @@ func (c *PrincipalClient) ByID(id string) (*Principal, error) { func (c *PrincipalClient) Delete(container *Principal) error { return c.apiClient.Ops.DoResourceDelete(PrincipalType, &container.Resource) } + +func (c *PrincipalClient) ActionSearch(resource *Principal, input *SearchPrincipalsInput) (*PrincipalCollection, error) { + resp := &PrincipalCollection{} + err := c.apiClient.Ops.DoAction(PrincipalType, "search", &resource.Resource, input, resp) + return resp, err + +} diff --git a/vendor.conf b/vendor.conf index 267b407b..5a7b0a74 100644 --- a/vendor.conf +++ b/vendor.conf @@ -5,4 +5,4 @@ k8s.io/kubernetes v1.8.3 bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5 -github.com/rancher/norman d20a37adbef4e306cb354ad643b2c2d9b1d8a403 +github.com/rancher/norman 9f2b71df502fc476603eed99d137593d4a879f53 diff --git a/vendor/github.com/rancher/norman/generator/funcs.go b/vendor/github.com/rancher/norman/generator/funcs.go index 274b43b7..4d191c76 100644 --- a/vendor/github.com/rancher/norman/generator/funcs.go +++ b/vendor/github.com/rancher/norman/generator/funcs.go @@ -11,12 +11,13 @@ import ( func funcs() template.FuncMap { return template.FuncMap{ - "capitalize": convert.Capitalize, - "unCapitalize": convert.Uncapitalize, - "upper": strings.ToUpper, - "toLower": strings.ToLower, - "hasGet": hasGet, - "hasPost": hasPost, + "capitalize": convert.Capitalize, + "unCapitalize": convert.Uncapitalize, + "upper": strings.ToUpper, + "toLower": strings.ToLower, + "hasGet": hasGet, + "hasPost": hasPost, + "getCollectionOutput": getCollectionOutput, } } @@ -40,3 +41,10 @@ func contains(list []string, needle string) bool { } return false } + +func getCollectionOutput(output, codeName string) string { + if output == "collection" { + return codeName + "Collection" + } + return convert.Capitalize(output) +} diff --git a/vendor/github.com/rancher/norman/generator/generator.go b/vendor/github.com/rancher/norman/generator/generator.go index 6de26646..5c6b5436 100644 --- a/vendor/github.com/rancher/norman/generator/generator.go +++ b/vendor/github.com/rancher/norman/generator/generator.go @@ -126,7 +126,10 @@ func getCollectionActions(schema *types.Schema, schemas *types.Schemas) map[stri result := map[string]types.Action{} for name, action := range schema.CollectionActions { if action.Output != "" { - output := strings.TrimSuffix(action.Output, "Collection") + output := action.Output + if action.Output == "collection" { + output = strings.ToLower(schema.CodeName) + } if schemas.Schema(&schema.Version, output) != nil { result[name] = action } diff --git a/vendor/github.com/rancher/norman/generator/type_template.go b/vendor/github.com/rancher/norman/generator/type_template.go index b5a887df..b0098671 100644 --- a/vendor/github.com/rancher/norman/generator/type_template.go +++ b/vendor/github.com/rancher/norman/generator/type_template.go @@ -53,11 +53,11 @@ type {{.schema.CodeName}}Operations interface { {{if (and (eq $value.Input "") (eq $value.Output ""))}} Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}) (error) {{else if (and (eq $value.Input "") (ne $value.Output ""))}} - Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}) (*{{.Output | capitalize}}, error) + Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error) {{else if (and (ne $value.Input "") (eq $value.Output ""))}} Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}, input *{{$value.Input | capitalize}}) (error) {{else}} - Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}, input *{{$value.Input | capitalize}}) (*{{.Output | capitalize}}, error) + Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}, input *{{$value.Input | capitalize}}) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error) {{end}} {{end}} } @@ -129,8 +129,8 @@ func (c *{{.schema.CodeName}}Client) Delete(container *{{.schema.CodeName}}) err err := c.apiClient.Ops.DoAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Resource, nil, nil) return err {{else if (and (eq $value.Input "") (ne $value.Output ""))}} - func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}) (*{{.Output | capitalize}}, error) { - resp := &{{.Output | capitalize}}{} + func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error) { + resp := &{{getCollectionOutput $value.Output $.schema.CodeName}}{} err := c.apiClient.Ops.DoAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Resource, nil, resp) return resp, err {{else if (and (ne $value.Input "") (eq $value.Output ""))}} @@ -138,8 +138,8 @@ func (c *{{.schema.CodeName}}Client) Delete(container *{{.schema.CodeName}}) err err := c.apiClient.Ops.DoAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Resource, input, nil) return err {{else}} - func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}, input *{{$value.Input | capitalize}}) (*{{.Output | capitalize}}, error) { - resp := &{{.Output | capitalize}}{} + func (c *{{$.schema.CodeName}}Client) Action{{$key | capitalize}} (resource *{{$.schema.CodeName}}, input *{{$value.Input | capitalize}}) (*{{getCollectionOutput $value.Output $.schema.CodeName}}, error) { + resp := &{{getCollectionOutput $value.Output $.schema.CodeName}}{} err := c.apiClient.Ops.DoAction({{$.schema.CodeName}}Type, "{{$key}}", &resource.Resource, input, resp) return resp, err {{end}} diff --git a/vendor/github.com/rancher/norman/lifecycle/object.go b/vendor/github.com/rancher/norman/lifecycle/object.go index dae128e5..725bd7d6 100644 --- a/vendor/github.com/rancher/norman/lifecycle/object.go +++ b/vendor/github.com/rancher/norman/lifecycle/object.go @@ -1,6 +1,7 @@ package lifecycle import ( + "fmt" "reflect" "github.com/rancher/norman/clientbase" @@ -92,15 +93,10 @@ func (o *objectLifecycleAdapter) finalize(metadata metav1.Object, obj runtime.Ob copyObj = newObj } - if err := removeFinalizer(o.constructFinalizerKey(), copyObj); err != nil { - return false, err - } - - _, err := o.objectClient.Update(metadata.GetName(), copyObj) - return false, err + return false, o.removeFinalizer(o.constructFinalizerKey(), copyObj) } -func removeFinalizer(name string, obj runtime.Object) error { +func (o *objectLifecycleAdapter) removeFinalizer(name string, obj runtime.Object) error { metadata, err := meta.Accessor(obj) if err != nil { return err @@ -115,7 +111,26 @@ func removeFinalizer(name string, obj runtime.Object) error { } metadata.SetFinalizers(finalizers) - return nil + for i := 0; i < 3; i++ { + _, err := o.objectClient.Update(metadata.GetName(), obj) + if err == nil { + return nil + } + + obj, err = o.objectClient.GetNamespaced(metadata.GetNamespace(), metadata.GetName(), metav1.GetOptions{}) + if err != nil { + return err + } + + metadata, err := meta.Accessor(obj) + if err != nil { + return err + } + + metadata.SetFinalizers(finalizers) + } + + return fmt.Errorf("failed to remove finalizer on %s:%s", metadata.GetNamespace(), metadata.GetName()) } func (o *objectLifecycleAdapter) createKey() string {