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