agones.dev/agones@v1.53.0/pkg/client/applyconfiguration/agones/v1/gameserverspec.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 apis "agones.dev/agones/pkg/apis" 23 corev1 "k8s.io/api/core/v1" 24 ) 25 26 // GameServerSpecApplyConfiguration represents a declarative configuration of the GameServerSpec type for use 27 // with apply. 28 type GameServerSpecApplyConfiguration struct { 29 Container *string `json:"container,omitempty"` 30 Ports []GameServerPortApplyConfiguration `json:"ports,omitempty"` 31 Health *HealthApplyConfiguration `json:"health,omitempty"` 32 Scheduling *apis.SchedulingStrategy `json:"scheduling,omitempty"` 33 SdkServer *SdkServerApplyConfiguration `json:"sdkServer,omitempty"` 34 Template *corev1.PodTemplateSpec `json:"template,omitempty"` 35 Players *PlayersSpecApplyConfiguration `json:"players,omitempty"` 36 Counters map[string]CounterStatusApplyConfiguration `json:"counters,omitempty"` 37 Lists map[string]ListStatusApplyConfiguration `json:"lists,omitempty"` 38 Eviction *EvictionApplyConfiguration `json:"eviction,omitempty"` 39 } 40 41 // GameServerSpecApplyConfiguration constructs a declarative configuration of the GameServerSpec type for use with 42 // apply. 43 func GameServerSpec() *GameServerSpecApplyConfiguration { 44 return &GameServerSpecApplyConfiguration{} 45 } 46 47 // WithContainer sets the Container 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 Container field is set to the value of the last call. 50 func (b *GameServerSpecApplyConfiguration) WithContainer(value string) *GameServerSpecApplyConfiguration { 51 b.Container = &value 52 return b 53 } 54 55 // WithPorts adds the given value to the Ports field in the declarative configuration 56 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 57 // If called multiple times, values provided by each call will be appended to the Ports field. 58 func (b *GameServerSpecApplyConfiguration) WithPorts(values ...*GameServerPortApplyConfiguration) *GameServerSpecApplyConfiguration { 59 for i := range values { 60 if values[i] == nil { 61 panic("nil value passed to WithPorts") 62 } 63 b.Ports = append(b.Ports, *values[i]) 64 } 65 return b 66 } 67 68 // WithHealth sets the Health field in the declarative configuration to the given value 69 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 70 // If called multiple times, the Health field is set to the value of the last call. 71 func (b *GameServerSpecApplyConfiguration) WithHealth(value *HealthApplyConfiguration) *GameServerSpecApplyConfiguration { 72 b.Health = value 73 return b 74 } 75 76 // WithScheduling sets the Scheduling field in the declarative configuration to the given value 77 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 78 // If called multiple times, the Scheduling field is set to the value of the last call. 79 func (b *GameServerSpecApplyConfiguration) WithScheduling(value apis.SchedulingStrategy) *GameServerSpecApplyConfiguration { 80 b.Scheduling = &value 81 return b 82 } 83 84 // WithSdkServer sets the SdkServer 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 SdkServer field is set to the value of the last call. 87 func (b *GameServerSpecApplyConfiguration) WithSdkServer(value *SdkServerApplyConfiguration) *GameServerSpecApplyConfiguration { 88 b.SdkServer = value 89 return b 90 } 91 92 // WithTemplate sets the Template 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 Template field is set to the value of the last call. 95 func (b *GameServerSpecApplyConfiguration) WithTemplate(value corev1.PodTemplateSpec) *GameServerSpecApplyConfiguration { 96 b.Template = &value 97 return b 98 } 99 100 // WithPlayers sets the Players 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 Players field is set to the value of the last call. 103 func (b *GameServerSpecApplyConfiguration) WithPlayers(value *PlayersSpecApplyConfiguration) *GameServerSpecApplyConfiguration { 104 b.Players = value 105 return b 106 } 107 108 // WithCounters puts the entries into the Counters field in the declarative configuration 109 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 110 // If called multiple times, the entries provided by each call will be put on the Counters field, 111 // overwriting an existing map entries in Counters field with the same key. 112 func (b *GameServerSpecApplyConfiguration) WithCounters(entries map[string]CounterStatusApplyConfiguration) *GameServerSpecApplyConfiguration { 113 if b.Counters == nil && len(entries) > 0 { 114 b.Counters = make(map[string]CounterStatusApplyConfiguration, len(entries)) 115 } 116 for k, v := range entries { 117 b.Counters[k] = v 118 } 119 return b 120 } 121 122 // WithLists puts the entries into the Lists field in the declarative configuration 123 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 124 // If called multiple times, the entries provided by each call will be put on the Lists field, 125 // overwriting an existing map entries in Lists field with the same key. 126 func (b *GameServerSpecApplyConfiguration) WithLists(entries map[string]ListStatusApplyConfiguration) *GameServerSpecApplyConfiguration { 127 if b.Lists == nil && len(entries) > 0 { 128 b.Lists = make(map[string]ListStatusApplyConfiguration, len(entries)) 129 } 130 for k, v := range entries { 131 b.Lists[k] = v 132 } 133 return b 134 } 135 136 // WithEviction sets the Eviction 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 Eviction field is set to the value of the last call. 139 func (b *GameServerSpecApplyConfiguration) WithEviction(value *EvictionApplyConfiguration) *GameServerSpecApplyConfiguration { 140 b.Eviction = value 141 return b 142 }