prioritylevelconfiguration.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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 v1alpha1
  15. import (
  16. flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
  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 an declarative configuration of the PriorityLevelConfiguration type for use
  24. // with apply.
  25. type PriorityLevelConfigurationApplyConfiguration struct {
  26. v1.TypeMetaApplyConfiguration `json:",inline"`
  27. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
  28. Spec *PriorityLevelConfigurationSpecApplyConfiguration `json:"spec,omitempty"`
  29. Status *PriorityLevelConfigurationStatusApplyConfiguration `json:"status,omitempty"`
  30. }
  31. // PriorityLevelConfiguration constructs an declarative configuration of the PriorityLevelConfiguration type for use with
  32. // apply.
  33. func PriorityLevelConfiguration(name string) *PriorityLevelConfigurationApplyConfiguration {
  34. b := &PriorityLevelConfigurationApplyConfiguration{}
  35. b.WithName(name)
  36. b.WithKind("PriorityLevelConfiguration")
  37. b.WithAPIVersion("flowcontrol.apiserver.k8s.io/v1alpha1")
  38. return b
  39. }
  40. // ExtractPriorityLevelConfiguration extracts the applied configuration owned by fieldManager from
  41. // priorityLevelConfiguration. If no managedFields are found in priorityLevelConfiguration for fieldManager, a
  42. // PriorityLevelConfigurationApplyConfiguration is returned with only the Name, Namespace (if applicable),
  43. // APIVersion and Kind populated. It is possible that no managed fields were found for because other
  44. // field managers have taken ownership of all the fields previously owned by fieldManager, or because
  45. // the fieldManager never owned fields any fields.
  46. // priorityLevelConfiguration must be a unmodified PriorityLevelConfiguration API object that was retrieved from the Kubernetes API.
  47. // ExtractPriorityLevelConfiguration provides a way to perform a extract/modify-in-place/apply workflow.
  48. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
  49. // applied if another fieldManager has updated or force applied any of the previously applied fields.
  50. // Experimental!
  51. func ExtractPriorityLevelConfiguration(priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfiguration, fieldManager string) (*PriorityLevelConfigurationApplyConfiguration, error) {
  52. return extractPriorityLevelConfiguration(priorityLevelConfiguration, fieldManager, "")
  53. }
  54. // ExtractPriorityLevelConfigurationStatus is the same as ExtractPriorityLevelConfiguration except
  55. // that it extracts the status subresource applied configuration.
  56. // Experimental!
  57. func ExtractPriorityLevelConfigurationStatus(priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfiguration, fieldManager string) (*PriorityLevelConfigurationApplyConfiguration, error) {
  58. return extractPriorityLevelConfiguration(priorityLevelConfiguration, fieldManager, "status")
  59. }
  60. func extractPriorityLevelConfiguration(priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfiguration, fieldManager string, subresource string) (*PriorityLevelConfigurationApplyConfiguration, error) {
  61. b := &PriorityLevelConfigurationApplyConfiguration{}
  62. err := managedfields.ExtractInto(priorityLevelConfiguration, internal.Parser().Type("io.k8s.api.flowcontrol.v1alpha1.PriorityLevelConfiguration"), fieldManager, b, subresource)
  63. if err != nil {
  64. return nil, err
  65. }
  66. b.WithName(priorityLevelConfiguration.Name)
  67. b.WithKind("PriorityLevelConfiguration")
  68. b.WithAPIVersion("flowcontrol.apiserver.k8s.io/v1alpha1")
  69. return b, nil
  70. }
  71. // WithKind sets the Kind 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 Kind field is set to the value of the last call.
  74. func (b *PriorityLevelConfigurationApplyConfiguration) WithKind(value string) *PriorityLevelConfigurationApplyConfiguration {
  75. b.Kind = &value
  76. return b
  77. }
  78. // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
  79. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  80. // If called multiple times, the APIVersion field is set to the value of the last call.
  81. func (b *PriorityLevelConfigurationApplyConfiguration) WithAPIVersion(value string) *PriorityLevelConfigurationApplyConfiguration {
  82. b.APIVersion = &value
  83. return b
  84. }
  85. // WithName sets the Name 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 Name field is set to the value of the last call.
  88. func (b *PriorityLevelConfigurationApplyConfiguration) WithName(value string) *PriorityLevelConfigurationApplyConfiguration {
  89. b.ensureObjectMetaApplyConfigurationExists()
  90. b.Name = &value
  91. return b
  92. }
  93. // WithGenerateName sets the GenerateName field in the declarative configuration to the given value
  94. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  95. // If called multiple times, the GenerateName field is set to the value of the last call.
  96. func (b *PriorityLevelConfigurationApplyConfiguration) WithGenerateName(value string) *PriorityLevelConfigurationApplyConfiguration {
  97. b.ensureObjectMetaApplyConfigurationExists()
  98. b.GenerateName = &value
  99. return b
  100. }
  101. // WithNamespace sets the Namespace field in the declarative configuration to the given value
  102. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  103. // If called multiple times, the Namespace field is set to the value of the last call.
  104. func (b *PriorityLevelConfigurationApplyConfiguration) WithNamespace(value string) *PriorityLevelConfigurationApplyConfiguration {
  105. b.ensureObjectMetaApplyConfigurationExists()
  106. b.Namespace = &value
  107. return b
  108. }
  109. // WithUID sets the UID field in the declarative configuration to the given value
  110. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  111. // If called multiple times, the UID field is set to the value of the last call.
  112. func (b *PriorityLevelConfigurationApplyConfiguration) WithUID(value types.UID) *PriorityLevelConfigurationApplyConfiguration {
  113. b.ensureObjectMetaApplyConfigurationExists()
  114. b.UID = &value
  115. return b
  116. }
  117. // WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call.
  120. func (b *PriorityLevelConfigurationApplyConfiguration) WithResourceVersion(value string) *PriorityLevelConfigurationApplyConfiguration {
  121. b.ensureObjectMetaApplyConfigurationExists()
  122. b.ResourceVersion = &value
  123. return b
  124. }
  125. // WithGeneration sets the Generation 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 Generation field is set to the value of the last call.
  128. func (b *PriorityLevelConfigurationApplyConfiguration) WithGeneration(value int64) *PriorityLevelConfigurationApplyConfiguration {
  129. b.ensureObjectMetaApplyConfigurationExists()
  130. b.Generation = &value
  131. return b
  132. }
  133. // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
  134. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  135. // If called multiple times, the CreationTimestamp field is set to the value of the last call.
  136. func (b *PriorityLevelConfigurationApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PriorityLevelConfigurationApplyConfiguration {
  137. b.ensureObjectMetaApplyConfigurationExists()
  138. b.CreationTimestamp = &value
  139. return b
  140. }
  141. // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
  142. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  143. // If called multiple times, the DeletionTimestamp field is set to the value of the last call.
  144. func (b *PriorityLevelConfigurationApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PriorityLevelConfigurationApplyConfiguration {
  145. b.ensureObjectMetaApplyConfigurationExists()
  146. b.DeletionTimestamp = &value
  147. return b
  148. }
  149. // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
  150. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  151. // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
  152. func (b *PriorityLevelConfigurationApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PriorityLevelConfigurationApplyConfiguration {
  153. b.ensureObjectMetaApplyConfigurationExists()
  154. b.DeletionGracePeriodSeconds = &value
  155. return b
  156. }
  157. // WithLabels puts the entries into the Labels field in the declarative configuration
  158. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  159. // If called multiple times, the entries provided by each call will be put on the Labels field,
  160. // overwriting an existing map entries in Labels field with the same key.
  161. func (b *PriorityLevelConfigurationApplyConfiguration) WithLabels(entries map[string]string) *PriorityLevelConfigurationApplyConfiguration {
  162. b.ensureObjectMetaApplyConfigurationExists()
  163. if b.Labels == nil && len(entries) > 0 {
  164. b.Labels = make(map[string]string, len(entries))
  165. }
  166. for k, v := range entries {
  167. b.Labels[k] = v
  168. }
  169. return b
  170. }
  171. // WithAnnotations puts the entries into the Annotations 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 Annotations field,
  174. // overwriting an existing map entries in Annotations field with the same key.
  175. func (b *PriorityLevelConfigurationApplyConfiguration) WithAnnotations(entries map[string]string) *PriorityLevelConfigurationApplyConfiguration {
  176. b.ensureObjectMetaApplyConfigurationExists()
  177. if b.Annotations == nil && len(entries) > 0 {
  178. b.Annotations = make(map[string]string, len(entries))
  179. }
  180. for k, v := range entries {
  181. b.Annotations[k] = v
  182. }
  183. return b
  184. }
  185. // WithOwnerReferences adds the given value to the OwnerReferences 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, values provided by each call will be appended to the OwnerReferences field.
  188. func (b *PriorityLevelConfigurationApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PriorityLevelConfigurationApplyConfiguration {
  189. b.ensureObjectMetaApplyConfigurationExists()
  190. for i := range values {
  191. if values[i] == nil {
  192. panic("nil value passed to WithOwnerReferences")
  193. }
  194. b.OwnerReferences = append(b.OwnerReferences, *values[i])
  195. }
  196. return b
  197. }
  198. // WithFinalizers adds the given value to the Finalizers field in the declarative configuration
  199. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  200. // If called multiple times, values provided by each call will be appended to the Finalizers field.
  201. func (b *PriorityLevelConfigurationApplyConfiguration) WithFinalizers(values ...string) *PriorityLevelConfigurationApplyConfiguration {
  202. b.ensureObjectMetaApplyConfigurationExists()
  203. for i := range values {
  204. b.Finalizers = append(b.Finalizers, values[i])
  205. }
  206. return b
  207. }
  208. func (b *PriorityLevelConfigurationApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
  209. if b.ObjectMetaApplyConfiguration == nil {
  210. b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
  211. }
  212. }
  213. // WithSpec sets the Spec 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 Spec field is set to the value of the last call.
  216. func (b *PriorityLevelConfigurationApplyConfiguration) WithSpec(value *PriorityLevelConfigurationSpecApplyConfiguration) *PriorityLevelConfigurationApplyConfiguration {
  217. b.Spec = value
  218. return b
  219. }
  220. // WithStatus sets the Status field in the declarative configuration to the given value
  221. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  222. // If called multiple times, the Status field is set to the value of the last call.
  223. func (b *PriorityLevelConfigurationApplyConfiguration) WithStatus(value *PriorityLevelConfigurationStatusApplyConfiguration) *PriorityLevelConfigurationApplyConfiguration {
  224. b.Status = value
  225. return b
  226. }