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 // MutatingWebhookApplyConfiguration represents an declarative configuration of the MutatingWebhook type for use 27 // with apply. 28 type MutatingWebhookApplyConfiguration 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 ReinvocationPolicy *admissionregistrationv1.ReinvocationPolicyType `json:"reinvocationPolicy,omitempty"` 40 MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"` 41 } 42 43 // MutatingWebhookApplyConfiguration constructs an declarative configuration of the MutatingWebhook type for use with 44 // apply. 45 func MutatingWebhook() *MutatingWebhookApplyConfiguration { 46 return &MutatingWebhookApplyConfiguration{} 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 *MutatingWebhookApplyConfiguration) WithName(value string) *MutatingWebhookApplyConfiguration { 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 *MutatingWebhookApplyConfiguration) WithClientConfig(value *WebhookClientConfigApplyConfiguration) *MutatingWebhookApplyConfiguration { 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 *MutatingWebhookApplyConfiguration) WithRules(values ...*RuleWithOperationsApplyConfiguration) *MutatingWebhookApplyConfiguration { 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 *MutatingWebhookApplyConfiguration) WithFailurePolicy(value admissionregistrationv1.FailurePolicyType) *MutatingWebhookApplyConfiguration { 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 *MutatingWebhookApplyConfiguration) WithMatchPolicy(value admissionregistrationv1.MatchPolicyType) *MutatingWebhookApplyConfiguration { 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 *MutatingWebhookApplyConfiguration) WithNamespaceSelector(value *metav1.LabelSelectorApplyConfiguration) *MutatingWebhookApplyConfiguration { 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 *MutatingWebhookApplyConfiguration) WithObjectSelector(value *metav1.LabelSelectorApplyConfiguration) *MutatingWebhookApplyConfiguration { 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 *MutatingWebhookApplyConfiguration) WithSideEffects(value admissionregistrationv1.SideEffectClass) *MutatingWebhookApplyConfiguration { 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 *MutatingWebhookApplyConfiguration) WithTimeoutSeconds(value int32) *MutatingWebhookApplyConfiguration { 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 *MutatingWebhookApplyConfiguration) WithAdmissionReviewVersions(values ...string) *MutatingWebhookApplyConfiguration { 130 for i := range values { 131 b.AdmissionReviewVersions = append(b.AdmissionReviewVersions, values[i]) 132 } 133 return b 134 } 135 136 // WithReinvocationPolicy sets the ReinvocationPolicy field in the declarative configuration to the given value 137 // and returns the receiver, so that objects can be built by chaining "With" function invocations. 138 // If called multiple times, the ReinvocationPolicy field is set to the value of the last call. 139 func (b *MutatingWebhookApplyConfiguration) WithReinvocationPolicy(value admissionregistrationv1.ReinvocationPolicyType) *MutatingWebhookApplyConfiguration { 140 b.ReinvocationPolicy = &value 141 return b 142 } 143 144 // WithMatchConditions adds the given value to the MatchConditions field in the declarative configuration 145 // and returns the receiver, so that objects can be build by chaining "With" function invocations. 146 // If called multiple times, values provided by each call will be appended to the MatchConditions field. 147 func (b *MutatingWebhookApplyConfiguration) WithMatchConditions(values ...*MatchConditionApplyConfiguration) *MutatingWebhookApplyConfiguration { 148 for i := range values { 149 if values[i] == nil { 150 panic("nil value passed to WithMatchConditions") 151 } 152 b.MatchConditions = append(b.MatchConditions, *values[i]) 153 } 154 return b 155 } 156