1
0
mirror of https://github.com/rancher/types.git synced 2025-09-16 23:08:25 +00:00

generated changes

This commit is contained in:
Daishan Peng
2018-04-17 17:11:55 -07:00
committed by Darren Shepherd
parent db0df8bdfa
commit 57640dab66
26 changed files with 1196 additions and 131 deletions

View File

@@ -0,0 +1,252 @@
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 (
AppRevisionGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "AppRevision",
}
AppRevisionResource = metav1.APIResource{
Name: "apprevisions",
SingularName: "apprevision",
Namespaced: true,
Kind: AppRevisionGroupVersionKind.Kind,
}
)
type AppRevisionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []AppRevision
}
type AppRevisionHandlerFunc func(key string, obj *AppRevision) error
type AppRevisionLister interface {
List(namespace string, selector labels.Selector) (ret []*AppRevision, err error)
Get(namespace, name string) (*AppRevision, error)
}
type AppRevisionController interface {
Informer() cache.SharedIndexInformer
Lister() AppRevisionLister
AddHandler(name string, handler AppRevisionHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler AppRevisionHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type AppRevisionInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*AppRevision) (*AppRevision, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*AppRevision, error)
Get(name string, opts metav1.GetOptions) (*AppRevision, error)
Update(*AppRevision) (*AppRevision, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*AppRevisionList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() AppRevisionController
AddHandler(name string, sync AppRevisionHandlerFunc)
AddLifecycle(name string, lifecycle AppRevisionLifecycle)
AddClusterScopedHandler(name, clusterName string, sync AppRevisionHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle AppRevisionLifecycle)
}
type appRevisionLister struct {
controller *appRevisionController
}
func (l *appRevisionLister) List(namespace string, selector labels.Selector) (ret []*AppRevision, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*AppRevision))
})
return
}
func (l *appRevisionLister) Get(namespace, name string) (*AppRevision, 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: AppRevisionGroupVersionKind.Group,
Resource: "appRevision",
}, name)
}
return obj.(*AppRevision), nil
}
type appRevisionController struct {
controller.GenericController
}
func (c *appRevisionController) Lister() AppRevisionLister {
return &appRevisionLister{
controller: c,
}
}
func (c *appRevisionController) AddHandler(name string, handler AppRevisionHandlerFunc) {
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.(*AppRevision))
})
}
func (c *appRevisionController) AddClusterScopedHandler(name, cluster string, handler AppRevisionHandlerFunc) {
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.(*AppRevision))
})
}
type appRevisionFactory struct {
}
func (c appRevisionFactory) Object() runtime.Object {
return &AppRevision{}
}
func (c appRevisionFactory) List() runtime.Object {
return &AppRevisionList{}
}
func (s *appRevisionClient) Controller() AppRevisionController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.appRevisionControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(AppRevisionGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &appRevisionController{
GenericController: genericController,
}
s.client.appRevisionControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type appRevisionClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller AppRevisionController
}
func (s *appRevisionClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *appRevisionClient) Create(o *AppRevision) (*AppRevision, error) {
obj, err := s.objectClient.Create(o)
return obj.(*AppRevision), err
}
func (s *appRevisionClient) Get(name string, opts metav1.GetOptions) (*AppRevision, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*AppRevision), err
}
func (s *appRevisionClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*AppRevision, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*AppRevision), err
}
func (s *appRevisionClient) Update(o *AppRevision) (*AppRevision, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*AppRevision), err
}
func (s *appRevisionClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *appRevisionClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *appRevisionClient) List(opts metav1.ListOptions) (*AppRevisionList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*AppRevisionList), err
}
func (s *appRevisionClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *appRevisionClient) Patch(o *AppRevision, data []byte, subresources ...string) (*AppRevision, error) {
obj, err := s.objectClient.Patch(o.Name, o, data, subresources...)
return obj.(*AppRevision), err
}
func (s *appRevisionClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *appRevisionClient) AddHandler(name string, sync AppRevisionHandlerFunc) {
s.Controller().AddHandler(name, sync)
}
func (s *appRevisionClient) AddLifecycle(name string, lifecycle AppRevisionLifecycle) {
sync := NewAppRevisionLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *appRevisionClient) AddClusterScopedHandler(name, clusterName string, sync AppRevisionHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *appRevisionClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle AppRevisionLifecycle) {
sync := NewAppRevisionLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@@ -0,0 +1,51 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type AppRevisionLifecycle interface {
Create(obj *AppRevision) (*AppRevision, error)
Remove(obj *AppRevision) (*AppRevision, error)
Updated(obj *AppRevision) (*AppRevision, error)
}
type appRevisionLifecycleAdapter struct {
lifecycle AppRevisionLifecycle
}
func (w *appRevisionLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*AppRevision))
if o == nil {
return nil, err
}
return o, err
}
func (w *appRevisionLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*AppRevision))
if o == nil {
return nil, err
}
return o, err
}
func (w *appRevisionLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*AppRevision))
if o == nil {
return nil, err
}
return o, err
}
func NewAppRevisionLifecycleAdapter(name string, clusterScoped bool, client AppRevisionInterface, l AppRevisionLifecycle) AppRevisionHandlerFunc {
adapter := &appRevisionLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *AppRevision) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -29,6 +29,22 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*AppList).DeepCopyInto(out.(*AppList))
return nil
}, InType: reflect.TypeOf(&AppList{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*AppRevision).DeepCopyInto(out.(*AppRevision))
return nil
}, InType: reflect.TypeOf(&AppRevision{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*AppRevisionList).DeepCopyInto(out.(*AppRevisionList))
return nil
}, InType: reflect.TypeOf(&AppRevisionList{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*AppRevisionSpec).DeepCopyInto(out.(*AppRevisionSpec))
return nil
}, InType: reflect.TypeOf(&AppRevisionSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*AppRevisionStatus).DeepCopyInto(out.(*AppRevisionStatus))
return nil
}, InType: reflect.TypeOf(&AppRevisionStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*AppSpec).DeepCopyInto(out.(*AppSpec))
return nil
@@ -133,10 +149,6 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*RegistryCredential).DeepCopyInto(out.(*RegistryCredential))
return nil
}, InType: reflect.TypeOf(&RegistryCredential{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ReleaseInfo).DeepCopyInto(out.(*ReleaseInfo))
return nil
}, InType: reflect.TypeOf(&ReleaseInfo{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*SSHAuth).DeepCopyInto(out.(*SSHAuth))
return nil
@@ -245,15 +257,111 @@ func (in *AppList) DeepCopyObject() runtime.Object {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AppSpec) DeepCopyInto(out *AppSpec) {
func (in *AppRevision) DeepCopyInto(out *AppRevision) {
*out = *in
if in.Templates != nil {
in, out := &in.Templates, &out.Templates
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppRevision.
func (in *AppRevision) DeepCopy() *AppRevision {
if in == nil {
return nil
}
out := new(AppRevision)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *AppRevision) 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 *AppRevisionList) DeepCopyInto(out *AppRevisionList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]AppRevision, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppRevisionList.
func (in *AppRevisionList) DeepCopy() *AppRevisionList {
if in == nil {
return nil
}
out := new(AppRevisionList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *AppRevisionList) 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 *AppRevisionSpec) DeepCopyInto(out *AppRevisionSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppRevisionSpec.
func (in *AppRevisionSpec) DeepCopy() *AppRevisionSpec {
if in == nil {
return nil
}
out := new(AppRevisionSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AppRevisionStatus) DeepCopyInto(out *AppRevisionStatus) {
*out = *in
if in.Answers != nil {
in, out := &in.Answers, &out.Answers
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppRevisionStatus.
func (in *AppRevisionStatus) DeepCopy() *AppRevisionStatus {
if in == nil {
return nil
}
out := new(AppRevisionStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AppSpec) DeepCopyInto(out *AppSpec) {
*out = *in
if in.Answers != nil {
in, out := &in.Answers, &out.Answers
*out = make(map[string]string, len(*in))
@@ -277,21 +385,6 @@ func (in *AppSpec) DeepCopy() *AppSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AppStatus) DeepCopyInto(out *AppStatus) {
*out = *in
if in.StdOutput != nil {
in, out := &in.StdOutput, &out.StdOutput
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.StdError != nil {
in, out := &in.StdError, &out.StdError
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Releases != nil {
in, out := &in.Releases, &out.Releases
*out = make([]ReleaseInfo, len(*in))
copy(*out, *in)
}
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]AppCondition, len(*in))
@@ -1000,22 +1093,6 @@ func (in *RegistryCredential) DeepCopy() *RegistryCredential {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ReleaseInfo) DeepCopyInto(out *ReleaseInfo) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleaseInfo.
func (in *ReleaseInfo) DeepCopy() *ReleaseInfo {
if in == nil {
return nil
}
out := new(ReleaseInfo)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SSHAuth) DeepCopyInto(out *SSHAuth) {
*out = *in

View File

@@ -27,6 +27,7 @@ type Interface interface {
NamespacedSSHAuthsGetter
WorkloadsGetter
AppsGetter
AppRevisionsGetter
NamespaceComposeConfigsGetter
}
@@ -47,6 +48,7 @@ type Client struct {
namespacedSshAuthControllers map[string]NamespacedSSHAuthController
workloadControllers map[string]WorkloadController
appControllers map[string]AppController
appRevisionControllers map[string]AppRevisionController
namespaceComposeConfigControllers map[string]NamespaceComposeConfigController
}
@@ -76,6 +78,7 @@ func NewForConfig(config rest.Config) (Interface, error) {
namespacedSshAuthControllers: map[string]NamespacedSSHAuthController{},
workloadControllers: map[string]WorkloadController{},
appControllers: map[string]AppController{},
appRevisionControllers: map[string]AppRevisionController{},
namespaceComposeConfigControllers: map[string]NamespaceComposeConfigController{},
}, nil
}
@@ -248,6 +251,19 @@ func (c *Client) Apps(namespace string) AppInterface {
}
}
type AppRevisionsGetter interface {
AppRevisions(namespace string) AppRevisionInterface
}
func (c *Client) AppRevisions(namespace string) AppRevisionInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &AppRevisionResource, AppRevisionGroupVersionKind, appRevisionFactory{})
return &appRevisionClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type NamespaceComposeConfigsGetter interface {
NamespaceComposeConfigs(namespace string) NamespaceComposeConfigInterface
}

View File

@@ -57,6 +57,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&WorkloadList{},
&App{},
&AppList{},
&AppRevision{},
&AppRevisionList{},
&NamespaceComposeConfig{},
&NamespaceComposeConfigList{},
)