1/* 2Copyright The Kubernetes Authors. 3 4Licensed under the Apache License, Version 2.0 (the "License"); 5you may not use this file except in compliance with the License. 6You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10Unless required by applicable law or agreed to in writing, software 11distributed under the License is distributed on an "AS IS" BASIS, 12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13See the License for the specific language governing permissions and 14limitations under the License. 15*/ 16 17// Code generated by client-gen. DO NOT EDIT. 18 19package fake 20 21import ( 22 batchv1 "k8s.io/api/batch/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" 29) 30 31// FakeJobs implements JobInterface 32type FakeJobs struct { 33 Fake *FakeBatchV1 34 ns string 35} 36 37var jobsResource = schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "jobs"} 38 39var jobsKind = schema.GroupVersionKind{Group: "batch", Version: "v1", Kind: "Job"} 40 41// Get takes name of the job, and returns the corresponding job object, and an error if there is any. 42func (c *FakeJobs) Get(name string, options v1.GetOptions) (result *batchv1.Job, err error) { 43 obj, err := c.Fake. 44 Invokes(testing.NewGetAction(jobsResource, c.ns, name), &batchv1.Job{}) 45 46 if obj == nil { 47 return nil, err 48 } 49 return obj.(*batchv1.Job), err 50} 51 52// List takes label and field selectors, and returns the list of Jobs that match those selectors. 53func (c *FakeJobs) List(opts v1.ListOptions) (result *batchv1.JobList, err error) { 54 obj, err := c.Fake. 55 Invokes(testing.NewListAction(jobsResource, jobsKind, c.ns, opts), &batchv1.JobList{}) 56 57 if obj == nil { 58 return nil, err 59 } 60 61 label, _, _ := testing.ExtractFromListOptions(opts) 62 if label == nil { 63 label = labels.Everything() 64 } 65 list := &batchv1.JobList{ListMeta: obj.(*batchv1.JobList).ListMeta} 66 for _, item := range obj.(*batchv1.JobList).Items { 67 if label.Matches(labels.Set(item.Labels)) { 68 list.Items = append(list.Items, item) 69 } 70 } 71 return list, err 72} 73 74// Watch returns a watch.Interface that watches the requested jobs. 75func (c *FakeJobs) Watch(opts v1.ListOptions) (watch.Interface, error) { 76 return c.Fake. 77 InvokesWatch(testing.NewWatchAction(jobsResource, c.ns, opts)) 78 79} 80 81// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any. 82func (c *FakeJobs) Create(job *batchv1.Job) (result *batchv1.Job, err error) { 83 obj, err := c.Fake. 84 Invokes(testing.NewCreateAction(jobsResource, c.ns, job), &batchv1.Job{}) 85 86 if obj == nil { 87 return nil, err 88 } 89 return obj.(*batchv1.Job), err 90} 91 92// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any. 93func (c *FakeJobs) Update(job *batchv1.Job) (result *batchv1.Job, err error) { 94 obj, err := c.Fake. 95 Invokes(testing.NewUpdateAction(jobsResource, c.ns, job), &batchv1.Job{}) 96 97 if obj == nil { 98 return nil, err 99 } 100 return obj.(*batchv1.Job), err 101} 102 103// UpdateStatus was generated because the type contains a Status member. 104// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 105func (c *FakeJobs) UpdateStatus(job *batchv1.Job) (*batchv1.Job, error) { 106 obj, err := c.Fake. 107 Invokes(testing.NewUpdateSubresourceAction(jobsResource, "status", c.ns, job), &batchv1.Job{}) 108 109 if obj == nil { 110 return nil, err 111 } 112 return obj.(*batchv1.Job), err 113} 114 115// Delete takes name of the job and deletes it. Returns an error if one occurs. 116func (c *FakeJobs) Delete(name string, options *v1.DeleteOptions) error { 117 _, err := c.Fake. 118 Invokes(testing.NewDeleteAction(jobsResource, c.ns, name), &batchv1.Job{}) 119 120 return err 121} 122 123// DeleteCollection deletes a collection of objects. 124func (c *FakeJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { 125 action := testing.NewDeleteCollectionAction(jobsResource, c.ns, listOptions) 126 127 _, err := c.Fake.Invokes(action, &batchv1.JobList{}) 128 return err 129} 130 131// Patch applies the patch and returns the patched job. 132func (c *FakeJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *batchv1.Job, err error) { 133 obj, err := c.Fake. 134 Invokes(testing.NewPatchSubresourceAction(jobsResource, c.ns, name, pt, data, subresources...), &batchv1.Job{}) 135 136 if obj == nil { 137 return nil, err 138 } 139 return obj.(*batchv1.Job), err 140} 141