1 /* 2 Copyright The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 // Code generated by applyconfiguration-gen. DO NOT EDIT. 18 19 package v1 20 21 import ( 22 admissionregistrationv1 "k8s.io/api/admissionregistration/v1" 23 metav1 "k8s.io/client-go/applyconfigurations/meta/v1" 24 ) 25 26 // ValidatingWebhookApplyConfiguration represents an declarative configuration of the ValidatingWebhook type for use 27 // with apply. 28 type ValidatingWebhookApplyConfiguration struct { 29 Name *string `json:"name,omitempty"` 30 ClientConfig *WebhookClientConfigApplyConfiguration `json:"clientConfig,omitempty"` 31 Rules []RuleWithOperationsApplyConfiguration `json:"rules,omitempty"` 32 FailurePolicy *admissionregistrationv1.FailurePolicyType `json:"failurePolicy,omitempty"` 33 MatchPolicy *admissionregistrationv1.MatchPolicyType `json:"matchPolicy,omitempty"` 34 NamespaceSelector *metav1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` 35 ObjectSelector *metav1.LabelSelectorApplyConfiguration `json:"objectSelector,omitempty"` 36 SideEffects *admissionregistrationv1.SideEffectClass `json:"sideEffects,omitempty"` 37 TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` 38 AdmissionReviewVersions []string `json:"admissionReviewVersions,omitempty"` 39 MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"` 40 } 41 42 // ValidatingWebhookApplyConfiguration constructs an declarative configuration of the ValidatingWebhook type for use with 43 // apply. 44 func ValidatingWebhook() *ValidatingWebhookApplyConfiguration { 45 return &ValidatingWebhookApplyConfiguration{} 46 } 47 48 // WithName sets the Name 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 Name field is set to the value of the last call. 51 func (b *ValidatingWebhookApplyConfiguration) WithName(value string) *ValidatingWebhookApplyConfiguration { 52 b.Name = &value 53 return b 54 } 55 56 // WithClientConfig sets the ClientConfig field in the declarative configuration to the given value 57 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 58 // If called multiple times, the ClientConfig field is set to the value of the last call. 59 func (b *ValidatingWebhookApplyConfiguration) WithClientConfig(value *WebhookClientConfigApplyConfiguration) *ValidatingWebhookApplyConfiguration { 60 b.ClientConfig = value 61 return b 62 } 63 64 // WithRules adds the given value to the Rules field in the declarative configuration 65 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 66 // If called multiple times, values provided by each call will be appended to the Rules field. 67 func (b *ValidatingWebhookApplyConfiguration) WithRules(values ...*RuleWithOperationsApplyConfiguration) *ValidatingWebhookApplyConfiguration { 68 for i := range values { 69 if values[i] == nil { 70 panic("nil value passed to WithRules") 71 } 72 b.Rules = append(b.Rules, *values[i]) 73 } 74 return b 75 } 76 77 // WithFailurePolicy sets the FailurePolicy field in the declarative configuration to the given value 78 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 79 // If called multiple times, the FailurePolicy field is set to the value of the last call. 80 func (b *ValidatingWebhookApplyConfiguration) WithFailurePolicy(value admissionregistrationv1.FailurePolicyType) *ValidatingWebhookApplyConfiguration { 81 b.FailurePolicy = &value 82 return b 83 } 84 85 // WithMatchPolicy sets the MatchPolicy 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 MatchPolicy field is set to the value of the last call. 88 func (b *ValidatingWebhookApplyConfiguration) WithMatchPolicy(value admissionregistrationv1.MatchPolicyType) *ValidatingWebhookApplyConfiguration { 89 b.MatchPolicy = &value 90 return b 91 } 92 93 // WithNamespaceSelector sets the NamespaceSelector 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 NamespaceSelector field is set to the value of the last call. 96 func (b *ValidatingWebhookApplyConfiguration) WithNamespaceSelector(value *metav1.LabelSelectorApplyConfiguration) *ValidatingWebhookApplyConfiguration { 97 b.NamespaceSelector = value 98 return b 99 } 100 101 // WithObjectSelector sets the ObjectSelector 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 ObjectSelector field is set to the value of the last call. 104 func (b *ValidatingWebhookApplyConfiguration) WithObjectSelector(value *metav1.LabelSelectorApplyConfiguration) *ValidatingWebhookApplyConfiguration { 105 b.ObjectSelector = value 106 return b 107 } 108 109 // WithSideEffects sets the SideEffects field in the declarative configuration to the given value 110 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 111 // If called multiple times, the SideEffects field is set to the value of the last call. 112 func (b *ValidatingWebhookApplyConfiguration) WithSideEffects(value admissionregistrationv1.SideEffectClass) *ValidatingWebhookApplyConfiguration { 113 b.SideEffects = &value 114 return b 115 } 116 117 // WithTimeoutSeconds sets the TimeoutSeconds 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 TimeoutSeconds field is set to the value of the last call. 120 func (b *ValidatingWebhookApplyConfiguration) WithTimeoutSeconds(value int32) *ValidatingWebhookApplyConfiguration { 121 b.TimeoutSeconds = &value 122 return b 123 } 124 125 // WithAdmissionReviewVersions adds the given value to the AdmissionReviewVersions 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 AdmissionReviewVersions field. 128 func (b *ValidatingWebhookApplyConfiguration) WithAdmissionReviewVersions(values ...string) *ValidatingWebhookApplyConfiguration { 129 for i := range values { 130 b.AdmissionReviewVersions = append(b.AdmissionReviewVersions, values[i]) 131 } 132 return b 133 } 134 135 // WithMatchConditions adds the given value to the MatchConditions field in the declarative configuration 136 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 137 // If called multiple times, values provided by each call will be appended to the MatchConditions field. 138 func (b *ValidatingWebhookApplyConfiguration) WithMatchConditions(values ...*MatchConditionApplyConfiguration) *ValidatingWebhookApplyConfiguration { 139 for i := range values { 140 if values[i] == nil { 141 panic("nil value passed to WithMatchConditions") 142 } 143 b.MatchConditions = append(b.MatchConditions, *values[i]) 144 } 145 return b 146 } 147