mirror of
https://github.com/rancher/types.git
synced 2025-07-01 07:51:48 +00:00
Generated changes
This commit is contained in:
parent
a13c7fffd9
commit
4268be633d
@ -147,6 +147,22 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
in.(*GithubCredential).DeepCopyInto(out.(*GithubCredential))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&GithubCredential{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*GlobalRole).DeepCopyInto(out.(*GlobalRole))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&GlobalRole{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*GlobalRoleBinding).DeepCopyInto(out.(*GlobalRoleBinding))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&GlobalRoleBinding{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*GlobalRoleBindingList).DeepCopyInto(out.(*GlobalRoleBindingList))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&GlobalRoleBindingList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*GlobalRoleList).DeepCopyInto(out.(*GlobalRoleList))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&GlobalRoleList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*GoogleKubernetesEngineConfig).DeepCopyInto(out.(*GoogleKubernetesEngineConfig))
|
||||
return nil
|
||||
@ -1232,6 +1248,136 @@ func (in *GithubCredential) DeepCopy() *GithubCredential {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GlobalRole) DeepCopyInto(out *GlobalRole) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]rbac_v1.PolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalRole.
|
||||
func (in *GlobalRole) DeepCopy() *GlobalRole {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GlobalRole)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GlobalRole) 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 *GlobalRoleBinding) DeepCopyInto(out *GlobalRoleBinding) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Subject = in.Subject
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalRoleBinding.
|
||||
func (in *GlobalRoleBinding) DeepCopy() *GlobalRoleBinding {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GlobalRoleBinding)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GlobalRoleBinding) 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 *GlobalRoleBindingList) DeepCopyInto(out *GlobalRoleBindingList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]GlobalRoleBinding, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalRoleBindingList.
|
||||
func (in *GlobalRoleBindingList) DeepCopy() *GlobalRoleBindingList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GlobalRoleBindingList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GlobalRoleBindingList) 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 *GlobalRoleList) DeepCopyInto(out *GlobalRoleList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]GlobalRole, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalRoleList.
|
||||
func (in *GlobalRoleList) DeepCopy() *GlobalRoleList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GlobalRoleList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *GlobalRoleList) 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
|
||||
|
@ -0,0 +1,204 @@
|
||||
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 (
|
||||
GlobalRoleBindingGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: Version,
|
||||
Group: GroupName,
|
||||
Kind: "GlobalRoleBinding",
|
||||
}
|
||||
GlobalRoleBindingResource = metav1.APIResource{
|
||||
Name: "globalrolebindings",
|
||||
SingularName: "globalrolebinding",
|
||||
Namespaced: false,
|
||||
Kind: GlobalRoleBindingGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type GlobalRoleBindingList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []GlobalRoleBinding
|
||||
}
|
||||
|
||||
type GlobalRoleBindingHandlerFunc func(key string, obj *GlobalRoleBinding) error
|
||||
|
||||
type GlobalRoleBindingLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*GlobalRoleBinding, err error)
|
||||
Get(namespace, name string) (*GlobalRoleBinding, error)
|
||||
}
|
||||
|
||||
type GlobalRoleBindingController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() GlobalRoleBindingLister
|
||||
AddHandler(handler GlobalRoleBindingHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type GlobalRoleBindingInterface interface {
|
||||
ObjectClient() *clientbase.ObjectClient
|
||||
Create(*GlobalRoleBinding) (*GlobalRoleBinding, error)
|
||||
Get(name string, opts metav1.GetOptions) (*GlobalRoleBinding, error)
|
||||
Update(*GlobalRoleBinding) (*GlobalRoleBinding, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*GlobalRoleBindingList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() GlobalRoleBindingController
|
||||
AddSyncHandler(sync GlobalRoleBindingHandlerFunc)
|
||||
AddLifecycle(name string, lifecycle GlobalRoleBindingLifecycle)
|
||||
}
|
||||
|
||||
type globalRoleBindingLister struct {
|
||||
controller *globalRoleBindingController
|
||||
}
|
||||
|
||||
func (l *globalRoleBindingLister) List(namespace string, selector labels.Selector) (ret []*GlobalRoleBinding, err error) {
|
||||
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
|
||||
ret = append(ret, obj.(*GlobalRoleBinding))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (l *globalRoleBindingLister) Get(namespace, name string) (*GlobalRoleBinding, 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: GlobalRoleBindingGroupVersionKind.Group,
|
||||
Resource: "globalRoleBinding",
|
||||
}, name)
|
||||
}
|
||||
return obj.(*GlobalRoleBinding), nil
|
||||
}
|
||||
|
||||
type globalRoleBindingController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *globalRoleBindingController) Lister() GlobalRoleBindingLister {
|
||||
return &globalRoleBindingLister{
|
||||
controller: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *globalRoleBindingController) AddHandler(handler GlobalRoleBindingHandlerFunc) {
|
||||
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.(*GlobalRoleBinding))
|
||||
})
|
||||
}
|
||||
|
||||
type globalRoleBindingFactory struct {
|
||||
}
|
||||
|
||||
func (c globalRoleBindingFactory) Object() runtime.Object {
|
||||
return &GlobalRoleBinding{}
|
||||
}
|
||||
|
||||
func (c globalRoleBindingFactory) List() runtime.Object {
|
||||
return &GlobalRoleBindingList{}
|
||||
}
|
||||
|
||||
func (s *globalRoleBindingClient) Controller() GlobalRoleBindingController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.globalRoleBindingControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(GlobalRoleBindingGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
|
||||
c = &globalRoleBindingController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.globalRoleBindingControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type globalRoleBindingClient struct {
|
||||
client *Client
|
||||
ns string
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller GlobalRoleBindingController
|
||||
}
|
||||
|
||||
func (s *globalRoleBindingClient) ObjectClient() *clientbase.ObjectClient {
|
||||
return s.objectClient
|
||||
}
|
||||
|
||||
func (s *globalRoleBindingClient) Create(o *GlobalRoleBinding) (*GlobalRoleBinding, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*GlobalRoleBinding), err
|
||||
}
|
||||
|
||||
func (s *globalRoleBindingClient) Get(name string, opts metav1.GetOptions) (*GlobalRoleBinding, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*GlobalRoleBinding), err
|
||||
}
|
||||
|
||||
func (s *globalRoleBindingClient) Update(o *GlobalRoleBinding) (*GlobalRoleBinding, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*GlobalRoleBinding), err
|
||||
}
|
||||
|
||||
func (s *globalRoleBindingClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *globalRoleBindingClient) List(opts metav1.ListOptions) (*GlobalRoleBindingList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*GlobalRoleBindingList), err
|
||||
}
|
||||
|
||||
func (s *globalRoleBindingClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
func (s *globalRoleBindingClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
||||
|
||||
func (s *globalRoleBindingClient) AddSyncHandler(sync GlobalRoleBindingHandlerFunc) {
|
||||
s.Controller().AddHandler(sync)
|
||||
}
|
||||
|
||||
func (s *globalRoleBindingClient) AddLifecycle(name string, lifecycle GlobalRoleBindingLifecycle) {
|
||||
sync := NewGlobalRoleBindingLifecycleAdapter(name, s, lifecycle)
|
||||
s.AddSyncHandler(sync)
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/lifecycle"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
type GlobalRoleBindingLifecycle interface {
|
||||
Create(obj *GlobalRoleBinding) (*GlobalRoleBinding, error)
|
||||
Remove(obj *GlobalRoleBinding) (*GlobalRoleBinding, error)
|
||||
Updated(obj *GlobalRoleBinding) (*GlobalRoleBinding, error)
|
||||
}
|
||||
|
||||
type globalRoleBindingLifecycleAdapter struct {
|
||||
lifecycle GlobalRoleBindingLifecycle
|
||||
}
|
||||
|
||||
func (w *globalRoleBindingLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Create(obj.(*GlobalRoleBinding))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *globalRoleBindingLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Remove(obj.(*GlobalRoleBinding))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *globalRoleBindingLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Updated(obj.(*GlobalRoleBinding))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func NewGlobalRoleBindingLifecycleAdapter(name string, client GlobalRoleBindingInterface, l GlobalRoleBindingLifecycle) GlobalRoleBindingHandlerFunc {
|
||||
adapter := &globalRoleBindingLifecycleAdapter{lifecycle: l}
|
||||
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
|
||||
return func(key string, obj *GlobalRoleBinding) error {
|
||||
if obj == nil {
|
||||
return syncFn(key, nil)
|
||||
}
|
||||
return syncFn(key, obj)
|
||||
}
|
||||
}
|
@ -0,0 +1,204 @@
|
||||
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 (
|
||||
GlobalRoleGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: Version,
|
||||
Group: GroupName,
|
||||
Kind: "GlobalRole",
|
||||
}
|
||||
GlobalRoleResource = metav1.APIResource{
|
||||
Name: "globalroles",
|
||||
SingularName: "globalrole",
|
||||
Namespaced: false,
|
||||
Kind: GlobalRoleGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type GlobalRoleList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []GlobalRole
|
||||
}
|
||||
|
||||
type GlobalRoleHandlerFunc func(key string, obj *GlobalRole) error
|
||||
|
||||
type GlobalRoleLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*GlobalRole, err error)
|
||||
Get(namespace, name string) (*GlobalRole, error)
|
||||
}
|
||||
|
||||
type GlobalRoleController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() GlobalRoleLister
|
||||
AddHandler(handler GlobalRoleHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type GlobalRoleInterface interface {
|
||||
ObjectClient() *clientbase.ObjectClient
|
||||
Create(*GlobalRole) (*GlobalRole, error)
|
||||
Get(name string, opts metav1.GetOptions) (*GlobalRole, error)
|
||||
Update(*GlobalRole) (*GlobalRole, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*GlobalRoleList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() GlobalRoleController
|
||||
AddSyncHandler(sync GlobalRoleHandlerFunc)
|
||||
AddLifecycle(name string, lifecycle GlobalRoleLifecycle)
|
||||
}
|
||||
|
||||
type globalRoleLister struct {
|
||||
controller *globalRoleController
|
||||
}
|
||||
|
||||
func (l *globalRoleLister) List(namespace string, selector labels.Selector) (ret []*GlobalRole, err error) {
|
||||
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
|
||||
ret = append(ret, obj.(*GlobalRole))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (l *globalRoleLister) Get(namespace, name string) (*GlobalRole, 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: GlobalRoleGroupVersionKind.Group,
|
||||
Resource: "globalRole",
|
||||
}, name)
|
||||
}
|
||||
return obj.(*GlobalRole), nil
|
||||
}
|
||||
|
||||
type globalRoleController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *globalRoleController) Lister() GlobalRoleLister {
|
||||
return &globalRoleLister{
|
||||
controller: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *globalRoleController) AddHandler(handler GlobalRoleHandlerFunc) {
|
||||
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.(*GlobalRole))
|
||||
})
|
||||
}
|
||||
|
||||
type globalRoleFactory struct {
|
||||
}
|
||||
|
||||
func (c globalRoleFactory) Object() runtime.Object {
|
||||
return &GlobalRole{}
|
||||
}
|
||||
|
||||
func (c globalRoleFactory) List() runtime.Object {
|
||||
return &GlobalRoleList{}
|
||||
}
|
||||
|
||||
func (s *globalRoleClient) Controller() GlobalRoleController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.globalRoleControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(GlobalRoleGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
|
||||
c = &globalRoleController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.globalRoleControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type globalRoleClient struct {
|
||||
client *Client
|
||||
ns string
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller GlobalRoleController
|
||||
}
|
||||
|
||||
func (s *globalRoleClient) ObjectClient() *clientbase.ObjectClient {
|
||||
return s.objectClient
|
||||
}
|
||||
|
||||
func (s *globalRoleClient) Create(o *GlobalRole) (*GlobalRole, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*GlobalRole), err
|
||||
}
|
||||
|
||||
func (s *globalRoleClient) Get(name string, opts metav1.GetOptions) (*GlobalRole, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*GlobalRole), err
|
||||
}
|
||||
|
||||
func (s *globalRoleClient) Update(o *GlobalRole) (*GlobalRole, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*GlobalRole), err
|
||||
}
|
||||
|
||||
func (s *globalRoleClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *globalRoleClient) List(opts metav1.ListOptions) (*GlobalRoleList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*GlobalRoleList), err
|
||||
}
|
||||
|
||||
func (s *globalRoleClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
func (s *globalRoleClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
||||
|
||||
func (s *globalRoleClient) AddSyncHandler(sync GlobalRoleHandlerFunc) {
|
||||
s.Controller().AddHandler(sync)
|
||||
}
|
||||
|
||||
func (s *globalRoleClient) AddLifecycle(name string, lifecycle GlobalRoleLifecycle) {
|
||||
sync := NewGlobalRoleLifecycleAdapter(name, s, lifecycle)
|
||||
s.AddSyncHandler(sync)
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/lifecycle"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
type GlobalRoleLifecycle interface {
|
||||
Create(obj *GlobalRole) (*GlobalRole, error)
|
||||
Remove(obj *GlobalRole) (*GlobalRole, error)
|
||||
Updated(obj *GlobalRole) (*GlobalRole, error)
|
||||
}
|
||||
|
||||
type globalRoleLifecycleAdapter struct {
|
||||
lifecycle GlobalRoleLifecycle
|
||||
}
|
||||
|
||||
func (w *globalRoleLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Create(obj.(*GlobalRole))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *globalRoleLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Remove(obj.(*GlobalRole))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *globalRoleLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Updated(obj.(*GlobalRole))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func NewGlobalRoleLifecycleAdapter(name string, client GlobalRoleInterface, l GlobalRoleLifecycle) GlobalRoleHandlerFunc {
|
||||
adapter := &globalRoleLifecycleAdapter{lifecycle: l}
|
||||
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
|
||||
return func(key string, obj *GlobalRole) error {
|
||||
if obj == nil {
|
||||
return syncFn(key, nil)
|
||||
}
|
||||
return syncFn(key, obj)
|
||||
}
|
||||
}
|
@ -18,6 +18,8 @@ type Interface interface {
|
||||
MachineDriversGetter
|
||||
MachineTemplatesGetter
|
||||
ProjectsGetter
|
||||
GlobalRolesGetter
|
||||
GlobalRoleBindingsGetter
|
||||
RoleTemplatesGetter
|
||||
PodSecurityPolicyTemplatesGetter
|
||||
ClusterRoleTemplateBindingsGetter
|
||||
@ -45,6 +47,8 @@ type Client struct {
|
||||
machineDriverControllers map[string]MachineDriverController
|
||||
machineTemplateControllers map[string]MachineTemplateController
|
||||
projectControllers map[string]ProjectController
|
||||
globalRoleControllers map[string]GlobalRoleController
|
||||
globalRoleBindingControllers map[string]GlobalRoleBindingController
|
||||
roleTemplateControllers map[string]RoleTemplateController
|
||||
podSecurityPolicyTemplateControllers map[string]PodSecurityPolicyTemplateController
|
||||
clusterRoleTemplateBindingControllers map[string]ClusterRoleTemplateBindingController
|
||||
@ -81,6 +85,8 @@ func NewForConfig(config rest.Config) (Interface, error) {
|
||||
machineDriverControllers: map[string]MachineDriverController{},
|
||||
machineTemplateControllers: map[string]MachineTemplateController{},
|
||||
projectControllers: map[string]ProjectController{},
|
||||
globalRoleControllers: map[string]GlobalRoleController{},
|
||||
globalRoleBindingControllers: map[string]GlobalRoleBindingController{},
|
||||
roleTemplateControllers: map[string]RoleTemplateController{},
|
||||
podSecurityPolicyTemplateControllers: map[string]PodSecurityPolicyTemplateController{},
|
||||
clusterRoleTemplateBindingControllers: map[string]ClusterRoleTemplateBindingController{},
|
||||
@ -164,6 +170,32 @@ func (c *Client) Projects(namespace string) ProjectInterface {
|
||||
}
|
||||
}
|
||||
|
||||
type GlobalRolesGetter interface {
|
||||
GlobalRoles(namespace string) GlobalRoleInterface
|
||||
}
|
||||
|
||||
func (c *Client) GlobalRoles(namespace string) GlobalRoleInterface {
|
||||
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &GlobalRoleResource, GlobalRoleGroupVersionKind, globalRoleFactory{})
|
||||
return &globalRoleClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
||||
type GlobalRoleBindingsGetter interface {
|
||||
GlobalRoleBindings(namespace string) GlobalRoleBindingInterface
|
||||
}
|
||||
|
||||
func (c *Client) GlobalRoleBindings(namespace string) GlobalRoleBindingInterface {
|
||||
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &GlobalRoleBindingResource, GlobalRoleBindingGroupVersionKind, globalRoleBindingFactory{})
|
||||
return &globalRoleBindingClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
||||
type RoleTemplatesGetter interface {
|
||||
RoleTemplates(namespace string) RoleTemplateInterface
|
||||
}
|
||||
|
@ -41,6 +41,10 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
&MachineTemplateList{},
|
||||
&Project{},
|
||||
&ProjectList{},
|
||||
&GlobalRole{},
|
||||
&GlobalRoleList{},
|
||||
&GlobalRoleBinding{},
|
||||
&GlobalRoleBindingList{},
|
||||
&RoleTemplate{},
|
||||
&RoleTemplateList{},
|
||||
&PodSecurityPolicyTemplate{},
|
||||
|
@ -12,6 +12,8 @@ type Client struct {
|
||||
MachineDriver MachineDriverOperations
|
||||
MachineTemplate MachineTemplateOperations
|
||||
Project ProjectOperations
|
||||
GlobalRole GlobalRoleOperations
|
||||
GlobalRoleBinding GlobalRoleBindingOperations
|
||||
RoleTemplate RoleTemplateOperations
|
||||
PodSecurityPolicyTemplate PodSecurityPolicyTemplateOperations
|
||||
ClusterRoleTemplateBinding ClusterRoleTemplateBindingOperations
|
||||
@ -45,6 +47,8 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
|
||||
client.MachineDriver = newMachineDriverClient(client)
|
||||
client.MachineTemplate = newMachineTemplateClient(client)
|
||||
client.Project = newProjectClient(client)
|
||||
client.GlobalRole = newGlobalRoleClient(client)
|
||||
client.GlobalRoleBinding = newGlobalRoleBindingClient(client)
|
||||
client.RoleTemplate = newRoleTemplateClient(client)
|
||||
client.PodSecurityPolicyTemplate = newPodSecurityPolicyTemplateClient(client)
|
||||
client.ClusterRoleTemplateBinding = newClusterRoleTemplateBindingClient(client)
|
||||
|
97
client/management/v3/zz_generated_global_role.go
Normal file
97
client/management/v3/zz_generated_global_role.go
Normal file
@ -0,0 +1,97 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/types"
|
||||
)
|
||||
|
||||
const (
|
||||
GlobalRoleType = "globalRole"
|
||||
GlobalRoleFieldAnnotations = "annotations"
|
||||
GlobalRoleFieldBuiltin = "builtin"
|
||||
GlobalRoleFieldCreated = "created"
|
||||
GlobalRoleFieldFinalizers = "finalizers"
|
||||
GlobalRoleFieldLabels = "labels"
|
||||
GlobalRoleFieldName = "name"
|
||||
GlobalRoleFieldOwnerReferences = "ownerReferences"
|
||||
GlobalRoleFieldRemoved = "removed"
|
||||
GlobalRoleFieldResourcePath = "resourcePath"
|
||||
GlobalRoleFieldRules = "rules"
|
||||
GlobalRoleFieldUuid = "uuid"
|
||||
)
|
||||
|
||||
type GlobalRole struct {
|
||||
types.Resource
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Builtin *bool `json:"builtin,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"`
|
||||
Rules []PolicyRule `json:"rules,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
}
|
||||
type GlobalRoleCollection struct {
|
||||
types.Collection
|
||||
Data []GlobalRole `json:"data,omitempty"`
|
||||
client *GlobalRoleClient
|
||||
}
|
||||
|
||||
type GlobalRoleClient struct {
|
||||
apiClient *Client
|
||||
}
|
||||
|
||||
type GlobalRoleOperations interface {
|
||||
List(opts *types.ListOpts) (*GlobalRoleCollection, error)
|
||||
Create(opts *GlobalRole) (*GlobalRole, error)
|
||||
Update(existing *GlobalRole, updates interface{}) (*GlobalRole, error)
|
||||
ByID(id string) (*GlobalRole, error)
|
||||
Delete(container *GlobalRole) error
|
||||
}
|
||||
|
||||
func newGlobalRoleClient(apiClient *Client) *GlobalRoleClient {
|
||||
return &GlobalRoleClient{
|
||||
apiClient: apiClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *GlobalRoleClient) Create(container *GlobalRole) (*GlobalRole, error) {
|
||||
resp := &GlobalRole{}
|
||||
err := c.apiClient.Ops.DoCreate(GlobalRoleType, container, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *GlobalRoleClient) Update(existing *GlobalRole, updates interface{}) (*GlobalRole, error) {
|
||||
resp := &GlobalRole{}
|
||||
err := c.apiClient.Ops.DoUpdate(GlobalRoleType, &existing.Resource, updates, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *GlobalRoleClient) List(opts *types.ListOpts) (*GlobalRoleCollection, error) {
|
||||
resp := &GlobalRoleCollection{}
|
||||
err := c.apiClient.Ops.DoList(GlobalRoleType, opts, resp)
|
||||
resp.client = c
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (cc *GlobalRoleCollection) Next() (*GlobalRoleCollection, error) {
|
||||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
|
||||
resp := &GlobalRoleCollection{}
|
||||
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
|
||||
resp.client = cc.client
|
||||
return resp, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *GlobalRoleClient) ByID(id string) (*GlobalRole, error) {
|
||||
resp := &GlobalRole{}
|
||||
err := c.apiClient.Ops.DoByID(GlobalRoleType, id, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *GlobalRoleClient) Delete(container *GlobalRole) error {
|
||||
return c.apiClient.Ops.DoResourceDelete(GlobalRoleType, &container.Resource)
|
||||
}
|
97
client/management/v3/zz_generated_global_role_binding.go
Normal file
97
client/management/v3/zz_generated_global_role_binding.go
Normal file
@ -0,0 +1,97 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/types"
|
||||
)
|
||||
|
||||
const (
|
||||
GlobalRoleBindingType = "globalRoleBinding"
|
||||
GlobalRoleBindingFieldAnnotations = "annotations"
|
||||
GlobalRoleBindingFieldCreated = "created"
|
||||
GlobalRoleBindingFieldFinalizers = "finalizers"
|
||||
GlobalRoleBindingFieldGlobalRoleId = "globalRoleId"
|
||||
GlobalRoleBindingFieldLabels = "labels"
|
||||
GlobalRoleBindingFieldName = "name"
|
||||
GlobalRoleBindingFieldOwnerReferences = "ownerReferences"
|
||||
GlobalRoleBindingFieldRemoved = "removed"
|
||||
GlobalRoleBindingFieldResourcePath = "resourcePath"
|
||||
GlobalRoleBindingFieldSubject = "subject"
|
||||
GlobalRoleBindingFieldUuid = "uuid"
|
||||
)
|
||||
|
||||
type GlobalRoleBinding struct {
|
||||
types.Resource
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Finalizers []string `json:"finalizers,omitempty"`
|
||||
GlobalRoleId string `json:"globalRoleId,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"`
|
||||
Subject *Subject `json:"subject,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
}
|
||||
type GlobalRoleBindingCollection struct {
|
||||
types.Collection
|
||||
Data []GlobalRoleBinding `json:"data,omitempty"`
|
||||
client *GlobalRoleBindingClient
|
||||
}
|
||||
|
||||
type GlobalRoleBindingClient struct {
|
||||
apiClient *Client
|
||||
}
|
||||
|
||||
type GlobalRoleBindingOperations interface {
|
||||
List(opts *types.ListOpts) (*GlobalRoleBindingCollection, error)
|
||||
Create(opts *GlobalRoleBinding) (*GlobalRoleBinding, error)
|
||||
Update(existing *GlobalRoleBinding, updates interface{}) (*GlobalRoleBinding, error)
|
||||
ByID(id string) (*GlobalRoleBinding, error)
|
||||
Delete(container *GlobalRoleBinding) error
|
||||
}
|
||||
|
||||
func newGlobalRoleBindingClient(apiClient *Client) *GlobalRoleBindingClient {
|
||||
return &GlobalRoleBindingClient{
|
||||
apiClient: apiClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *GlobalRoleBindingClient) Create(container *GlobalRoleBinding) (*GlobalRoleBinding, error) {
|
||||
resp := &GlobalRoleBinding{}
|
||||
err := c.apiClient.Ops.DoCreate(GlobalRoleBindingType, container, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *GlobalRoleBindingClient) Update(existing *GlobalRoleBinding, updates interface{}) (*GlobalRoleBinding, error) {
|
||||
resp := &GlobalRoleBinding{}
|
||||
err := c.apiClient.Ops.DoUpdate(GlobalRoleBindingType, &existing.Resource, updates, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *GlobalRoleBindingClient) List(opts *types.ListOpts) (*GlobalRoleBindingCollection, error) {
|
||||
resp := &GlobalRoleBindingCollection{}
|
||||
err := c.apiClient.Ops.DoList(GlobalRoleBindingType, opts, resp)
|
||||
resp.client = c
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (cc *GlobalRoleBindingCollection) Next() (*GlobalRoleBindingCollection, error) {
|
||||
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
|
||||
resp := &GlobalRoleBindingCollection{}
|
||||
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
|
||||
resp.client = cc.client
|
||||
return resp, err
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *GlobalRoleBindingClient) ByID(id string) (*GlobalRoleBinding, error) {
|
||||
resp := &GlobalRoleBinding{}
|
||||
err := c.apiClient.Ops.DoByID(GlobalRoleBindingType, id, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *GlobalRoleBindingClient) Delete(container *GlobalRoleBinding) error {
|
||||
return c.apiClient.Ops.DoResourceDelete(GlobalRoleBindingType, &container.Resource)
|
||||
}
|
@ -9,7 +9,9 @@ const (
|
||||
RoleTemplateFieldAnnotations = "annotations"
|
||||
RoleTemplateFieldBuiltin = "builtin"
|
||||
RoleTemplateFieldCreated = "created"
|
||||
RoleTemplateFieldExternal = "external"
|
||||
RoleTemplateFieldFinalizers = "finalizers"
|
||||
RoleTemplateFieldHidden = "hidden"
|
||||
RoleTemplateFieldLabels = "labels"
|
||||
RoleTemplateFieldName = "name"
|
||||
RoleTemplateFieldOwnerReferences = "ownerReferences"
|
||||
@ -25,7 +27,9 @@ type RoleTemplate struct {
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Builtin *bool `json:"builtin,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
External *bool `json:"external,omitempty"`
|
||||
Finalizers []string `json:"finalizers,omitempty"`
|
||||
Hidden *bool `json:"hidden,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"`
|
||||
|
Loading…
Reference in New Issue
Block a user