runtimeclass.go 14 KB

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