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