agones.dev/agones@v1.53.0/pkg/client/applyconfiguration/multicluster/v1/gameserverallocationpolicy.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  // GameServerAllocationPolicyApplyConfiguration represents a declarative configuration of the GameServerAllocationPolicy type for use
    28  // with apply.
    29  type GameServerAllocationPolicyApplyConfiguration struct {
    30  	metav1.TypeMetaApplyConfiguration    `json:",inline"`
    31  	*metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
    32  	Spec                                 *GameServerAllocationPolicySpecApplyConfiguration `json:"spec,omitempty"`
    33  }
    34  
    35  // GameServerAllocationPolicy constructs a declarative configuration of the GameServerAllocationPolicy type for use with
    36  // apply.
    37  func GameServerAllocationPolicy(name, namespace string) *GameServerAllocationPolicyApplyConfiguration {
    38  	b := &GameServerAllocationPolicyApplyConfiguration{}
    39  	b.WithName(name)
    40  	b.WithNamespace(namespace)
    41  	b.WithKind("GameServerAllocationPolicy")
    42  	b.WithAPIVersion("multicluster.agones.dev/v1")
    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 *GameServerAllocationPolicyApplyConfiguration) WithKind(value string) *GameServerAllocationPolicyApplyConfiguration {
    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 *GameServerAllocationPolicyApplyConfiguration) WithAPIVersion(value string) *GameServerAllocationPolicyApplyConfiguration {
    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 *GameServerAllocationPolicyApplyConfiguration) WithName(value string) *GameServerAllocationPolicyApplyConfiguration {
    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 *GameServerAllocationPolicyApplyConfiguration) WithGenerateName(value string) *GameServerAllocationPolicyApplyConfiguration {
    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 *GameServerAllocationPolicyApplyConfiguration) WithNamespace(value string) *GameServerAllocationPolicyApplyConfiguration {
    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 *GameServerAllocationPolicyApplyConfiguration) WithUID(value types.UID) *GameServerAllocationPolicyApplyConfiguration {
    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 *GameServerAllocationPolicyApplyConfiguration) WithResourceVersion(value string) *GameServerAllocationPolicyApplyConfiguration {
   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 *GameServerAllocationPolicyApplyConfiguration) WithGeneration(value int64) *GameServerAllocationPolicyApplyConfiguration {
   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 *GameServerAllocationPolicyApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *GameServerAllocationPolicyApplyConfiguration {
   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 *GameServerAllocationPolicyApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *GameServerAllocationPolicyApplyConfiguration {
   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 *GameServerAllocationPolicyApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *GameServerAllocationPolicyApplyConfiguration {
   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 *GameServerAllocationPolicyApplyConfiguration) WithLabels(entries map[string]string) *GameServerAllocationPolicyApplyConfiguration {
   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 *GameServerAllocationPolicyApplyConfiguration) WithAnnotations(entries map[string]string) *GameServerAllocationPolicyApplyConfiguration {
   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 *GameServerAllocationPolicyApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *GameServerAllocationPolicyApplyConfiguration {
   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 *GameServerAllocationPolicyApplyConfiguration) WithFinalizers(values ...string) *GameServerAllocationPolicyApplyConfiguration {
   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 *GameServerAllocationPolicyApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
   199  	if b.ObjectMetaApplyConfiguration == nil {
   200  		b.ObjectMetaApplyConfiguration = &metav1.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 *GameServerAllocationPolicyApplyConfiguration) WithSpec(value *GameServerAllocationPolicySpecApplyConfiguration) *GameServerAllocationPolicyApplyConfiguration {
   208  	b.Spec = value
   209  	return b
   210  }
   211  
   212  // GetName retrieves the value of the Name field in the declarative configuration.
   213  func (b *GameServerAllocationPolicyApplyConfiguration) GetName() *string {
   214  	b.ensureObjectMetaApplyConfigurationExists()
   215  	return b.ObjectMetaApplyConfiguration.Name
   216  }