validatingwebhook.go 6.9 KB

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