2 Copyright The Kubernetes Authors.
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
8 http://www.apache.org/licenses/LICENSE-2.0
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.
17 // Code generated by client-gen. DO NOT EDIT.
22 appsv1 "k8s.io/api/apps/v1"
23 autoscalingv1 "k8s.io/api/autoscaling/v1"
24 v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25 labels "k8s.io/apimachinery/pkg/labels"
26 schema "k8s.io/apimachinery/pkg/runtime/schema"
27 types "k8s.io/apimachinery/pkg/types"
28 watch "k8s.io/apimachinery/pkg/watch"
29 testing "k8s.io/client-go/testing"
32 // FakeDeployments implements DeploymentInterface
33 type FakeDeployments struct {
38 var deploymentsResource = schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"}
40 var deploymentsKind = schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "Deployment"}
42 // Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any.
43 func (c *FakeDeployments) Get(name string, options v1.GetOptions) (result *appsv1.Deployment, err error) {
45 Invokes(testing.NewGetAction(deploymentsResource, c.ns, name), &appsv1.Deployment{})
50 return obj.(*appsv1.Deployment), err
53 // List takes label and field selectors, and returns the list of Deployments that match those selectors.
54 func (c *FakeDeployments) List(opts v1.ListOptions) (result *appsv1.DeploymentList, err error) {
56 Invokes(testing.NewListAction(deploymentsResource, deploymentsKind, c.ns, opts), &appsv1.DeploymentList{})
62 label, _, _ := testing.ExtractFromListOptions(opts)
64 label = labels.Everything()
66 list := &appsv1.DeploymentList{ListMeta: obj.(*appsv1.DeploymentList).ListMeta}
67 for _, item := range obj.(*appsv1.DeploymentList).Items {
68 if label.Matches(labels.Set(item.Labels)) {
69 list.Items = append(list.Items, item)
75 // Watch returns a watch.Interface that watches the requested deployments.
76 func (c *FakeDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
78 InvokesWatch(testing.NewWatchAction(deploymentsResource, c.ns, opts))
82 // Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any.
83 func (c *FakeDeployments) Create(deployment *appsv1.Deployment) (result *appsv1.Deployment, err error) {
85 Invokes(testing.NewCreateAction(deploymentsResource, c.ns, deployment), &appsv1.Deployment{})
90 return obj.(*appsv1.Deployment), err
93 // Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any.
94 func (c *FakeDeployments) Update(deployment *appsv1.Deployment) (result *appsv1.Deployment, err error) {
96 Invokes(testing.NewUpdateAction(deploymentsResource, c.ns, deployment), &appsv1.Deployment{})
101 return obj.(*appsv1.Deployment), err
104 // UpdateStatus was generated because the type contains a Status member.
105 // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
106 func (c *FakeDeployments) UpdateStatus(deployment *appsv1.Deployment) (*appsv1.Deployment, error) {
108 Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "status", c.ns, deployment), &appsv1.Deployment{})
113 return obj.(*appsv1.Deployment), err
116 // Delete takes name of the deployment and deletes it. Returns an error if one occurs.
117 func (c *FakeDeployments) Delete(name string, options *v1.DeleteOptions) error {
119 Invokes(testing.NewDeleteAction(deploymentsResource, c.ns, name), &appsv1.Deployment{})
124 // DeleteCollection deletes a collection of objects.
125 func (c *FakeDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
126 action := testing.NewDeleteCollectionAction(deploymentsResource, c.ns, listOptions)
128 _, err := c.Fake.Invokes(action, &appsv1.DeploymentList{})
132 // Patch applies the patch and returns the patched deployment.
133 func (c *FakeDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *appsv1.Deployment, err error) {
135 Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, name, pt, data, subresources...), &appsv1.Deployment{})
140 return obj.(*appsv1.Deployment), err
143 // GetScale takes name of the deployment, and returns the corresponding scale object, and an error if there is any.
144 func (c *FakeDeployments) GetScale(deploymentName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) {
146 Invokes(testing.NewGetSubresourceAction(deploymentsResource, c.ns, "scale", deploymentName), &autoscalingv1.Scale{})
151 return obj.(*autoscalingv1.Scale), err
154 // UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
155 func (c *FakeDeployments) UpdateScale(deploymentName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
157 Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "scale", c.ns, scale), &autoscalingv1.Scale{})
162 return obj.(*autoscalingv1.Scale), err