mutatingwebhook.go 8.3 KB

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