From 446c7ae47b63bc50b51e765e6ca330cc082e6c1d Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Mon, 11 Dec 2017 22:09:01 -0800 Subject: [PATCH] Changes to authn types --- apis/management.cattle.io/v3/authn_types.go | 67 ++++-- apis/management.cattle.io/v3/schema/schema.go | 5 +- .../v3/zz_generated_deepcopy.go | 185 +++++++++++++++++ ..._generated_github_credential_controller.go | 193 ++++++++++++++++++ ...ted_github_credential_lifecycle_adapter.go | 39 ++++ .../v3/zz_generated_k8s_client.go | 48 +++++ ...z_generated_local_credential_controller.go | 193 ++++++++++++++++++ ...ated_local_credential_lifecycle_adapter.go | 39 ++++ .../v3/zz_generated_login_input_controller.go | 193 ++++++++++++++++++ ...generated_login_input_lifecycle_adapter.go | 39 ++++ client/management/v3/zz_generated_client.go | 6 + .../v3/zz_generated_github_credential.go | 95 +++++++++ client/management/v3/zz_generated_group.go | 6 - .../v3/zz_generated_group_member.go | 46 ++--- client/management/v3/zz_generated_identity.go | 6 +- .../v3/zz_generated_local_credential.go | 97 +++++++++ .../management/v3/zz_generated_login_input.go | 105 ++++++++++ client/management/v3/zz_generated_token.go | 78 +++---- client/management/v3/zz_generated_user.go | 8 +- 19 files changed, 1347 insertions(+), 101 deletions(-) create mode 100644 apis/management.cattle.io/v3/zz_generated_github_credential_controller.go create mode 100644 apis/management.cattle.io/v3/zz_generated_github_credential_lifecycle_adapter.go create mode 100644 apis/management.cattle.io/v3/zz_generated_local_credential_controller.go create mode 100644 apis/management.cattle.io/v3/zz_generated_local_credential_lifecycle_adapter.go create mode 100644 apis/management.cattle.io/v3/zz_generated_login_input_controller.go create mode 100644 apis/management.cattle.io/v3/zz_generated_login_input_lifecycle_adapter.go create mode 100644 client/management/v3/zz_generated_github_credential.go create mode 100644 client/management/v3/zz_generated_local_credential.go create mode 100644 client/management/v3/zz_generated_login_input.go diff --git a/apis/management.cattle.io/v3/authn_types.go b/apis/management.cattle.io/v3/authn_types.go index fafcbab3..859f79f7 100644 --- a/apis/management.cattle.io/v3/authn_types.go +++ b/apis/management.cattle.io/v3/authn_types.go @@ -8,52 +8,45 @@ type Token struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - TokenID string `json:"tokenID,omitempty"` - TokenValue string `json:"tokenValue,omitempty"` - User string `json:"user,omitempty"` - ExternalID string `json:"externalID,omitempty"` - AuthProvider string `json:"authProvider,omitempty"` - TTLMillis string `json:"ttl,omitempty"` - RefreshTTLMillis string `json:"refreshTTL,omitempty"` - LastUpdateTime string `json:"lastUpdateTime,omitempty"` - IsDerived bool `json:"isDerived,omitempty"` - Description string `json:"description,omitempty"` + TokenID string `json:"tokenId,omitempty"` + TokenValue string `json:"tokenValue,omitempty"` + User string `json:"user,omitempty"` + ExternalID string `json:"externalId,omitempty"` + AuthProvider string `json:"authProvider,omitempty"` + TTLMillis string `json:"ttl,omitempty"` + IdentityRefreshTTLMillis string `json:"identityRefreshTTL,omitempty"` + LastUpdateTime string `json:"lastUpdateTime,omitempty"` + IsDerived bool `json:"isDerived,omitempty"` + Description string `json:"description,omitempty"` } type User struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - UserName string `json:"userName,omitempty"` - Secret string `json:"secret,omitempty"` - DisplayName string `json:"displayName,omitempty"` - ExternalID string `json:"externalID,omitempty"` + Secret string `json:"secret,omitempty"` + ExternalID string `json:"externalId,omitempty"` } type Group struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - - GroupName string `json:"groupName,omitempty"` - DisplayName string `json:"displayName,omitempty"` - ExternalID string `json:"externalID,omitempty"` } type GroupMember struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - GroupExternalID string `json:"groupExternalID,omitempty"` - MemberExternalID string `json:"memberExternalID,omitempty"` + GroupName string `json:"groupName,omitempty" norman:"type=reference[/v3/schemas/group]"` + ExternalID string `json:"externalId,omitempty"` } type Identity struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - ExternalID string `json:"externalID,omitempty"` DisplayName string `json:"displayName,omitempty"` - IdentityName string `json:"identityName,omitempty"` + LoginName string `json:"loginName,omitempty"` ProfilePicture string `json:"profilePicture,omitempty"` ProfileURL string `json:"profileURL,omitempty"` Kind string `json:"kind,omitempty"` @@ -61,3 +54,33 @@ type Identity struct { MemberOf bool `json:"memberOf,omitempty"` ExtraInfo map[string]string `json:"extraInfo,omitempty"` } + +//LoginInput structure defines all properties that can be sent by client to create a token +type LoginInput struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + TTLMillis string `json:"ttl,omitempty"` + IdentityRefreshTTLMillis string `json:"identityRefreshTTL,omitempty"` + Description string `json:"description,omitempty"` + ResponseType string `json:"responseType,omitempty"` //json or cookie + LocalCredential LocalCredential `json:"localCredential, omitempty"` + GithubCredential GithubCredential `json:"githubCredential, omitempty"` +} + +//LocalCredential stores the local auth creds +type LocalCredential struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Username string `json:"username"` + Password string `json:"password"` +} + +//GithubCredential stores the github auth creds +type GithubCredential struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Code string `json:"code"` +} diff --git a/apis/management.cattle.io/v3/schema/schema.go b/apis/management.cattle.io/v3/schema/schema.go index 12225f81..653db68e 100644 --- a/apis/management.cattle.io/v3/schema/schema.go +++ b/apis/management.cattle.io/v3/schema/schema.go @@ -126,5 +126,8 @@ func authnTypes(schemas *types.Schemas) *types.Schemas { MustImport(&Version, v3.User{}). MustImport(&Version, v3.Group{}). MustImport(&Version, v3.GroupMember{}). - MustImport(&Version, v3.Identity{}) + MustImport(&Version, v3.Identity{}). + MustImport(&Version, v3.LoginInput{}). + MustImport(&Version, v3.LocalCredential{}). + MustImport(&Version, v3.GithubCredential{}) } diff --git a/apis/management.cattle.io/v3/zz_generated_deepcopy.go b/apis/management.cattle.io/v3/zz_generated_deepcopy.go index 20f3d3a5..c1f83e55 100644 --- a/apis/management.cattle.io/v3/zz_generated_deepcopy.go +++ b/apis/management.cattle.io/v3/zz_generated_deepcopy.go @@ -785,6 +785,67 @@ func (in *Filter) DeepCopy() *Filter { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GithubCredential) DeepCopyInto(out *GithubCredential) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GithubCredential. +func (in *GithubCredential) DeepCopy() *GithubCredential { + if in == nil { + return nil + } + out := new(GithubCredential) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GithubCredential) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GithubCredentialList) DeepCopyInto(out *GithubCredentialList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GithubCredential, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GithubCredentialList. +func (in *GithubCredentialList) DeepCopy() *GithubCredentialList { + if in == nil { + return nil + } + out := new(GithubCredentialList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GithubCredentialList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GoogleKubernetesEngineConfig) DeepCopyInto(out *GoogleKubernetesEngineConfig) { *out = *in @@ -1094,6 +1155,130 @@ func (in *ListOpts) DeepCopy() *ListOpts { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalCredential) DeepCopyInto(out *LocalCredential) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalCredential. +func (in *LocalCredential) DeepCopy() *LocalCredential { + if in == nil { + return nil + } + out := new(LocalCredential) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LocalCredential) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalCredentialList) DeepCopyInto(out *LocalCredentialList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LocalCredential, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalCredentialList. +func (in *LocalCredentialList) DeepCopy() *LocalCredentialList { + if in == nil { + return nil + } + out := new(LocalCredentialList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LocalCredentialList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoginInput) DeepCopyInto(out *LoginInput) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.LocalCredential.DeepCopyInto(&out.LocalCredential) + in.GithubCredential.DeepCopyInto(&out.GithubCredential) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoginInput. +func (in *LoginInput) DeepCopy() *LoginInput { + if in == nil { + return nil + } + out := new(LoginInput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LoginInput) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoginInputList) DeepCopyInto(out *LoginInputList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LoginInput, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoginInputList. +func (in *LoginInputList) DeepCopy() *LoginInputList { + if in == nil { + return nil + } + out := new(LoginInputList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LoginInputList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Machine) DeepCopyInto(out *Machine) { *out = *in diff --git a/apis/management.cattle.io/v3/zz_generated_github_credential_controller.go b/apis/management.cattle.io/v3/zz_generated_github_credential_controller.go new file mode 100644 index 00000000..c3453717 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_github_credential_controller.go @@ -0,0 +1,193 @@ +package v3 + +import ( + "context" + + "github.com/rancher/norman/clientbase" + "github.com/rancher/norman/controller" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + GithubCredentialGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "GithubCredential", + } + GithubCredentialResource = metav1.APIResource{ + Name: "githubcredentials", + SingularName: "githubcredential", + Namespaced: false, + Kind: GithubCredentialGroupVersionKind.Kind, + } +) + +type GithubCredentialList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []GithubCredential +} + +type GithubCredentialHandlerFunc func(key string, obj *GithubCredential) error + +type GithubCredentialLister interface { + List(namespace string, selector labels.Selector) (ret []*GithubCredential, err error) + Get(namespace, name string) (*GithubCredential, error) +} + +type GithubCredentialController interface { + Informer() cache.SharedIndexInformer + Lister() GithubCredentialLister + AddHandler(handler GithubCredentialHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type GithubCredentialInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*GithubCredential) (*GithubCredential, error) + Get(name string, opts metav1.GetOptions) (*GithubCredential, error) + Update(*GithubCredential) (*GithubCredential, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*GithubCredentialList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() GithubCredentialController +} + +type githubCredentialLister struct { + controller *githubCredentialController +} + +func (l *githubCredentialLister) List(namespace string, selector labels.Selector) (ret []*GithubCredential, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*GithubCredential)) + }) + return +} + +func (l *githubCredentialLister) Get(namespace, name string) (*GithubCredential, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: GithubCredentialGroupVersionKind.Group, + Resource: "githubCredential", + }, name) + } + return obj.(*GithubCredential), nil +} + +type githubCredentialController struct { + controller.GenericController +} + +func (c *githubCredentialController) Lister() GithubCredentialLister { + return &githubCredentialLister{ + controller: c, + } +} + +func (c *githubCredentialController) AddHandler(handler GithubCredentialHandlerFunc) { + c.GenericController.AddHandler(func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + return handler(key, obj.(*GithubCredential)) + }) +} + +type githubCredentialFactory struct { +} + +func (c githubCredentialFactory) Object() runtime.Object { + return &GithubCredential{} +} + +func (c githubCredentialFactory) List() runtime.Object { + return &GithubCredentialList{} +} + +func (s *githubCredentialClient) Controller() GithubCredentialController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.githubCredentialControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(GithubCredentialGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &githubCredentialController{ + GenericController: genericController, + } + + s.client.githubCredentialControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type githubCredentialClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller GithubCredentialController +} + +func (s *githubCredentialClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *githubCredentialClient) Create(o *GithubCredential) (*GithubCredential, error) { + obj, err := s.objectClient.Create(o) + return obj.(*GithubCredential), err +} + +func (s *githubCredentialClient) Get(name string, opts metav1.GetOptions) (*GithubCredential, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*GithubCredential), err +} + +func (s *githubCredentialClient) Update(o *GithubCredential) (*GithubCredential, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*GithubCredential), err +} + +func (s *githubCredentialClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *githubCredentialClient) List(opts metav1.ListOptions) (*GithubCredentialList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*GithubCredentialList), err +} + +func (s *githubCredentialClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *githubCredentialClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/apis/management.cattle.io/v3/zz_generated_github_credential_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_github_credential_lifecycle_adapter.go new file mode 100644 index 00000000..0b6a075b --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_github_credential_lifecycle_adapter.go @@ -0,0 +1,39 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type GithubCredentialLifecycle interface { + Create(obj *GithubCredential) error + Remove(obj *GithubCredential) error + Updated(obj *GithubCredential) error +} + +type githubCredentialLifecycleAdapter struct { + lifecycle GithubCredentialLifecycle +} + +func (w *githubCredentialLifecycleAdapter) Create(obj runtime.Object) error { + return w.lifecycle.Create(obj.(*GithubCredential)) +} + +func (w *githubCredentialLifecycleAdapter) Finalize(obj runtime.Object) error { + return w.lifecycle.Remove(obj.(*GithubCredential)) +} + +func (w *githubCredentialLifecycleAdapter) Updated(obj runtime.Object) error { + return w.lifecycle.Updated(obj.(*GithubCredential)) +} + +func NewGithubCredentialLifecycleAdapter(name string, client GithubCredentialInterface, l GithubCredentialLifecycle) GithubCredentialHandlerFunc { + adapter := &githubCredentialLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *GithubCredential) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_k8s_client.go b/apis/management.cattle.io/v3/zz_generated_k8s_client.go index 9bece8c8..47c40f53 100644 --- a/apis/management.cattle.io/v3/zz_generated_k8s_client.go +++ b/apis/management.cattle.io/v3/zz_generated_k8s_client.go @@ -32,6 +32,9 @@ type Interface interface { GroupsGetter GroupMembersGetter IdentitiesGetter + LocalCredentialsGetter + GithubCredentialsGetter + LoginInputsGetter DynamicSchemasGetter } @@ -58,6 +61,9 @@ type Client struct { groupControllers map[string]GroupController groupMemberControllers map[string]GroupMemberController identityControllers map[string]IdentityController + localCredentialControllers map[string]LocalCredentialController + githubCredentialControllers map[string]GithubCredentialController + loginInputControllers map[string]LoginInputController dynamicSchemaControllers map[string]DynamicSchemaController } @@ -93,6 +99,9 @@ func NewForConfig(config rest.Config) (Interface, error) { groupControllers: map[string]GroupController{}, groupMemberControllers: map[string]GroupMemberController{}, identityControllers: map[string]IdentityController{}, + localCredentialControllers: map[string]LocalCredentialController{}, + githubCredentialControllers: map[string]GithubCredentialController{}, + loginInputControllers: map[string]LoginInputController{}, dynamicSchemaControllers: map[string]DynamicSchemaController{}, }, nil } @@ -343,6 +352,45 @@ func (c *Client) Identities(namespace string) IdentityInterface { } } +type LocalCredentialsGetter interface { + LocalCredentials(namespace string) LocalCredentialInterface +} + +func (c *Client) LocalCredentials(namespace string) LocalCredentialInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &LocalCredentialResource, LocalCredentialGroupVersionKind, localCredentialFactory{}) + return &localCredentialClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type GithubCredentialsGetter interface { + GithubCredentials(namespace string) GithubCredentialInterface +} + +func (c *Client) GithubCredentials(namespace string) GithubCredentialInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &GithubCredentialResource, GithubCredentialGroupVersionKind, githubCredentialFactory{}) + return &githubCredentialClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type LoginInputsGetter interface { + LoginInputs(namespace string) LoginInputInterface +} + +func (c *Client) LoginInputs(namespace string) LoginInputInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &LoginInputResource, LoginInputGroupVersionKind, loginInputFactory{}) + return &loginInputClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + type DynamicSchemasGetter interface { DynamicSchemas(namespace string) DynamicSchemaInterface } diff --git a/apis/management.cattle.io/v3/zz_generated_local_credential_controller.go b/apis/management.cattle.io/v3/zz_generated_local_credential_controller.go new file mode 100644 index 00000000..660599b7 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_local_credential_controller.go @@ -0,0 +1,193 @@ +package v3 + +import ( + "context" + + "github.com/rancher/norman/clientbase" + "github.com/rancher/norman/controller" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + LocalCredentialGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "LocalCredential", + } + LocalCredentialResource = metav1.APIResource{ + Name: "localcredentials", + SingularName: "localcredential", + Namespaced: false, + Kind: LocalCredentialGroupVersionKind.Kind, + } +) + +type LocalCredentialList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []LocalCredential +} + +type LocalCredentialHandlerFunc func(key string, obj *LocalCredential) error + +type LocalCredentialLister interface { + List(namespace string, selector labels.Selector) (ret []*LocalCredential, err error) + Get(namespace, name string) (*LocalCredential, error) +} + +type LocalCredentialController interface { + Informer() cache.SharedIndexInformer + Lister() LocalCredentialLister + AddHandler(handler LocalCredentialHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type LocalCredentialInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*LocalCredential) (*LocalCredential, error) + Get(name string, opts metav1.GetOptions) (*LocalCredential, error) + Update(*LocalCredential) (*LocalCredential, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*LocalCredentialList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() LocalCredentialController +} + +type localCredentialLister struct { + controller *localCredentialController +} + +func (l *localCredentialLister) List(namespace string, selector labels.Selector) (ret []*LocalCredential, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*LocalCredential)) + }) + return +} + +func (l *localCredentialLister) Get(namespace, name string) (*LocalCredential, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: LocalCredentialGroupVersionKind.Group, + Resource: "localCredential", + }, name) + } + return obj.(*LocalCredential), nil +} + +type localCredentialController struct { + controller.GenericController +} + +func (c *localCredentialController) Lister() LocalCredentialLister { + return &localCredentialLister{ + controller: c, + } +} + +func (c *localCredentialController) AddHandler(handler LocalCredentialHandlerFunc) { + c.GenericController.AddHandler(func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + return handler(key, obj.(*LocalCredential)) + }) +} + +type localCredentialFactory struct { +} + +func (c localCredentialFactory) Object() runtime.Object { + return &LocalCredential{} +} + +func (c localCredentialFactory) List() runtime.Object { + return &LocalCredentialList{} +} + +func (s *localCredentialClient) Controller() LocalCredentialController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.localCredentialControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(LocalCredentialGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &localCredentialController{ + GenericController: genericController, + } + + s.client.localCredentialControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type localCredentialClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller LocalCredentialController +} + +func (s *localCredentialClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *localCredentialClient) Create(o *LocalCredential) (*LocalCredential, error) { + obj, err := s.objectClient.Create(o) + return obj.(*LocalCredential), err +} + +func (s *localCredentialClient) Get(name string, opts metav1.GetOptions) (*LocalCredential, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*LocalCredential), err +} + +func (s *localCredentialClient) Update(o *LocalCredential) (*LocalCredential, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*LocalCredential), err +} + +func (s *localCredentialClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *localCredentialClient) List(opts metav1.ListOptions) (*LocalCredentialList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*LocalCredentialList), err +} + +func (s *localCredentialClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *localCredentialClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/apis/management.cattle.io/v3/zz_generated_local_credential_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_local_credential_lifecycle_adapter.go new file mode 100644 index 00000000..2827ede1 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_local_credential_lifecycle_adapter.go @@ -0,0 +1,39 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type LocalCredentialLifecycle interface { + Create(obj *LocalCredential) error + Remove(obj *LocalCredential) error + Updated(obj *LocalCredential) error +} + +type localCredentialLifecycleAdapter struct { + lifecycle LocalCredentialLifecycle +} + +func (w *localCredentialLifecycleAdapter) Create(obj runtime.Object) error { + return w.lifecycle.Create(obj.(*LocalCredential)) +} + +func (w *localCredentialLifecycleAdapter) Finalize(obj runtime.Object) error { + return w.lifecycle.Remove(obj.(*LocalCredential)) +} + +func (w *localCredentialLifecycleAdapter) Updated(obj runtime.Object) error { + return w.lifecycle.Updated(obj.(*LocalCredential)) +} + +func NewLocalCredentialLifecycleAdapter(name string, client LocalCredentialInterface, l LocalCredentialLifecycle) LocalCredentialHandlerFunc { + adapter := &localCredentialLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *LocalCredential) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_login_input_controller.go b/apis/management.cattle.io/v3/zz_generated_login_input_controller.go new file mode 100644 index 00000000..0863d6f2 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_login_input_controller.go @@ -0,0 +1,193 @@ +package v3 + +import ( + "context" + + "github.com/rancher/norman/clientbase" + "github.com/rancher/norman/controller" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + LoginInputGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "LoginInput", + } + LoginInputResource = metav1.APIResource{ + Name: "logininputs", + SingularName: "logininput", + Namespaced: false, + Kind: LoginInputGroupVersionKind.Kind, + } +) + +type LoginInputList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []LoginInput +} + +type LoginInputHandlerFunc func(key string, obj *LoginInput) error + +type LoginInputLister interface { + List(namespace string, selector labels.Selector) (ret []*LoginInput, err error) + Get(namespace, name string) (*LoginInput, error) +} + +type LoginInputController interface { + Informer() cache.SharedIndexInformer + Lister() LoginInputLister + AddHandler(handler LoginInputHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type LoginInputInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*LoginInput) (*LoginInput, error) + Get(name string, opts metav1.GetOptions) (*LoginInput, error) + Update(*LoginInput) (*LoginInput, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*LoginInputList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() LoginInputController +} + +type loginInputLister struct { + controller *loginInputController +} + +func (l *loginInputLister) List(namespace string, selector labels.Selector) (ret []*LoginInput, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*LoginInput)) + }) + return +} + +func (l *loginInputLister) Get(namespace, name string) (*LoginInput, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: LoginInputGroupVersionKind.Group, + Resource: "loginInput", + }, name) + } + return obj.(*LoginInput), nil +} + +type loginInputController struct { + controller.GenericController +} + +func (c *loginInputController) Lister() LoginInputLister { + return &loginInputLister{ + controller: c, + } +} + +func (c *loginInputController) AddHandler(handler LoginInputHandlerFunc) { + c.GenericController.AddHandler(func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + return handler(key, obj.(*LoginInput)) + }) +} + +type loginInputFactory struct { +} + +func (c loginInputFactory) Object() runtime.Object { + return &LoginInput{} +} + +func (c loginInputFactory) List() runtime.Object { + return &LoginInputList{} +} + +func (s *loginInputClient) Controller() LoginInputController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.loginInputControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(LoginInputGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &loginInputController{ + GenericController: genericController, + } + + s.client.loginInputControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type loginInputClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller LoginInputController +} + +func (s *loginInputClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *loginInputClient) Create(o *LoginInput) (*LoginInput, error) { + obj, err := s.objectClient.Create(o) + return obj.(*LoginInput), err +} + +func (s *loginInputClient) Get(name string, opts metav1.GetOptions) (*LoginInput, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*LoginInput), err +} + +func (s *loginInputClient) Update(o *LoginInput) (*LoginInput, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*LoginInput), err +} + +func (s *loginInputClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *loginInputClient) List(opts metav1.ListOptions) (*LoginInputList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*LoginInputList), err +} + +func (s *loginInputClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *loginInputClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/apis/management.cattle.io/v3/zz_generated_login_input_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_login_input_lifecycle_adapter.go new file mode 100644 index 00000000..86b38dfb --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_login_input_lifecycle_adapter.go @@ -0,0 +1,39 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type LoginInputLifecycle interface { + Create(obj *LoginInput) error + Remove(obj *LoginInput) error + Updated(obj *LoginInput) error +} + +type loginInputLifecycleAdapter struct { + lifecycle LoginInputLifecycle +} + +func (w *loginInputLifecycleAdapter) Create(obj runtime.Object) error { + return w.lifecycle.Create(obj.(*LoginInput)) +} + +func (w *loginInputLifecycleAdapter) Finalize(obj runtime.Object) error { + return w.lifecycle.Remove(obj.(*LoginInput)) +} + +func (w *loginInputLifecycleAdapter) Updated(obj runtime.Object) error { + return w.lifecycle.Updated(obj.(*LoginInput)) +} + +func NewLoginInputLifecycleAdapter(name string, client LoginInputInterface, l LoginInputLifecycle) LoginInputHandlerFunc { + adapter := &loginInputLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *LoginInput) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/client/management/v3/zz_generated_client.go b/client/management/v3/zz_generated_client.go index f005c9af..93dc6270 100644 --- a/client/management/v3/zz_generated_client.go +++ b/client/management/v3/zz_generated_client.go @@ -26,6 +26,9 @@ type Client struct { Group GroupOperations GroupMember GroupMemberOperations Identity IdentityOperations + LocalCredential LocalCredentialOperations + GithubCredential GithubCredentialOperations + LoginInput LoginInputOperations DynamicSchema DynamicSchemaOperations } @@ -58,6 +61,9 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) { client.Group = newGroupClient(client) client.GroupMember = newGroupMemberClient(client) client.Identity = newIdentityClient(client) + client.LocalCredential = newLocalCredentialClient(client) + client.GithubCredential = newGithubCredentialClient(client) + client.LoginInput = newLoginInputClient(client) client.DynamicSchema = newDynamicSchemaClient(client) return client, nil diff --git a/client/management/v3/zz_generated_github_credential.go b/client/management/v3/zz_generated_github_credential.go new file mode 100644 index 00000000..f17b0019 --- /dev/null +++ b/client/management/v3/zz_generated_github_credential.go @@ -0,0 +1,95 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + GithubCredentialType = "githubCredential" + GithubCredentialFieldAnnotations = "annotations" + GithubCredentialFieldCode = "code" + GithubCredentialFieldCreated = "created" + GithubCredentialFieldFinalizers = "finalizers" + GithubCredentialFieldLabels = "labels" + GithubCredentialFieldName = "name" + GithubCredentialFieldOwnerReferences = "ownerReferences" + GithubCredentialFieldRemoved = "removed" + GithubCredentialFieldResourcePath = "resourcePath" + GithubCredentialFieldUuid = "uuid" +) + +type GithubCredential struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty"` + Code string `json:"code,omitempty"` + Created string `json:"created,omitempty"` + Finalizers []string `json:"finalizers,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Name string `json:"name,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` + Removed string `json:"removed,omitempty"` + ResourcePath string `json:"resourcePath,omitempty"` + Uuid string `json:"uuid,omitempty"` +} +type GithubCredentialCollection struct { + types.Collection + Data []GithubCredential `json:"data,omitempty"` + client *GithubCredentialClient +} + +type GithubCredentialClient struct { + apiClient *Client +} + +type GithubCredentialOperations interface { + List(opts *types.ListOpts) (*GithubCredentialCollection, error) + Create(opts *GithubCredential) (*GithubCredential, error) + Update(existing *GithubCredential, updates interface{}) (*GithubCredential, error) + ByID(id string) (*GithubCredential, error) + Delete(container *GithubCredential) error +} + +func newGithubCredentialClient(apiClient *Client) *GithubCredentialClient { + return &GithubCredentialClient{ + apiClient: apiClient, + } +} + +func (c *GithubCredentialClient) Create(container *GithubCredential) (*GithubCredential, error) { + resp := &GithubCredential{} + err := c.apiClient.Ops.DoCreate(GithubCredentialType, container, resp) + return resp, err +} + +func (c *GithubCredentialClient) Update(existing *GithubCredential, updates interface{}) (*GithubCredential, error) { + resp := &GithubCredential{} + err := c.apiClient.Ops.DoUpdate(GithubCredentialType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *GithubCredentialClient) List(opts *types.ListOpts) (*GithubCredentialCollection, error) { + resp := &GithubCredentialCollection{} + err := c.apiClient.Ops.DoList(GithubCredentialType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *GithubCredentialCollection) Next() (*GithubCredentialCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &GithubCredentialCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *GithubCredentialClient) ByID(id string) (*GithubCredential, error) { + resp := &GithubCredential{} + err := c.apiClient.Ops.DoByID(GithubCredentialType, id, resp) + return resp, err +} + +func (c *GithubCredentialClient) Delete(container *GithubCredential) error { + return c.apiClient.Ops.DoResourceDelete(GithubCredentialType, &container.Resource) +} diff --git a/client/management/v3/zz_generated_group.go b/client/management/v3/zz_generated_group.go index d36ce62b..98cc6f5a 100644 --- a/client/management/v3/zz_generated_group.go +++ b/client/management/v3/zz_generated_group.go @@ -8,10 +8,7 @@ const ( GroupType = "group" GroupFieldAnnotations = "annotations" GroupFieldCreated = "created" - GroupFieldDisplayName = "displayName" - GroupFieldExternalID = "externalID" GroupFieldFinalizers = "finalizers" - GroupFieldGroupName = "groupName" GroupFieldLabels = "labels" GroupFieldName = "name" GroupFieldOwnerReferences = "ownerReferences" @@ -24,10 +21,7 @@ type Group struct { types.Resource Annotations map[string]string `json:"annotations,omitempty"` Created string `json:"created,omitempty"` - DisplayName string `json:"displayName,omitempty"` - ExternalID string `json:"externalID,omitempty"` Finalizers []string `json:"finalizers,omitempty"` - GroupName string `json:"groupName,omitempty"` Labels map[string]string `json:"labels,omitempty"` Name string `json:"name,omitempty"` OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` diff --git a/client/management/v3/zz_generated_group_member.go b/client/management/v3/zz_generated_group_member.go index 692993a8..c32c1382 100644 --- a/client/management/v3/zz_generated_group_member.go +++ b/client/management/v3/zz_generated_group_member.go @@ -5,33 +5,33 @@ import ( ) const ( - GroupMemberType = "groupMember" - GroupMemberFieldAnnotations = "annotations" - GroupMemberFieldCreated = "created" - GroupMemberFieldFinalizers = "finalizers" - GroupMemberFieldGroupExternalID = "groupExternalID" - GroupMemberFieldLabels = "labels" - GroupMemberFieldMemberExternalID = "memberExternalID" - GroupMemberFieldName = "name" - GroupMemberFieldOwnerReferences = "ownerReferences" - GroupMemberFieldRemoved = "removed" - GroupMemberFieldResourcePath = "resourcePath" - GroupMemberFieldUuid = "uuid" + GroupMemberType = "groupMember" + GroupMemberFieldAnnotations = "annotations" + GroupMemberFieldCreated = "created" + GroupMemberFieldExternalID = "externalId" + GroupMemberFieldFinalizers = "finalizers" + GroupMemberFieldGroupId = "groupId" + GroupMemberFieldLabels = "labels" + GroupMemberFieldName = "name" + GroupMemberFieldOwnerReferences = "ownerReferences" + GroupMemberFieldRemoved = "removed" + GroupMemberFieldResourcePath = "resourcePath" + GroupMemberFieldUuid = "uuid" ) type GroupMember struct { types.Resource - Annotations map[string]string `json:"annotations,omitempty"` - Created string `json:"created,omitempty"` - Finalizers []string `json:"finalizers,omitempty"` - GroupExternalID string `json:"groupExternalID,omitempty"` - Labels map[string]string `json:"labels,omitempty"` - MemberExternalID string `json:"memberExternalID,omitempty"` - Name string `json:"name,omitempty"` - OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` - Removed string `json:"removed,omitempty"` - ResourcePath string `json:"resourcePath,omitempty"` - Uuid string `json:"uuid,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` + Created string `json:"created,omitempty"` + ExternalID string `json:"externalId,omitempty"` + Finalizers []string `json:"finalizers,omitempty"` + GroupId string `json:"groupId,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Name string `json:"name,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` + Removed string `json:"removed,omitempty"` + ResourcePath string `json:"resourcePath,omitempty"` + Uuid string `json:"uuid,omitempty"` } type GroupMemberCollection struct { types.Collection diff --git a/client/management/v3/zz_generated_identity.go b/client/management/v3/zz_generated_identity.go index ff4b5062..e1a08088 100644 --- a/client/management/v3/zz_generated_identity.go +++ b/client/management/v3/zz_generated_identity.go @@ -9,11 +9,10 @@ const ( IdentityFieldAnnotations = "annotations" IdentityFieldCreated = "created" IdentityFieldDisplayName = "displayName" - IdentityFieldExternalID = "externalID" IdentityFieldExtraInfo = "extraInfo" IdentityFieldFinalizers = "finalizers" - IdentityFieldIdentityName = "identityName" IdentityFieldLabels = "labels" + IdentityFieldLoginName = "loginName" IdentityFieldMe = "me" IdentityFieldMemberOf = "memberOf" IdentityFieldName = "name" @@ -30,11 +29,10 @@ type Identity struct { Annotations map[string]string `json:"annotations,omitempty"` Created string `json:"created,omitempty"` DisplayName string `json:"displayName,omitempty"` - ExternalID string `json:"externalID,omitempty"` ExtraInfo map[string]string `json:"extraInfo,omitempty"` Finalizers []string `json:"finalizers,omitempty"` - IdentityName string `json:"identityName,omitempty"` Labels map[string]string `json:"labels,omitempty"` + LoginName string `json:"loginName,omitempty"` Me *bool `json:"me,omitempty"` MemberOf *bool `json:"memberOf,omitempty"` Name string `json:"name,omitempty"` diff --git a/client/management/v3/zz_generated_local_credential.go b/client/management/v3/zz_generated_local_credential.go new file mode 100644 index 00000000..5fe9a706 --- /dev/null +++ b/client/management/v3/zz_generated_local_credential.go @@ -0,0 +1,97 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + LocalCredentialType = "localCredential" + LocalCredentialFieldAnnotations = "annotations" + LocalCredentialFieldCreated = "created" + LocalCredentialFieldFinalizers = "finalizers" + LocalCredentialFieldLabels = "labels" + LocalCredentialFieldName = "name" + LocalCredentialFieldOwnerReferences = "ownerReferences" + LocalCredentialFieldPassword = "password" + LocalCredentialFieldRemoved = "removed" + LocalCredentialFieldResourcePath = "resourcePath" + LocalCredentialFieldUsername = "username" + LocalCredentialFieldUuid = "uuid" +) + +type LocalCredential struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty"` + Created string `json:"created,omitempty"` + Finalizers []string `json:"finalizers,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Name string `json:"name,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` + Password string `json:"password,omitempty"` + Removed string `json:"removed,omitempty"` + ResourcePath string `json:"resourcePath,omitempty"` + Username string `json:"username,omitempty"` + Uuid string `json:"uuid,omitempty"` +} +type LocalCredentialCollection struct { + types.Collection + Data []LocalCredential `json:"data,omitempty"` + client *LocalCredentialClient +} + +type LocalCredentialClient struct { + apiClient *Client +} + +type LocalCredentialOperations interface { + List(opts *types.ListOpts) (*LocalCredentialCollection, error) + Create(opts *LocalCredential) (*LocalCredential, error) + Update(existing *LocalCredential, updates interface{}) (*LocalCredential, error) + ByID(id string) (*LocalCredential, error) + Delete(container *LocalCredential) error +} + +func newLocalCredentialClient(apiClient *Client) *LocalCredentialClient { + return &LocalCredentialClient{ + apiClient: apiClient, + } +} + +func (c *LocalCredentialClient) Create(container *LocalCredential) (*LocalCredential, error) { + resp := &LocalCredential{} + err := c.apiClient.Ops.DoCreate(LocalCredentialType, container, resp) + return resp, err +} + +func (c *LocalCredentialClient) Update(existing *LocalCredential, updates interface{}) (*LocalCredential, error) { + resp := &LocalCredential{} + err := c.apiClient.Ops.DoUpdate(LocalCredentialType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *LocalCredentialClient) List(opts *types.ListOpts) (*LocalCredentialCollection, error) { + resp := &LocalCredentialCollection{} + err := c.apiClient.Ops.DoList(LocalCredentialType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *LocalCredentialCollection) Next() (*LocalCredentialCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &LocalCredentialCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *LocalCredentialClient) ByID(id string) (*LocalCredential, error) { + resp := &LocalCredential{} + err := c.apiClient.Ops.DoByID(LocalCredentialType, id, resp) + return resp, err +} + +func (c *LocalCredentialClient) Delete(container *LocalCredential) error { + return c.apiClient.Ops.DoResourceDelete(LocalCredentialType, &container.Resource) +} diff --git a/client/management/v3/zz_generated_login_input.go b/client/management/v3/zz_generated_login_input.go new file mode 100644 index 00000000..d99a957e --- /dev/null +++ b/client/management/v3/zz_generated_login_input.go @@ -0,0 +1,105 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + LoginInputType = "loginInput" + LoginInputFieldAnnotations = "annotations" + LoginInputFieldCreated = "created" + LoginInputFieldDescription = "description" + LoginInputFieldFinalizers = "finalizers" + LoginInputFieldGithubCredential = "githubCredential" + LoginInputFieldIdentityRefreshTTLMillis = "identityRefreshTTL" + LoginInputFieldLabels = "labels" + LoginInputFieldLocalCredential = "localCredential" + LoginInputFieldName = "name" + LoginInputFieldOwnerReferences = "ownerReferences" + LoginInputFieldRemoved = "removed" + LoginInputFieldResourcePath = "resourcePath" + LoginInputFieldResponseType = "responseType" + LoginInputFieldTTLMillis = "ttl" + LoginInputFieldUuid = "uuid" +) + +type LoginInput struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty"` + Created string `json:"created,omitempty"` + Description string `json:"description,omitempty"` + Finalizers []string `json:"finalizers,omitempty"` + GithubCredential *GithubCredential `json:"githubCredential,omitempty"` + IdentityRefreshTTLMillis string `json:"identityRefreshTTL,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + LocalCredential *LocalCredential `json:"localCredential,omitempty"` + Name string `json:"name,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` + Removed string `json:"removed,omitempty"` + ResourcePath string `json:"resourcePath,omitempty"` + ResponseType string `json:"responseType,omitempty"` + TTLMillis string `json:"ttl,omitempty"` + Uuid string `json:"uuid,omitempty"` +} +type LoginInputCollection struct { + types.Collection + Data []LoginInput `json:"data,omitempty"` + client *LoginInputClient +} + +type LoginInputClient struct { + apiClient *Client +} + +type LoginInputOperations interface { + List(opts *types.ListOpts) (*LoginInputCollection, error) + Create(opts *LoginInput) (*LoginInput, error) + Update(existing *LoginInput, updates interface{}) (*LoginInput, error) + ByID(id string) (*LoginInput, error) + Delete(container *LoginInput) error +} + +func newLoginInputClient(apiClient *Client) *LoginInputClient { + return &LoginInputClient{ + apiClient: apiClient, + } +} + +func (c *LoginInputClient) Create(container *LoginInput) (*LoginInput, error) { + resp := &LoginInput{} + err := c.apiClient.Ops.DoCreate(LoginInputType, container, resp) + return resp, err +} + +func (c *LoginInputClient) Update(existing *LoginInput, updates interface{}) (*LoginInput, error) { + resp := &LoginInput{} + err := c.apiClient.Ops.DoUpdate(LoginInputType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *LoginInputClient) List(opts *types.ListOpts) (*LoginInputCollection, error) { + resp := &LoginInputCollection{} + err := c.apiClient.Ops.DoList(LoginInputType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *LoginInputCollection) Next() (*LoginInputCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &LoginInputCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *LoginInputClient) ByID(id string) (*LoginInput, error) { + resp := &LoginInput{} + err := c.apiClient.Ops.DoByID(LoginInputType, id, resp) + return resp, err +} + +func (c *LoginInputClient) Delete(container *LoginInput) error { + return c.apiClient.Ops.DoResourceDelete(LoginInputType, &container.Resource) +} diff --git a/client/management/v3/zz_generated_token.go b/client/management/v3/zz_generated_token.go index f82e5080..a941a226 100644 --- a/client/management/v3/zz_generated_token.go +++ b/client/management/v3/zz_generated_token.go @@ -5,49 +5,49 @@ import ( ) const ( - TokenType = "token" - TokenFieldAnnotations = "annotations" - TokenFieldAuthProvider = "authProvider" - TokenFieldCreated = "created" - TokenFieldDescription = "description" - TokenFieldExternalID = "externalID" - TokenFieldFinalizers = "finalizers" - TokenFieldIsDerived = "isDerived" - TokenFieldLabels = "labels" - TokenFieldLastUpdateTime = "lastUpdateTime" - TokenFieldName = "name" - TokenFieldOwnerReferences = "ownerReferences" - TokenFieldRefreshTTLMillis = "refreshTTL" - TokenFieldRemoved = "removed" - TokenFieldResourcePath = "resourcePath" - TokenFieldTTLMillis = "ttl" - TokenFieldTokenID = "tokenID" - TokenFieldTokenValue = "tokenValue" - TokenFieldUser = "user" - TokenFieldUuid = "uuid" + TokenType = "token" + TokenFieldAnnotations = "annotations" + TokenFieldAuthProvider = "authProvider" + TokenFieldCreated = "created" + TokenFieldDescription = "description" + TokenFieldExternalID = "externalId" + TokenFieldFinalizers = "finalizers" + TokenFieldIdentityRefreshTTLMillis = "identityRefreshTTL" + TokenFieldIsDerived = "isDerived" + TokenFieldLabels = "labels" + TokenFieldLastUpdateTime = "lastUpdateTime" + TokenFieldName = "name" + TokenFieldOwnerReferences = "ownerReferences" + TokenFieldRemoved = "removed" + TokenFieldResourcePath = "resourcePath" + TokenFieldTTLMillis = "ttl" + TokenFieldTokenID = "tokenId" + TokenFieldTokenValue = "tokenValue" + TokenFieldUser = "user" + TokenFieldUuid = "uuid" ) type Token struct { types.Resource - Annotations map[string]string `json:"annotations,omitempty"` - AuthProvider string `json:"authProvider,omitempty"` - Created string `json:"created,omitempty"` - Description string `json:"description,omitempty"` - ExternalID string `json:"externalID,omitempty"` - Finalizers []string `json:"finalizers,omitempty"` - IsDerived *bool `json:"isDerived,omitempty"` - Labels map[string]string `json:"labels,omitempty"` - LastUpdateTime string `json:"lastUpdateTime,omitempty"` - Name string `json:"name,omitempty"` - OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` - RefreshTTLMillis string `json:"refreshTTL,omitempty"` - Removed string `json:"removed,omitempty"` - ResourcePath string `json:"resourcePath,omitempty"` - TTLMillis string `json:"ttl,omitempty"` - TokenID string `json:"tokenID,omitempty"` - TokenValue string `json:"tokenValue,omitempty"` - User string `json:"user,omitempty"` - Uuid string `json:"uuid,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` + AuthProvider string `json:"authProvider,omitempty"` + Created string `json:"created,omitempty"` + Description string `json:"description,omitempty"` + ExternalID string `json:"externalId,omitempty"` + Finalizers []string `json:"finalizers,omitempty"` + IdentityRefreshTTLMillis string `json:"identityRefreshTTL,omitempty"` + IsDerived *bool `json:"isDerived,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + LastUpdateTime string `json:"lastUpdateTime,omitempty"` + Name string `json:"name,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` + Removed string `json:"removed,omitempty"` + ResourcePath string `json:"resourcePath,omitempty"` + TTLMillis string `json:"ttl,omitempty"` + TokenID string `json:"tokenId,omitempty"` + TokenValue string `json:"tokenValue,omitempty"` + User string `json:"user,omitempty"` + Uuid string `json:"uuid,omitempty"` } type TokenCollection struct { types.Collection diff --git a/client/management/v3/zz_generated_user.go b/client/management/v3/zz_generated_user.go index 00ae87d4..5a9f6377 100644 --- a/client/management/v3/zz_generated_user.go +++ b/client/management/v3/zz_generated_user.go @@ -8,8 +8,7 @@ const ( UserType = "user" UserFieldAnnotations = "annotations" UserFieldCreated = "created" - UserFieldDisplayName = "displayName" - UserFieldExternalID = "externalID" + UserFieldExternalID = "externalId" UserFieldFinalizers = "finalizers" UserFieldLabels = "labels" UserFieldName = "name" @@ -17,7 +16,6 @@ const ( UserFieldRemoved = "removed" UserFieldResourcePath = "resourcePath" UserFieldSecret = "secret" - UserFieldUserName = "userName" UserFieldUuid = "uuid" ) @@ -25,8 +23,7 @@ type User struct { types.Resource Annotations map[string]string `json:"annotations,omitempty"` Created string `json:"created,omitempty"` - DisplayName string `json:"displayName,omitempty"` - ExternalID string `json:"externalID,omitempty"` + ExternalID string `json:"externalId,omitempty"` Finalizers []string `json:"finalizers,omitempty"` Labels map[string]string `json:"labels,omitempty"` Name string `json:"name,omitempty"` @@ -34,7 +31,6 @@ type User struct { Removed string `json:"removed,omitempty"` ResourcePath string `json:"resourcePath,omitempty"` Secret string `json:"secret,omitempty"` - UserName string `json:"userName,omitempty"` Uuid string `json:"uuid,omitempty"` } type UserCollection struct {