1/*
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 applyconfiguration-gen. DO NOT EDIT.
18
19package v1
20
21import (
22	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23	types "k8s.io/apimachinery/pkg/types"
24	v1 "k8s.io/client-go/applyconfigurations/meta/v1"
25)
26
27// PodTemplateSpecApplyConfiguration represents an declarative configuration of the PodTemplateSpec type for use
28// with apply.
29type PodTemplateSpecApplyConfiguration struct {
30	*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
31	Spec                             *PodSpecApplyConfiguration `json:"spec,omitempty"`
32}
33
34// PodTemplateSpecApplyConfiguration constructs an declarative configuration of the PodTemplateSpec type for use with
35// apply.
36func PodTemplateSpec() *PodTemplateSpecApplyConfiguration {
37	return &PodTemplateSpecApplyConfiguration{}
38}
39
40// WithName sets the Name field in the declarative configuration to the given value
41// and returns the receiver, so that objects can be built by chaining "With" function invocations.
42// If called multiple times, the Name field is set to the value of the last call.
43func (b *PodTemplateSpecApplyConfiguration) WithName(value string) *PodTemplateSpecApplyConfiguration {
44	b.ensureObjectMetaApplyConfigurationExists()
45	b.Name = &value
46	return b
47}
48
49// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
50// and returns the receiver, so that objects can be built by chaining "With" function invocations.
51// If called multiple times, the GenerateName field is set to the value of the last call.
52func (b *PodTemplateSpecApplyConfiguration) WithGenerateName(value string) *PodTemplateSpecApplyConfiguration {
53	b.ensureObjectMetaApplyConfigurationExists()
54	b.GenerateName = &value
55	return b
56}
57
58// WithNamespace sets the Namespace field in the declarative configuration to the given value
59// and returns the receiver, so that objects can be built by chaining "With" function invocations.
60// If called multiple times, the Namespace field is set to the value of the last call.
61func (b *PodTemplateSpecApplyConfiguration) WithNamespace(value string) *PodTemplateSpecApplyConfiguration {
62	b.ensureObjectMetaApplyConfigurationExists()
63	b.Namespace = &value
64	return b
65}
66
67// WithSelfLink sets the SelfLink field in the declarative configuration to the given value
68// and returns the receiver, so that objects can be built by chaining "With" function invocations.
69// If called multiple times, the SelfLink field is set to the value of the last call.
70func (b *PodTemplateSpecApplyConfiguration) WithSelfLink(value string) *PodTemplateSpecApplyConfiguration {
71	b.ensureObjectMetaApplyConfigurationExists()
72	b.SelfLink = &value
73	return b
74}
75
76// WithUID sets the UID field in the declarative configuration to the given value
77// and returns the receiver, so that objects can be built by chaining "With" function invocations.
78// If called multiple times, the UID field is set to the value of the last call.
79func (b *PodTemplateSpecApplyConfiguration) WithUID(value types.UID) *PodTemplateSpecApplyConfiguration {
80	b.ensureObjectMetaApplyConfigurationExists()
81	b.UID = &value
82	return b
83}
84
85// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
86// and returns the receiver, so that objects can be built by chaining "With" function invocations.
87// If called multiple times, the ResourceVersion field is set to the value of the last call.
88func (b *PodTemplateSpecApplyConfiguration) WithResourceVersion(value string) *PodTemplateSpecApplyConfiguration {
89	b.ensureObjectMetaApplyConfigurationExists()
90	b.ResourceVersion = &value
91	return b
92}
93
94// WithGeneration sets the Generation 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 Generation field is set to the value of the last call.
97func (b *PodTemplateSpecApplyConfiguration) WithGeneration(value int64) *PodTemplateSpecApplyConfiguration {
98	b.ensureObjectMetaApplyConfigurationExists()
99	b.Generation = &value
100	return b
101}
102
103// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
104// and returns the receiver, so that objects can be built by chaining "With" function invocations.
105// If called multiple times, the CreationTimestamp field is set to the value of the last call.
106func (b *PodTemplateSpecApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PodTemplateSpecApplyConfiguration {
107	b.ensureObjectMetaApplyConfigurationExists()
108	b.CreationTimestamp = &value
109	return b
110}
111
112// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
113// and returns the receiver, so that objects can be built by chaining "With" function invocations.
114// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
115func (b *PodTemplateSpecApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PodTemplateSpecApplyConfiguration {
116	b.ensureObjectMetaApplyConfigurationExists()
117	b.DeletionTimestamp = &value
118	return b
119}
120
121// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
122// and returns the receiver, so that objects can be built by chaining "With" function invocations.
123// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
124func (b *PodTemplateSpecApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PodTemplateSpecApplyConfiguration {
125	b.ensureObjectMetaApplyConfigurationExists()
126	b.DeletionGracePeriodSeconds = &value
127	return b
128}
129
130// WithLabels puts the entries into the Labels field in the declarative configuration
131// and returns the receiver, so that objects can be build by chaining "With" function invocations.
132// If called multiple times, the entries provided by each call will be put on the Labels field,
133// overwriting an existing map entries in Labels field with the same key.
134func (b *PodTemplateSpecApplyConfiguration) WithLabels(entries map[string]string) *PodTemplateSpecApplyConfiguration {
135	b.ensureObjectMetaApplyConfigurationExists()
136	if b.Labels == nil && len(entries) > 0 {
137		b.Labels = make(map[string]string, len(entries))
138	}
139	for k, v := range entries {
140		b.Labels[k] = v
141	}
142	return b
143}
144
145// WithAnnotations puts the entries into the Annotations field in the declarative configuration
146// and returns the receiver, so that objects can be build by chaining "With" function invocations.
147// If called multiple times, the entries provided by each call will be put on the Annotations field,
148// overwriting an existing map entries in Annotations field with the same key.
149func (b *PodTemplateSpecApplyConfiguration) WithAnnotations(entries map[string]string) *PodTemplateSpecApplyConfiguration {
150	b.ensureObjectMetaApplyConfigurationExists()
151	if b.Annotations == nil && len(entries) > 0 {
152		b.Annotations = make(map[string]string, len(entries))
153	}
154	for k, v := range entries {
155		b.Annotations[k] = v
156	}
157	return b
158}
159
160// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
161// and returns the receiver, so that objects can be build by chaining "With" function invocations.
162// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
163func (b *PodTemplateSpecApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PodTemplateSpecApplyConfiguration {
164	b.ensureObjectMetaApplyConfigurationExists()
165	for i := range values {
166		if values[i] == nil {
167			panic("nil value passed to WithOwnerReferences")
168		}
169		b.OwnerReferences = append(b.OwnerReferences, *values[i])
170	}
171	return b
172}
173
174// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
175// and returns the receiver, so that objects can be build by chaining "With" function invocations.
176// If called multiple times, values provided by each call will be appended to the Finalizers field.
177func (b *PodTemplateSpecApplyConfiguration) WithFinalizers(values ...string) *PodTemplateSpecApplyConfiguration {
178	b.ensureObjectMetaApplyConfigurationExists()
179	for i := range values {
180		b.Finalizers = append(b.Finalizers, values[i])
181	}
182	return b
183}
184
185// WithClusterName sets the ClusterName field in the declarative configuration to the given value
186// and returns the receiver, so that objects can be built by chaining "With" function invocations.
187// If called multiple times, the ClusterName field is set to the value of the last call.
188func (b *PodTemplateSpecApplyConfiguration) WithClusterName(value string) *PodTemplateSpecApplyConfiguration {
189	b.ensureObjectMetaApplyConfigurationExists()
190	b.ClusterName = &value
191	return b
192}
193
194func (b *PodTemplateSpecApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
195	if b.ObjectMetaApplyConfiguration == nil {
196		b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
197	}
198}
199
200// WithSpec sets the Spec field in the declarative configuration to the given value
201// and returns the receiver, so that objects can be built by chaining "With" function invocations.
202// If called multiple times, the Spec field is set to the value of the last call.
203func (b *PodTemplateSpecApplyConfiguration) WithSpec(value *PodSpecApplyConfiguration) *PodTemplateSpecApplyConfiguration {
204	b.Spec = value
205	return b
206}
207