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 // MutatingWebhookApplyConfiguration represents an declarative configuration of the MutatingWebhook type for use 28 // with apply. 29 type MutatingWebhookApplyConfiguration 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 ReinvocationPolicy *admissionregistrationv1beta1.ReinvocationPolicyType `json:"reinvocationPolicy,omitempty"` 41 MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"` 42 } 43 44 // MutatingWebhookApplyConfiguration constructs an declarative configuration of the MutatingWebhook type for use with 45 // apply. 46 func MutatingWebhook() *MutatingWebhookApplyConfiguration { 47 return &MutatingWebhookApplyConfiguration{} 48 } 49 50 // WithName sets the Name field in the declarative configuration to the given value 51 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 52 // If called multiple times, the Name field is set to the value of the last call. 53 func (b *MutatingWebhookApplyConfiguration) WithName(value string) *MutatingWebhookApplyConfiguration { 54 b.Name = &value 55 return b 56 } 57 58 // WithClientConfig sets the ClientConfig field in the declarative configuration to the given value 59 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 60 // If called multiple times, the ClientConfig field is set to the value of the last call. 61 func (b *MutatingWebhookApplyConfiguration) WithClientConfig(value *WebhookClientConfigApplyConfiguration) *MutatingWebhookApplyConfiguration { 62 b.ClientConfig = value 63 return b 64 } 65 66 // WithRules adds the given value to the Rules field in the declarative configuration 67 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 68 // If called multiple times, values provided by each call will be appended to the Rules field. 69 func (b *MutatingWebhookApplyConfiguration) WithRules(values ...*v1.RuleWithOperationsApplyConfiguration) *MutatingWebhookApplyConfiguration { 70 for i := range values { 71 if values[i] == nil { 72 panic("nil value passed to WithRules") 73 } 74 b.Rules = append(b.Rules, *values[i]) 75 } 76 return b 77 } 78 79 // WithFailurePolicy sets the FailurePolicy 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 FailurePolicy field is set to the value of the last call. 82 func (b *MutatingWebhookApplyConfiguration) WithFailurePolicy(value admissionregistrationv1beta1.FailurePolicyType) *MutatingWebhookApplyConfiguration { 83 b.FailurePolicy = &value 84 return b 85 } 86 87 // WithMatchPolicy sets the MatchPolicy 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 MatchPolicy field is set to the value of the last call. 90 func (b *MutatingWebhookApplyConfiguration) WithMatchPolicy(value admissionregistrationv1beta1.MatchPolicyType) *MutatingWebhookApplyConfiguration { 91 b.MatchPolicy = &value 92 return b 93 } 94 95 // WithNamespaceSelector sets the NamespaceSelector field in the declarative configuration to the given value 96 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 97 // If called multiple times, the NamespaceSelector field is set to the value of the last call. 98 func (b *MutatingWebhookApplyConfiguration) WithNamespaceSelector(value *metav1.LabelSelectorApplyConfiguration) *MutatingWebhookApplyConfiguration { 99 b.NamespaceSelector = value 100 return b 101 } 102 103 // WithObjectSelector sets the ObjectSelector field in the declarative configuration to the given value 104 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 105 // If called multiple times, the ObjectSelector field is set to the value of the last call. 106 func (b *MutatingWebhookApplyConfiguration) WithObjectSelector(value *metav1.LabelSelectorApplyConfiguration) *MutatingWebhookApplyConfiguration { 107 b.ObjectSelector = value 108 return b 109 } 110 111 // WithSideEffects sets the SideEffects field in the declarative configuration to the given value 112 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 113 // If called multiple times, the SideEffects field is set to the value of the last call. 114 func (b *MutatingWebhookApplyConfiguration) WithSideEffects(value admissionregistrationv1beta1.SideEffectClass) *MutatingWebhookApplyConfiguration { 115 b.SideEffects = &value 116 return b 117 } 118 119 // WithTimeoutSeconds sets the TimeoutSeconds field in the declarative configuration to the given value 120 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 121 // If called multiple times, the TimeoutSeconds field is set to the value of the last call. 122 func (b *MutatingWebhookApplyConfiguration) WithTimeoutSeconds(value int32) *MutatingWebhookApplyConfiguration { 123 b.TimeoutSeconds = &value 124 return b 125 } 126 127 // WithAdmissionReviewVersions adds the given value to the AdmissionReviewVersions field in the declarative configuration 128 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 129 // If called multiple times, values provided by each call will be appended to the AdmissionReviewVersions field. 130 func (b *MutatingWebhookApplyConfiguration) WithAdmissionReviewVersions(values ...string) *MutatingWebhookApplyConfiguration { 131 for i := range values { 132 b.AdmissionReviewVersions = append(b.AdmissionReviewVersions, values[i]) 133 } 134 return b 135 } 136 137 // WithReinvocationPolicy sets the ReinvocationPolicy field in the declarative configuration to the given value 138 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 139 // If called multiple times, the ReinvocationPolicy field is set to the value of the last call. 140 func (b *MutatingWebhookApplyConfiguration) WithReinvocationPolicy(value admissionregistrationv1beta1.ReinvocationPolicyType) *MutatingWebhookApplyConfiguration { 141 b.ReinvocationPolicy = &value 142 return b 143 } 144 145 // WithMatchConditions adds the given value to the MatchConditions field in the declarative configuration 146 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 147 // If called multiple times, values provided by each call will be appended to the MatchConditions field. 148 func (b *MutatingWebhookApplyConfiguration) WithMatchConditions(values ...*MatchConditionApplyConfiguration) *MutatingWebhookApplyConfiguration { 149 for i := range values { 150 if values[i] == nil { 151 panic("nil value passed to WithMatchConditions") 152 } 153 b.MatchConditions = append(b.MatchConditions, *values[i]) 154 } 155 return b 156 } 157