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 corev1 "k8s.io/api/core/v1"
23 v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24 labels "k8s.io/apimachinery/pkg/labels"
25 schema "k8s.io/apimachinery/pkg/runtime/schema"
26 types "k8s.io/apimachinery/pkg/types"
27 watch "k8s.io/apimachinery/pkg/watch"
28 testing "k8s.io/client-go/testing"
31 // FakeNamespaces implements NamespaceInterface
32 type FakeNamespaces struct {
36 var namespacesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "namespaces"}
38 var namespacesKind = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Namespace"}
40 // Get takes name of the namespace, and returns the corresponding namespace object, and an error if there is any.
41 func (c *FakeNamespaces) Get(name string, options v1.GetOptions) (result *corev1.Namespace, err error) {
43 Invokes(testing.NewRootGetAction(namespacesResource, name), &corev1.Namespace{})
47 return obj.(*corev1.Namespace), err
50 // List takes label and field selectors, and returns the list of Namespaces that match those selectors.
51 func (c *FakeNamespaces) List(opts v1.ListOptions) (result *corev1.NamespaceList, err error) {
53 Invokes(testing.NewRootListAction(namespacesResource, namespacesKind, opts), &corev1.NamespaceList{})
58 label, _, _ := testing.ExtractFromListOptions(opts)
60 label = labels.Everything()
62 list := &corev1.NamespaceList{ListMeta: obj.(*corev1.NamespaceList).ListMeta}
63 for _, item := range obj.(*corev1.NamespaceList).Items {
64 if label.Matches(labels.Set(item.Labels)) {
65 list.Items = append(list.Items, item)
71 // Watch returns a watch.Interface that watches the requested namespaces.
72 func (c *FakeNamespaces) Watch(opts v1.ListOptions) (watch.Interface, error) {
74 InvokesWatch(testing.NewRootWatchAction(namespacesResource, opts))
77 // Create takes the representation of a namespace and creates it. Returns the server's representation of the namespace, and an error, if there is any.
78 func (c *FakeNamespaces) Create(namespace *corev1.Namespace) (result *corev1.Namespace, err error) {
80 Invokes(testing.NewRootCreateAction(namespacesResource, namespace), &corev1.Namespace{})
84 return obj.(*corev1.Namespace), err
87 // Update takes the representation of a namespace and updates it. Returns the server's representation of the namespace, and an error, if there is any.
88 func (c *FakeNamespaces) Update(namespace *corev1.Namespace) (result *corev1.Namespace, err error) {
90 Invokes(testing.NewRootUpdateAction(namespacesResource, namespace), &corev1.Namespace{})
94 return obj.(*corev1.Namespace), err
97 // UpdateStatus was generated because the type contains a Status member.
98 // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
99 func (c *FakeNamespaces) UpdateStatus(namespace *corev1.Namespace) (*corev1.Namespace, error) {
101 Invokes(testing.NewRootUpdateSubresourceAction(namespacesResource, "status", namespace), &corev1.Namespace{})
105 return obj.(*corev1.Namespace), err
108 // Delete takes name of the namespace and deletes it. Returns an error if one occurs.
109 func (c *FakeNamespaces) Delete(name string, options *v1.DeleteOptions) error {
111 Invokes(testing.NewRootDeleteAction(namespacesResource, name), &corev1.Namespace{})
115 // Patch applies the patch and returns the patched namespace.
116 func (c *FakeNamespaces) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *corev1.Namespace, err error) {
118 Invokes(testing.NewRootPatchSubresourceAction(namespacesResource, name, pt, data, subresources...), &corev1.Namespace{})
122 return obj.(*corev1.Namespace), err