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 // FakeReplicaSets implements ReplicaSetInterface
33 type FakeReplicaSets struct {
38 var replicasetsResource = schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "replicasets"}
40 var replicasetsKind = schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "ReplicaSet"}
42 // Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any.
43 func (c *FakeReplicaSets) Get(name string, options v1.GetOptions) (result *appsv1.ReplicaSet, err error) {
45 Invokes(testing.NewGetAction(replicasetsResource, c.ns, name), &appsv1.ReplicaSet{})
50 return obj.(*appsv1.ReplicaSet), err
53 // List takes label and field selectors, and returns the list of ReplicaSets that match those selectors.
54 func (c *FakeReplicaSets) List(opts v1.ListOptions) (result *appsv1.ReplicaSetList, err error) {
56 Invokes(testing.NewListAction(replicasetsResource, replicasetsKind, c.ns, opts), &appsv1.ReplicaSetList{})
62 label, _, _ := testing.ExtractFromListOptions(opts)
64 label = labels.Everything()
66 list := &appsv1.ReplicaSetList{ListMeta: obj.(*appsv1.ReplicaSetList).ListMeta}
67 for _, item := range obj.(*appsv1.ReplicaSetList).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 replicaSets.
76 func (c *FakeReplicaSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
78 InvokesWatch(testing.NewWatchAction(replicasetsResource, c.ns, opts))
82 // 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.
83 func (c *FakeReplicaSets) Create(replicaSet *appsv1.ReplicaSet) (result *appsv1.ReplicaSet, err error) {
85 Invokes(testing.NewCreateAction(replicasetsResource, c.ns, replicaSet), &appsv1.ReplicaSet{})
90 return obj.(*appsv1.ReplicaSet), err
93 // 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.
94 func (c *FakeReplicaSets) Update(replicaSet *appsv1.ReplicaSet) (result *appsv1.ReplicaSet, err error) {
96 Invokes(testing.NewUpdateAction(replicasetsResource, c.ns, replicaSet), &appsv1.ReplicaSet{})
101 return obj.(*appsv1.ReplicaSet), 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 *FakeReplicaSets) UpdateStatus(replicaSet *appsv1.ReplicaSet) (*appsv1.ReplicaSet, error) {
108 Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "status", c.ns, replicaSet), &appsv1.ReplicaSet{})
113 return obj.(*appsv1.ReplicaSet), err
116 // Delete takes name of the replicaSet and deletes it. Returns an error if one occurs.
117 func (c *FakeReplicaSets) Delete(name string, options *v1.DeleteOptions) error {
119 Invokes(testing.NewDeleteAction(replicasetsResource, c.ns, name), &appsv1.ReplicaSet{})
124 // DeleteCollection deletes a collection of objects.
125 func (c *FakeReplicaSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
126 action := testing.NewDeleteCollectionAction(replicasetsResource, c.ns, listOptions)
128 _, err := c.Fake.Invokes(action, &appsv1.ReplicaSetList{})
132 // Patch applies the patch and returns the patched replicaSet.
133 func (c *FakeReplicaSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *appsv1.ReplicaSet, err error) {
135 Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, name, pt, data, subresources...), &appsv1.ReplicaSet{})
140 return obj.(*appsv1.ReplicaSet), err
143 // GetScale takes name of the replicaSet, and returns the corresponding scale object, and an error if there is any.
144 func (c *FakeReplicaSets) GetScale(replicaSetName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) {
146 Invokes(testing.NewGetSubresourceAction(replicasetsResource, c.ns, "scale", replicaSetName), &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 *FakeReplicaSets) UpdateScale(replicaSetName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
157 Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "scale", c.ns, scale), &autoscalingv1.Scale{})
162 return obj.(*autoscalingv1.Scale), err