mirror of
https://github.com/rancher/types.git
synced 2025-09-12 13:03:45 +00:00
Update generated code
This commit is contained in:
268
io.cattle.authorization/v1/zz_generated_deepcopy.go
Normal file
268
io.cattle.authorization/v1/zz_generated_deepcopy.go
Normal file
@@ -0,0 +1,268 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
rbac_v1 "k8s.io/api/rbac/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PodSecurityPolicyTemplate) DeepCopyInto(out *PodSecurityPolicyTemplate) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSecurityPolicyTemplate.
|
||||
func (in *PodSecurityPolicyTemplate) DeepCopy() *PodSecurityPolicyTemplate {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PodSecurityPolicyTemplate)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PodSecurityPolicyTemplate) 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 *PodSecurityPolicyTemplateList) DeepCopyInto(out *PodSecurityPolicyTemplateList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]PodSecurityPolicyTemplate, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSecurityPolicyTemplateList.
|
||||
func (in *PodSecurityPolicyTemplateList) DeepCopy() *PodSecurityPolicyTemplateList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PodSecurityPolicyTemplateList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PodSecurityPolicyTemplateList) 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
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Project.
|
||||
func (in *Project) DeepCopy() *Project {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Project)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Project) 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 *ProjectList) DeepCopyInto(out *ProjectList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Project, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectList.
|
||||
func (in *ProjectList) DeepCopy() *ProjectList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ProjectList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ProjectList) 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 *ProjectRoleBinding) DeepCopyInto(out *ProjectRoleBinding) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Subjects != nil {
|
||||
in, out := &in.Subjects, &out.Subjects
|
||||
*out = make([]rbac_v1.Subject, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectRoleBinding.
|
||||
func (in *ProjectRoleBinding) DeepCopy() *ProjectRoleBinding {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ProjectRoleBinding)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ProjectRoleBinding) 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 *ProjectRoleBindingList) DeepCopyInto(out *ProjectRoleBindingList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ProjectRoleBinding, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectRoleBindingList.
|
||||
func (in *ProjectRoleBindingList) DeepCopy() *ProjectRoleBindingList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ProjectRoleBindingList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ProjectRoleBindingList) 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 *RoleTemplate) DeepCopyInto(out *RoleTemplate) {
|
||||
*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])
|
||||
}
|
||||
}
|
||||
if in.RoleTemplates != nil {
|
||||
in, out := &in.RoleTemplates, &out.RoleTemplates
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleTemplate.
|
||||
func (in *RoleTemplate) DeepCopy() *RoleTemplate {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RoleTemplate)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *RoleTemplate) 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 *RoleTemplateList) DeepCopyInto(out *RoleTemplateList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]RoleTemplate, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleTemplateList.
|
||||
func (in *RoleTemplateList) DeepCopy() *RoleTemplateList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RoleTemplateList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *RoleTemplateList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
@@ -0,0 +1,149 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"context"
|
||||
|
||||
"github.com/rancher/norman/clientbase"
|
||||
"github.com/rancher/norman/controller"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
PodSecurityPolicyTemplateGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: "v1",
|
||||
Group: "io.cattle.authorization",
|
||||
Kind: "PodSecurityPolicyTemplate",
|
||||
}
|
||||
PodSecurityPolicyTemplateResource = metav1.APIResource{
|
||||
Name: "podsecuritypolicytemplates",
|
||||
SingularName: "podsecuritypolicytemplate",
|
||||
Namespaced: false,
|
||||
Kind: PodSecurityPolicyTemplateGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type PodSecurityPolicyTemplateList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Items []PodSecurityPolicyTemplate
|
||||
}
|
||||
|
||||
type PodSecurityPolicyTemplateHandlerFunc func(key string, obj *PodSecurityPolicyTemplate) error
|
||||
|
||||
type PodSecurityPolicyTemplateController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
AddHandler(handler PodSecurityPolicyTemplateHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Start(threadiness int, ctx context.Context) error
|
||||
}
|
||||
|
||||
type PodSecurityPolicyTemplateInterface interface {
|
||||
Create(*PodSecurityPolicyTemplate) (*PodSecurityPolicyTemplate, error)
|
||||
Get(name string, opts metav1.GetOptions) (*PodSecurityPolicyTemplate, error)
|
||||
Update(*PodSecurityPolicyTemplate) (*PodSecurityPolicyTemplate, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*PodSecurityPolicyTemplateList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() (PodSecurityPolicyTemplateController, error)
|
||||
}
|
||||
|
||||
type podSecurityPolicyTemplateController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *podSecurityPolicyTemplateController) AddHandler(handler PodSecurityPolicyTemplateHandlerFunc) {
|
||||
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.(*PodSecurityPolicyTemplate))
|
||||
})
|
||||
}
|
||||
|
||||
type podSecurityPolicyTemplateFactory struct {
|
||||
}
|
||||
|
||||
func (c podSecurityPolicyTemplateFactory) Object() runtime.Object {
|
||||
return &PodSecurityPolicyTemplate{}
|
||||
}
|
||||
|
||||
func (c podSecurityPolicyTemplateFactory) List() runtime.Object {
|
||||
return &PodSecurityPolicyTemplateList{}
|
||||
}
|
||||
|
||||
func NewPodSecurityPolicyTemplateClient(namespace string, config rest.Config) (PodSecurityPolicyTemplateInterface, error) {
|
||||
objectClient, err := clientbase.NewObjectClient(namespace, config, &PodSecurityPolicyTemplateResource, PodSecurityPolicyTemplateGroupVersionKind, podSecurityPolicyTemplateFactory{})
|
||||
return &podSecurityPolicyTemplateClient{
|
||||
objectClient: objectClient,
|
||||
}, err
|
||||
}
|
||||
|
||||
func (s *podSecurityPolicyTemplateClient) Controller() (PodSecurityPolicyTemplateController, error) {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
||||
if s.controller != nil {
|
||||
return s.controller, nil
|
||||
}
|
||||
|
||||
controller, err := controller.NewGenericController(PodSecurityPolicyTemplateGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.controller = &podSecurityPolicyTemplateController{
|
||||
GenericController: controller,
|
||||
}
|
||||
return s.controller, nil
|
||||
}
|
||||
|
||||
type podSecurityPolicyTemplateClient struct {
|
||||
sync.Mutex
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller PodSecurityPolicyTemplateController
|
||||
}
|
||||
|
||||
func (s *podSecurityPolicyTemplateClient) Create(o *PodSecurityPolicyTemplate) (*PodSecurityPolicyTemplate, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*PodSecurityPolicyTemplate), err
|
||||
}
|
||||
|
||||
func (s *podSecurityPolicyTemplateClient) Get(name string, opts metav1.GetOptions) (*PodSecurityPolicyTemplate, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*PodSecurityPolicyTemplate), err
|
||||
}
|
||||
|
||||
func (s *podSecurityPolicyTemplateClient) Update(o *PodSecurityPolicyTemplate) (*PodSecurityPolicyTemplate, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*PodSecurityPolicyTemplate), err
|
||||
}
|
||||
|
||||
func (s *podSecurityPolicyTemplateClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *podSecurityPolicyTemplateClient) List(opts metav1.ListOptions) (*PodSecurityPolicyTemplateList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*PodSecurityPolicyTemplateList), err
|
||||
}
|
||||
|
||||
func (s *podSecurityPolicyTemplateClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
func (s *podSecurityPolicyTemplateClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
149
io.cattle.authorization/v1/zz_generated_project_controller.go
Normal file
149
io.cattle.authorization/v1/zz_generated_project_controller.go
Normal file
@@ -0,0 +1,149 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"context"
|
||||
|
||||
"github.com/rancher/norman/clientbase"
|
||||
"github.com/rancher/norman/controller"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
ProjectGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: "v1",
|
||||
Group: "io.cattle.authorization",
|
||||
Kind: "Project",
|
||||
}
|
||||
ProjectResource = metav1.APIResource{
|
||||
Name: "projects",
|
||||
SingularName: "project",
|
||||
Namespaced: false,
|
||||
Kind: ProjectGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type ProjectList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Items []Project
|
||||
}
|
||||
|
||||
type ProjectHandlerFunc func(key string, obj *Project) error
|
||||
|
||||
type ProjectController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
AddHandler(handler ProjectHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Start(threadiness int, ctx context.Context) error
|
||||
}
|
||||
|
||||
type ProjectInterface interface {
|
||||
Create(*Project) (*Project, error)
|
||||
Get(name string, opts metav1.GetOptions) (*Project, error)
|
||||
Update(*Project) (*Project, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*ProjectList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() (ProjectController, error)
|
||||
}
|
||||
|
||||
type projectController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *projectController) AddHandler(handler ProjectHandlerFunc) {
|
||||
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.(*Project))
|
||||
})
|
||||
}
|
||||
|
||||
type projectFactory struct {
|
||||
}
|
||||
|
||||
func (c projectFactory) Object() runtime.Object {
|
||||
return &Project{}
|
||||
}
|
||||
|
||||
func (c projectFactory) List() runtime.Object {
|
||||
return &ProjectList{}
|
||||
}
|
||||
|
||||
func NewProjectClient(namespace string, config rest.Config) (ProjectInterface, error) {
|
||||
objectClient, err := clientbase.NewObjectClient(namespace, config, &ProjectResource, ProjectGroupVersionKind, projectFactory{})
|
||||
return &projectClient{
|
||||
objectClient: objectClient,
|
||||
}, err
|
||||
}
|
||||
|
||||
func (s *projectClient) Controller() (ProjectController, error) {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
||||
if s.controller != nil {
|
||||
return s.controller, nil
|
||||
}
|
||||
|
||||
controller, err := controller.NewGenericController(ProjectGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.controller = &projectController{
|
||||
GenericController: controller,
|
||||
}
|
||||
return s.controller, nil
|
||||
}
|
||||
|
||||
type projectClient struct {
|
||||
sync.Mutex
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller ProjectController
|
||||
}
|
||||
|
||||
func (s *projectClient) Create(o *Project) (*Project, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*Project), err
|
||||
}
|
||||
|
||||
func (s *projectClient) Get(name string, opts metav1.GetOptions) (*Project, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*Project), err
|
||||
}
|
||||
|
||||
func (s *projectClient) Update(o *Project) (*Project, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*Project), err
|
||||
}
|
||||
|
||||
func (s *projectClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *projectClient) List(opts metav1.ListOptions) (*ProjectList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*ProjectList), err
|
||||
}
|
||||
|
||||
func (s *projectClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
func (s *projectClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
@@ -0,0 +1,149 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"context"
|
||||
|
||||
"github.com/rancher/norman/clientbase"
|
||||
"github.com/rancher/norman/controller"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
ProjectRoleBindingGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: "v1",
|
||||
Group: "io.cattle.authorization",
|
||||
Kind: "ProjectRoleBinding",
|
||||
}
|
||||
ProjectRoleBindingResource = metav1.APIResource{
|
||||
Name: "projectrolebindings",
|
||||
SingularName: "projectrolebinding",
|
||||
Namespaced: false,
|
||||
Kind: ProjectRoleBindingGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type ProjectRoleBindingList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Items []ProjectRoleBinding
|
||||
}
|
||||
|
||||
type ProjectRoleBindingHandlerFunc func(key string, obj *ProjectRoleBinding) error
|
||||
|
||||
type ProjectRoleBindingController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
AddHandler(handler ProjectRoleBindingHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Start(threadiness int, ctx context.Context) error
|
||||
}
|
||||
|
||||
type ProjectRoleBindingInterface interface {
|
||||
Create(*ProjectRoleBinding) (*ProjectRoleBinding, error)
|
||||
Get(name string, opts metav1.GetOptions) (*ProjectRoleBinding, error)
|
||||
Update(*ProjectRoleBinding) (*ProjectRoleBinding, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*ProjectRoleBindingList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() (ProjectRoleBindingController, error)
|
||||
}
|
||||
|
||||
type projectRoleBindingController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *projectRoleBindingController) AddHandler(handler ProjectRoleBindingHandlerFunc) {
|
||||
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.(*ProjectRoleBinding))
|
||||
})
|
||||
}
|
||||
|
||||
type projectRoleBindingFactory struct {
|
||||
}
|
||||
|
||||
func (c projectRoleBindingFactory) Object() runtime.Object {
|
||||
return &ProjectRoleBinding{}
|
||||
}
|
||||
|
||||
func (c projectRoleBindingFactory) List() runtime.Object {
|
||||
return &ProjectRoleBindingList{}
|
||||
}
|
||||
|
||||
func NewProjectRoleBindingClient(namespace string, config rest.Config) (ProjectRoleBindingInterface, error) {
|
||||
objectClient, err := clientbase.NewObjectClient(namespace, config, &ProjectRoleBindingResource, ProjectRoleBindingGroupVersionKind, projectRoleBindingFactory{})
|
||||
return &projectRoleBindingClient{
|
||||
objectClient: objectClient,
|
||||
}, err
|
||||
}
|
||||
|
||||
func (s *projectRoleBindingClient) Controller() (ProjectRoleBindingController, error) {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
||||
if s.controller != nil {
|
||||
return s.controller, nil
|
||||
}
|
||||
|
||||
controller, err := controller.NewGenericController(ProjectRoleBindingGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.controller = &projectRoleBindingController{
|
||||
GenericController: controller,
|
||||
}
|
||||
return s.controller, nil
|
||||
}
|
||||
|
||||
type projectRoleBindingClient struct {
|
||||
sync.Mutex
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller ProjectRoleBindingController
|
||||
}
|
||||
|
||||
func (s *projectRoleBindingClient) Create(o *ProjectRoleBinding) (*ProjectRoleBinding, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*ProjectRoleBinding), err
|
||||
}
|
||||
|
||||
func (s *projectRoleBindingClient) Get(name string, opts metav1.GetOptions) (*ProjectRoleBinding, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*ProjectRoleBinding), err
|
||||
}
|
||||
|
||||
func (s *projectRoleBindingClient) Update(o *ProjectRoleBinding) (*ProjectRoleBinding, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*ProjectRoleBinding), err
|
||||
}
|
||||
|
||||
func (s *projectRoleBindingClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *projectRoleBindingClient) List(opts metav1.ListOptions) (*ProjectRoleBindingList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*ProjectRoleBindingList), err
|
||||
}
|
||||
|
||||
func (s *projectRoleBindingClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
func (s *projectRoleBindingClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
@@ -0,0 +1,149 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"context"
|
||||
|
||||
"github.com/rancher/norman/clientbase"
|
||||
"github.com/rancher/norman/controller"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
RoleTemplateGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: "v1",
|
||||
Group: "io.cattle.authorization",
|
||||
Kind: "RoleTemplate",
|
||||
}
|
||||
RoleTemplateResource = metav1.APIResource{
|
||||
Name: "roletemplates",
|
||||
SingularName: "roletemplate",
|
||||
Namespaced: false,
|
||||
Kind: RoleTemplateGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type RoleTemplateList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Items []RoleTemplate
|
||||
}
|
||||
|
||||
type RoleTemplateHandlerFunc func(key string, obj *RoleTemplate) error
|
||||
|
||||
type RoleTemplateController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
AddHandler(handler RoleTemplateHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Start(threadiness int, ctx context.Context) error
|
||||
}
|
||||
|
||||
type RoleTemplateInterface interface {
|
||||
Create(*RoleTemplate) (*RoleTemplate, error)
|
||||
Get(name string, opts metav1.GetOptions) (*RoleTemplate, error)
|
||||
Update(*RoleTemplate) (*RoleTemplate, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*RoleTemplateList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() (RoleTemplateController, error)
|
||||
}
|
||||
|
||||
type roleTemplateController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *roleTemplateController) AddHandler(handler RoleTemplateHandlerFunc) {
|
||||
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.(*RoleTemplate))
|
||||
})
|
||||
}
|
||||
|
||||
type roleTemplateFactory struct {
|
||||
}
|
||||
|
||||
func (c roleTemplateFactory) Object() runtime.Object {
|
||||
return &RoleTemplate{}
|
||||
}
|
||||
|
||||
func (c roleTemplateFactory) List() runtime.Object {
|
||||
return &RoleTemplateList{}
|
||||
}
|
||||
|
||||
func NewRoleTemplateClient(namespace string, config rest.Config) (RoleTemplateInterface, error) {
|
||||
objectClient, err := clientbase.NewObjectClient(namespace, config, &RoleTemplateResource, RoleTemplateGroupVersionKind, roleTemplateFactory{})
|
||||
return &roleTemplateClient{
|
||||
objectClient: objectClient,
|
||||
}, err
|
||||
}
|
||||
|
||||
func (s *roleTemplateClient) Controller() (RoleTemplateController, error) {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
||||
if s.controller != nil {
|
||||
return s.controller, nil
|
||||
}
|
||||
|
||||
controller, err := controller.NewGenericController(RoleTemplateGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.controller = &roleTemplateController{
|
||||
GenericController: controller,
|
||||
}
|
||||
return s.controller, nil
|
||||
}
|
||||
|
||||
type roleTemplateClient struct {
|
||||
sync.Mutex
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller RoleTemplateController
|
||||
}
|
||||
|
||||
func (s *roleTemplateClient) Create(o *RoleTemplate) (*RoleTemplate, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*RoleTemplate), err
|
||||
}
|
||||
|
||||
func (s *roleTemplateClient) Get(name string, opts metav1.GetOptions) (*RoleTemplate, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*RoleTemplate), err
|
||||
}
|
||||
|
||||
func (s *roleTemplateClient) Update(o *RoleTemplate) (*RoleTemplate, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*RoleTemplate), err
|
||||
}
|
||||
|
||||
func (s *roleTemplateClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *roleTemplateClient) List(opts metav1.ListOptions) (*RoleTemplateList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*RoleTemplateList), err
|
||||
}
|
||||
|
||||
func (s *roleTemplateClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
func (s *roleTemplateClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
Reference in New Issue
Block a user