diff --git a/.gitignore b/.gitignore index 9fd6ea5f..53580991 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ /dist *.swp /.trash-cache +/trash.lock kube_config* diff --git a/vendor.conf b/vendor.conf index a9057963..9dd738d0 100644 --- a/vendor.conf +++ b/vendor.conf @@ -24,4 +24,4 @@ github.com/coreos/go-semver e214231b295a8ea9479f11b70b35d5acf3556d9 github.com/ugorji/go/codec ccfe18359b55b97855cee1d3f74e5efbda4869dc github.com/rancher/norman ff60298f31f081b06d198815b4c178a578664f7d -github.com/rancher/types 681245a6f5e7b007ae58f0eb3e9f956d93930368 +github.com/rancher/types 733076a260717a97846ce0fcd9066c96ac957aa7 diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/alerting_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/alerting_types.go index 098e47cb..834fd5bd 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/alerting_types.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/alerting_types.go @@ -82,7 +82,7 @@ type TargetPod struct { type TargetEvent struct { EventType string `json:"eventType,omitempty" norman:"required,options=Normal|Warning,default=Warning"` - ResourceKind string `json:"resourceKind,omitempty" norman:"required,options=Pod|Node|Deployment|Statefulset|Daemonset"` + ResourceKind string `json:"resourceKind,omitempty" norman:"required,options=Pod|Node|Deployment|StatefulSet|DaemonSet"` } type TargetWorkload struct { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/catalog_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/catalog_types.go index 2276d84a..d497b7d5 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/catalog_types.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/catalog_types.go @@ -92,7 +92,6 @@ type TemplateSpec struct { } type TemplateStatus struct { - // todo: } type TemplateVersion struct { @@ -114,14 +113,15 @@ type TemplateVersionSpec struct { MaximumRancherVersion string `json:"maximumRancherVersion,omitempty" yaml:"maximum_rancher_version,omitempty"` UpgradeFrom string `json:"upgradeFrom,omitempty" yaml:"upgrade_from,omitempty"` Readme string `json:"readme,omitempty"` + AppReadme string `json:"appReadme,omitempty"` UpgradeVersionLinks map[string]string `json:"upgradeVersionLinks,omitempty"` + Digest string `json:"digest,omitempty"` - Files []File `json:"files,omitempty"` - Questions []Question `json:"questions,omitempty"` + Files map[string]string `json:"files,omitempty"` + Questions []Question `json:"questions,omitempty"` } type TemplateVersionStatus struct { - // todo } type File struct { @@ -130,6 +130,26 @@ type File struct { } type Question struct { + Variable string `json:"variable,omitempty" yaml:"variable,omitempty"` + Label string `json:"label,omitempty" yaml:"label,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` + Required bool `json:"required,omitempty" yaml:"required,omitempty"` + Default string `json:"default,omitempty" yaml:"default,omitempty"` + Group string `json:"group,omitempty" yaml:"group,omitempty"` + MinLength int `json:"minLength,omitempty" yaml:"min_length,omitempty"` + MaxLength int `json:"maxLength,omitempty" yaml:"max_length,omitempty"` + Min int `json:"min,omitempty" yaml:"min,omitempty"` + Max int `json:"max,omitempty" yaml:"max,omitempty"` + Options []string `json:"options,omitempty" yaml:"options,omitempty"` + ValidChars string `json:"validChars,omitempty" yaml:"valid_chars,omitempty"` + InvalidChars string `json:"invalidChars,omitempty" yaml:"invalid_chars,omitempty"` + Subquestions []SubQuestion `json:"subquestions,omitempty" yaml:"subquestions,omitempty"` + ShowIf string `json:"showIf,omitempty" yaml:"show_if,omitempty"` + ShowSubquestionIf string `json:"showSubquestionIf,omitempty" yaml:"show_subquestion_if,omitempty"` +} + +type SubQuestion struct { Variable string `json:"variable,omitempty" yaml:"variable,omitempty"` Label string `json:"label,omitempty" yaml:"label,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` @@ -144,4 +164,15 @@ type Question struct { Options []string `json:"options,omitempty" yaml:"options,omitempty"` ValidChars string `json:"validChars,omitempty" yaml:"valid_chars,omitempty"` InvalidChars string `json:"invalidChars,omitempty" yaml:"invalid_chars,omitempty"` + ShowIf string `json:"showIf,omitempty" yaml:"show_if,omitempty"` +} + +type TemplateContent struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Data string `json:"data,omitempty"` } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/k8s_defaults.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/k8s_defaults.go index e533c989..b3193e3f 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/k8s_defaults.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/k8s_defaults.go @@ -9,6 +9,8 @@ const ( ) var ( + ToolsImage = "rancher/rke-tools:v0.1.1" + // K8sVersionToRKESystemImages - images map for 2.0 K8sVersionToRKESystemImages = map[string]RKESystemImages{ K8sV18: v18SystemImages, @@ -57,11 +59,11 @@ var ( // v18 system images defaults v18SystemImages = RKESystemImages{ Etcd: "rancher/coreos-etcd:v3.0.17", - Kubernetes: "rancher/k8s:" + K8sV18, - Alpine: "alpine:latest", - NginxProxy: "rancher/rke-nginx-proxy:v0.1.1", - CertDownloader: "rancher/rke-cert-deployer:v0.1.1", - KubernetesServicesSidecar: "rancher/rke-service-sidekick:v0.1.2", + Kubernetes: "rancher/hyperkube:v1.8.10", + Alpine: ToolsImage, + NginxProxy: ToolsImage, + CertDownloader: ToolsImage, + KubernetesServicesSidecar: ToolsImage, KubeDNS: "rancher/k8s-dns-kube-dns-amd64:1.14.5", DNSmasq: "rancher/k8s-dns-dnsmasq-nanny-amd64:1.14.5", KubeDNSSidecar: "rancher/k8s-dns-sidecar-amd64:1.14.5", @@ -84,11 +86,11 @@ var ( // v19 system images defaults v19SystemImages = RKESystemImages{ Etcd: "rancher/coreos-etcd:v3.1.12", - Kubernetes: "rancher/k8s:" + K8sV19, - Alpine: "alpine:latest", - NginxProxy: "rancher/rke-nginx-proxy:v0.1.1", - CertDownloader: "rancher/rke-cert-deployer:v0.1.1", - KubernetesServicesSidecar: "rancher/rke-service-sidekick:v0.1.1", + Kubernetes: "rancher/hyperkube:v1.9.5", + Alpine: ToolsImage, + NginxProxy: ToolsImage, + CertDownloader: ToolsImage, + KubernetesServicesSidecar: ToolsImage, KubeDNS: "rancher/k8s-dns-kube-dns-amd64:1.14.7", DNSmasq: "rancher/k8s-dns-dnsmasq-nanny-amd64:1.14.7", KubeDNSSidecar: "rancher/k8s-dns-sidecar-amd64:1.14.7", @@ -116,11 +118,11 @@ var ( // v110 system images defaults v110SystemImages = RKESystemImages{ Etcd: "rancher/coreos-etcd:v3.1.12", - Kubernetes: "rancher/k8s:" + K8sV110, - Alpine: "alpine:latest", - NginxProxy: "rancher/rke-nginx-proxy:v0.1.1", - CertDownloader: "rancher/rke-cert-deployer:v0.1.1", - KubernetesServicesSidecar: "rancher/rke-service-sidekick:v0.1.1", + Kubernetes: "rancher/hyperkube:v1.10.1", + Alpine: ToolsImage, + NginxProxy: ToolsImage, + CertDownloader: ToolsImage, + KubernetesServicesSidecar: ToolsImage, KubeDNS: "rancher/k8s-dns-kube-dns-amd64:1.14.8", DNSmasq: "rancher/k8s-dns-dnsmasq-nanny-amd64:1.14.8", KubeDNSSidecar: "rancher/k8s-dns-sidecar-amd64:1.14.8", diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go index 9fd314fb..f5c37d5e 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go @@ -848,6 +848,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*StepStatus).DeepCopyInto(out.(*StepStatus)) return nil }, InType: reflect.TypeOf(&StepStatus{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*SubQuestion).DeepCopyInto(out.(*SubQuestion)) + return nil + }, InType: reflect.TypeOf(&SubQuestion{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*SyslogConfig).DeepCopyInto(out.(*SyslogConfig)) return nil @@ -876,6 +880,14 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*Template).DeepCopyInto(out.(*Template)) return nil }, InType: reflect.TypeOf(&Template{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*TemplateContent).DeepCopyInto(out.(*TemplateContent)) + return nil + }, InType: reflect.TypeOf(&TemplateContent{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*TemplateContentList).DeepCopyInto(out.(*TemplateContentList)) + return nil + }, InType: reflect.TypeOf(&TemplateContentList{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*TemplateList).DeepCopyInto(out.(*TemplateList)) return nil @@ -5641,6 +5653,13 @@ func (in *Question) DeepCopyInto(out *Question) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.Subquestions != nil { + in, out := &in.Subquestions, &out.Subquestions + *out = make([]SubQuestion, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -6458,6 +6477,27 @@ func (in *StepStatus) DeepCopy() *StepStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubQuestion) DeepCopyInto(out *SubQuestion) { + *out = *in + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubQuestion. +func (in *SubQuestion) DeepCopy() *SubQuestion { + if in == nil { + return nil + } + out := new(SubQuestion) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SyslogConfig) DeepCopyInto(out *SyslogConfig) { *out = *in @@ -6597,6 +6637,67 @@ func (in *Template) DeepCopyObject() runtime.Object { } } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateContent) DeepCopyInto(out *TemplateContent) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateContent. +func (in *TemplateContent) DeepCopy() *TemplateContent { + if in == nil { + return nil + } + out := new(TemplateContent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TemplateContent) 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 *TemplateContentList) DeepCopyInto(out *TemplateContentList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TemplateContent, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateContentList. +func (in *TemplateContentList) DeepCopy() *TemplateContentList { + if in == nil { + return nil + } + out := new(TemplateContentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TemplateContentList) 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 *TemplateList) DeepCopyInto(out *TemplateList) { *out = *in @@ -6759,8 +6860,10 @@ func (in *TemplateVersionSpec) DeepCopyInto(out *TemplateVersionSpec) { } if in.Files != nil { in, out := &in.Files, &out.Files - *out = make([]File, len(*in)) - copy(*out, *in) + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } } if in.Questions != nil { in, out := &in.Questions, &out.Questions diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go index 359fa60c..be177c7f 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go @@ -33,6 +33,7 @@ type Interface interface { CatalogsGetter TemplatesGetter TemplateVersionsGetter + TemplateContentsGetter GroupsGetter GroupMembersGetter PrincipalsGetter @@ -82,6 +83,7 @@ type Client struct { catalogControllers map[string]CatalogController templateControllers map[string]TemplateController templateVersionControllers map[string]TemplateVersionController + templateContentControllers map[string]TemplateContentController groupControllers map[string]GroupController groupMemberControllers map[string]GroupMemberController principalControllers map[string]PrincipalController @@ -140,6 +142,7 @@ func NewForConfig(config rest.Config) (Interface, error) { catalogControllers: map[string]CatalogController{}, templateControllers: map[string]TemplateController{}, templateVersionControllers: map[string]TemplateVersionController{}, + templateContentControllers: map[string]TemplateContentController{}, groupControllers: map[string]GroupController{}, groupMemberControllers: map[string]GroupMemberController{}, principalControllers: map[string]PrincipalController{}, @@ -413,6 +416,19 @@ func (c *Client) TemplateVersions(namespace string) TemplateVersionInterface { } } +type TemplateContentsGetter interface { + TemplateContents(namespace string) TemplateContentInterface +} + +func (c *Client) TemplateContents(namespace string) TemplateContentInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &TemplateContentResource, TemplateContentGroupVersionKind, templateContentFactory{}) + return &templateContentClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + type GroupsGetter interface { Groups(namespace string) GroupInterface } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_scheme.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_scheme.go index 06b614eb..ab90db86 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_scheme.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_scheme.go @@ -69,6 +69,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &TemplateList{}, &TemplateVersion{}, &TemplateVersionList{}, + &TemplateContent{}, + &TemplateContentList{}, &Group{}, &GroupList{}, &GroupMember{}, diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_content_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_content_controller.go new file mode 100644 index 00000000..6fba6068 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_content_controller.go @@ -0,0 +1,251 @@ +package v3 + +import ( + "context" + + "github.com/rancher/norman/controller" + "github.com/rancher/norman/objectclient" + "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 ( + TemplateContentGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "TemplateContent", + } + TemplateContentResource = metav1.APIResource{ + Name: "templatecontents", + SingularName: "templatecontent", + Namespaced: false, + Kind: TemplateContentGroupVersionKind.Kind, + } +) + +type TemplateContentList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []TemplateContent +} + +type TemplateContentHandlerFunc func(key string, obj *TemplateContent) error + +type TemplateContentLister interface { + List(namespace string, selector labels.Selector) (ret []*TemplateContent, err error) + Get(namespace, name string) (*TemplateContent, error) +} + +type TemplateContentController interface { + Informer() cache.SharedIndexInformer + Lister() TemplateContentLister + AddHandler(name string, handler TemplateContentHandlerFunc) + AddClusterScopedHandler(name, clusterName string, handler TemplateContentHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type TemplateContentInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*TemplateContent) (*TemplateContent, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*TemplateContent, error) + Get(name string, opts metav1.GetOptions) (*TemplateContent, error) + Update(*TemplateContent) (*TemplateContent, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*TemplateContentList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() TemplateContentController + AddHandler(name string, sync TemplateContentHandlerFunc) + AddLifecycle(name string, lifecycle TemplateContentLifecycle) + AddClusterScopedHandler(name, clusterName string, sync TemplateContentHandlerFunc) + AddClusterScopedLifecycle(name, clusterName string, lifecycle TemplateContentLifecycle) +} + +type templateContentLister struct { + controller *templateContentController +} + +func (l *templateContentLister) List(namespace string, selector labels.Selector) (ret []*TemplateContent, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*TemplateContent)) + }) + return +} + +func (l *templateContentLister) Get(namespace, name string) (*TemplateContent, 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: TemplateContentGroupVersionKind.Group, + Resource: "templateContent", + }, name) + } + return obj.(*TemplateContent), nil +} + +type templateContentController struct { + controller.GenericController +} + +func (c *templateContentController) Lister() TemplateContentLister { + return &templateContentLister{ + controller: c, + } +} + +func (c *templateContentController) AddHandler(name string, handler TemplateContentHandlerFunc) { + c.GenericController.AddHandler(name, 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.(*TemplateContent)) + }) +} + +func (c *templateContentController) AddClusterScopedHandler(name, cluster string, handler TemplateContentHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + + if !controller.ObjectInCluster(cluster, obj) { + return nil + } + + return handler(key, obj.(*TemplateContent)) + }) +} + +type templateContentFactory struct { +} + +func (c templateContentFactory) Object() runtime.Object { + return &TemplateContent{} +} + +func (c templateContentFactory) List() runtime.Object { + return &TemplateContentList{} +} + +func (s *templateContentClient) Controller() TemplateContentController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.templateContentControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(TemplateContentGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &templateContentController{ + GenericController: genericController, + } + + s.client.templateContentControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type templateContentClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller TemplateContentController +} + +func (s *templateContentClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *templateContentClient) Create(o *TemplateContent) (*TemplateContent, error) { + obj, err := s.objectClient.Create(o) + return obj.(*TemplateContent), err +} + +func (s *templateContentClient) Get(name string, opts metav1.GetOptions) (*TemplateContent, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*TemplateContent), err +} + +func (s *templateContentClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*TemplateContent, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*TemplateContent), err +} + +func (s *templateContentClient) Update(o *TemplateContent) (*TemplateContent, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*TemplateContent), err +} + +func (s *templateContentClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *templateContentClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *templateContentClient) List(opts metav1.ListOptions) (*TemplateContentList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*TemplateContentList), err +} + +func (s *templateContentClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *templateContentClient) Patch(o *TemplateContent, data []byte, subresources ...string) (*TemplateContent, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*TemplateContent), err +} + +func (s *templateContentClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *templateContentClient) AddHandler(name string, sync TemplateContentHandlerFunc) { + s.Controller().AddHandler(name, sync) +} + +func (s *templateContentClient) AddLifecycle(name string, lifecycle TemplateContentLifecycle) { + sync := NewTemplateContentLifecycleAdapter(name, false, s, lifecycle) + s.AddHandler(name, sync) +} + +func (s *templateContentClient) AddClusterScopedHandler(name, clusterName string, sync TemplateContentHandlerFunc) { + s.Controller().AddClusterScopedHandler(name, clusterName, sync) +} + +func (s *templateContentClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle TemplateContentLifecycle) { + sync := NewTemplateContentLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.AddClusterScopedHandler(name, clusterName, sync) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_content_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_content_lifecycle_adapter.go new file mode 100644 index 00000000..83cf95bd --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_content_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type TemplateContentLifecycle interface { + Create(obj *TemplateContent) (*TemplateContent, error) + Remove(obj *TemplateContent) (*TemplateContent, error) + Updated(obj *TemplateContent) (*TemplateContent, error) +} + +type templateContentLifecycleAdapter struct { + lifecycle TemplateContentLifecycle +} + +func (w *templateContentLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*TemplateContent)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *templateContentLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*TemplateContent)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *templateContentLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*TemplateContent)) + if o == nil { + return nil, err + } + return o, err +} + +func NewTemplateContentLifecycleAdapter(name string, clusterScoped bool, client TemplateContentInterface, l TemplateContentLifecycle) TemplateContentHandlerFunc { + adapter := &templateContentLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *TemplateContent) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +}