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