From 54dc2e892029ad7f8850f8b6ca3d815e423ea44a Mon Sep 17 00:00:00 2001 From: Janet Kuo Date: Wed, 26 Jul 2017 10:18:11 -0700 Subject: [PATCH] Autogen Kubernetes-commit: ac3f9b8c34b22f4859c4fd23d229f3b767106de0 --- informers/apps/v1beta2/BUILD | 1 + informers/apps/v1beta2/interface.go | 7 + informers/apps/v1beta2/replicaset.go | 73 ++++++++ informers/generic.go | 2 + kubernetes/typed/apps/v1beta2/BUILD | 1 + kubernetes/typed/apps/v1beta2/apps_client.go | 5 + kubernetes/typed/apps/v1beta2/fake/BUILD | 1 + .../apps/v1beta2/fake/fake_apps_client.go | 4 + .../apps/v1beta2/fake/fake_replicaset.go | 138 ++++++++++++++ .../typed/apps/v1beta2/generated_expansion.go | 2 + kubernetes/typed/apps/v1beta2/replicaset.go | 172 ++++++++++++++++++ listers/apps/v1beta2/BUILD | 1 + listers/apps/v1beta2/expansion_generated.go | 8 + listers/apps/v1beta2/replicaset.go | 94 ++++++++++ 14 files changed, 509 insertions(+) create mode 100644 informers/apps/v1beta2/replicaset.go create mode 100644 kubernetes/typed/apps/v1beta2/fake/fake_replicaset.go create mode 100644 kubernetes/typed/apps/v1beta2/replicaset.go create mode 100644 listers/apps/v1beta2/replicaset.go diff --git a/informers/apps/v1beta2/BUILD b/informers/apps/v1beta2/BUILD index 228e9790..1a672521 100644 --- a/informers/apps/v1beta2/BUILD +++ b/informers/apps/v1beta2/BUILD @@ -13,6 +13,7 @@ go_library( "daemonset.go", "deployment.go", "interface.go", + "replicaset.go", "statefulset.go", ], tags = ["automanaged"], diff --git a/informers/apps/v1beta2/interface.go b/informers/apps/v1beta2/interface.go index 3853d15e..dcf1c2fe 100644 --- a/informers/apps/v1beta2/interface.go +++ b/informers/apps/v1beta2/interface.go @@ -28,6 +28,8 @@ type Interface interface { DaemonSets() DaemonSetInformer // Deployments returns a DeploymentInformer. Deployments() DeploymentInformer + // ReplicaSets returns a ReplicaSetInformer. + ReplicaSets() ReplicaSetInformer // StatefulSets returns a StatefulSetInformer. StatefulSets() StatefulSetInformer } @@ -51,6 +53,11 @@ func (v *version) Deployments() DeploymentInformer { return &deploymentInformer{factory: v.SharedInformerFactory} } +// ReplicaSets returns a ReplicaSetInformer. +func (v *version) ReplicaSets() ReplicaSetInformer { + return &replicaSetInformer{factory: v.SharedInformerFactory} +} + // StatefulSets returns a StatefulSetInformer. func (v *version) StatefulSets() StatefulSetInformer { return &statefulSetInformer{factory: v.SharedInformerFactory} diff --git a/informers/apps/v1beta2/replicaset.go b/informers/apps/v1beta2/replicaset.go new file mode 100644 index 00000000..1eec8e8c --- /dev/null +++ b/informers/apps/v1beta2/replicaset.go @@ -0,0 +1,73 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was automatically generated by informer-gen + +package v1beta2 + +import ( + apps_v1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// ReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets. +type ReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.ReplicaSetLister +} + +type replicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + return client.AppsV1beta2().ReplicaSets(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + return client.AppsV1beta2().ReplicaSets(namespace).Watch(options) + }, + }, + &apps_v1beta2.ReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func defaultReplicaSetInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewReplicaSetInformer(client, v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apps_v1beta2.ReplicaSet{}, defaultReplicaSetInformer) +} + +func (f *replicaSetInformer) Lister() v1beta2.ReplicaSetLister { + return v1beta2.NewReplicaSetLister(f.Informer().GetIndexer()) +} diff --git a/informers/generic.go b/informers/generic.go index b4fccd7b..dd41f2df 100644 --- a/informers/generic.go +++ b/informers/generic.go @@ -87,6 +87,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().DaemonSets().Informer()}, nil case v1beta2.SchemeGroupVersion.WithResource("deployments"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().Deployments().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("replicasets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().ReplicaSets().Informer()}, nil case v1beta2.SchemeGroupVersion.WithResource("statefulsets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().StatefulSets().Informer()}, nil diff --git a/kubernetes/typed/apps/v1beta2/BUILD b/kubernetes/typed/apps/v1beta2/BUILD index 1e2a69f6..9cc16e22 100644 --- a/kubernetes/typed/apps/v1beta2/BUILD +++ b/kubernetes/typed/apps/v1beta2/BUILD @@ -15,6 +15,7 @@ go_library( "deployment.go", "doc.go", "generated_expansion.go", + "replicaset.go", "scale.go", "statefulset.go", ], diff --git a/kubernetes/typed/apps/v1beta2/apps_client.go b/kubernetes/typed/apps/v1beta2/apps_client.go index a70e73ab..4c5c431c 100644 --- a/kubernetes/typed/apps/v1beta2/apps_client.go +++ b/kubernetes/typed/apps/v1beta2/apps_client.go @@ -27,6 +27,7 @@ type AppsV1beta2Interface interface { RESTClient() rest.Interface DaemonSetsGetter DeploymentsGetter + ReplicaSetsGetter ScalesGetter StatefulSetsGetter } @@ -44,6 +45,10 @@ func (c *AppsV1beta2Client) Deployments(namespace string) DeploymentInterface { return newDeployments(c, namespace) } +func (c *AppsV1beta2Client) ReplicaSets(namespace string) ReplicaSetInterface { + return newReplicaSets(c, namespace) +} + func (c *AppsV1beta2Client) Scales(namespace string) ScaleInterface { return newScales(c, namespace) } diff --git a/kubernetes/typed/apps/v1beta2/fake/BUILD b/kubernetes/typed/apps/v1beta2/fake/BUILD index cace0227..c6e10052 100644 --- a/kubernetes/typed/apps/v1beta2/fake/BUILD +++ b/kubernetes/typed/apps/v1beta2/fake/BUILD @@ -14,6 +14,7 @@ go_library( "fake_apps_client.go", "fake_daemonset.go", "fake_deployment.go", + "fake_replicaset.go", "fake_scale.go", "fake_statefulset.go", ], diff --git a/kubernetes/typed/apps/v1beta2/fake/fake_apps_client.go b/kubernetes/typed/apps/v1beta2/fake/fake_apps_client.go index 1c7f3843..af07c198 100644 --- a/kubernetes/typed/apps/v1beta2/fake/fake_apps_client.go +++ b/kubernetes/typed/apps/v1beta2/fake/fake_apps_client.go @@ -34,6 +34,10 @@ func (c *FakeAppsV1beta2) Deployments(namespace string) v1beta2.DeploymentInterf return &FakeDeployments{c, namespace} } +func (c *FakeAppsV1beta2) ReplicaSets(namespace string) v1beta2.ReplicaSetInterface { + return &FakeReplicaSets{c, namespace} +} + func (c *FakeAppsV1beta2) Scales(namespace string) v1beta2.ScaleInterface { return &FakeScales{c, namespace} } diff --git a/kubernetes/typed/apps/v1beta2/fake/fake_replicaset.go b/kubernetes/typed/apps/v1beta2/fake/fake_replicaset.go new file mode 100644 index 00000000..338f92c1 --- /dev/null +++ b/kubernetes/typed/apps/v1beta2/fake/fake_replicaset.go @@ -0,0 +1,138 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package fake + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeReplicaSets implements ReplicaSetInterface +type FakeReplicaSets struct { + Fake *FakeAppsV1beta2 + ns string +} + +var replicasetsResource = schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "replicasets"} + +var replicasetsKind = schema.GroupVersionKind{Group: "apps", Version: "v1beta2", Kind: "ReplicaSet"} + +// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any. +func (c *FakeReplicaSets) Get(name string, options v1.GetOptions) (result *v1beta2.ReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(replicasetsResource, c.ns, name), &v1beta2.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.ReplicaSet), err +} + +// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors. +func (c *FakeReplicaSets) List(opts v1.ListOptions) (result *v1beta2.ReplicaSetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(replicasetsResource, replicasetsKind, c.ns, opts), &v1beta2.ReplicaSetList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta2.ReplicaSetList{} + for _, item := range obj.(*v1beta2.ReplicaSetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested replicaSets. +func (c *FakeReplicaSets) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(replicasetsResource, c.ns, opts)) + +} + +// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any. +func (c *FakeReplicaSets) Create(replicaSet *v1beta2.ReplicaSet) (result *v1beta2.ReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(replicasetsResource, c.ns, replicaSet), &v1beta2.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.ReplicaSet), err +} + +// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any. +func (c *FakeReplicaSets) Update(replicaSet *v1beta2.ReplicaSet) (result *v1beta2.ReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(replicasetsResource, c.ns, replicaSet), &v1beta2.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.ReplicaSet), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeReplicaSets) UpdateStatus(replicaSet *v1beta2.ReplicaSet) (*v1beta2.ReplicaSet, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "status", c.ns, replicaSet), &v1beta2.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.ReplicaSet), err +} + +// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs. +func (c *FakeReplicaSets) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(replicasetsResource, c.ns, name), &v1beta2.ReplicaSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeReplicaSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(replicasetsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta2.ReplicaSetList{}) + return err +} + +// Patch applies the patch and returns the patched replicaSet. +func (c *FakeReplicaSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.ReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, name, data, subresources...), &v1beta2.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.ReplicaSet), err +} diff --git a/kubernetes/typed/apps/v1beta2/generated_expansion.go b/kubernetes/typed/apps/v1beta2/generated_expansion.go index bfee88eb..f60e7aa8 100644 --- a/kubernetes/typed/apps/v1beta2/generated_expansion.go +++ b/kubernetes/typed/apps/v1beta2/generated_expansion.go @@ -20,6 +20,8 @@ type DaemonSetExpansion interface{} type DeploymentExpansion interface{} +type ReplicaSetExpansion interface{} + type ScaleExpansion interface{} type StatefulSetExpansion interface{} diff --git a/kubernetes/typed/apps/v1beta2/replicaset.go b/kubernetes/typed/apps/v1beta2/replicaset.go new file mode 100644 index 00000000..dc6ce105 --- /dev/null +++ b/kubernetes/typed/apps/v1beta2/replicaset.go @@ -0,0 +1,172 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + scheme "k8s.io/client-go/kubernetes/scheme" + rest "k8s.io/client-go/rest" +) + +// ReplicaSetsGetter has a method to return a ReplicaSetInterface. +// A group's client should implement this interface. +type ReplicaSetsGetter interface { + ReplicaSets(namespace string) ReplicaSetInterface +} + +// ReplicaSetInterface has methods to work with ReplicaSet resources. +type ReplicaSetInterface interface { + Create(*v1beta2.ReplicaSet) (*v1beta2.ReplicaSet, error) + Update(*v1beta2.ReplicaSet) (*v1beta2.ReplicaSet, error) + UpdateStatus(*v1beta2.ReplicaSet) (*v1beta2.ReplicaSet, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta2.ReplicaSet, error) + List(opts v1.ListOptions) (*v1beta2.ReplicaSetList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.ReplicaSet, err error) + ReplicaSetExpansion +} + +// replicaSets implements ReplicaSetInterface +type replicaSets struct { + client rest.Interface + ns string +} + +// newReplicaSets returns a ReplicaSets +func newReplicaSets(c *AppsV1beta2Client, namespace string) *replicaSets { + return &replicaSets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any. +func (c *replicaSets) Get(name string, options v1.GetOptions) (result *v1beta2.ReplicaSet, err error) { + result = &v1beta2.ReplicaSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicasets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors. +func (c *replicaSets) List(opts v1.ListOptions) (result *v1beta2.ReplicaSetList, err error) { + result = &v1beta2.ReplicaSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicasets"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested replicaSets. +func (c *replicaSets) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("replicasets"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any. +func (c *replicaSets) Create(replicaSet *v1beta2.ReplicaSet) (result *v1beta2.ReplicaSet, err error) { + result = &v1beta2.ReplicaSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("replicasets"). + Body(replicaSet). + Do(). + Into(result) + return +} + +// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any. +func (c *replicaSets) Update(replicaSet *v1beta2.ReplicaSet) (result *v1beta2.ReplicaSet, err error) { + result = &v1beta2.ReplicaSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicasets"). + Name(replicaSet.Name). + Body(replicaSet). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *replicaSets) UpdateStatus(replicaSet *v1beta2.ReplicaSet) (result *v1beta2.ReplicaSet, err error) { + result = &v1beta2.ReplicaSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicasets"). + Name(replicaSet.Name). + SubResource("status"). + Body(replicaSet). + Do(). + Into(result) + return +} + +// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs. +func (c *replicaSets) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("replicasets"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *replicaSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("replicasets"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched replicaSet. +func (c *replicaSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.ReplicaSet, err error) { + result = &v1beta2.ReplicaSet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("replicasets"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/listers/apps/v1beta2/BUILD b/listers/apps/v1beta2/BUILD index 39f2316a..06d6f669 100644 --- a/listers/apps/v1beta2/BUILD +++ b/listers/apps/v1beta2/BUILD @@ -13,6 +13,7 @@ go_library( "daemonset.go", "deployment.go", "expansion_generated.go", + "replicaset.go", "scale.go", "statefulset.go", ], diff --git a/listers/apps/v1beta2/expansion_generated.go b/listers/apps/v1beta2/expansion_generated.go index 07a14a24..0b04cc5b 100644 --- a/listers/apps/v1beta2/expansion_generated.go +++ b/listers/apps/v1beta2/expansion_generated.go @@ -34,6 +34,14 @@ type DeploymentListerExpansion interface{} // DeploymentNamespaceLister. type DeploymentNamespaceListerExpansion interface{} +// ReplicaSetListerExpansion allows custom methods to be added to +// ReplicaSetLister. +type ReplicaSetListerExpansion interface{} + +// ReplicaSetNamespaceListerExpansion allows custom methods to be added to +// ReplicaSetNamespaceLister. +type ReplicaSetNamespaceListerExpansion interface{} + // ScaleListerExpansion allows custom methods to be added to // ScaleLister. type ScaleListerExpansion interface{} diff --git a/listers/apps/v1beta2/replicaset.go b/listers/apps/v1beta2/replicaset.go new file mode 100644 index 00000000..f76e2eeb --- /dev/null +++ b/listers/apps/v1beta2/replicaset.go @@ -0,0 +1,94 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was automatically generated by lister-gen + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ReplicaSetLister helps list ReplicaSets. +type ReplicaSetLister interface { + // List lists all ReplicaSets in the indexer. + List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) + // ReplicaSets returns an object that can list and get ReplicaSets. + ReplicaSets(namespace string) ReplicaSetNamespaceLister + ReplicaSetListerExpansion +} + +// replicaSetLister implements the ReplicaSetLister interface. +type replicaSetLister struct { + indexer cache.Indexer +} + +// NewReplicaSetLister returns a new ReplicaSetLister. +func NewReplicaSetLister(indexer cache.Indexer) ReplicaSetLister { + return &replicaSetLister{indexer: indexer} +} + +// List lists all ReplicaSets in the indexer. +func (s *replicaSetLister) List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.ReplicaSet)) + }) + return ret, err +} + +// ReplicaSets returns an object that can list and get ReplicaSets. +func (s *replicaSetLister) ReplicaSets(namespace string) ReplicaSetNamespaceLister { + return replicaSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ReplicaSetNamespaceLister helps list and get ReplicaSets. +type ReplicaSetNamespaceLister interface { + // List lists all ReplicaSets in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) + // Get retrieves the ReplicaSet from the indexer for a given namespace and name. + Get(name string) (*v1beta2.ReplicaSet, error) + ReplicaSetNamespaceListerExpansion +} + +// replicaSetNamespaceLister implements the ReplicaSetNamespaceLister +// interface. +type replicaSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ReplicaSets in the indexer for a given namespace. +func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.ReplicaSet)) + }) + return ret, err +} + +// Get retrieves the ReplicaSet from the indexer for a given namespace and name. +func (s replicaSetNamespaceLister) Get(name string) (*v1beta2.ReplicaSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("replicaset"), name) + } + return obj.(*v1beta2.ReplicaSet), nil +}