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.
24 v2alpha1 "k8s.io/api/batch/v2alpha1"
25 v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26 types "k8s.io/apimachinery/pkg/types"
27 watch "k8s.io/apimachinery/pkg/watch"
28 scheme "k8s.io/client-go/kubernetes/scheme"
29 rest "k8s.io/client-go/rest"
32 // CronJobsGetter has a method to return a CronJobInterface.
33 // A group's client should implement this interface.
34 type CronJobsGetter interface {
35 CronJobs(namespace string) CronJobInterface
38 // CronJobInterface has methods to work with CronJob resources.
39 type CronJobInterface interface {
40 Create(*v2alpha1.CronJob) (*v2alpha1.CronJob, error)
41 Update(*v2alpha1.CronJob) (*v2alpha1.CronJob, error)
42 UpdateStatus(*v2alpha1.CronJob) (*v2alpha1.CronJob, error)
43 Delete(name string, options *v1.DeleteOptions) error
44 DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
45 Get(name string, options v1.GetOptions) (*v2alpha1.CronJob, error)
46 List(opts v1.ListOptions) (*v2alpha1.CronJobList, error)
47 Watch(opts v1.ListOptions) (watch.Interface, error)
48 Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error)
52 // cronJobs implements CronJobInterface
53 type cronJobs struct {
58 // newCronJobs returns a CronJobs
59 func newCronJobs(c *BatchV2alpha1Client, namespace string) *cronJobs {
61 client: c.RESTClient(),
66 // Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any.
67 func (c *cronJobs) Get(name string, options v1.GetOptions) (result *v2alpha1.CronJob, err error) {
68 result = &v2alpha1.CronJob{}
73 VersionedParams(&options, scheme.ParameterCodec).
79 // List takes label and field selectors, and returns the list of CronJobs that match those selectors.
80 func (c *cronJobs) List(opts v1.ListOptions) (result *v2alpha1.CronJobList, err error) {
81 var timeout time.Duration
82 if opts.TimeoutSeconds != nil {
83 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
85 result = &v2alpha1.CronJobList{}
89 VersionedParams(&opts, scheme.ParameterCodec).
96 // Watch returns a watch.Interface that watches the requested cronJobs.
97 func (c *cronJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
98 var timeout time.Duration
99 if opts.TimeoutSeconds != nil {
100 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
103 return c.client.Get().
105 Resource("cronjobs").
106 VersionedParams(&opts, scheme.ParameterCodec).
111 // Create takes the representation of a cronJob and creates it. Returns the server's representation of the cronJob, and an error, if there is any.
112 func (c *cronJobs) Create(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
113 result = &v2alpha1.CronJob{}
114 err = c.client.Post().
116 Resource("cronjobs").
123 // Update takes the representation of a cronJob and updates it. Returns the server's representation of the cronJob, and an error, if there is any.
124 func (c *cronJobs) Update(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
125 result = &v2alpha1.CronJob{}
126 err = c.client.Put().
128 Resource("cronjobs").
136 // UpdateStatus was generated because the type contains a Status member.
137 // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
139 func (c *cronJobs) UpdateStatus(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
140 result = &v2alpha1.CronJob{}
141 err = c.client.Put().
143 Resource("cronjobs").
145 SubResource("status").
152 // Delete takes name of the cronJob and deletes it. Returns an error if one occurs.
153 func (c *cronJobs) Delete(name string, options *v1.DeleteOptions) error {
154 return c.client.Delete().
156 Resource("cronjobs").
163 // DeleteCollection deletes a collection of objects.
164 func (c *cronJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
165 var timeout time.Duration
166 if listOptions.TimeoutSeconds != nil {
167 timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
169 return c.client.Delete().
171 Resource("cronjobs").
172 VersionedParams(&listOptions, scheme.ParameterCodec).
179 // Patch applies the patch and returns the patched cronJob.
180 func (c *cronJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error) {
181 result = &v2alpha1.CronJob{}
182 err = c.client.Patch(pt).
184 Resource("cronjobs").
185 SubResource(subresources...).