agones.dev/agones@v1.53.0/pkg/client/applyconfiguration/agones/v1/gameserver.go (about) 1 // Copyright 2024 Google LLC All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // This code was autogenerated. Do not edit directly. 16 17 // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 19 package v1 20 21 import ( 22 apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 23 types "k8s.io/apimachinery/pkg/types" 24 metav1 "k8s.io/client-go/applyconfigurations/meta/v1" 25 ) 26 27 // GameServerApplyConfiguration represents a declarative configuration of the GameServer type for use 28 // with apply. 29 type GameServerApplyConfiguration struct { 30 metav1.TypeMetaApplyConfiguration `json:",inline"` 31 *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` 32 Spec *GameServerSpecApplyConfiguration `json:"spec,omitempty"` 33 Status *GameServerStatusApplyConfiguration `json:"status,omitempty"` 34 } 35 36 // GameServer constructs a declarative configuration of the GameServer type for use with 37 // apply. 38 func GameServer(name, namespace string) *GameServerApplyConfiguration { 39 b := &GameServerApplyConfiguration{} 40 b.WithName(name) 41 b.WithNamespace(namespace) 42 b.WithKind("GameServer") 43 b.WithAPIVersion("agones.dev/v1") 44 return b 45 } 46 47 // WithKind sets the Kind field in the declarative configuration to the given value 48 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 49 // If called multiple times, the Kind field is set to the value of the last call. 50 func (b *GameServerApplyConfiguration) WithKind(value string) *GameServerApplyConfiguration { 51 b.TypeMetaApplyConfiguration.Kind = &value 52 return b 53 } 54 55 // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value 56 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 57 // If called multiple times, the APIVersion field is set to the value of the last call. 58 func (b *GameServerApplyConfiguration) WithAPIVersion(value string) *GameServerApplyConfiguration { 59 b.TypeMetaApplyConfiguration.APIVersion = &value 60 return b 61 } 62 63 // WithName sets the Name field in the declarative configuration to the given value 64 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 65 // If called multiple times, the Name field is set to the value of the last call. 66 func (b *GameServerApplyConfiguration) WithName(value string) *GameServerApplyConfiguration { 67 b.ensureObjectMetaApplyConfigurationExists() 68 b.ObjectMetaApplyConfiguration.Name = &value 69 return b 70 } 71 72 // WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call. 75 func (b *GameServerApplyConfiguration) WithGenerateName(value string) *GameServerApplyConfiguration { 76 b.ensureObjectMetaApplyConfigurationExists() 77 b.ObjectMetaApplyConfiguration.GenerateName = &value 78 return b 79 } 80 81 // WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call. 84 func (b *GameServerApplyConfiguration) WithNamespace(value string) *GameServerApplyConfiguration { 85 b.ensureObjectMetaApplyConfigurationExists() 86 b.ObjectMetaApplyConfiguration.Namespace = &value 87 return b 88 } 89 90 // WithUID sets the UID field in the declarative configuration to the given value 91 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 92 // If called multiple times, the UID field is set to the value of the last call. 93 func (b *GameServerApplyConfiguration) WithUID(value types.UID) *GameServerApplyConfiguration { 94 b.ensureObjectMetaApplyConfigurationExists() 95 b.ObjectMetaApplyConfiguration.UID = &value 96 return b 97 } 98 99 // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value 100 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 101 // If called multiple times, the ResourceVersion field is set to the value of the last call. 102 func (b *GameServerApplyConfiguration) WithResourceVersion(value string) *GameServerApplyConfiguration { 103 b.ensureObjectMetaApplyConfigurationExists() 104 b.ObjectMetaApplyConfiguration.ResourceVersion = &value 105 return b 106 } 107 108 // WithGeneration sets the Generation field in the declarative configuration to the given value 109 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 110 // If called multiple times, the Generation field is set to the value of the last call. 111 func (b *GameServerApplyConfiguration) WithGeneration(value int64) *GameServerApplyConfiguration { 112 b.ensureObjectMetaApplyConfigurationExists() 113 b.ObjectMetaApplyConfiguration.Generation = &value 114 return b 115 } 116 117 // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value 118 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 119 // If called multiple times, the CreationTimestamp field is set to the value of the last call. 120 func (b *GameServerApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *GameServerApplyConfiguration { 121 b.ensureObjectMetaApplyConfigurationExists() 122 b.ObjectMetaApplyConfiguration.CreationTimestamp = &value 123 return b 124 } 125 126 // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value 127 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 128 // If called multiple times, the DeletionTimestamp field is set to the value of the last call. 129 func (b *GameServerApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *GameServerApplyConfiguration { 130 b.ensureObjectMetaApplyConfigurationExists() 131 b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value 132 return b 133 } 134 135 // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value 136 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 137 // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. 138 func (b *GameServerApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *GameServerApplyConfiguration { 139 b.ensureObjectMetaApplyConfigurationExists() 140 b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value 141 return b 142 } 143 144 // WithLabels puts the entries into the Labels field in the declarative configuration 145 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 146 // If called multiple times, the entries provided by each call will be put on the Labels field, 147 // overwriting an existing map entries in Labels field with the same key. 148 func (b *GameServerApplyConfiguration) WithLabels(entries map[string]string) *GameServerApplyConfiguration { 149 b.ensureObjectMetaApplyConfigurationExists() 150 if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { 151 b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) 152 } 153 for k, v := range entries { 154 b.ObjectMetaApplyConfiguration.Labels[k] = v 155 } 156 return b 157 } 158 159 // WithAnnotations puts the entries into the Annotations field in the declarative configuration 160 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 161 // If called multiple times, the entries provided by each call will be put on the Annotations field, 162 // overwriting an existing map entries in Annotations field with the same key. 163 func (b *GameServerApplyConfiguration) WithAnnotations(entries map[string]string) *GameServerApplyConfiguration { 164 b.ensureObjectMetaApplyConfigurationExists() 165 if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { 166 b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) 167 } 168 for k, v := range entries { 169 b.ObjectMetaApplyConfiguration.Annotations[k] = v 170 } 171 return b 172 } 173 174 // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration 175 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 176 // If called multiple times, values provided by each call will be appended to the OwnerReferences field. 177 func (b *GameServerApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *GameServerApplyConfiguration { 178 b.ensureObjectMetaApplyConfigurationExists() 179 for i := range values { 180 if values[i] == nil { 181 panic("nil value passed to WithOwnerReferences") 182 } 183 b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) 184 } 185 return b 186 } 187 188 // WithFinalizers adds the given value to the Finalizers field in the declarative configuration 189 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 190 // If called multiple times, values provided by each call will be appended to the Finalizers field. 191 func (b *GameServerApplyConfiguration) WithFinalizers(values ...string) *GameServerApplyConfiguration { 192 b.ensureObjectMetaApplyConfigurationExists() 193 for i := range values { 194 b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) 195 } 196 return b 197 } 198 199 func (b *GameServerApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { 200 if b.ObjectMetaApplyConfiguration == nil { 201 b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} 202 } 203 } 204 205 // WithSpec sets the Spec field in the declarative configuration to the given value 206 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 207 // If called multiple times, the Spec field is set to the value of the last call. 208 func (b *GameServerApplyConfiguration) WithSpec(value *GameServerSpecApplyConfiguration) *GameServerApplyConfiguration { 209 b.Spec = value 210 return b 211 } 212 213 // WithStatus sets the Status field in the declarative configuration to the given value 214 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 215 // If called multiple times, the Status field is set to the value of the last call. 216 func (b *GameServerApplyConfiguration) WithStatus(value *GameServerStatusApplyConfiguration) *GameServerApplyConfiguration { 217 b.Status = value 218 return b 219 } 220 221 // GetName retrieves the value of the Name field in the declarative configuration. 222 func (b *GameServerApplyConfiguration) GetName() *string { 223 b.ensureObjectMetaApplyConfigurationExists() 224 return b.ObjectMetaApplyConfiguration.Name 225 }