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