Matthias Andreas Benkard | 832a54e | 2019-01-29 09:27:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | Copyright The Kubernetes Authors. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | // Code generated by lister-gen. DO NOT EDIT. |
| 18 | |
| 19 | package v1beta1 |
| 20 | |
| 21 | import ( |
| 22 | v1beta1 "k8s.io/api/extensions/v1beta1" |
| 23 | "k8s.io/apimachinery/pkg/api/errors" |
| 24 | "k8s.io/apimachinery/pkg/labels" |
| 25 | "k8s.io/client-go/tools/cache" |
| 26 | ) |
| 27 | |
| 28 | // DeploymentLister helps list Deployments. |
| 29 | type DeploymentLister interface { |
| 30 | // List lists all Deployments in the indexer. |
| 31 | List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) |
| 32 | // Deployments returns an object that can list and get Deployments. |
| 33 | Deployments(namespace string) DeploymentNamespaceLister |
| 34 | DeploymentListerExpansion |
| 35 | } |
| 36 | |
| 37 | // deploymentLister implements the DeploymentLister interface. |
| 38 | type deploymentLister struct { |
| 39 | indexer cache.Indexer |
| 40 | } |
| 41 | |
| 42 | // NewDeploymentLister returns a new DeploymentLister. |
| 43 | func NewDeploymentLister(indexer cache.Indexer) DeploymentLister { |
| 44 | return &deploymentLister{indexer: indexer} |
| 45 | } |
| 46 | |
| 47 | // List lists all Deployments in the indexer. |
| 48 | func (s *deploymentLister) List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) { |
| 49 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { |
| 50 | ret = append(ret, m.(*v1beta1.Deployment)) |
| 51 | }) |
| 52 | return ret, err |
| 53 | } |
| 54 | |
| 55 | // Deployments returns an object that can list and get Deployments. |
| 56 | func (s *deploymentLister) Deployments(namespace string) DeploymentNamespaceLister { |
| 57 | return deploymentNamespaceLister{indexer: s.indexer, namespace: namespace} |
| 58 | } |
| 59 | |
| 60 | // DeploymentNamespaceLister helps list and get Deployments. |
| 61 | type DeploymentNamespaceLister interface { |
| 62 | // List lists all Deployments in the indexer for a given namespace. |
| 63 | List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) |
| 64 | // Get retrieves the Deployment from the indexer for a given namespace and name. |
| 65 | Get(name string) (*v1beta1.Deployment, error) |
| 66 | DeploymentNamespaceListerExpansion |
| 67 | } |
| 68 | |
| 69 | // deploymentNamespaceLister implements the DeploymentNamespaceLister |
| 70 | // interface. |
| 71 | type deploymentNamespaceLister struct { |
| 72 | indexer cache.Indexer |
| 73 | namespace string |
| 74 | } |
| 75 | |
| 76 | // List lists all Deployments in the indexer for a given namespace. |
| 77 | func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) { |
| 78 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { |
| 79 | ret = append(ret, m.(*v1beta1.Deployment)) |
| 80 | }) |
| 81 | return ret, err |
| 82 | } |
| 83 | |
| 84 | // Get retrieves the Deployment from the indexer for a given namespace and name. |
| 85 | func (s deploymentNamespaceLister) Get(name string) (*v1beta1.Deployment, error) { |
| 86 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) |
| 87 | if err != nil { |
| 88 | return nil, err |
| 89 | } |
| 90 | if !exists { |
| 91 | return nil, errors.NewNotFound(v1beta1.Resource("deployment"), name) |
| 92 | } |
| 93 | return obj.(*v1beta1.Deployment), nil |
| 94 | } |