Debian Codegraph @

applyconfigurations/events/v1beta1/event.go

raw symbols SCIP
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 v1beta1
20
21 import (
22 eventsv1beta1 "k8s.io/api/events/v1beta1"
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 corev1 "k8s.io/client-go/applyconfigurations/core/v1"
27 internal "k8s.io/client-go/applyconfigurations/internal"
28 v1 "k8s.io/client-go/applyconfigurations/meta/v1"
29 )
30
31 // EventApplyConfiguration represents a declarative configuration of the Event type for use
32 // with apply.
33 type EventApplyConfiguration struct {
34 v1.TypeMetaApplyConfiguration `json:",inline"`
35 *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
36 EventTime *metav1.MicroTime `json:"eventTime,omitempty"`
37 Series *EventSeriesApplyConfiguration `json:"series,omitempty"`
38 ReportingController *string `json:"reportingController,omitempty"`
39 ReportingInstance *string `json:"reportingInstance,omitempty"`
40 Action *string `json:"action,omitempty"`
41 Reason *string `json:"reason,omitempty"`
42 Regarding *corev1.ObjectReferenceApplyConfiguration `json:"regarding,omitempty"`
43 Related *corev1.ObjectReferenceApplyConfiguration `json:"related,omitempty"`
44 Note *string `json:"note,omitempty"`
45 Type *string `json:"type,omitempty"`
46 DeprecatedSource *corev1.EventSourceApplyConfiguration `json:"deprecatedSource,omitempty"`
47 DeprecatedFirstTimestamp *metav1.Time `json:"deprecatedFirstTimestamp,omitempty"`
48 DeprecatedLastTimestamp *metav1.Time `json:"deprecatedLastTimestamp,omitempty"`
49 DeprecatedCount *int32 `json:"deprecatedCount,omitempty"`
50 }
51
52 // Event constructs a declarative configuration of the Event type for use with
53 // apply.
54 func Event(name, namespace string) *EventApplyConfiguration {
55 b := &EventApplyConfiguration{}
56 b.WithName(name)
57 b.WithNamespace(namespace)
58 b.WithKind("Event")
59 b.WithAPIVersion("events.k8s.io/v1beta1")
60 return b
61 }
62
63 // ExtractEvent extracts the applied configuration owned by fieldManager from
64 // event. If no managedFields are found in event for fieldManager, a
65 // EventApplyConfiguration is returned with only the Name, Namespace (if applicable),
66 // APIVersion and Kind populated. It is possible that no managed fields were found for because other
67 // field managers have taken ownership of all the fields previously owned by fieldManager, or because
68 // the fieldManager never owned fields any fields.
69 // event must be a unmodified Event API object that was retrieved from the Kubernetes API.
70 // ExtractEvent provides a way to perform a extract/modify-in-place/apply workflow.
71 // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
72 // applied if another fieldManager has updated or force applied any of the previously applied fields.
73 // Experimental!
74 func ExtractEvent(event *eventsv1beta1.Event, fieldManager string) (*EventApplyConfiguration, error) {
75 return extractEvent(event, fieldManager, "")
76 }
77
78 // ExtractEventStatus is the same as ExtractEvent except
79 // that it extracts the status subresource applied configuration.
80 // Experimental!
81 func ExtractEventStatus(event *eventsv1beta1.Event, fieldManager string) (*EventApplyConfiguration, error) {
82 return extractEvent(event, fieldManager, "status")
83 }
84
85 func extractEvent(event *eventsv1beta1.Event, fieldManager string, subresource string) (*EventApplyConfiguration, error) {
86 b := &EventApplyConfiguration{}
87 err := managedfields.ExtractInto(event, internal.Parser().Type("io.k8s.api.events.v1beta1.Event"), fieldManager, b, subresource)
88 if err != nil {
89 return nil, err
90 }
91 b.WithName(event.Name)
92 b.WithNamespace(event.Namespace)
93
94 b.WithKind("Event")
95 b.WithAPIVersion("events.k8s.io/v1beta1")
96 return b, nil
97 }
98
99 // WithKind sets the Kind field in the declarative configuration to the given value
100 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
101 // If called multiple times, the Kind field is set to the value of the last call.
102 func (b *EventApplyConfiguration) WithKind(value string) *EventApplyConfiguration {
103 b.TypeMetaApplyConfiguration.Kind = &value
104 return b
105 }
106
107 // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
108 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
109 // If called multiple times, the APIVersion field is set to the value of the last call.
110 func (b *EventApplyConfiguration) WithAPIVersion(value string) *EventApplyConfiguration {
111 b.TypeMetaApplyConfiguration.APIVersion = &value
112 return b
113 }
114
115 // WithName sets the Name field in the declarative configuration to the given value
116 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
117 // If called multiple times, the Name field is set to the value of the last call.
118 func (b *EventApplyConfiguration) WithName(value string) *EventApplyConfiguration {
119 b.ensureObjectMetaApplyConfigurationExists()
120 b.ObjectMetaApplyConfiguration.Name = &value
121 return b
122 }
123
124 // WithGenerateName sets the GenerateName field in the declarative configuration to the given value
125 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
126 // If called multiple times, the GenerateName field is set to the value of the last call.
127 func (b *EventApplyConfiguration) WithGenerateName(value string) *EventApplyConfiguration {
128 b.ensureObjectMetaApplyConfigurationExists()
129 b.ObjectMetaApplyConfiguration.GenerateName = &value
130 return b
131 }
132
133 // WithNamespace sets the Namespace field in the declarative configuration to the given value
134 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
135 // If called multiple times, the Namespace field is set to the value of the last call.
136 func (b *EventApplyConfiguration) WithNamespace(value string) *EventApplyConfiguration {
137 b.ensureObjectMetaApplyConfigurationExists()
138 b.ObjectMetaApplyConfiguration.Namespace = &value
139 return b
140 }
141
142 // WithUID sets the UID field in the declarative configuration to the given value
143 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
144 // If called multiple times, the UID field is set to the value of the last call.
145 func (b *EventApplyConfiguration) WithUID(value types.UID) *EventApplyConfiguration {
146 b.ensureObjectMetaApplyConfigurationExists()
147 b.ObjectMetaApplyConfiguration.UID = &value
148 return b
149 }
150
151 // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
152 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
153 // If called multiple times, the ResourceVersion field is set to the value of the last call.
154 func (b *EventApplyConfiguration) WithResourceVersion(value string) *EventApplyConfiguration {
155 b.ensureObjectMetaApplyConfigurationExists()
156 b.ObjectMetaApplyConfiguration.ResourceVersion = &value
157 return b
158 }
159
160 // WithGeneration sets the Generation field in the declarative configuration to the given value
161 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
162 // If called multiple times, the Generation field is set to the value of the last call.
163 func (b *EventApplyConfiguration) WithGeneration(value int64) *EventApplyConfiguration {
164 b.ensureObjectMetaApplyConfigurationExists()
165 b.ObjectMetaApplyConfiguration.Generation = &value
166 return b
167 }
168
169 // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
170 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
171 // If called multiple times, the CreationTimestamp field is set to the value of the last call.
172 func (b *EventApplyConfiguration) WithCreationTimestamp(value metav1.Time) *EventApplyConfiguration {
173 b.ensureObjectMetaApplyConfigurationExists()
174 b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
175 return b
176 }
177
178 // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
179 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
180 // If called multiple times, the DeletionTimestamp field is set to the value of the last call.
181 func (b *EventApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *EventApplyConfiguration {
182 b.ensureObjectMetaApplyConfigurationExists()
183 b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
184 return b
185 }
186
187 // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
188 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
189 // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
190 func (b *EventApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *EventApplyConfiguration {
191 b.ensureObjectMetaApplyConfigurationExists()
192 b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
193 return b
194 }
195
196 // WithLabels puts the entries into the Labels field in the declarative configuration
197 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
198 // If called multiple times, the entries provided by each call will be put on the Labels field,
199 // overwriting an existing map entries in Labels field with the same key.
200 func (b *EventApplyConfiguration) WithLabels(entries map[string]string) *EventApplyConfiguration {
201 b.ensureObjectMetaApplyConfigurationExists()
202 if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
203 b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
204 }
205 for k, v := range entries {
206 b.ObjectMetaApplyConfiguration.Labels[k] = v
207 }
208 return b
209 }
210
211 // WithAnnotations puts the entries into the Annotations field in the declarative configuration
212 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
213 // If called multiple times, the entries provided by each call will be put on the Annotations field,
214 // overwriting an existing map entries in Annotations field with the same key.
215 func (b *EventApplyConfiguration) WithAnnotations(entries map[string]string) *EventApplyConfiguration {
216 b.ensureObjectMetaApplyConfigurationExists()
217 if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
218 b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
219 }
220 for k, v := range entries {
221 b.ObjectMetaApplyConfiguration.Annotations[k] = v
222 }
223 return b
224 }
225
226 // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
227 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
228 // If called multiple times, values provided by each call will be appended to the OwnerReferences field.
229 func (b *EventApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *EventApplyConfiguration {
230 b.ensureObjectMetaApplyConfigurationExists()
231 for i := range values {
232 if values[i] == nil {
233 panic("nil value passed to WithOwnerReferences")
234 }
235 b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
236 }
237 return b
238 }
239
240 // WithFinalizers adds the given value to the Finalizers field in the declarative configuration
241 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
242 // If called multiple times, values provided by each call will be appended to the Finalizers field.
243 func (b *EventApplyConfiguration) WithFinalizers(values ...string) *EventApplyConfiguration {
244 b.ensureObjectMetaApplyConfigurationExists()
245 for i := range values {
246 b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
247 }
248 return b
249 }
250
251 func (b *EventApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
252 if b.ObjectMetaApplyConfiguration == nil {
253 b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
254 }
255 }
256
257 // WithEventTime sets the EventTime field in the declarative configuration to the given value
258 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
259 // If called multiple times, the EventTime field is set to the value of the last call.
260 func (b *EventApplyConfiguration) WithEventTime(value metav1.MicroTime) *EventApplyConfiguration {
261 b.EventTime = &value
262 return b
263 }
264
265 // WithSeries sets the Series field in the declarative configuration to the given value
266 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
267 // If called multiple times, the Series field is set to the value of the last call.
268 func (b *EventApplyConfiguration) WithSeries(value *EventSeriesApplyConfiguration) *EventApplyConfiguration {
269 b.Series = value
270 return b
271 }
272
273 // WithReportingController sets the ReportingController field in the declarative configuration to the given value
274 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
275 // If called multiple times, the ReportingController field is set to the value of the last call.
276 func (b *EventApplyConfiguration) WithReportingController(value string) *EventApplyConfiguration {
277 b.ReportingController = &value
278 return b
279 }
280
281 // WithReportingInstance sets the ReportingInstance field in the declarative configuration to the given value
282 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
283 // If called multiple times, the ReportingInstance field is set to the value of the last call.
284 func (b *EventApplyConfiguration) WithReportingInstance(value string) *EventApplyConfiguration {
285 b.ReportingInstance = &value
286 return b
287 }
288
289 // WithAction sets the Action field in the declarative configuration to the given value
290 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
291 // If called multiple times, the Action field is set to the value of the last call.
292 func (b *EventApplyConfiguration) WithAction(value string) *EventApplyConfiguration {
293 b.Action = &value
294 return b
295 }
296
297 // WithReason sets the Reason field in the declarative configuration to the given value
298 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
299 // If called multiple times, the Reason field is set to the value of the last call.
300 func (b *EventApplyConfiguration) WithReason(value string) *EventApplyConfiguration {
301 b.Reason = &value
302 return b
303 }
304
305 // WithRegarding sets the Regarding field in the declarative configuration to the given value
306 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
307 // If called multiple times, the Regarding field is set to the value of the last call.
308 func (b *EventApplyConfiguration) WithRegarding(value *corev1.ObjectReferenceApplyConfiguration) *EventApplyConfiguration {
309 b.Regarding = value
310 return b
311 }
312
313 // WithRelated sets the Related field in the declarative configuration to the given value
314 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
315 // If called multiple times, the Related field is set to the value of the last call.
316 func (b *EventApplyConfiguration) WithRelated(value *corev1.ObjectReferenceApplyConfiguration) *EventApplyConfiguration {
317 b.Related = value
318 return b
319 }
320
321 // WithNote sets the Note field in the declarative configuration to the given value
322 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
323 // If called multiple times, the Note field is set to the value of the last call.
324 func (b *EventApplyConfiguration) WithNote(value string) *EventApplyConfiguration {
325 b.Note = &value
326 return b
327 }
328
329 // WithType sets the Type field in the declarative configuration to the given value
330 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
331 // If called multiple times, the Type field is set to the value of the last call.
332 func (b *EventApplyConfiguration) WithType(value string) *EventApplyConfiguration {
333 b.Type = &value
334 return b
335 }
336
337 // WithDeprecatedSource sets the DeprecatedSource field in the declarative configuration to the given value
338 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
339 // If called multiple times, the DeprecatedSource field is set to the value of the last call.
340 func (b *EventApplyConfiguration) WithDeprecatedSource(value *corev1.EventSourceApplyConfiguration) *EventApplyConfiguration {
341 b.DeprecatedSource = value
342 return b
343 }
344
345 // WithDeprecatedFirstTimestamp sets the DeprecatedFirstTimestamp field in the declarative configuration to the given value
346 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
347 // If called multiple times, the DeprecatedFirstTimestamp field is set to the value of the last call.
348 func (b *EventApplyConfiguration) WithDeprecatedFirstTimestamp(value metav1.Time) *EventApplyConfiguration {
349 b.DeprecatedFirstTimestamp = &value
350 return b
351 }
352
353 // WithDeprecatedLastTimestamp sets the DeprecatedLastTimestamp field in the declarative configuration to the given value
354 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
355 // If called multiple times, the DeprecatedLastTimestamp field is set to the value of the last call.
356 func (b *EventApplyConfiguration) WithDeprecatedLastTimestamp(value metav1.Time) *EventApplyConfiguration {
357 b.DeprecatedLastTimestamp = &value
358 return b
359 }
360
361 // WithDeprecatedCount sets the DeprecatedCount field in the declarative configuration to the given value
362 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
363 // If called multiple times, the DeprecatedCount field is set to the value of the last call.
364 func (b *EventApplyConfiguration) WithDeprecatedCount(value int32) *EventApplyConfiguration {
365 b.DeprecatedCount = &value
366 return b
367 }
368
369 // GetName retrieves the value of the Name field in the declarative configuration.
370 func (b *EventApplyConfiguration) GetName() *string {
371 b.ensureObjectMetaApplyConfigurationExists()
372 return b.ObjectMetaApplyConfiguration.Name
373 }