k8s.io/client-go@v0.22.2/kubernetes/typed/flowcontrol/v1alpha1/prioritylevelconfiguration.go (about) 1 /* 2 Copyright 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 // Code generated by client-gen. DO NOT EDIT. 18 19 package v1alpha1 20 21 import ( 22 "context" 23 json "encoding/json" 24 "fmt" 25 "time" 26 27 v1alpha1 "k8s.io/api/flowcontrol/v1alpha1" 28 v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 29 types "k8s.io/apimachinery/pkg/types" 30 watch "k8s.io/apimachinery/pkg/watch" 31 flowcontrolv1alpha1 "k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1" 32 scheme "k8s.io/client-go/kubernetes/scheme" 33 rest "k8s.io/client-go/rest" 34 ) 35 36 // PriorityLevelConfigurationsGetter has a method to return a PriorityLevelConfigurationInterface. 37 // A group's client should implement this interface. 38 type PriorityLevelConfigurationsGetter interface { 39 PriorityLevelConfigurations() PriorityLevelConfigurationInterface 40 } 41 42 // PriorityLevelConfigurationInterface has methods to work with PriorityLevelConfiguration resources. 43 type PriorityLevelConfigurationInterface interface { 44 Create(ctx context.Context, priorityLevelConfiguration *v1alpha1.PriorityLevelConfiguration, opts v1.CreateOptions) (*v1alpha1.PriorityLevelConfiguration, error) 45 Update(ctx context.Context, priorityLevelConfiguration *v1alpha1.PriorityLevelConfiguration, opts v1.UpdateOptions) (*v1alpha1.PriorityLevelConfiguration, error) 46 UpdateStatus(ctx context.Context, priorityLevelConfiguration *v1alpha1.PriorityLevelConfiguration, opts v1.UpdateOptions) (*v1alpha1.PriorityLevelConfiguration, error) 47 Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 48 DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 49 Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.PriorityLevelConfiguration, error) 50 List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PriorityLevelConfigurationList, error) 51 Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 52 Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PriorityLevelConfiguration, err error) 53 Apply(ctx context.Context, priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfigurationApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.PriorityLevelConfiguration, err error) 54 ApplyStatus(ctx context.Context, priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfigurationApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.PriorityLevelConfiguration, err error) 55 PriorityLevelConfigurationExpansion 56 } 57 58 // priorityLevelConfigurations implements PriorityLevelConfigurationInterface 59 type priorityLevelConfigurations struct { 60 client rest.Interface 61 } 62 63 // newPriorityLevelConfigurations returns a PriorityLevelConfigurations 64 func newPriorityLevelConfigurations(c *FlowcontrolV1alpha1Client) *priorityLevelConfigurations { 65 return &priorityLevelConfigurations{ 66 client: c.RESTClient(), 67 } 68 } 69 70 // Get takes name of the priorityLevelConfiguration, and returns the corresponding priorityLevelConfiguration object, and an error if there is any. 71 func (c *priorityLevelConfigurations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PriorityLevelConfiguration, err error) { 72 result = &v1alpha1.PriorityLevelConfiguration{} 73 err = c.client.Get(). 74 Resource("prioritylevelconfigurations"). 75 Name(name). 76 VersionedParams(&options, scheme.ParameterCodec). 77 Do(ctx). 78 Into(result) 79 return 80 } 81 82 // List takes label and field selectors, and returns the list of PriorityLevelConfigurations that match those selectors. 83 func (c *priorityLevelConfigurations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PriorityLevelConfigurationList, err error) { 84 var timeout time.Duration 85 if opts.TimeoutSeconds != nil { 86 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second 87 } 88 result = &v1alpha1.PriorityLevelConfigurationList{} 89 err = c.client.Get(). 90 Resource("prioritylevelconfigurations"). 91 VersionedParams(&opts, scheme.ParameterCodec). 92 Timeout(timeout). 93 Do(ctx). 94 Into(result) 95 return 96 } 97 98 // Watch returns a watch.Interface that watches the requested priorityLevelConfigurations. 99 func (c *priorityLevelConfigurations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { 100 var timeout time.Duration 101 if opts.TimeoutSeconds != nil { 102 timeout = time.Duration(*opts.TimeoutSeconds) * time.Second 103 } 104 opts.Watch = true 105 return c.client.Get(). 106 Resource("prioritylevelconfigurations"). 107 VersionedParams(&opts, scheme.ParameterCodec). 108 Timeout(timeout). 109 Watch(ctx) 110 } 111 112 // Create takes the representation of a priorityLevelConfiguration and creates it. Returns the server's representation of the priorityLevelConfiguration, and an error, if there is any. 113 func (c *priorityLevelConfigurations) Create(ctx context.Context, priorityLevelConfiguration *v1alpha1.PriorityLevelConfiguration, opts v1.CreateOptions) (result *v1alpha1.PriorityLevelConfiguration, err error) { 114 result = &v1alpha1.PriorityLevelConfiguration{} 115 err = c.client.Post(). 116 Resource("prioritylevelconfigurations"). 117 VersionedParams(&opts, scheme.ParameterCodec). 118 Body(priorityLevelConfiguration). 119 Do(ctx). 120 Into(result) 121 return 122 } 123 124 // Update takes the representation of a priorityLevelConfiguration and updates it. Returns the server's representation of the priorityLevelConfiguration, and an error, if there is any. 125 func (c *priorityLevelConfigurations) Update(ctx context.Context, priorityLevelConfiguration *v1alpha1.PriorityLevelConfiguration, opts v1.UpdateOptions) (result *v1alpha1.PriorityLevelConfiguration, err error) { 126 result = &v1alpha1.PriorityLevelConfiguration{} 127 err = c.client.Put(). 128 Resource("prioritylevelconfigurations"). 129 Name(priorityLevelConfiguration.Name). 130 VersionedParams(&opts, scheme.ParameterCodec). 131 Body(priorityLevelConfiguration). 132 Do(ctx). 133 Into(result) 134 return 135 } 136 137 // UpdateStatus was generated because the type contains a Status member. 138 // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 139 func (c *priorityLevelConfigurations) UpdateStatus(ctx context.Context, priorityLevelConfiguration *v1alpha1.PriorityLevelConfiguration, opts v1.UpdateOptions) (result *v1alpha1.PriorityLevelConfiguration, err error) { 140 result = &v1alpha1.PriorityLevelConfiguration{} 141 err = c.client.Put(). 142 Resource("prioritylevelconfigurations"). 143 Name(priorityLevelConfiguration.Name). 144 SubResource("status"). 145 VersionedParams(&opts, scheme.ParameterCodec). 146 Body(priorityLevelConfiguration). 147 Do(ctx). 148 Into(result) 149 return 150 } 151 152 // Delete takes name of the priorityLevelConfiguration and deletes it. Returns an error if one occurs. 153 func (c *priorityLevelConfigurations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { 154 return c.client.Delete(). 155 Resource("prioritylevelconfigurations"). 156 Name(name). 157 Body(&opts). 158 Do(ctx). 159 Error() 160 } 161 162 // DeleteCollection deletes a collection of objects. 163 func (c *priorityLevelConfigurations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { 164 var timeout time.Duration 165 if listOpts.TimeoutSeconds != nil { 166 timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second 167 } 168 return c.client.Delete(). 169 Resource("prioritylevelconfigurations"). 170 VersionedParams(&listOpts, scheme.ParameterCodec). 171 Timeout(timeout). 172 Body(&opts). 173 Do(ctx). 174 Error() 175 } 176 177 // Patch applies the patch and returns the patched priorityLevelConfiguration. 178 func (c *priorityLevelConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PriorityLevelConfiguration, err error) { 179 result = &v1alpha1.PriorityLevelConfiguration{} 180 err = c.client.Patch(pt). 181 Resource("prioritylevelconfigurations"). 182 Name(name). 183 SubResource(subresources...). 184 VersionedParams(&opts, scheme.ParameterCodec). 185 Body(data). 186 Do(ctx). 187 Into(result) 188 return 189 } 190 191 // Apply takes the given apply declarative configuration, applies it and returns the applied priorityLevelConfiguration. 192 func (c *priorityLevelConfigurations) Apply(ctx context.Context, priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfigurationApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.PriorityLevelConfiguration, err error) { 193 if priorityLevelConfiguration == nil { 194 return nil, fmt.Errorf("priorityLevelConfiguration provided to Apply must not be nil") 195 } 196 patchOpts := opts.ToPatchOptions() 197 data, err := json.Marshal(priorityLevelConfiguration) 198 if err != nil { 199 return nil, err 200 } 201 name := priorityLevelConfiguration.Name 202 if name == nil { 203 return nil, fmt.Errorf("priorityLevelConfiguration.Name must be provided to Apply") 204 } 205 result = &v1alpha1.PriorityLevelConfiguration{} 206 err = c.client.Patch(types.ApplyPatchType). 207 Resource("prioritylevelconfigurations"). 208 Name(*name). 209 VersionedParams(&patchOpts, scheme.ParameterCodec). 210 Body(data). 211 Do(ctx). 212 Into(result) 213 return 214 } 215 216 // ApplyStatus was generated because the type contains a Status member. 217 // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). 218 func (c *priorityLevelConfigurations) ApplyStatus(ctx context.Context, priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfigurationApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.PriorityLevelConfiguration, err error) { 219 if priorityLevelConfiguration == nil { 220 return nil, fmt.Errorf("priorityLevelConfiguration provided to Apply must not be nil") 221 } 222 patchOpts := opts.ToPatchOptions() 223 data, err := json.Marshal(priorityLevelConfiguration) 224 if err != nil { 225 return nil, err 226 } 227 228 name := priorityLevelConfiguration.Name 229 if name == nil { 230 return nil, fmt.Errorf("priorityLevelConfiguration.Name must be provided to Apply") 231 } 232 233 result = &v1alpha1.PriorityLevelConfiguration{} 234 err = c.client.Patch(types.ApplyPatchType). 235 Resource("prioritylevelconfigurations"). 236 Name(*name). 237 SubResource("status"). 238 VersionedParams(&patchOpts, scheme.ParameterCodec). 239 Body(data). 240 Do(ctx). 241 Into(result) 242 return 243 }