mirror of
https://github.com/rancher/types.git
synced 2025-08-25 07:18:25 +00:00
Generated authn changes
This commit is contained in:
parent
82755ad33f
commit
dd15a68660
@ -1069,74 +1069,6 @@ func (in *GroupMemberList) DeepCopyObject() runtime.Object {
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Identity) DeepCopyInto(out *Identity) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.ExtraInfo != nil {
|
||||
in, out := &in.ExtraInfo, &out.ExtraInfo
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Identity.
|
||||
func (in *Identity) DeepCopy() *Identity {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Identity)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Identity) 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 *IdentityList) DeepCopyInto(out *IdentityList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Identity, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IdentityList.
|
||||
func (in *IdentityList) DeepCopy() *IdentityList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IdentityList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *IdentityList) 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 *KubeAPIService) DeepCopyInto(out *KubeAPIService) {
|
||||
*out = *in
|
||||
@ -1785,6 +1717,74 @@ func (in *PodSecurityPolicyTemplateList) DeepCopyObject() runtime.Object {
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Principal) DeepCopyInto(out *Principal) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.ExtraInfo != nil {
|
||||
in, out := &in.ExtraInfo, &out.ExtraInfo
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Principal.
|
||||
func (in *Principal) DeepCopy() *Principal {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Principal)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Principal) 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 *PrincipalList) DeepCopyInto(out *PrincipalList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Principal, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrincipalList.
|
||||
func (in *PrincipalList) DeepCopy() *PrincipalList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PrincipalList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PrincipalList) 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 *Project) DeepCopyInto(out *Project) {
|
||||
*out = *in
|
||||
@ -2341,10 +2341,10 @@ func (in *Token) DeepCopyInto(out *Token) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.UserIdentity.DeepCopyInto(&out.UserIdentity)
|
||||
if in.GroupIdentities != nil {
|
||||
in, out := &in.GroupIdentities, &out.GroupIdentities
|
||||
*out = make([]Identity, len(*in))
|
||||
in.UserPrincipal.DeepCopyInto(&out.UserPrincipal)
|
||||
if in.GroupPrincipals != nil {
|
||||
in, out := &in.GroupPrincipals, &out.GroupPrincipals
|
||||
*out = make([]Principal, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
@ -2417,6 +2417,11 @@ func (in *User) DeepCopyInto(out *User) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.PrincipalIDs != nil {
|
||||
in, out := &in.PrincipalIDs, &out.PrincipalIDs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1,193 +0,0 @@
|
||||
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 (
|
||||
IdentityGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: "v3",
|
||||
Group: "management.cattle.io",
|
||||
Kind: "Identity",
|
||||
}
|
||||
IdentityResource = metav1.APIResource{
|
||||
Name: "identities",
|
||||
SingularName: "identity",
|
||||
Namespaced: false,
|
||||
Kind: IdentityGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type IdentityList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Identity
|
||||
}
|
||||
|
||||
type IdentityHandlerFunc func(key string, obj *Identity) error
|
||||
|
||||
type IdentityLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*Identity, err error)
|
||||
Get(namespace, name string) (*Identity, error)
|
||||
}
|
||||
|
||||
type IdentityController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() IdentityLister
|
||||
AddHandler(handler IdentityHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type IdentityInterface interface {
|
||||
ObjectClient() *clientbase.ObjectClient
|
||||
Create(*Identity) (*Identity, error)
|
||||
Get(name string, opts metav1.GetOptions) (*Identity, error)
|
||||
Update(*Identity) (*Identity, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*IdentityList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() IdentityController
|
||||
}
|
||||
|
||||
type identityLister struct {
|
||||
controller *identityController
|
||||
}
|
||||
|
||||
func (l *identityLister) List(namespace string, selector labels.Selector) (ret []*Identity, err error) {
|
||||
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
|
||||
ret = append(ret, obj.(*Identity))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (l *identityLister) Get(namespace, name string) (*Identity, 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: IdentityGroupVersionKind.Group,
|
||||
Resource: "identity",
|
||||
}, name)
|
||||
}
|
||||
return obj.(*Identity), nil
|
||||
}
|
||||
|
||||
type identityController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *identityController) Lister() IdentityLister {
|
||||
return &identityLister{
|
||||
controller: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *identityController) AddHandler(handler IdentityHandlerFunc) {
|
||||
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.(*Identity))
|
||||
})
|
||||
}
|
||||
|
||||
type identityFactory struct {
|
||||
}
|
||||
|
||||
func (c identityFactory) Object() runtime.Object {
|
||||
return &Identity{}
|
||||
}
|
||||
|
||||
func (c identityFactory) List() runtime.Object {
|
||||
return &IdentityList{}
|
||||
}
|
||||
|
||||
func (s *identityClient) Controller() IdentityController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.identityControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(IdentityGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
|
||||
c = &identityController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.identityControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type identityClient struct {
|
||||
client *Client
|
||||
ns string
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller IdentityController
|
||||
}
|
||||
|
||||
func (s *identityClient) ObjectClient() *clientbase.ObjectClient {
|
||||
return s.objectClient
|
||||
}
|
||||
|
||||
func (s *identityClient) Create(o *Identity) (*Identity, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*Identity), err
|
||||
}
|
||||
|
||||
func (s *identityClient) Get(name string, opts metav1.GetOptions) (*Identity, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*Identity), err
|
||||
}
|
||||
|
||||
func (s *identityClient) Update(o *Identity) (*Identity, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*Identity), err
|
||||
}
|
||||
|
||||
func (s *identityClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *identityClient) List(opts metav1.ListOptions) (*IdentityList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*IdentityList), err
|
||||
}
|
||||
|
||||
func (s *identityClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
func (s *identityClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/lifecycle"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
type IdentityLifecycle interface {
|
||||
Create(obj *Identity) (*Identity, error)
|
||||
Remove(obj *Identity) (*Identity, error)
|
||||
Updated(obj *Identity) (*Identity, error)
|
||||
}
|
||||
|
||||
type identityLifecycleAdapter struct {
|
||||
lifecycle IdentityLifecycle
|
||||
}
|
||||
|
||||
func (w *identityLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Create(obj.(*Identity))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *identityLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Remove(obj.(*Identity))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *identityLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Updated(obj.(*Identity))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func NewIdentityLifecycleAdapter(name string, client IdentityInterface, l IdentityLifecycle) IdentityHandlerFunc {
|
||||
adapter := &identityLifecycleAdapter{lifecycle: l}
|
||||
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
|
||||
return func(key string, obj *Identity) error {
|
||||
if obj == nil {
|
||||
return syncFn(key, nil)
|
||||
}
|
||||
return syncFn(key, obj)
|
||||
}
|
||||
}
|
@ -28,11 +28,11 @@ type Interface interface {
|
||||
CatalogsGetter
|
||||
TemplatesGetter
|
||||
TemplateVersionsGetter
|
||||
IdentitiesGetter
|
||||
TokensGetter
|
||||
UsersGetter
|
||||
GroupsGetter
|
||||
GroupMembersGetter
|
||||
PrincipalsGetter
|
||||
DynamicSchemasGetter
|
||||
}
|
||||
|
||||
@ -55,11 +55,11 @@ type Client struct {
|
||||
catalogControllers map[string]CatalogController
|
||||
templateControllers map[string]TemplateController
|
||||
templateVersionControllers map[string]TemplateVersionController
|
||||
identityControllers map[string]IdentityController
|
||||
tokenControllers map[string]TokenController
|
||||
userControllers map[string]UserController
|
||||
groupControllers map[string]GroupController
|
||||
groupMemberControllers map[string]GroupMemberController
|
||||
principalControllers map[string]PrincipalController
|
||||
dynamicSchemaControllers map[string]DynamicSchemaController
|
||||
}
|
||||
|
||||
@ -91,11 +91,11 @@ func NewForConfig(config rest.Config) (Interface, error) {
|
||||
catalogControllers: map[string]CatalogController{},
|
||||
templateControllers: map[string]TemplateController{},
|
||||
templateVersionControllers: map[string]TemplateVersionController{},
|
||||
identityControllers: map[string]IdentityController{},
|
||||
tokenControllers: map[string]TokenController{},
|
||||
userControllers: map[string]UserController{},
|
||||
groupControllers: map[string]GroupController{},
|
||||
groupMemberControllers: map[string]GroupMemberController{},
|
||||
principalControllers: map[string]PrincipalController{},
|
||||
dynamicSchemaControllers: map[string]DynamicSchemaController{},
|
||||
}, nil
|
||||
}
|
||||
@ -294,19 +294,6 @@ func (c *Client) TemplateVersions(namespace string) TemplateVersionInterface {
|
||||
}
|
||||
}
|
||||
|
||||
type IdentitiesGetter interface {
|
||||
Identities(namespace string) IdentityInterface
|
||||
}
|
||||
|
||||
func (c *Client) Identities(namespace string) IdentityInterface {
|
||||
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &IdentityResource, IdentityGroupVersionKind, identityFactory{})
|
||||
return &identityClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
||||
type TokensGetter interface {
|
||||
Tokens(namespace string) TokenInterface
|
||||
}
|
||||
@ -359,6 +346,19 @@ func (c *Client) GroupMembers(namespace string) GroupMemberInterface {
|
||||
}
|
||||
}
|
||||
|
||||
type PrincipalsGetter interface {
|
||||
Principals(namespace string) PrincipalInterface
|
||||
}
|
||||
|
||||
func (c *Client) Principals(namespace string) PrincipalInterface {
|
||||
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &PrincipalResource, PrincipalGroupVersionKind, principalFactory{})
|
||||
return &principalClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
||||
type DynamicSchemasGetter interface {
|
||||
DynamicSchemas(namespace string) DynamicSchemaInterface
|
||||
}
|
||||
|
@ -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 (
|
||||
PrincipalGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: "v3",
|
||||
Group: "management.cattle.io",
|
||||
Kind: "Principal",
|
||||
}
|
||||
PrincipalResource = metav1.APIResource{
|
||||
Name: "principals",
|
||||
SingularName: "principal",
|
||||
Namespaced: false,
|
||||
Kind: PrincipalGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type PrincipalList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Principal
|
||||
}
|
||||
|
||||
type PrincipalHandlerFunc func(key string, obj *Principal) error
|
||||
|
||||
type PrincipalLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*Principal, err error)
|
||||
Get(namespace, name string) (*Principal, error)
|
||||
}
|
||||
|
||||
type PrincipalController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() PrincipalLister
|
||||
AddHandler(handler PrincipalHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type PrincipalInterface interface {
|
||||
ObjectClient() *clientbase.ObjectClient
|
||||
Create(*Principal) (*Principal, error)
|
||||
Get(name string, opts metav1.GetOptions) (*Principal, error)
|
||||
Update(*Principal) (*Principal, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*PrincipalList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() PrincipalController
|
||||
}
|
||||
|
||||
type principalLister struct {
|
||||
controller *principalController
|
||||
}
|
||||
|
||||
func (l *principalLister) List(namespace string, selector labels.Selector) (ret []*Principal, err error) {
|
||||
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
|
||||
ret = append(ret, obj.(*Principal))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (l *principalLister) Get(namespace, name string) (*Principal, 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: PrincipalGroupVersionKind.Group,
|
||||
Resource: "principal",
|
||||
}, name)
|
||||
}
|
||||
return obj.(*Principal), nil
|
||||
}
|
||||
|
||||
type principalController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *principalController) Lister() PrincipalLister {
|
||||
return &principalLister{
|
||||
controller: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *principalController) AddHandler(handler PrincipalHandlerFunc) {
|
||||
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.(*Principal))
|
||||
})
|
||||
}
|
||||
|
||||
type principalFactory struct {
|
||||
}
|
||||
|
||||
func (c principalFactory) Object() runtime.Object {
|
||||
return &Principal{}
|
||||
}
|
||||
|
||||
func (c principalFactory) List() runtime.Object {
|
||||
return &PrincipalList{}
|
||||
}
|
||||
|
||||
func (s *principalClient) Controller() PrincipalController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.principalControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(PrincipalGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
|
||||
c = &principalController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.principalControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type principalClient struct {
|
||||
client *Client
|
||||
ns string
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller PrincipalController
|
||||
}
|
||||
|
||||
func (s *principalClient) ObjectClient() *clientbase.ObjectClient {
|
||||
return s.objectClient
|
||||
}
|
||||
|
||||
func (s *principalClient) Create(o *Principal) (*Principal, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*Principal), err
|
||||
}
|
||||
|
||||
func (s *principalClient) Get(name string, opts metav1.GetOptions) (*Principal, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*Principal), err
|
||||
}
|
||||
|
||||
func (s *principalClient) Update(o *Principal) (*Principal, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*Principal), err
|
||||
}
|
||||
|
||||
func (s *principalClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *principalClient) List(opts metav1.ListOptions) (*PrincipalList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*PrincipalList), err
|
||||
}
|
||||
|
||||
func (s *principalClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
func (s *principalClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/lifecycle"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
type PrincipalLifecycle interface {
|
||||
Create(obj *Principal) (*Principal, error)
|
||||
Remove(obj *Principal) (*Principal, error)
|
||||
Updated(obj *Principal) (*Principal, error)
|
||||
}
|
||||
|
||||
type principalLifecycleAdapter struct {
|
||||
lifecycle PrincipalLifecycle
|
||||
}
|
||||
|
||||
func (w *principalLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Create(obj.(*Principal))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *principalLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Remove(obj.(*Principal))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *principalLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Updated(obj.(*Principal))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func NewPrincipalLifecycleAdapter(name string, client PrincipalInterface, l PrincipalLifecycle) PrincipalHandlerFunc {
|
||||
adapter := &principalLifecycleAdapter{lifecycle: l}
|
||||
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
|
||||
return func(key string, obj *Principal) error {
|
||||
if obj == nil {
|
||||
return syncFn(key, nil)
|
||||
}
|
||||
return syncFn(key, obj)
|
||||
}
|
||||
}
|
@ -22,11 +22,11 @@ type Client struct {
|
||||
Catalog CatalogOperations
|
||||
Template TemplateOperations
|
||||
TemplateVersion TemplateVersionOperations
|
||||
Identity IdentityOperations
|
||||
Token TokenOperations
|
||||
User UserOperations
|
||||
Group GroupOperations
|
||||
GroupMember GroupMemberOperations
|
||||
Principal PrincipalOperations
|
||||
DynamicSchema DynamicSchemaOperations
|
||||
}
|
||||
|
||||
@ -55,11 +55,11 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
|
||||
client.Catalog = newCatalogClient(client)
|
||||
client.Template = newTemplateClient(client)
|
||||
client.TemplateVersion = newTemplateVersionClient(client)
|
||||
client.Identity = newIdentityClient(client)
|
||||
client.Token = newTokenClient(client)
|
||||
client.User = newUserClient(client)
|
||||
client.Group = newGroupClient(client)
|
||||
client.GroupMember = newGroupMemberClient(client)
|
||||
client.Principal = newPrincipalClient(client)
|
||||
client.DynamicSchema = newDynamicSchemaClient(client)
|
||||
|
||||
return client, nil
|
||||
|
@ -5,35 +5,39 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
ClusterRoleTemplateBindingType = "clusterRoleTemplateBinding"
|
||||
ClusterRoleTemplateBindingFieldAnnotations = "annotations"
|
||||
ClusterRoleTemplateBindingFieldClusterId = "clusterId"
|
||||
ClusterRoleTemplateBindingFieldCreated = "created"
|
||||
ClusterRoleTemplateBindingFieldFinalizers = "finalizers"
|
||||
ClusterRoleTemplateBindingFieldLabels = "labels"
|
||||
ClusterRoleTemplateBindingFieldName = "name"
|
||||
ClusterRoleTemplateBindingFieldOwnerReferences = "ownerReferences"
|
||||
ClusterRoleTemplateBindingFieldRemoved = "removed"
|
||||
ClusterRoleTemplateBindingFieldResourcePath = "resourcePath"
|
||||
ClusterRoleTemplateBindingFieldRoleTemplateId = "roleTemplateId"
|
||||
ClusterRoleTemplateBindingFieldSubject = "subject"
|
||||
ClusterRoleTemplateBindingFieldUuid = "uuid"
|
||||
ClusterRoleTemplateBindingType = "clusterRoleTemplateBinding"
|
||||
ClusterRoleTemplateBindingFieldAnnotations = "annotations"
|
||||
ClusterRoleTemplateBindingFieldClusterId = "clusterId"
|
||||
ClusterRoleTemplateBindingFieldCreated = "created"
|
||||
ClusterRoleTemplateBindingFieldFinalizers = "finalizers"
|
||||
ClusterRoleTemplateBindingFieldLabels = "labels"
|
||||
ClusterRoleTemplateBindingFieldName = "name"
|
||||
ClusterRoleTemplateBindingFieldOwnerReferences = "ownerReferences"
|
||||
ClusterRoleTemplateBindingFieldRemoved = "removed"
|
||||
ClusterRoleTemplateBindingFieldResourcePath = "resourcePath"
|
||||
ClusterRoleTemplateBindingFieldRoleTemplateId = "roleTemplateId"
|
||||
ClusterRoleTemplateBindingFieldSubjectKind = "subjectKind"
|
||||
ClusterRoleTemplateBindingFieldSubjectName = "subjectName"
|
||||
ClusterRoleTemplateBindingFieldSubjectNamespace = "subjectNamespace"
|
||||
ClusterRoleTemplateBindingFieldUuid = "uuid"
|
||||
)
|
||||
|
||||
type ClusterRoleTemplateBinding struct {
|
||||
types.Resource
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
ClusterId string `json:"clusterId,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"`
|
||||
RoleTemplateId string `json:"roleTemplateId,omitempty"`
|
||||
Subject *Subject `json:"subject,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
ClusterId string `json:"clusterId,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"`
|
||||
RoleTemplateId string `json:"roleTemplateId,omitempty"`
|
||||
SubjectKind string `json:"subjectKind,omitempty"`
|
||||
SubjectName string `json:"subjectName,omitempty"`
|
||||
SubjectNamespace string `json:"subjectNamespace,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
}
|
||||
type ClusterRoleTemplateBindingCollection struct {
|
||||
types.Collection
|
||||
|
@ -9,6 +9,7 @@ const (
|
||||
GroupFieldAnnotations = "annotations"
|
||||
GroupFieldCreated = "created"
|
||||
GroupFieldFinalizers = "finalizers"
|
||||
GroupFieldId = "id"
|
||||
GroupFieldLabels = "labels"
|
||||
GroupFieldName = "name"
|
||||
GroupFieldOwnerReferences = "ownerReferences"
|
||||
@ -22,6 +23,7 @@ type Group struct {
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Finalizers []string `json:"finalizers,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"`
|
||||
|
@ -8,12 +8,12 @@ const (
|
||||
GroupMemberType = "groupMember"
|
||||
GroupMemberFieldAnnotations = "annotations"
|
||||
GroupMemberFieldCreated = "created"
|
||||
GroupMemberFieldExternalID = "externalId"
|
||||
GroupMemberFieldFinalizers = "finalizers"
|
||||
GroupMemberFieldGroupId = "groupId"
|
||||
GroupMemberFieldLabels = "labels"
|
||||
GroupMemberFieldName = "name"
|
||||
GroupMemberFieldOwnerReferences = "ownerReferences"
|
||||
GroupMemberFieldPrincipalID = "principalId"
|
||||
GroupMemberFieldRemoved = "removed"
|
||||
GroupMemberFieldResourcePath = "resourcePath"
|
||||
GroupMemberFieldUuid = "uuid"
|
||||
@ -23,12 +23,12 @@ type GroupMember struct {
|
||||
types.Resource
|
||||
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"`
|
||||
PrincipalID string `json:"principalId,omitempty"`
|
||||
Removed string `json:"removed,omitempty"`
|
||||
ResourcePath string `json:"resourcePath,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
|
@ -1,107 +0,0 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/types"
|
||||
)
|
||||
|
||||
const (
|
||||
IdentityType = "identity"
|
||||
IdentityFieldAnnotations = "annotations"
|
||||
IdentityFieldCreated = "created"
|
||||
IdentityFieldDisplayName = "displayName"
|
||||
IdentityFieldExtraInfo = "extraInfo"
|
||||
IdentityFieldFinalizers = "finalizers"
|
||||
IdentityFieldLabels = "labels"
|
||||
IdentityFieldLoginName = "loginName"
|
||||
IdentityFieldMe = "me"
|
||||
IdentityFieldMemberOf = "memberOf"
|
||||
IdentityFieldName = "name"
|
||||
IdentityFieldOwnerReferences = "ownerReferences"
|
||||
IdentityFieldProfilePicture = "profilePicture"
|
||||
IdentityFieldProfileURL = "profileURL"
|
||||
IdentityFieldRemoved = "removed"
|
||||
IdentityFieldResourcePath = "resourcePath"
|
||||
IdentityFieldUuid = "uuid"
|
||||
)
|
||||
|
||||
type Identity struct {
|
||||
types.Resource
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
ExtraInfo map[string]string `json:"extraInfo,omitempty"`
|
||||
Finalizers []string `json:"finalizers,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"`
|
||||
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"`
|
||||
ProfilePicture string `json:"profilePicture,omitempty"`
|
||||
ProfileURL string `json:"profileURL,omitempty"`
|
||||
Removed string `json:"removed,omitempty"`
|
||||
ResourcePath string `json:"resourcePath,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
}
|
||||
type IdentityCollection struct {
|
||||
types.Collection
|
||||
Data []Identity `json:"data,omitempty"`
|
||||
client *IdentityClient
|
||||
}
|
||||
|
||||
type IdentityClient struct {
|
||||
apiClient *Client
|
||||
}
|
||||
|
||||
type IdentityOperations interface {
|
||||
List(opts *types.ListOpts) (*IdentityCollection, error)
|
||||
Create(opts *Identity) (*Identity, error)
|
||||
Update(existing *Identity, updates interface{}) (*Identity, error)
|
||||
ByID(id string) (*Identity, error)
|
||||
Delete(container *Identity) error
|
||||
}
|
||||
|
||||
func newIdentityClient(apiClient *Client) *IdentityClient {
|
||||
return &IdentityClient{
|
||||
apiClient: apiClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *IdentityClient) Create(container *Identity) (*Identity, error) {
|
||||
resp := &Identity{}
|
||||
err := c.apiClient.Ops.DoCreate(IdentityType, container, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *IdentityClient) Update(existing *Identity, updates interface{}) (*Identity, error) {
|
||||
resp := &Identity{}
|
||||
err := c.apiClient.Ops.DoUpdate(IdentityType, &existing.Resource, updates, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *IdentityClient) List(opts *types.ListOpts) (*IdentityCollection, error) {
|
||||
resp := &IdentityCollection{}
|
||||
err := c.apiClient.Ops.DoList(IdentityType, opts, resp)
|
||||
resp.client = c
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (cc *IdentityCollection) Next() (*IdentityCollection, error) {
|
||||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
|
||||
resp := &IdentityCollection{}
|
||||
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
|
||||
resp.client = cc.client
|
||||
return resp, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *IdentityClient) ByID(id string) (*Identity, error) {
|
||||
resp := &Identity{}
|
||||
err := c.apiClient.Ops.DoByID(IdentityType, id, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *IdentityClient) Delete(container *Identity) error {
|
||||
return c.apiClient.Ops.DoResourceDelete(IdentityType, &container.Resource)
|
||||
}
|
@ -1,20 +1,18 @@
|
||||
package client
|
||||
|
||||
const (
|
||||
LoginInputType = "loginInput"
|
||||
LoginInputFieldDescription = "description"
|
||||
LoginInputFieldGithubCredential = "githubCredential"
|
||||
LoginInputFieldIdentityRefreshTTLMillis = "identityRefreshTTL"
|
||||
LoginInputFieldLocalCredential = "localCredential"
|
||||
LoginInputFieldResponseType = "responseType"
|
||||
LoginInputFieldTTLMillis = "ttl"
|
||||
LoginInputType = "loginInput"
|
||||
LoginInputFieldDescription = "description"
|
||||
LoginInputFieldGithubCredential = "githubCredential"
|
||||
LoginInputFieldLocalCredential = "localCredential"
|
||||
LoginInputFieldResponseType = "responseType"
|
||||
LoginInputFieldTTLMillis = "ttl"
|
||||
)
|
||||
|
||||
type LoginInput struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
GithubCredential *GithubCredential `json:"githubCredential,omitempty"`
|
||||
IdentityRefreshTTLMillis string `json:"identityRefreshTTL,omitempty"`
|
||||
LocalCredential *LocalCredential `json:"localCredential,omitempty"`
|
||||
ResponseType string `json:"responseType,omitempty"`
|
||||
TTLMillis string `json:"ttl,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
GithubCredential *GithubCredential `json:"githubCredential,omitempty"`
|
||||
LocalCredential *LocalCredential `json:"localCredential,omitempty"`
|
||||
ResponseType string `json:"responseType,omitempty"`
|
||||
TTLMillis *int64 `json:"ttl,omitempty"`
|
||||
}
|
||||
|
107
client/management/v3/zz_generated_principal.go
Normal file
107
client/management/v3/zz_generated_principal.go
Normal file
@ -0,0 +1,107 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/types"
|
||||
)
|
||||
|
||||
const (
|
||||
PrincipalType = "principal"
|
||||
PrincipalFieldAnnotations = "annotations"
|
||||
PrincipalFieldCreated = "created"
|
||||
PrincipalFieldDisplayName = "displayName"
|
||||
PrincipalFieldExtraInfo = "extraInfo"
|
||||
PrincipalFieldFinalizers = "finalizers"
|
||||
PrincipalFieldLabels = "labels"
|
||||
PrincipalFieldLoginName = "loginName"
|
||||
PrincipalFieldMe = "me"
|
||||
PrincipalFieldMemberOf = "memberOf"
|
||||
PrincipalFieldName = "name"
|
||||
PrincipalFieldOwnerReferences = "ownerReferences"
|
||||
PrincipalFieldProfilePicture = "profilePicture"
|
||||
PrincipalFieldProfileURL = "profileURL"
|
||||
PrincipalFieldRemoved = "removed"
|
||||
PrincipalFieldResourcePath = "resourcePath"
|
||||
PrincipalFieldUuid = "uuid"
|
||||
)
|
||||
|
||||
type Principal struct {
|
||||
types.Resource
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
ExtraInfo map[string]string `json:"extraInfo,omitempty"`
|
||||
Finalizers []string `json:"finalizers,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"`
|
||||
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"`
|
||||
ProfilePicture string `json:"profilePicture,omitempty"`
|
||||
ProfileURL string `json:"profileURL,omitempty"`
|
||||
Removed string `json:"removed,omitempty"`
|
||||
ResourcePath string `json:"resourcePath,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
}
|
||||
type PrincipalCollection struct {
|
||||
types.Collection
|
||||
Data []Principal `json:"data,omitempty"`
|
||||
client *PrincipalClient
|
||||
}
|
||||
|
||||
type PrincipalClient struct {
|
||||
apiClient *Client
|
||||
}
|
||||
|
||||
type PrincipalOperations interface {
|
||||
List(opts *types.ListOpts) (*PrincipalCollection, error)
|
||||
Create(opts *Principal) (*Principal, error)
|
||||
Update(existing *Principal, updates interface{}) (*Principal, error)
|
||||
ByID(id string) (*Principal, error)
|
||||
Delete(container *Principal) error
|
||||
}
|
||||
|
||||
func newPrincipalClient(apiClient *Client) *PrincipalClient {
|
||||
return &PrincipalClient{
|
||||
apiClient: apiClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *PrincipalClient) Create(container *Principal) (*Principal, error) {
|
||||
resp := &Principal{}
|
||||
err := c.apiClient.Ops.DoCreate(PrincipalType, container, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *PrincipalClient) Update(existing *Principal, updates interface{}) (*Principal, error) {
|
||||
resp := &Principal{}
|
||||
err := c.apiClient.Ops.DoUpdate(PrincipalType, &existing.Resource, updates, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *PrincipalClient) List(opts *types.ListOpts) (*PrincipalCollection, error) {
|
||||
resp := &PrincipalCollection{}
|
||||
err := c.apiClient.Ops.DoList(PrincipalType, opts, resp)
|
||||
resp.client = c
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (cc *PrincipalCollection) Next() (*PrincipalCollection, error) {
|
||||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
|
||||
resp := &PrincipalCollection{}
|
||||
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
|
||||
resp.client = cc.client
|
||||
return resp, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *PrincipalClient) ByID(id string) (*Principal, error) {
|
||||
resp := &Principal{}
|
||||
err := c.apiClient.Ops.DoByID(PrincipalType, id, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *PrincipalClient) Delete(container *Principal) error {
|
||||
return c.apiClient.Ops.DoResourceDelete(PrincipalType, &container.Resource)
|
||||
}
|
@ -5,53 +5,47 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
TokenType = "token"
|
||||
TokenFieldAnnotations = "annotations"
|
||||
TokenFieldAuthProvider = "authProvider"
|
||||
TokenFieldCreated = "created"
|
||||
TokenFieldDescription = "description"
|
||||
TokenFieldExternalID = "externalId"
|
||||
TokenFieldFinalizers = "finalizers"
|
||||
TokenFieldGroupIdentities = "groupIdentities"
|
||||
TokenFieldIdentityRefreshTTLMillis = "identityRefreshTTL"
|
||||
TokenFieldIsDerived = "isDerived"
|
||||
TokenFieldLabels = "labels"
|
||||
TokenFieldLastUpdateTime = "lastUpdateTime"
|
||||
TokenFieldName = "name"
|
||||
TokenFieldOwnerReferences = "ownerReferences"
|
||||
TokenFieldProviderInfo = "providerInfo"
|
||||
TokenFieldRemoved = "removed"
|
||||
TokenFieldResourcePath = "resourcePath"
|
||||
TokenFieldTTLMillis = "ttl"
|
||||
TokenFieldTokenID = "tokenId"
|
||||
TokenFieldUser = "user"
|
||||
TokenFieldUserIdentity = "userIdentity"
|
||||
TokenFieldUuid = "uuid"
|
||||
TokenType = "token"
|
||||
TokenFieldAnnotations = "annotations"
|
||||
TokenFieldAuthProvider = "authProvider"
|
||||
TokenFieldCreated = "created"
|
||||
TokenFieldDescription = "description"
|
||||
TokenFieldFinalizers = "finalizers"
|
||||
TokenFieldGroupPrincipals = "groupPrincipals"
|
||||
TokenFieldIsDerived = "isDerived"
|
||||
TokenFieldLabels = "labels"
|
||||
TokenFieldLastUpdateTime = "lastUpdateTime"
|
||||
TokenFieldName = "name"
|
||||
TokenFieldOwnerReferences = "ownerReferences"
|
||||
TokenFieldProviderInfo = "providerInfo"
|
||||
TokenFieldRemoved = "removed"
|
||||
TokenFieldResourcePath = "resourcePath"
|
||||
TokenFieldTTLMillis = "ttl"
|
||||
TokenFieldUserID = "userId"
|
||||
TokenFieldUserPrincipal = "userPrincipal"
|
||||
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"`
|
||||
GroupIdentities []Identity `json:"groupIdentities,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"`
|
||||
ProviderInfo map[string]string `json:"providerInfo,omitempty"`
|
||||
Removed string `json:"removed,omitempty"`
|
||||
ResourcePath string `json:"resourcePath,omitempty"`
|
||||
TTLMillis string `json:"ttl,omitempty"`
|
||||
TokenID string `json:"tokenId,omitempty"`
|
||||
User string `json:"user,omitempty"`
|
||||
UserIdentity *Identity `json:"userIdentity,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"`
|
||||
Finalizers []string `json:"finalizers,omitempty"`
|
||||
GroupPrincipals []string `json:"groupPrincipals,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"`
|
||||
ProviderInfo map[string]string `json:"providerInfo,omitempty"`
|
||||
Removed string `json:"removed,omitempty"`
|
||||
ResourcePath string `json:"resourcePath,omitempty"`
|
||||
TTLMillis *int64 `json:"ttl,omitempty"`
|
||||
UserID string `json:"userId,omitempty"`
|
||||
UserPrincipal string `json:"userPrincipal,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
}
|
||||
type TokenCollection struct {
|
||||
types.Collection
|
||||
|
@ -5,33 +5,39 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
UserType = "user"
|
||||
UserFieldAnnotations = "annotations"
|
||||
UserFieldCreated = "created"
|
||||
UserFieldExternalID = "externalId"
|
||||
UserFieldFinalizers = "finalizers"
|
||||
UserFieldLabels = "labels"
|
||||
UserFieldName = "name"
|
||||
UserFieldOwnerReferences = "ownerReferences"
|
||||
UserFieldRemoved = "removed"
|
||||
UserFieldResourcePath = "resourcePath"
|
||||
UserFieldSecret = "secret"
|
||||
UserFieldUuid = "uuid"
|
||||
UserType = "user"
|
||||
UserFieldAnnotations = "annotations"
|
||||
UserFieldCreated = "created"
|
||||
UserFieldFinalizers = "finalizers"
|
||||
UserFieldId = "id"
|
||||
UserFieldLabels = "labels"
|
||||
UserFieldMustChangePassword = "mustChangePassword"
|
||||
UserFieldName = "name"
|
||||
UserFieldOwnerReferences = "ownerReferences"
|
||||
UserFieldPassword = "password"
|
||||
UserFieldPrincipalIDs = "principalIds"
|
||||
UserFieldRemoved = "removed"
|
||||
UserFieldResourcePath = "resourcePath"
|
||||
UserFieldUserName = "userName"
|
||||
UserFieldUuid = "uuid"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
types.Resource
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
ExternalID string `json:"externalId,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"`
|
||||
Secret string `json:"secret,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Finalizers []string `json:"finalizers,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
MustChangePassword *bool `json:"mustChangePassword,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
PrincipalIDs []string `json:"principalIds,omitempty"`
|
||||
Removed string `json:"removed,omitempty"`
|
||||
ResourcePath string `json:"resourcePath,omitempty"`
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
}
|
||||
type UserCollection struct {
|
||||
types.Collection
|
||||
|
Loading…
Reference in New Issue
Block a user