validatingwebhook.go 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. // ValidatingWebhookApplyConfiguration represents an declarative configuration of the ValidatingWebhook type for use
  20. // with apply.
  21. type ValidatingWebhookApplyConfiguration 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. MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"`
  33. }
  34. // ValidatingWebhookApplyConfiguration constructs an declarative configuration of the ValidatingWebhook type for use with
  35. // apply.
  36. func ValidatingWebhook() *ValidatingWebhookApplyConfiguration {
  37. return &ValidatingWebhookApplyConfiguration{}
  38. }
  39. // WithName sets the Name field in the declarative configuration to the given value
  40. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  41. // If called multiple times, the Name field is set to the value of the last call.
  42. func (b *ValidatingWebhookApplyConfiguration) WithName(value string) *ValidatingWebhookApplyConfiguration {
  43. b.Name = &value
  44. return b
  45. }
  46. // WithClientConfig sets the ClientConfig field in the declarative configuration to the given value
  47. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  48. // If called multiple times, the ClientConfig field is set to the value of the last call.
  49. func (b *ValidatingWebhookApplyConfiguration) WithClientConfig(value *WebhookClientConfigApplyConfiguration) *ValidatingWebhookApplyConfiguration {
  50. b.ClientConfig = value
  51. return b
  52. }
  53. // WithRules adds the given value to the Rules field in the declarative configuration
  54. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  55. // If called multiple times, values provided by each call will be appended to the Rules field.
  56. func (b *ValidatingWebhookApplyConfiguration) WithRules(values ...*RuleWithOperationsApplyConfiguration) *ValidatingWebhookApplyConfiguration {
  57. for i := range values {
  58. if values[i] == nil {
  59. panic("nil value passed to WithRules")
  60. }
  61. b.Rules = append(b.Rules, *values[i])
  62. }
  63. return b
  64. }
  65. // WithFailurePolicy sets the FailurePolicy 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 FailurePolicy field is set to the value of the last call.
  68. func (b *ValidatingWebhookApplyConfiguration) WithFailurePolicy(value admissionregistrationv1.FailurePolicyType) *ValidatingWebhookApplyConfiguration {
  69. b.FailurePolicy = &value
  70. return b
  71. }
  72. // WithMatchPolicy sets the MatchPolicy 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 MatchPolicy field is set to the value of the last call.
  75. func (b *ValidatingWebhookApplyConfiguration) WithMatchPolicy(value admissionregistrationv1.MatchPolicyType) *ValidatingWebhookApplyConfiguration {
  76. b.MatchPolicy = &value
  77. return b
  78. }
  79. // WithNamespaceSelector sets the NamespaceSelector 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 NamespaceSelector field is set to the value of the last call.
  82. func (b *ValidatingWebhookApplyConfiguration) WithNamespaceSelector(value *metav1.LabelSelectorApplyConfiguration) *ValidatingWebhookApplyConfiguration {
  83. b.NamespaceSelector = value
  84. return b
  85. }
  86. // WithObjectSelector sets the ObjectSelector 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 ObjectSelector field is set to the value of the last call.
  89. func (b *ValidatingWebhookApplyConfiguration) WithObjectSelector(value *metav1.LabelSelectorApplyConfiguration) *ValidatingWebhookApplyConfiguration {
  90. b.ObjectSelector = value
  91. return b
  92. }
  93. // WithSideEffects sets the SideEffects 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 SideEffects field is set to the value of the last call.
  96. func (b *ValidatingWebhookApplyConfiguration) WithSideEffects(value admissionregistrationv1.SideEffectClass) *ValidatingWebhookApplyConfiguration {
  97. b.SideEffects = &value
  98. return b
  99. }
  100. // WithTimeoutSeconds sets the TimeoutSeconds field in the declarative configuration to the given value
  101. // and returns the receiver, so that objects can be built by chaining "With" function invocations.
  102. // If called multiple times, the TimeoutSeconds field is set to the value of the last call.
  103. func (b *ValidatingWebhookApplyConfiguration) WithTimeoutSeconds(value int32) *ValidatingWebhookApplyConfiguration {
  104. b.TimeoutSeconds = &value
  105. return b
  106. }
  107. // WithAdmissionReviewVersions adds the given value to the AdmissionReviewVersions field in the declarative configuration
  108. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  109. // If called multiple times, values provided by each call will be appended to the AdmissionReviewVersions field.
  110. func (b *ValidatingWebhookApplyConfiguration) WithAdmissionReviewVersions(values ...string) *ValidatingWebhookApplyConfiguration {
  111. for i := range values {
  112. b.AdmissionReviewVersions = append(b.AdmissionReviewVersions, values[i])
  113. }
  114. return b
  115. }
  116. // WithMatchConditions adds the given value to the MatchConditions field in the declarative configuration
  117. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  118. // If called multiple times, values provided by each call will be appended to the MatchConditions field.
  119. func (b *ValidatingWebhookApplyConfiguration) WithMatchConditions(values ...*MatchConditionApplyConfiguration) *ValidatingWebhookApplyConfiguration {
  120. for i := range values {
  121. if values[i] == nil {
  122. panic("nil value passed to WithMatchConditions")
  123. }
  124. b.MatchConditions = append(b.MatchConditions, *values[i])
  125. }
  126. return b
  127. }