Debian Codegraph @

applyconfigurations/resource/v1beta2/resourceclaim.go

raw
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 applyconfiguration-gen. DO NOT EDIT.
18
19 package v1beta2
20
21 import (
22 resourcev1beta2 "k8s.io/api/resource/v1beta2"
23 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24 types "k8s.io/apimachinery/pkg/types"
25 managedfields "k8s.io/apimachinery/pkg/util/managedfields"
26 internal "k8s.io/client-go/applyconfigurations/internal"
27 v1 "k8s.io/client-go/applyconfigurations/meta/v1"
28 )
29
30 // ResourceClaimApplyConfiguration represents a declarative configuration of the ResourceClaim type for use
31 // with apply.
32 type ResourceClaimApplyConfiguration struct {
33 v1.TypeMetaApplyConfiguration `json:",inline"`
34 *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
35 Spec *ResourceClaimSpecApplyConfiguration `json:"spec,omitempty"`
36 Status *ResourceClaimStatusApplyConfiguration `json:"status,omitempty"`
37 }
38
39 // ResourceClaim constructs a declarative configuration of the ResourceClaim type for use with
40 // apply.
41 func ResourceClaim(name, namespace string) *ResourceClaimApplyConfiguration {
42 b := &ResourceClaimApplyConfiguration{}
43 b.WithName(name)
44 b.WithNamespace(namespace)
45 b.WithKind("ResourceClaim")
46 b.WithAPIVersion("resource.k8s.io/v1beta2")
47 return b
48 }
49
50 // ExtractResourceClaim extracts the applied configuration owned by fieldManager from
51 // resourceClaim. If no managedFields are found in resourceClaim for fieldManager, a
52 // ResourceClaimApplyConfiguration is returned with only the Name, Namespace (if applicable),
53 // APIVersion and Kind populated. It is possible that no managed fields were found for because other
54 // field managers have taken ownership of all the fields previously owned by fieldManager, or because
55 // the fieldManager never owned fields any fields.
56 // resourceClaim must be a unmodified ResourceClaim API object that was retrieved from the Kubernetes API.
57 // ExtractResourceClaim provides a way to perform a extract/modify-in-place/apply workflow.
58 // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
59 // applied if another fieldManager has updated or force applied any of the previously applied fields.
60 // Experimental!
61 func ExtractResourceClaim(resourceClaim *resourcev1beta2.ResourceClaim, fieldManager string) (*ResourceClaimApplyConfiguration, error) {
62 return extractResourceClaim(resourceClaim, fieldManager, "")
63 }
64
65 // ExtractResourceClaimStatus is the same as ExtractResourceClaim except
66 // that it extracts the status subresource applied configuration.
67 // Experimental!
68 func ExtractResourceClaimStatus(resourceClaim *resourcev1beta2.ResourceClaim, fieldManager string) (*ResourceClaimApplyConfiguration, error) {
69 return extractResourceClaim(resourceClaim, fieldManager, "status")
70 }
71
72 func extractResourceClaim(resourceClaim *resourcev1beta2.ResourceClaim, fieldManager string, subresource string) (*ResourceClaimApplyConfiguration, error) {
73 b := &ResourceClaimApplyConfiguration{}
74 err := managedfields.ExtractInto(resourceClaim, internal.Parser().Type("io.k8s.api.resource.v1beta2.ResourceClaim"), fieldManager, b, subresource)
75 if err != nil {
76 return nil, err
77 }
78 b.WithName(resourceClaim.Name)
79 b.WithNamespace(resourceClaim.Namespace)
80
81 b.WithKind("ResourceClaim")
82 b.WithAPIVersion("resource.k8s.io/v1beta2")
83 return b, nil
84 }
85
86 // WithKind sets the Kind field in the declarative configuration to the given value
87 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
88 // If called multiple times, the Kind field is set to the value of the last call.
89 func (b *ResourceClaimApplyConfiguration) WithKind(value string) *ResourceClaimApplyConfiguration {
90 b.TypeMetaApplyConfiguration.Kind = &value
91 return b
92 }
93
94 // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
95 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
96 // If called multiple times, the APIVersion field is set to the value of the last call.
97 func (b *ResourceClaimApplyConfiguration) WithAPIVersion(value string) *ResourceClaimApplyConfiguration {
98 b.TypeMetaApplyConfiguration.APIVersion = &value
99 return b
100 }
101
102 // WithName sets the Name field in the declarative configuration to the given value
103 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
104 // If called multiple times, the Name field is set to the value of the last call.
105 func (b *ResourceClaimApplyConfiguration) WithName(value string) *ResourceClaimApplyConfiguration {
106 b.ensureObjectMetaApplyConfigurationExists()
107 b.ObjectMetaApplyConfiguration.Name = &value
108 return b
109 }
110
111 // WithGenerateName sets the GenerateName field in the declarative configuration to the given value
112 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
113 // If called multiple times, the GenerateName field is set to the value of the last call.
114 func (b *ResourceClaimApplyConfiguration) WithGenerateName(value string) *ResourceClaimApplyConfiguration {
115 b.ensureObjectMetaApplyConfigurationExists()
116 b.ObjectMetaApplyConfiguration.GenerateName = &value
117 return b
118 }
119
120 // WithNamespace sets the Namespace field in the declarative configuration to the given value
121 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
122 // If called multiple times, the Namespace field is set to the value of the last call.
123 func (b *ResourceClaimApplyConfiguration) WithNamespace(value string) *ResourceClaimApplyConfiguration {
124 b.ensureObjectMetaApplyConfigurationExists()
125 b.ObjectMetaApplyConfiguration.Namespace = &value
126 return b
127 }
128
129 // WithUID sets the UID field in the declarative configuration to the given value
130 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
131 // If called multiple times, the UID field is set to the value of the last call.
132 func (b *ResourceClaimApplyConfiguration) WithUID(value types.UID) *ResourceClaimApplyConfiguration {
133 b.ensureObjectMetaApplyConfigurationExists()
134 b.ObjectMetaApplyConfiguration.UID = &value
135 return b
136 }
137
138 // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
139 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
140 // If called multiple times, the ResourceVersion field is set to the value of the last call.
141 func (b *ResourceClaimApplyConfiguration) WithResourceVersion(value string) *ResourceClaimApplyConfiguration {
142 b.ensureObjectMetaApplyConfigurationExists()
143 b.ObjectMetaApplyConfiguration.ResourceVersion = &value
144 return b
145 }
146
147 // WithGeneration sets the Generation field in the declarative configuration to the given value
148 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
149 // If called multiple times, the Generation field is set to the value of the last call.
150 func (b *ResourceClaimApplyConfiguration) WithGeneration(value int64) *ResourceClaimApplyConfiguration {
151 b.ensureObjectMetaApplyConfigurationExists()
152 b.ObjectMetaApplyConfiguration.Generation = &value
153 return b
154 }
155
156 // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
157 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
158 // If called multiple times, the CreationTimestamp field is set to the value of the last call.
159 func (b *ResourceClaimApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourceClaimApplyConfiguration {
160 b.ensureObjectMetaApplyConfigurationExists()
161 b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
162 return b
163 }
164
165 // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
166 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
167 // If called multiple times, the DeletionTimestamp field is set to the value of the last call.
168 func (b *ResourceClaimApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourceClaimApplyConfiguration {
169 b.ensureObjectMetaApplyConfigurationExists()
170 b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
171 return b
172 }
173
174 // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
175 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
176 // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
177 func (b *ResourceClaimApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourceClaimApplyConfiguration {
178 b.ensureObjectMetaApplyConfigurationExists()
179 b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
180 return b
181 }
182
183 // WithLabels puts the entries into the Labels field in the declarative configuration
184 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
185 // If called multiple times, the entries provided by each call will be put on the Labels field,
186 // overwriting an existing map entries in Labels field with the same key.
187 func (b *ResourceClaimApplyConfiguration) WithLabels(entries map[string]string) *ResourceClaimApplyConfiguration {
188 b.ensureObjectMetaApplyConfigurationExists()
189 if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
190 b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
191 }
192 for k, v := range entries {
193 b.ObjectMetaApplyConfiguration.Labels[k] = v
194 }
195 return b
196 }
197
198 // WithAnnotations puts the entries into the Annotations field in the declarative configuration
199 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
200 // If called multiple times, the entries provided by each call will be put on the Annotations field,
201 // overwriting an existing map entries in Annotations field with the same key.
202 func (b *ResourceClaimApplyConfiguration) WithAnnotations(entries map[string]string) *ResourceClaimApplyConfiguration {
203 b.ensureObjectMetaApplyConfigurationExists()
204 if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
205 b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
206 }
207 for k, v := range entries {
208 b.ObjectMetaApplyConfiguration.Annotations[k] = v
209 }
210 return b
211 }
212
213 // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
214 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
215 // If called multiple times, values provided by each call will be appended to the OwnerReferences field.
216 func (b *ResourceClaimApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourceClaimApplyConfiguration {
217 b.ensureObjectMetaApplyConfigurationExists()
218 for i := range values {
219 if values[i] == nil {
220 panic("nil value passed to WithOwnerReferences")
221 }
222 b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
223 }
224 return b
225 }
226
227 // WithFinalizers adds the given value to the Finalizers field in the declarative configuration
228 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
229 // If called multiple times, values provided by each call will be appended to the Finalizers field.
230 func (b *ResourceClaimApplyConfiguration) WithFinalizers(values ...string) *ResourceClaimApplyConfiguration {
231 b.ensureObjectMetaApplyConfigurationExists()
232 for i := range values {
233 b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
234 }
235 return b
236 }
237
238 func (b *ResourceClaimApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
239 if b.ObjectMetaApplyConfiguration == nil {
240 b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
241 }
242 }
243
244 // WithSpec sets the Spec field in the declarative configuration to the given value
245 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
246 // If called multiple times, the Spec field is set to the value of the last call.
247 func (b *ResourceClaimApplyConfiguration) WithSpec(value *ResourceClaimSpecApplyConfiguration) *ResourceClaimApplyConfiguration {
248 b.Spec = value
249 return b
250 }
251
252 // WithStatus sets the Status field in the declarative configuration to the given value
253 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
254 // If called multiple times, the Status field is set to the value of the last call.
255 func (b *ResourceClaimApplyConfiguration) WithStatus(value *ResourceClaimStatusApplyConfiguration) *ResourceClaimApplyConfiguration {
256 b.Status = value
257 return b
258 }
259
260 // GetName retrieves the value of the Name field in the declarative configuration.
261 func (b *ResourceClaimApplyConfiguration) GetName() *string {
262 b.ensureObjectMetaApplyConfigurationExists()
263 return b.ObjectMetaApplyConfiguration.Name
264 }