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