mirror of
https://github.com/rancher/types.git
synced 2025-09-15 22:39:05 +00:00
Updated generated code
This commit is contained in:
251
apis/project.cattle.io/v3/zz_generated_deepcopy.go
Normal file
251
apis/project.cattle.io/v3/zz_generated_deepcopy.go
Normal file
@@ -0,0 +1,251 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
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 *DeployConfig) DeepCopyInto(out *DeployConfig) {
|
||||
*out = *in
|
||||
if in.DeploymentStrategy != nil {
|
||||
in, out := &in.DeploymentStrategy, &out.DeploymentStrategy
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(DeployStrategy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployConfig.
|
||||
func (in *DeployConfig) DeepCopy() *DeployConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeployConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeployStrategy) DeepCopyInto(out *DeployStrategy) {
|
||||
*out = *in
|
||||
if in.ParallelConfig != nil {
|
||||
in, out := &in.ParallelConfig, &out.ParallelConfig
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(DeploymentParallelConfig)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.JobConfig != nil {
|
||||
in, out := &in.JobConfig, &out.JobConfig
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(DeploymentJobConfig)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.OrderedConfig != nil {
|
||||
in, out := &in.OrderedConfig, &out.OrderedConfig
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(DeploymentOrderedConfig)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.GlobalConfig != nil {
|
||||
in, out := &in.GlobalConfig, &out.GlobalConfig
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(DeploymentGlobalConfig)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployStrategy.
|
||||
func (in *DeployStrategy) DeepCopy() *DeployStrategy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeployStrategy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeploymentGlobalConfig) DeepCopyInto(out *DeploymentGlobalConfig) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentGlobalConfig.
|
||||
func (in *DeploymentGlobalConfig) DeepCopy() *DeploymentGlobalConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeploymentGlobalConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeploymentJobConfig) DeepCopyInto(out *DeploymentJobConfig) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentJobConfig.
|
||||
func (in *DeploymentJobConfig) DeepCopy() *DeploymentJobConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeploymentJobConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeploymentOrderedConfig) DeepCopyInto(out *DeploymentOrderedConfig) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentOrderedConfig.
|
||||
func (in *DeploymentOrderedConfig) DeepCopy() *DeploymentOrderedConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeploymentOrderedConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeploymentParallelConfig) DeepCopyInto(out *DeploymentParallelConfig) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentParallelConfig.
|
||||
func (in *DeploymentParallelConfig) DeepCopy() *DeploymentParallelConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeploymentParallelConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Workload) DeepCopyInto(out *Workload) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
if in.Status != nil {
|
||||
in, out := &in.Status, &out.Status
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(WorkloadStatus)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workload.
|
||||
func (in *Workload) DeepCopy() *Workload {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Workload)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Workload) 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 *WorkloadList) DeepCopyInto(out *WorkloadList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Workload, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadList.
|
||||
func (in *WorkloadList) DeepCopy() *WorkloadList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkloadList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *WorkloadList) 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 *WorkloadSpec) DeepCopyInto(out *WorkloadSpec) {
|
||||
*out = *in
|
||||
in.DeployConfig.DeepCopyInto(&out.DeployConfig)
|
||||
in.Template.DeepCopyInto(&out.Template)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadSpec.
|
||||
func (in *WorkloadSpec) DeepCopy() *WorkloadSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkloadSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkloadStatus) DeepCopyInto(out *WorkloadStatus) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadStatus.
|
||||
func (in *WorkloadStatus) DeepCopy() *WorkloadStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkloadStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
69
apis/project.cattle.io/v3/zz_generated_k8s_client.go
Normal file
69
apis/project.cattle.io/v3/zz_generated_k8s_client.go
Normal file
@@ -0,0 +1,69 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/rancher/norman/clientbase"
|
||||
"github.com/rancher/norman/controller"
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
controller.Starter
|
||||
|
||||
WorkloadsGetter
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sync.Mutex
|
||||
restClient rest.Interface
|
||||
starters []controller.Starter
|
||||
|
||||
workloadControllers map[string]WorkloadController
|
||||
}
|
||||
|
||||
func NewForConfig(config rest.Config) (Interface, error) {
|
||||
if config.NegotiatedSerializer == nil {
|
||||
configConfig := dynamic.ContentConfig()
|
||||
config.NegotiatedSerializer = configConfig.NegotiatedSerializer
|
||||
}
|
||||
|
||||
restClient, err := rest.UnversionedRESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Client{
|
||||
restClient: restClient,
|
||||
|
||||
workloadControllers: map[string]WorkloadController{},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *Client) RESTClient() rest.Interface {
|
||||
return c.restClient
|
||||
}
|
||||
|
||||
func (c *Client) Sync(ctx context.Context) error {
|
||||
return controller.Sync(ctx, c.starters...)
|
||||
}
|
||||
|
||||
func (c *Client) Start(ctx context.Context, threadiness int) error {
|
||||
return controller.Start(ctx, threadiness, c.starters...)
|
||||
}
|
||||
|
||||
type WorkloadsGetter interface {
|
||||
Workloads(namespace string) WorkloadInterface
|
||||
}
|
||||
|
||||
func (c *Client) Workloads(namespace string) WorkloadInterface {
|
||||
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &WorkloadResource, WorkloadGroupVersionKind, workloadFactory{})
|
||||
return &workloadClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
188
apis/project.cattle.io/v3/zz_generated_workload_controller.go
Normal file
188
apis/project.cattle.io/v3/zz_generated_workload_controller.go
Normal file
@@ -0,0 +1,188 @@
|
||||
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 (
|
||||
WorkloadGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: "v3",
|
||||
Group: "project.cattle.io",
|
||||
Kind: "Workload",
|
||||
}
|
||||
WorkloadResource = metav1.APIResource{
|
||||
Name: "workloads",
|
||||
SingularName: "workload",
|
||||
Namespaced: true,
|
||||
|
||||
Kind: WorkloadGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type WorkloadList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Workload
|
||||
}
|
||||
|
||||
type WorkloadHandlerFunc func(key string, obj *Workload) error
|
||||
|
||||
type WorkloadLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*Workload, err error)
|
||||
Get(namespace, name string) (*Workload, error)
|
||||
}
|
||||
|
||||
type WorkloadController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() WorkloadLister
|
||||
AddHandler(handler WorkloadHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type WorkloadInterface interface {
|
||||
ObjectClient() *clientbase.ObjectClient
|
||||
Create(*Workload) (*Workload, error)
|
||||
Get(name string, opts metav1.GetOptions) (*Workload, error)
|
||||
Update(*Workload) (*Workload, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*WorkloadList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() WorkloadController
|
||||
}
|
||||
|
||||
type workloadLister struct {
|
||||
controller *workloadController
|
||||
}
|
||||
|
||||
func (l *workloadLister) List(namespace string, selector labels.Selector) (ret []*Workload, err error) {
|
||||
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
|
||||
ret = append(ret, obj.(*Workload))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (l *workloadLister) Get(namespace, name string) (*Workload, error) {
|
||||
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(schema.GroupResource{
|
||||
Group: WorkloadGroupVersionKind.Group,
|
||||
Resource: "workload",
|
||||
}, name)
|
||||
}
|
||||
return obj.(*Workload), nil
|
||||
}
|
||||
|
||||
type workloadController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *workloadController) Lister() WorkloadLister {
|
||||
return &workloadLister{
|
||||
controller: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *workloadController) AddHandler(handler WorkloadHandlerFunc) {
|
||||
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.(*Workload))
|
||||
})
|
||||
}
|
||||
|
||||
type workloadFactory struct {
|
||||
}
|
||||
|
||||
func (c workloadFactory) Object() runtime.Object {
|
||||
return &Workload{}
|
||||
}
|
||||
|
||||
func (c workloadFactory) List() runtime.Object {
|
||||
return &WorkloadList{}
|
||||
}
|
||||
|
||||
func (s *workloadClient) Controller() WorkloadController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.workloadControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(WorkloadGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
|
||||
c = &workloadController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.workloadControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type workloadClient struct {
|
||||
client *Client
|
||||
ns string
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller WorkloadController
|
||||
}
|
||||
|
||||
func (s *workloadClient) ObjectClient() *clientbase.ObjectClient {
|
||||
return s.objectClient
|
||||
}
|
||||
|
||||
func (s *workloadClient) Create(o *Workload) (*Workload, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*Workload), err
|
||||
}
|
||||
|
||||
func (s *workloadClient) Get(name string, opts metav1.GetOptions) (*Workload, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*Workload), err
|
||||
}
|
||||
|
||||
func (s *workloadClient) Update(o *Workload) (*Workload, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*Workload), err
|
||||
}
|
||||
|
||||
func (s *workloadClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *workloadClient) List(opts metav1.ListOptions) (*WorkloadList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*WorkloadList), err
|
||||
}
|
||||
|
||||
func (s *workloadClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
func (s *workloadClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/lifecycle"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
type WorkloadLifecycle interface {
|
||||
Initialize(obj *Workload) error
|
||||
Remove(obj *Workload) error
|
||||
Updated(obj *Workload) error
|
||||
}
|
||||
|
||||
type workloadLifecycleAdapter struct {
|
||||
lifecycle WorkloadLifecycle
|
||||
}
|
||||
|
||||
func (w *workloadLifecycleAdapter) Initialize(obj runtime.Object) error {
|
||||
return w.lifecycle.Initialize(obj.(*Workload))
|
||||
}
|
||||
|
||||
func (w *workloadLifecycleAdapter) Finalize(obj runtime.Object) error {
|
||||
return w.lifecycle.Remove(obj.(*Workload))
|
||||
}
|
||||
|
||||
func (w *workloadLifecycleAdapter) Updated(obj runtime.Object) error {
|
||||
return w.lifecycle.Updated(obj.(*Workload))
|
||||
}
|
||||
|
||||
func NewWorkloadLifecycleAdapter(name string, client WorkloadInterface, l WorkloadLifecycle) WorkloadHandlerFunc {
|
||||
adapter := &workloadLifecycleAdapter{lifecycle: l}
|
||||
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
|
||||
return func(key string, obj *Workload) error {
|
||||
if obj == nil {
|
||||
return syncFn(key, nil)
|
||||
}
|
||||
return syncFn(key, obj)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user