controllerrevision.go 13 KB

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