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