mutatingwebhook.go 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1"
  17. v1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1"
  18. metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
  19. )
  20. // MutatingWebhookApplyConfiguration represents an declarative configuration of the MutatingWebhook type for use
  21. // with apply.
  22. type MutatingWebhookApplyConfiguration struct {
  23. Name *string `json:"name,omitempty"`
  24. ClientConfig *WebhookClientConfigApplyConfiguration `json:"clientConfig,omitempty"`
  25. Rules []v1.RuleWithOperationsApplyConfiguration `json:"rules,omitempty"`
  26. FailurePolicy *admissionregistrationv1beta1.FailurePolicyType `json:"failurePolicy,omitempty"`
  27. MatchPolicy *admissionregistrationv1beta1.MatchPolicyType `json:"matchPolicy,omitempty"`
  28. NamespaceSelector *metav1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"`
  29. ObjectSelector *metav1.LabelSelectorApplyConfiguration `json:"objectSelector,omitempty"`
  30. SideEffects *admissionregistrationv1beta1.SideEffectClass `json:"sideEffects,omitempty"`
  31. TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"`
  32. AdmissionReviewVersions []string `json:"admissionReviewVersions,omitempty"`
  33. ReinvocationPolicy *admissionregistrationv1beta1.ReinvocationPolicyType `json:"reinvocationPolicy,omitempty"`
  34. MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"`
  35. }
  36. // MutatingWebhookApplyConfiguration constructs an declarative configuration of the MutatingWebhook type for use with
  37. // apply.
  38. func MutatingWebhook() *MutatingWebhookApplyConfiguration {
  39. return &MutatingWebhookApplyConfiguration{}
  40. }
  41. // WithName sets the Name field in the declarative configuration to the given value
  42. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  43. // If called multiple times, the Name field is set to the value of the last call.
  44. func (b *MutatingWebhookApplyConfiguration) WithName(value string) *MutatingWebhookApplyConfiguration {
  45. b.Name = &value
  46. return b
  47. }
  48. // WithClientConfig sets the ClientConfig field in the declarative configuration to the given value
  49. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  50. // If called multiple times, the ClientConfig field is set to the value of the last call.
  51. func (b *MutatingWebhookApplyConfiguration) WithClientConfig(value *WebhookClientConfigApplyConfiguration) *MutatingWebhookApplyConfiguration {
  52. b.ClientConfig = value
  53. return b
  54. }
  55. // WithRules adds the given value to the Rules 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 Rules field.
  58. func (b *MutatingWebhookApplyConfiguration) WithRules(values ...*v1.RuleWithOperationsApplyConfiguration) *MutatingWebhookApplyConfiguration {
  59. for i := range values {
  60. if values[i] == nil {
  61. panic("nil value passed to WithRules")
  62. }
  63. b.Rules = append(b.Rules, *values[i])
  64. }
  65. return b
  66. }
  67. // WithFailurePolicy sets the FailurePolicy field in the declarative configuration to the given value
  68. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  69. // If called multiple times, the FailurePolicy field is set to the value of the last call.
  70. func (b *MutatingWebhookApplyConfiguration) WithFailurePolicy(value admissionregistrationv1beta1.FailurePolicyType) *MutatingWebhookApplyConfiguration {
  71. b.FailurePolicy = &value
  72. return b
  73. }
  74. // WithMatchPolicy sets the MatchPolicy field in the declarative configuration to the given value
  75. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  76. // If called multiple times, the MatchPolicy field is set to the value of the last call.
  77. func (b *MutatingWebhookApplyConfiguration) WithMatchPolicy(value admissionregistrationv1beta1.MatchPolicyType) *MutatingWebhookApplyConfiguration {
  78. b.MatchPolicy = &value
  79. return b
  80. }
  81. // WithNamespaceSelector sets the NamespaceSelector field in the declarative configuration to the given value
  82. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  83. // If called multiple times, the NamespaceSelector field is set to the value of the last call.
  84. func (b *MutatingWebhookApplyConfiguration) WithNamespaceSelector(value *metav1.LabelSelectorApplyConfiguration) *MutatingWebhookApplyConfiguration {
  85. b.NamespaceSelector = value
  86. return b
  87. }
  88. // WithObjectSelector sets the ObjectSelector field in the declarative configuration to the given value
  89. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  90. // If called multiple times, the ObjectSelector field is set to the value of the last call.
  91. func (b *MutatingWebhookApplyConfiguration) WithObjectSelector(value *metav1.LabelSelectorApplyConfiguration) *MutatingWebhookApplyConfiguration {
  92. b.ObjectSelector = value
  93. return b
  94. }
  95. // WithSideEffects sets the SideEffects 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 SideEffects field is set to the value of the last call.
  98. func (b *MutatingWebhookApplyConfiguration) WithSideEffects(value admissionregistrationv1beta1.SideEffectClass) *MutatingWebhookApplyConfiguration {
  99. b.SideEffects = &value
  100. return b
  101. }
  102. // WithTimeoutSeconds sets the TimeoutSeconds 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 TimeoutSeconds field is set to the value of the last call.
  105. func (b *MutatingWebhookApplyConfiguration) WithTimeoutSeconds(value int32) *MutatingWebhookApplyConfiguration {
  106. b.TimeoutSeconds = &value
  107. return b
  108. }
  109. // WithAdmissionReviewVersions adds the given value to the AdmissionReviewVersions field in the declarative configuration
  110. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  111. // If called multiple times, values provided by each call will be appended to the AdmissionReviewVersions field.
  112. func (b *MutatingWebhookApplyConfiguration) WithAdmissionReviewVersions(values ...string) *MutatingWebhookApplyConfiguration {
  113. for i := range values {
  114. b.AdmissionReviewVersions = append(b.AdmissionReviewVersions, values[i])
  115. }
  116. return b
  117. }
  118. // WithReinvocationPolicy sets the ReinvocationPolicy 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 ReinvocationPolicy field is set to the value of the last call.
  121. func (b *MutatingWebhookApplyConfiguration) WithReinvocationPolicy(value admissionregistrationv1beta1.ReinvocationPolicyType) *MutatingWebhookApplyConfiguration {
  122. b.ReinvocationPolicy = &value
  123. return b
  124. }
  125. // WithMatchConditions adds the given value to the MatchConditions field in the declarative configuration
  126. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  127. // If called multiple times, values provided by each call will be appended to the MatchConditions field.
  128. func (b *MutatingWebhookApplyConfiguration) WithMatchConditions(values ...*MatchConditionApplyConfiguration) *MutatingWebhookApplyConfiguration {
  129. for i := range values {
  130. if values[i] == nil {
  131. panic("nil value passed to WithMatchConditions")
  132. }
  133. b.MatchConditions = append(b.MatchConditions, *values[i])
  134. }
  135. return b
  136. }