prioritylevelconfiguration.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. /*
  2. Copyright The Kubernetes Authors.
  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. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // Code generated by applyconfiguration-gen. DO NOT EDIT.
  14. package v1beta2
  15. import (
  16. flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2"
  17. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  18. types "k8s.io/apimachinery/pkg/types"
  19. managedfields "k8s.io/apimachinery/pkg/util/managedfields"
  20. internal "k8s.io/client-go/applyconfigurations/internal"
  21. v1 "k8s.io/client-go/applyconfigurations/meta/v1"
  22. )
  23. // PriorityLevelConfigurationApplyConfiguration represents a declarative configuration of the PriorityLevelConfiguration type for use
  24. // with apply.
  25. //
  26. // PriorityLevelConfiguration represents the configuration of a priority level.
  27. type PriorityLevelConfigurationApplyConfiguration struct {
  28. v1.TypeMetaApplyConfiguration `json:",inline"`
  29. // `metadata` is the standard object's metadata.
  30. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  31. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
  32. // `spec` is the specification of the desired behavior of a "request-priority".
  33. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
  34. Spec *PriorityLevelConfigurationSpecApplyConfiguration `json:"spec,omitempty"`
  35. // `status` is the current status of a "request-priority".
  36. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
  37. Status *PriorityLevelConfigurationStatusApplyConfiguration `json:"status,omitempty"`
  38. }
  39. // PriorityLevelConfiguration constructs a declarative configuration of the PriorityLevelConfiguration type for use with
  40. // apply.
  41. func PriorityLevelConfiguration(name string) *PriorityLevelConfigurationApplyConfiguration {
  42. b := &PriorityLevelConfigurationApplyConfiguration{}
  43. b.WithName(name)
  44. b.WithKind("PriorityLevelConfiguration")
  45. b.WithAPIVersion("flowcontrol.apiserver.k8s.io/v1beta2")
  46. return b
  47. }
  48. // ExtractPriorityLevelConfigurationFrom extracts the applied configuration owned by fieldManager from
  49. // priorityLevelConfiguration for the specified subresource. Pass an empty string for subresource to extract
  50. // the main resource. Common subresources include "status", "scale", etc.
  51. // priorityLevelConfiguration must be a unmodified PriorityLevelConfiguration API object that was retrieved from the Kubernetes API.
  52. // ExtractPriorityLevelConfigurationFrom provides a way to perform a extract/modify-in-place/apply workflow.
  53. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
  54. // applied if another fieldManager has updated or force applied any of the previously applied fields.
  55. func ExtractPriorityLevelConfigurationFrom(priorityLevelConfiguration *flowcontrolv1beta2.PriorityLevelConfiguration, fieldManager string, subresource string) (*PriorityLevelConfigurationApplyConfiguration, error) {
  56. b := &PriorityLevelConfigurationApplyConfiguration{}
  57. err := managedfields.ExtractInto(priorityLevelConfiguration, internal.Parser().Type("io.k8s.api.flowcontrol.v1beta2.PriorityLevelConfiguration"), fieldManager, b, subresource)
  58. if err != nil {
  59. return nil, err
  60. }
  61. b.WithName(priorityLevelConfiguration.Name)
  62. b.WithKind("PriorityLevelConfiguration")
  63. b.WithAPIVersion("flowcontrol.apiserver.k8s.io/v1beta2")
  64. return b, nil
  65. }
  66. // ExtractPriorityLevelConfiguration extracts the applied configuration owned by fieldManager from
  67. // priorityLevelConfiguration. If no managedFields are found in priorityLevelConfiguration for fieldManager, a
  68. // PriorityLevelConfigurationApplyConfiguration is returned with only the Name, Namespace (if applicable),
  69. // APIVersion and Kind populated. It is possible that no managed fields were found for because other
  70. // field managers have taken ownership of all the fields previously owned by fieldManager, or because
  71. // the fieldManager never owned fields any fields.
  72. // priorityLevelConfiguration must be a unmodified PriorityLevelConfiguration API object that was retrieved from the Kubernetes API.
  73. // ExtractPriorityLevelConfiguration provides a way to perform a extract/modify-in-place/apply workflow.
  74. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
  75. // applied if another fieldManager has updated or force applied any of the previously applied fields.
  76. func ExtractPriorityLevelConfiguration(priorityLevelConfiguration *flowcontrolv1beta2.PriorityLevelConfiguration, fieldManager string) (*PriorityLevelConfigurationApplyConfiguration, error) {
  77. return ExtractPriorityLevelConfigurationFrom(priorityLevelConfiguration, fieldManager, "")
  78. }
  79. // ExtractPriorityLevelConfigurationStatus extracts the applied configuration owned by fieldManager from
  80. // priorityLevelConfiguration for the status subresource.
  81. func ExtractPriorityLevelConfigurationStatus(priorityLevelConfiguration *flowcontrolv1beta2.PriorityLevelConfiguration, fieldManager string) (*PriorityLevelConfigurationApplyConfiguration, error) {
  82. return ExtractPriorityLevelConfigurationFrom(priorityLevelConfiguration, fieldManager, "status")
  83. }
  84. func (b PriorityLevelConfigurationApplyConfiguration) IsApplyConfiguration() {}
  85. // WithKind sets the Kind field in the declarative configuration to the given value
  86. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  87. // If called multiple times, the Kind field is set to the value of the last call.
  88. func (b *PriorityLevelConfigurationApplyConfiguration) WithKind(value string) *PriorityLevelConfigurationApplyConfiguration {
  89. b.TypeMetaApplyConfiguration.Kind = &value
  90. return b
  91. }
  92. // WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call.
  95. func (b *PriorityLevelConfigurationApplyConfiguration) WithAPIVersion(value string) *PriorityLevelConfigurationApplyConfiguration {
  96. b.TypeMetaApplyConfiguration.APIVersion = &value
  97. return b
  98. }
  99. // WithName sets the Name 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 Name field is set to the value of the last call.
  102. func (b *PriorityLevelConfigurationApplyConfiguration) WithName(value string) *PriorityLevelConfigurationApplyConfiguration {
  103. b.ensureObjectMetaApplyConfigurationExists()
  104. b.ObjectMetaApplyConfiguration.Name = &value
  105. return b
  106. }
  107. // WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call.
  110. func (b *PriorityLevelConfigurationApplyConfiguration) WithGenerateName(value string) *PriorityLevelConfigurationApplyConfiguration {
  111. b.ensureObjectMetaApplyConfigurationExists()
  112. b.ObjectMetaApplyConfiguration.GenerateName = &value
  113. return b
  114. }
  115. // WithNamespace sets the Namespace field in the declarative configuration to the given value
  116. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  117. // If called multiple times, the Namespace field is set to the value of the last call.
  118. func (b *PriorityLevelConfigurationApplyConfiguration) WithNamespace(value string) *PriorityLevelConfigurationApplyConfiguration {
  119. b.ensureObjectMetaApplyConfigurationExists()
  120. b.ObjectMetaApplyConfiguration.Namespace = &value
  121. return b
  122. }
  123. // WithUID sets the UID 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 UID field is set to the value of the last call.
  126. func (b *PriorityLevelConfigurationApplyConfiguration) WithUID(value types.UID) *PriorityLevelConfigurationApplyConfiguration {
  127. b.ensureObjectMetaApplyConfigurationExists()
  128. b.ObjectMetaApplyConfiguration.UID = &value
  129. return b
  130. }
  131. // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
  132. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  133. // If called multiple times, the ResourceVersion field is set to the value of the last call.
  134. func (b *PriorityLevelConfigurationApplyConfiguration) WithResourceVersion(value string) *PriorityLevelConfigurationApplyConfiguration {
  135. b.ensureObjectMetaApplyConfigurationExists()
  136. b.ObjectMetaApplyConfiguration.ResourceVersion = &value
  137. return b
  138. }
  139. // WithGeneration sets the Generation field in the declarative configuration to the given value
  140. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  141. // If called multiple times, the Generation field is set to the value of the last call.
  142. func (b *PriorityLevelConfigurationApplyConfiguration) WithGeneration(value int64) *PriorityLevelConfigurationApplyConfiguration {
  143. b.ensureObjectMetaApplyConfigurationExists()
  144. b.ObjectMetaApplyConfiguration.Generation = &value
  145. return b
  146. }
  147. // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
  148. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  149. // If called multiple times, the CreationTimestamp field is set to the value of the last call.
  150. func (b *PriorityLevelConfigurationApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PriorityLevelConfigurationApplyConfiguration {
  151. b.ensureObjectMetaApplyConfigurationExists()
  152. b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
  153. return b
  154. }
  155. // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
  156. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  157. // If called multiple times, the DeletionTimestamp field is set to the value of the last call.
  158. func (b *PriorityLevelConfigurationApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PriorityLevelConfigurationApplyConfiguration {
  159. b.ensureObjectMetaApplyConfigurationExists()
  160. b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
  161. return b
  162. }
  163. // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
  164. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  165. // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
  166. func (b *PriorityLevelConfigurationApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PriorityLevelConfigurationApplyConfiguration {
  167. b.ensureObjectMetaApplyConfigurationExists()
  168. b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
  169. return b
  170. }
  171. // WithLabels puts the entries into the Labels field in the declarative configuration
  172. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  173. // If called multiple times, the entries provided by each call will be put on the Labels field,
  174. // overwriting an existing map entries in Labels field with the same key.
  175. func (b *PriorityLevelConfigurationApplyConfiguration) WithLabels(entries map[string]string) *PriorityLevelConfigurationApplyConfiguration {
  176. b.ensureObjectMetaApplyConfigurationExists()
  177. if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
  178. b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
  179. }
  180. for k, v := range entries {
  181. b.ObjectMetaApplyConfiguration.Labels[k] = v
  182. }
  183. return b
  184. }
  185. // WithAnnotations puts the entries into the Annotations field in the declarative configuration
  186. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  187. // If called multiple times, the entries provided by each call will be put on the Annotations field,
  188. // overwriting an existing map entries in Annotations field with the same key.
  189. func (b *PriorityLevelConfigurationApplyConfiguration) WithAnnotations(entries map[string]string) *PriorityLevelConfigurationApplyConfiguration {
  190. b.ensureObjectMetaApplyConfigurationExists()
  191. if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
  192. b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
  193. }
  194. for k, v := range entries {
  195. b.ObjectMetaApplyConfiguration.Annotations[k] = v
  196. }
  197. return b
  198. }
  199. // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
  200. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  201. // If called multiple times, values provided by each call will be appended to the OwnerReferences field.
  202. func (b *PriorityLevelConfigurationApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PriorityLevelConfigurationApplyConfiguration {
  203. b.ensureObjectMetaApplyConfigurationExists()
  204. for i := range values {
  205. if values[i] == nil {
  206. panic("nil value passed to WithOwnerReferences")
  207. }
  208. b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
  209. }
  210. return b
  211. }
  212. // WithFinalizers adds the given value to the Finalizers field in the declarative configuration
  213. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  214. // If called multiple times, values provided by each call will be appended to the Finalizers field.
  215. func (b *PriorityLevelConfigurationApplyConfiguration) WithFinalizers(values ...string) *PriorityLevelConfigurationApplyConfiguration {
  216. b.ensureObjectMetaApplyConfigurationExists()
  217. for i := range values {
  218. b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
  219. }
  220. return b
  221. }
  222. func (b *PriorityLevelConfigurationApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
  223. if b.ObjectMetaApplyConfiguration == nil {
  224. b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
  225. }
  226. }
  227. // WithSpec sets the Spec field in the declarative configuration to the given value
  228. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  229. // If called multiple times, the Spec field is set to the value of the last call.
  230. func (b *PriorityLevelConfigurationApplyConfiguration) WithSpec(value *PriorityLevelConfigurationSpecApplyConfiguration) *PriorityLevelConfigurationApplyConfiguration {
  231. b.Spec = value
  232. return b
  233. }
  234. // WithStatus sets the Status field in the declarative configuration to the given value
  235. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  236. // If called multiple times, the Status field is set to the value of the last call.
  237. func (b *PriorityLevelConfigurationApplyConfiguration) WithStatus(value *PriorityLevelConfigurationStatusApplyConfiguration) *PriorityLevelConfigurationApplyConfiguration {
  238. b.Status = value
  239. return b
  240. }
  241. // GetKind retrieves the value of the Kind field in the declarative configuration.
  242. func (b *PriorityLevelConfigurationApplyConfiguration) GetKind() *string {
  243. return b.TypeMetaApplyConfiguration.Kind
  244. }
  245. // GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
  246. func (b *PriorityLevelConfigurationApplyConfiguration) GetAPIVersion() *string {
  247. return b.TypeMetaApplyConfiguration.APIVersion
  248. }
  249. // GetName retrieves the value of the Name field in the declarative configuration.
  250. func (b *PriorityLevelConfigurationApplyConfiguration) GetName() *string {
  251. b.ensureObjectMetaApplyConfigurationExists()
  252. return b.ObjectMetaApplyConfiguration.Name
  253. }
  254. // GetNamespace retrieves the value of the Namespace field in the declarative configuration.
  255. func (b *PriorityLevelConfigurationApplyConfiguration) GetNamespace() *string {
  256. b.ensureObjectMetaApplyConfigurationExists()
  257. return b.ObjectMetaApplyConfiguration.Namespace
  258. }