Debian Codegraph @

applyconfigurations/core/v1/servicespec.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 v1
20
21 import (
22 corev1 "k8s.io/api/core/v1"
23 )
24
25 // ServiceSpecApplyConfiguration represents a declarative configuration of the ServiceSpec type for use
26 // with apply.
27 type ServiceSpecApplyConfiguration struct {
28 Ports []ServicePortApplyConfiguration `json:"ports,omitempty"`
29 Selector map[string]string `json:"selector,omitempty"`
30 ClusterIP *string `json:"clusterIP,omitempty"`
31 ClusterIPs []string `json:"clusterIPs,omitempty"`
32 Type *corev1.ServiceType `json:"type,omitempty"`
33 ExternalIPs []string `json:"externalIPs,omitempty"`
34 SessionAffinity *corev1.ServiceAffinity `json:"sessionAffinity,omitempty"`
35 LoadBalancerIP *string `json:"loadBalancerIP,omitempty"`
36 LoadBalancerSourceRanges []string `json:"loadBalancerSourceRanges,omitempty"`
37 ExternalName *string `json:"externalName,omitempty"`
38 ExternalTrafficPolicy *corev1.ServiceExternalTrafficPolicy `json:"externalTrafficPolicy,omitempty"`
39 HealthCheckNodePort *int32 `json:"healthCheckNodePort,omitempty"`
40 PublishNotReadyAddresses *bool `json:"publishNotReadyAddresses,omitempty"`
41 SessionAffinityConfig *SessionAffinityConfigApplyConfiguration `json:"sessionAffinityConfig,omitempty"`
42 IPFamilies []corev1.IPFamily `json:"ipFamilies,omitempty"`
43 IPFamilyPolicy *corev1.IPFamilyPolicy `json:"ipFamilyPolicy,omitempty"`
44 AllocateLoadBalancerNodePorts *bool `json:"allocateLoadBalancerNodePorts,omitempty"`
45 LoadBalancerClass *string `json:"loadBalancerClass,omitempty"`
46 InternalTrafficPolicy *corev1.ServiceInternalTrafficPolicy `json:"internalTrafficPolicy,omitempty"`
47 TrafficDistribution *string `json:"trafficDistribution,omitempty"`
48 }
49
50 // ServiceSpecApplyConfiguration constructs a declarative configuration of the ServiceSpec type for use with
51 // apply.
52 func ServiceSpec() *ServiceSpecApplyConfiguration {
53 return &ServiceSpecApplyConfiguration{}
54 }
55
56 // WithPorts adds the given value to the Ports field in the declarative configuration
57 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
58 // If called multiple times, values provided by each call will be appended to the Ports field.
59 func (b *ServiceSpecApplyConfiguration) WithPorts(values ...*ServicePortApplyConfiguration) *ServiceSpecApplyConfiguration {
60 for i := range values {
61 if values[i] == nil {
62 panic("nil value passed to WithPorts")
63 }
64 b.Ports = append(b.Ports, *values[i])
65 }
66 return b
67 }
68
69 // WithSelector puts the entries into the Selector field in the declarative configuration
70 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
71 // If called multiple times, the entries provided by each call will be put on the Selector field,
72 // overwriting an existing map entries in Selector field with the same key.
73 func (b *ServiceSpecApplyConfiguration) WithSelector(entries map[string]string) *ServiceSpecApplyConfiguration {
74 if b.Selector == nil && len(entries) > 0 {
75 b.Selector = make(map[string]string, len(entries))
76 }
77 for k, v := range entries {
78 b.Selector[k] = v
79 }
80 return b
81 }
82
83 // WithClusterIP sets the ClusterIP field in the declarative configuration to the given value
84 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
85 // If called multiple times, the ClusterIP field is set to the value of the last call.
86 func (b *ServiceSpecApplyConfiguration) WithClusterIP(value string) *ServiceSpecApplyConfiguration {
87 b.ClusterIP = &value
88 return b
89 }
90
91 // WithClusterIPs adds the given value to the ClusterIPs field in the declarative configuration
92 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
93 // If called multiple times, values provided by each call will be appended to the ClusterIPs field.
94 func (b *ServiceSpecApplyConfiguration) WithClusterIPs(values ...string) *ServiceSpecApplyConfiguration {
95 for i := range values {
96 b.ClusterIPs = append(b.ClusterIPs, values[i])
97 }
98 return b
99 }
100
101 // WithType sets the Type field in the declarative configuration to the given value
102 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
103 // If called multiple times, the Type field is set to the value of the last call.
104 func (b *ServiceSpecApplyConfiguration) WithType(value corev1.ServiceType) *ServiceSpecApplyConfiguration {
105 b.Type = &value
106 return b
107 }
108
109 // WithExternalIPs adds the given value to the ExternalIPs field in the declarative configuration
110 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
111 // If called multiple times, values provided by each call will be appended to the ExternalIPs field.
112 func (b *ServiceSpecApplyConfiguration) WithExternalIPs(values ...string) *ServiceSpecApplyConfiguration {
113 for i := range values {
114 b.ExternalIPs = append(b.ExternalIPs, values[i])
115 }
116 return b
117 }
118
119 // WithSessionAffinity sets the SessionAffinity field in the declarative configuration to the given value
120 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
121 // If called multiple times, the SessionAffinity field is set to the value of the last call.
122 func (b *ServiceSpecApplyConfiguration) WithSessionAffinity(value corev1.ServiceAffinity) *ServiceSpecApplyConfiguration {
123 b.SessionAffinity = &value
124 return b
125 }
126
127 // WithLoadBalancerIP sets the LoadBalancerIP field in the declarative configuration to the given value
128 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
129 // If called multiple times, the LoadBalancerIP field is set to the value of the last call.
130 func (b *ServiceSpecApplyConfiguration) WithLoadBalancerIP(value string) *ServiceSpecApplyConfiguration {
131 b.LoadBalancerIP = &value
132 return b
133 }
134
135 // WithLoadBalancerSourceRanges adds the given value to the LoadBalancerSourceRanges field in the declarative configuration
136 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
137 // If called multiple times, values provided by each call will be appended to the LoadBalancerSourceRanges field.
138 func (b *ServiceSpecApplyConfiguration) WithLoadBalancerSourceRanges(values ...string) *ServiceSpecApplyConfiguration {
139 for i := range values {
140 b.LoadBalancerSourceRanges = append(b.LoadBalancerSourceRanges, values[i])
141 }
142 return b
143 }
144
145 // WithExternalName sets the ExternalName field in the declarative configuration to the given value
146 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
147 // If called multiple times, the ExternalName field is set to the value of the last call.
148 func (b *ServiceSpecApplyConfiguration) WithExternalName(value string) *ServiceSpecApplyConfiguration {
149 b.ExternalName = &value
150 return b
151 }
152
153 // WithExternalTrafficPolicy sets the ExternalTrafficPolicy field in the declarative configuration to the given value
154 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
155 // If called multiple times, the ExternalTrafficPolicy field is set to the value of the last call.
156 func (b *ServiceSpecApplyConfiguration) WithExternalTrafficPolicy(value corev1.ServiceExternalTrafficPolicy) *ServiceSpecApplyConfiguration {
157 b.ExternalTrafficPolicy = &value
158 return b
159 }
160
161 // WithHealthCheckNodePort sets the HealthCheckNodePort field in the declarative configuration to the given value
162 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
163 // If called multiple times, the HealthCheckNodePort field is set to the value of the last call.
164 func (b *ServiceSpecApplyConfiguration) WithHealthCheckNodePort(value int32) *ServiceSpecApplyConfiguration {
165 b.HealthCheckNodePort = &value
166 return b
167 }
168
169 // WithPublishNotReadyAddresses sets the PublishNotReadyAddresses 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 PublishNotReadyAddresses field is set to the value of the last call.
172 func (b *ServiceSpecApplyConfiguration) WithPublishNotReadyAddresses(value bool) *ServiceSpecApplyConfiguration {
173 b.PublishNotReadyAddresses = &value
174 return b
175 }
176
177 // WithSessionAffinityConfig sets the SessionAffinityConfig field in the declarative configuration to the given value
178 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
179 // If called multiple times, the SessionAffinityConfig field is set to the value of the last call.
180 func (b *ServiceSpecApplyConfiguration) WithSessionAffinityConfig(value *SessionAffinityConfigApplyConfiguration) *ServiceSpecApplyConfiguration {
181 b.SessionAffinityConfig = value
182 return b
183 }
184
185 // WithIPFamilies adds the given value to the IPFamilies field in the declarative configuration
186 // and returns the receiver, so that objects can be build by chaining "With" function invocations.
187 // If called multiple times, values provided by each call will be appended to the IPFamilies field.
188 func (b *ServiceSpecApplyConfiguration) WithIPFamilies(values ...corev1.IPFamily) *ServiceSpecApplyConfiguration {
189 for i := range values {
190 b.IPFamilies = append(b.IPFamilies, values[i])
191 }
192 return b
193 }
194
195 // WithIPFamilyPolicy sets the IPFamilyPolicy field in the declarative configuration to the given value
196 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
197 // If called multiple times, the IPFamilyPolicy field is set to the value of the last call.
198 func (b *ServiceSpecApplyConfiguration) WithIPFamilyPolicy(value corev1.IPFamilyPolicy) *ServiceSpecApplyConfiguration {
199 b.IPFamilyPolicy = &value
200 return b
201 }
202
203 // WithAllocateLoadBalancerNodePorts sets the AllocateLoadBalancerNodePorts field in the declarative configuration to the given value
204 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
205 // If called multiple times, the AllocateLoadBalancerNodePorts field is set to the value of the last call.
206 func (b *ServiceSpecApplyConfiguration) WithAllocateLoadBalancerNodePorts(value bool) *ServiceSpecApplyConfiguration {
207 b.AllocateLoadBalancerNodePorts = &value
208 return b
209 }
210
211 // WithLoadBalancerClass sets the LoadBalancerClass field in the declarative configuration to the given value
212 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
213 // If called multiple times, the LoadBalancerClass field is set to the value of the last call.
214 func (b *ServiceSpecApplyConfiguration) WithLoadBalancerClass(value string) *ServiceSpecApplyConfiguration {
215 b.LoadBalancerClass = &value
216 return b
217 }
218
219 // WithInternalTrafficPolicy sets the InternalTrafficPolicy field in the declarative configuration to the given value
220 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
221 // If called multiple times, the InternalTrafficPolicy field is set to the value of the last call.
222 func (b *ServiceSpecApplyConfiguration) WithInternalTrafficPolicy(value corev1.ServiceInternalTrafficPolicy) *ServiceSpecApplyConfiguration {
223 b.InternalTrafficPolicy = &value
224 return b
225 }
226
227 // WithTrafficDistribution sets the TrafficDistribution field in the declarative configuration to the given value
228 // and returns the receiver, so that objects can be built by chaining "With" function invocations.
229 // If called multiple times, the TrafficDistribution field is set to the value of the last call.
230 func (b *ServiceSpecApplyConfiguration) WithTrafficDistribution(value string) *ServiceSpecApplyConfiguration {
231 b.TrafficDistribution = &value
232 return b
233 }