| 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 v1beta1 |
| 20 | |
| 21 | import ( |
| 22 | extensionsv1beta1 "k8s.io/api/extensions/v1beta1" |
| 23 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 24 | types "k8s.io/apimachinery/pkg/types" |
| 25 | v1 "k8s.io/client-go/applyconfigurations/meta/v1" |
| 26 | ) |
| 27 | |
| 28 | // ScaleApplyConfiguration represents a declarative configuration of the Scale type for use |
| 29 | // with apply. |
| 30 | type ScaleApplyConfiguration struct { |
| 31 | v1.TypeMetaApplyConfiguration `json:",inline"` |
| 32 | *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` |
| 33 | Spec *extensionsv1beta1.ScaleSpec `json:"spec,omitempty"` |
| 34 | Status *extensionsv1beta1.ScaleStatus `json:"status,omitempty"` |
| 35 | } |
| 36 | |
| 37 | // ScaleApplyConfiguration constructs a declarative configuration of the Scale type for use with |
| 38 | // apply. |
| 39 | func Scale() *ScaleApplyConfiguration { |
| 40 | b := &ScaleApplyConfiguration{} |
| 41 | b.WithKind("Scale") |
| 42 | b.WithAPIVersion("extensions/v1beta1") |
| 43 | return b |
| 44 | } |
| 45 | |
| 46 | // WithKind sets the Kind field in the declarative configuration to the given value |
| 47 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 48 | // If called multiple times, the Kind field is set to the value of the last call. |
| 49 | func (b *ScaleApplyConfiguration) WithKind(value string) *ScaleApplyConfiguration { |
| 50 | b.TypeMetaApplyConfiguration.Kind = &value |
| 51 | return b |
| 52 | } |
| 53 | |
| 54 | // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value |
| 55 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 56 | // If called multiple times, the APIVersion field is set to the value of the last call. |
| 57 | func (b *ScaleApplyConfiguration) WithAPIVersion(value string) *ScaleApplyConfiguration { |
| 58 | b.TypeMetaApplyConfiguration.APIVersion = &value |
| 59 | return b |
| 60 | } |
| 61 | |
| 62 | // WithName sets the Name field in the declarative configuration to the given value |
| 63 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 64 | // If called multiple times, the Name field is set to the value of the last call. |
| 65 | func (b *ScaleApplyConfiguration) WithName(value string) *ScaleApplyConfiguration { |
| 66 | b.ensureObjectMetaApplyConfigurationExists() |
| 67 | b.ObjectMetaApplyConfiguration.Name = &value |
| 68 | return b |
| 69 | } |
| 70 | |
| 71 | // WithGenerateName sets the GenerateName field in the declarative configuration to the given value |
| 72 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 73 | // If called multiple times, the GenerateName field is set to the value of the last call. |
| 74 | func (b *ScaleApplyConfiguration) WithGenerateName(value string) *ScaleApplyConfiguration { |
| 75 | b.ensureObjectMetaApplyConfigurationExists() |
| 76 | b.ObjectMetaApplyConfiguration.GenerateName = &value |
| 77 | return b |
| 78 | } |
| 79 | |
| 80 | // WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. |
| 83 | func (b *ScaleApplyConfiguration) WithNamespace(value string) *ScaleApplyConfiguration { |
| 84 | b.ensureObjectMetaApplyConfigurationExists() |
| 85 | b.ObjectMetaApplyConfiguration.Namespace = &value |
| 86 | return b |
| 87 | } |
| 88 | |
| 89 | // WithUID sets the UID 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 UID field is set to the value of the last call. |
| 92 | func (b *ScaleApplyConfiguration) WithUID(value types.UID) *ScaleApplyConfiguration { |
| 93 | b.ensureObjectMetaApplyConfigurationExists() |
| 94 | b.ObjectMetaApplyConfiguration.UID = &value |
| 95 | return b |
| 96 | } |
| 97 | |
| 98 | // WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call. |
| 101 | func (b *ScaleApplyConfiguration) WithResourceVersion(value string) *ScaleApplyConfiguration { |
| 102 | b.ensureObjectMetaApplyConfigurationExists() |
| 103 | b.ObjectMetaApplyConfiguration.ResourceVersion = &value |
| 104 | return b |
| 105 | } |
| 106 | |
| 107 | // WithGeneration sets the Generation 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 Generation field is set to the value of the last call. |
| 110 | func (b *ScaleApplyConfiguration) WithGeneration(value int64) *ScaleApplyConfiguration { |
| 111 | b.ensureObjectMetaApplyConfigurationExists() |
| 112 | b.ObjectMetaApplyConfiguration.Generation = &value |
| 113 | return b |
| 114 | } |
| 115 | |
| 116 | // WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call. |
| 119 | func (b *ScaleApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ScaleApplyConfiguration { |
| 120 | b.ensureObjectMetaApplyConfigurationExists() |
| 121 | b.ObjectMetaApplyConfiguration.CreationTimestamp = &value |
| 122 | return b |
| 123 | } |
| 124 | |
| 125 | // WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call. |
| 128 | func (b *ScaleApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ScaleApplyConfiguration { |
| 129 | b.ensureObjectMetaApplyConfigurationExists() |
| 130 | b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value |
| 131 | return b |
| 132 | } |
| 133 | |
| 134 | // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call. |
| 137 | func (b *ScaleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ScaleApplyConfiguration { |
| 138 | b.ensureObjectMetaApplyConfigurationExists() |
| 139 | b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value |
| 140 | return b |
| 141 | } |
| 142 | |
| 143 | // WithLabels puts the entries into the Labels field in the declarative configuration |
| 144 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. |
| 145 | // If called multiple times, the entries provided by each call will be put on the Labels field, |
| 146 | // overwriting an existing map entries in Labels field with the same key. |
| 147 | func (b *ScaleApplyConfiguration) WithLabels(entries map[string]string) *ScaleApplyConfiguration { |
| 148 | b.ensureObjectMetaApplyConfigurationExists() |
| 149 | if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { |
| 150 | b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) |
| 151 | } |
| 152 | for k, v := range entries { |
| 153 | b.ObjectMetaApplyConfiguration.Labels[k] = v |
| 154 | } |
| 155 | return b |
| 156 | } |
| 157 | |
| 158 | // WithAnnotations puts the entries into the Annotations field in the declarative configuration |
| 159 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. |
| 160 | // If called multiple times, the entries provided by each call will be put on the Annotations field, |
| 161 | // overwriting an existing map entries in Annotations field with the same key. |
| 162 | func (b *ScaleApplyConfiguration) WithAnnotations(entries map[string]string) *ScaleApplyConfiguration { |
| 163 | b.ensureObjectMetaApplyConfigurationExists() |
| 164 | if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { |
| 165 | b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) |
| 166 | } |
| 167 | for k, v := range entries { |
| 168 | b.ObjectMetaApplyConfiguration.Annotations[k] = v |
| 169 | } |
| 170 | return b |
| 171 | } |
| 172 | |
| 173 | // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration |
| 174 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. |
| 175 | // If called multiple times, values provided by each call will be appended to the OwnerReferences field. |
| 176 | func (b *ScaleApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ScaleApplyConfiguration { |
| 177 | b.ensureObjectMetaApplyConfigurationExists() |
| 178 | for i := range values { |
| 179 | if values[i] == nil { |
| 180 | panic("nil value passed to WithOwnerReferences") |
| 181 | } |
| 182 | b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) |
| 183 | } |
| 184 | return b |
| 185 | } |
| 186 | |
| 187 | // WithFinalizers adds the given value to the Finalizers field in the declarative configuration |
| 188 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. |
| 189 | // If called multiple times, values provided by each call will be appended to the Finalizers field. |
| 190 | func (b *ScaleApplyConfiguration) WithFinalizers(values ...string) *ScaleApplyConfiguration { |
| 191 | b.ensureObjectMetaApplyConfigurationExists() |
| 192 | for i := range values { |
| 193 | b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) |
| 194 | } |
| 195 | return b |
| 196 | } |
| 197 | |
| 198 | func (b *ScaleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { |
| 199 | if b.ObjectMetaApplyConfiguration == nil { |
| 200 | b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | // WithSpec sets the Spec field in the declarative configuration to the given value |
| 205 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 206 | // If called multiple times, the Spec field is set to the value of the last call. |
| 207 | func (b *ScaleApplyConfiguration) WithSpec(value extensionsv1beta1.ScaleSpec) *ScaleApplyConfiguration { |
| 208 | b.Spec = &value |
| 209 | return b |
| 210 | } |
| 211 | |
| 212 | // WithStatus sets the Status field in the declarative configuration to the given value |
| 213 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 214 | // If called multiple times, the Status field is set to the value of the last call. |
| 215 | func (b *ScaleApplyConfiguration) WithStatus(value extensionsv1beta1.ScaleStatus) *ScaleApplyConfiguration { |
| 216 | b.Status = &value |
| 217 | return b |
| 218 | } |
| 219 | |
| 220 | // GetName retrieves the value of the Name field in the declarative configuration. |
| 221 | func (b *ScaleApplyConfiguration) GetName() *string { |
| 222 | b.ensureObjectMetaApplyConfigurationExists() |
| 223 | return b.ObjectMetaApplyConfiguration.Name |
| 224 | } |