|
| 1 | +/* |
| 2 | +Copyright 2017 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 | +package fake |
| 18 | + |
| 19 | +import ( |
| 20 | + v1alpha1 "k8s.io/api/admissionregistration/v1alpha1" |
| 21 | + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 22 | + labels "k8s.io/apimachinery/pkg/labels" |
| 23 | + schema "k8s.io/apimachinery/pkg/runtime/schema" |
| 24 | + types "k8s.io/apimachinery/pkg/types" |
| 25 | + watch "k8s.io/apimachinery/pkg/watch" |
| 26 | + testing "k8s.io/client-go/testing" |
| 27 | +) |
| 28 | + |
| 29 | +// FakeMutatingWebhookConfigurations implements MutatingWebhookConfigurationInterface |
| 30 | +type FakeMutatingWebhookConfigurations struct { |
| 31 | + Fake *FakeAdmissionregistrationV1alpha1 |
| 32 | +} |
| 33 | + |
| 34 | +var mutatingwebhookconfigurationsResource = schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "mutatingwebhookconfigurations"} |
| 35 | + |
| 36 | +var mutatingwebhookconfigurationsKind = schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "MutatingWebhookConfiguration"} |
| 37 | + |
| 38 | +// Get takes name of the mutatingWebhookConfiguration, and returns the corresponding mutatingWebhookConfiguration object, and an error if there is any. |
| 39 | +func (c *FakeMutatingWebhookConfigurations) Get(name string, options v1.GetOptions) (result *v1alpha1.MutatingWebhookConfiguration, err error) { |
| 40 | + obj, err := c.Fake. |
| 41 | + Invokes(testing.NewRootGetAction(mutatingwebhookconfigurationsResource, name), &v1alpha1.MutatingWebhookConfiguration{}) |
| 42 | + if obj == nil { |
| 43 | + return nil, err |
| 44 | + } |
| 45 | + return obj.(*v1alpha1.MutatingWebhookConfiguration), err |
| 46 | +} |
| 47 | + |
| 48 | +// List takes label and field selectors, and returns the list of MutatingWebhookConfigurations that match those selectors. |
| 49 | +func (c *FakeMutatingWebhookConfigurations) List(opts v1.ListOptions) (result *v1alpha1.MutatingWebhookConfigurationList, err error) { |
| 50 | + obj, err := c.Fake. |
| 51 | + Invokes(testing.NewRootListAction(mutatingwebhookconfigurationsResource, mutatingwebhookconfigurationsKind, opts), &v1alpha1.MutatingWebhookConfigurationList{}) |
| 52 | + if obj == nil { |
| 53 | + return nil, err |
| 54 | + } |
| 55 | + |
| 56 | + label, _, _ := testing.ExtractFromListOptions(opts) |
| 57 | + if label == nil { |
| 58 | + label = labels.Everything() |
| 59 | + } |
| 60 | + list := &v1alpha1.MutatingWebhookConfigurationList{} |
| 61 | + for _, item := range obj.(*v1alpha1.MutatingWebhookConfigurationList).Items { |
| 62 | + if label.Matches(labels.Set(item.Labels)) { |
| 63 | + list.Items = append(list.Items, item) |
| 64 | + } |
| 65 | + } |
| 66 | + return list, err |
| 67 | +} |
| 68 | + |
| 69 | +// Watch returns a watch.Interface that watches the requested mutatingWebhookConfigurations. |
| 70 | +func (c *FakeMutatingWebhookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) { |
| 71 | + return c.Fake. |
| 72 | + InvokesWatch(testing.NewRootWatchAction(mutatingwebhookconfigurationsResource, opts)) |
| 73 | +} |
| 74 | + |
| 75 | +// Create takes the representation of a mutatingWebhookConfiguration and creates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any. |
| 76 | +func (c *FakeMutatingWebhookConfigurations) Create(mutatingWebhookConfiguration *v1alpha1.MutatingWebhookConfiguration) (result *v1alpha1.MutatingWebhookConfiguration, err error) { |
| 77 | + obj, err := c.Fake. |
| 78 | + Invokes(testing.NewRootCreateAction(mutatingwebhookconfigurationsResource, mutatingWebhookConfiguration), &v1alpha1.MutatingWebhookConfiguration{}) |
| 79 | + if obj == nil { |
| 80 | + return nil, err |
| 81 | + } |
| 82 | + return obj.(*v1alpha1.MutatingWebhookConfiguration), err |
| 83 | +} |
| 84 | + |
| 85 | +// Update takes the representation of a mutatingWebhookConfiguration and updates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any. |
| 86 | +func (c *FakeMutatingWebhookConfigurations) Update(mutatingWebhookConfiguration *v1alpha1.MutatingWebhookConfiguration) (result *v1alpha1.MutatingWebhookConfiguration, err error) { |
| 87 | + obj, err := c.Fake. |
| 88 | + Invokes(testing.NewRootUpdateAction(mutatingwebhookconfigurationsResource, mutatingWebhookConfiguration), &v1alpha1.MutatingWebhookConfiguration{}) |
| 89 | + if obj == nil { |
| 90 | + return nil, err |
| 91 | + } |
| 92 | + return obj.(*v1alpha1.MutatingWebhookConfiguration), err |
| 93 | +} |
| 94 | + |
| 95 | +// Delete takes name of the mutatingWebhookConfiguration and deletes it. Returns an error if one occurs. |
| 96 | +func (c *FakeMutatingWebhookConfigurations) Delete(name string, options *v1.DeleteOptions) error { |
| 97 | + _, err := c.Fake. |
| 98 | + Invokes(testing.NewRootDeleteAction(mutatingwebhookconfigurationsResource, name), &v1alpha1.MutatingWebhookConfiguration{}) |
| 99 | + return err |
| 100 | +} |
| 101 | + |
| 102 | +// DeleteCollection deletes a collection of objects. |
| 103 | +func (c *FakeMutatingWebhookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { |
| 104 | + action := testing.NewRootDeleteCollectionAction(mutatingwebhookconfigurationsResource, listOptions) |
| 105 | + |
| 106 | + _, err := c.Fake.Invokes(action, &v1alpha1.MutatingWebhookConfigurationList{}) |
| 107 | + return err |
| 108 | +} |
| 109 | + |
| 110 | +// Patch applies the patch and returns the patched mutatingWebhookConfiguration. |
| 111 | +func (c *FakeMutatingWebhookConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MutatingWebhookConfiguration, err error) { |
| 112 | + obj, err := c.Fake. |
| 113 | + Invokes(testing.NewRootPatchSubresourceAction(mutatingwebhookconfigurationsResource, name, data, subresources...), &v1alpha1.MutatingWebhookConfiguration{}) |
| 114 | + if obj == nil { |
| 115 | + return nil, err |
| 116 | + } |
| 117 | + return obj.(*v1alpha1.MutatingWebhookConfiguration), err |
| 118 | +} |
0 commit comments