blob: 319636f771b1fce2fd6369d6d6b66e97c40f7412 [file] [log] [blame]
Matteo Scandoloa4285862020-12-01 18:10:10 -08001/*
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 v1alpha1
20
21import (
22 "context"
23 "time"
24
25 v1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
26 v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27 types "k8s.io/apimachinery/pkg/types"
28 watch "k8s.io/apimachinery/pkg/watch"
29 scheme "k8s.io/client-go/kubernetes/scheme"
30 rest "k8s.io/client-go/rest"
31)
32
33// FlowSchemasGetter has a method to return a FlowSchemaInterface.
34// A group's client should implement this interface.
35type FlowSchemasGetter interface {
36 FlowSchemas() FlowSchemaInterface
37}
38
39// FlowSchemaInterface has methods to work with FlowSchema resources.
40type FlowSchemaInterface interface {
41 Create(ctx context.Context, flowSchema *v1alpha1.FlowSchema, opts v1.CreateOptions) (*v1alpha1.FlowSchema, error)
42 Update(ctx context.Context, flowSchema *v1alpha1.FlowSchema, opts v1.UpdateOptions) (*v1alpha1.FlowSchema, error)
43 UpdateStatus(ctx context.Context, flowSchema *v1alpha1.FlowSchema, opts v1.UpdateOptions) (*v1alpha1.FlowSchema, error)
44 Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
45 DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
46 Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.FlowSchema, error)
47 List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.FlowSchemaList, error)
48 Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
49 Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.FlowSchema, err error)
50 FlowSchemaExpansion
51}
52
53// flowSchemas implements FlowSchemaInterface
54type flowSchemas struct {
55 client rest.Interface
56}
57
58// newFlowSchemas returns a FlowSchemas
59func newFlowSchemas(c *FlowcontrolV1alpha1Client) *flowSchemas {
60 return &flowSchemas{
61 client: c.RESTClient(),
62 }
63}
64
65// Get takes name of the flowSchema, and returns the corresponding flowSchema object, and an error if there is any.
66func (c *flowSchemas) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.FlowSchema, err error) {
67 result = &v1alpha1.FlowSchema{}
68 err = c.client.Get().
69 Resource("flowschemas").
70 Name(name).
71 VersionedParams(&options, scheme.ParameterCodec).
72 Do(ctx).
73 Into(result)
74 return
75}
76
77// List takes label and field selectors, and returns the list of FlowSchemas that match those selectors.
78func (c *flowSchemas) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.FlowSchemaList, err error) {
79 var timeout time.Duration
80 if opts.TimeoutSeconds != nil {
81 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
82 }
83 result = &v1alpha1.FlowSchemaList{}
84 err = c.client.Get().
85 Resource("flowschemas").
86 VersionedParams(&opts, scheme.ParameterCodec).
87 Timeout(timeout).
88 Do(ctx).
89 Into(result)
90 return
91}
92
93// Watch returns a watch.Interface that watches the requested flowSchemas.
94func (c *flowSchemas) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
95 var timeout time.Duration
96 if opts.TimeoutSeconds != nil {
97 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
98 }
99 opts.Watch = true
100 return c.client.Get().
101 Resource("flowschemas").
102 VersionedParams(&opts, scheme.ParameterCodec).
103 Timeout(timeout).
104 Watch(ctx)
105}
106
107// Create takes the representation of a flowSchema and creates it. Returns the server's representation of the flowSchema, and an error, if there is any.
108func (c *flowSchemas) Create(ctx context.Context, flowSchema *v1alpha1.FlowSchema, opts v1.CreateOptions) (result *v1alpha1.FlowSchema, err error) {
109 result = &v1alpha1.FlowSchema{}
110 err = c.client.Post().
111 Resource("flowschemas").
112 VersionedParams(&opts, scheme.ParameterCodec).
113 Body(flowSchema).
114 Do(ctx).
115 Into(result)
116 return
117}
118
119// Update takes the representation of a flowSchema and updates it. Returns the server's representation of the flowSchema, and an error, if there is any.
120func (c *flowSchemas) Update(ctx context.Context, flowSchema *v1alpha1.FlowSchema, opts v1.UpdateOptions) (result *v1alpha1.FlowSchema, err error) {
121 result = &v1alpha1.FlowSchema{}
122 err = c.client.Put().
123 Resource("flowschemas").
124 Name(flowSchema.Name).
125 VersionedParams(&opts, scheme.ParameterCodec).
126 Body(flowSchema).
127 Do(ctx).
128 Into(result)
129 return
130}
131
132// UpdateStatus was generated because the type contains a Status member.
133// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
134func (c *flowSchemas) UpdateStatus(ctx context.Context, flowSchema *v1alpha1.FlowSchema, opts v1.UpdateOptions) (result *v1alpha1.FlowSchema, err error) {
135 result = &v1alpha1.FlowSchema{}
136 err = c.client.Put().
137 Resource("flowschemas").
138 Name(flowSchema.Name).
139 SubResource("status").
140 VersionedParams(&opts, scheme.ParameterCodec).
141 Body(flowSchema).
142 Do(ctx).
143 Into(result)
144 return
145}
146
147// Delete takes name of the flowSchema and deletes it. Returns an error if one occurs.
148func (c *flowSchemas) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
149 return c.client.Delete().
150 Resource("flowschemas").
151 Name(name).
152 Body(&opts).
153 Do(ctx).
154 Error()
155}
156
157// DeleteCollection deletes a collection of objects.
158func (c *flowSchemas) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
159 var timeout time.Duration
160 if listOpts.TimeoutSeconds != nil {
161 timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
162 }
163 return c.client.Delete().
164 Resource("flowschemas").
165 VersionedParams(&listOpts, scheme.ParameterCodec).
166 Timeout(timeout).
167 Body(&opts).
168 Do(ctx).
169 Error()
170}
171
172// Patch applies the patch and returns the patched flowSchema.
173func (c *flowSchemas) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.FlowSchema, err error) {
174 result = &v1alpha1.FlowSchema{}
175 err = c.client.Patch(pt).
176 Resource("flowschemas").
177 Name(name).
178 SubResource(subresources...).
179 VersionedParams(&opts, scheme.ParameterCodec).
180 Body(data).
181 Do(ctx).
182 Into(result)
183 return
184}