...

Source file src/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyspec.go

Documentation: k8s.io/client-go/applyconfigurations/extensions/v1beta1

     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  	extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
    23  	v1 "k8s.io/client-go/applyconfigurations/meta/v1"
    24  )
    25  
    26  // NetworkPolicySpecApplyConfiguration represents an declarative configuration of the NetworkPolicySpec type for use
    27  // with apply.
    28  type NetworkPolicySpecApplyConfiguration struct {
    29  	PodSelector *v1.LabelSelectorApplyConfiguration          `json:"podSelector,omitempty"`
    30  	Ingress     []NetworkPolicyIngressRuleApplyConfiguration `json:"ingress,omitempty"`
    31  	Egress      []NetworkPolicyEgressRuleApplyConfiguration  `json:"egress,omitempty"`
    32  	PolicyTypes []extensionsv1beta1.PolicyType               `json:"policyTypes,omitempty"`
    33  }
    34  
    35  // NetworkPolicySpecApplyConfiguration constructs an declarative configuration of the NetworkPolicySpec type for use with
    36  // apply.
    37  func NetworkPolicySpec() *NetworkPolicySpecApplyConfiguration {
    38  	return &NetworkPolicySpecApplyConfiguration{}
    39  }
    40  
    41  // WithPodSelector sets the PodSelector field in the declarative configuration to the given value
    42  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    43  // If called multiple times, the PodSelector field is set to the value of the last call.
    44  func (b *NetworkPolicySpecApplyConfiguration) WithPodSelector(value *v1.LabelSelectorApplyConfiguration) *NetworkPolicySpecApplyConfiguration {
    45  	b.PodSelector = value
    46  	return b
    47  }
    48  
    49  // WithIngress adds the given value to the Ingress field in the declarative configuration
    50  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
    51  // If called multiple times, values provided by each call will be appended to the Ingress field.
    52  func (b *NetworkPolicySpecApplyConfiguration) WithIngress(values ...*NetworkPolicyIngressRuleApplyConfiguration) *NetworkPolicySpecApplyConfiguration {
    53  	for i := range values {
    54  		if values[i] == nil {
    55  			panic("nil value passed to WithIngress")
    56  		}
    57  		b.Ingress = append(b.Ingress, *values[i])
    58  	}
    59  	return b
    60  }
    61  
    62  // WithEgress adds the given value to the Egress field in the declarative configuration
    63  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
    64  // If called multiple times, values provided by each call will be appended to the Egress field.
    65  func (b *NetworkPolicySpecApplyConfiguration) WithEgress(values ...*NetworkPolicyEgressRuleApplyConfiguration) *NetworkPolicySpecApplyConfiguration {
    66  	for i := range values {
    67  		if values[i] == nil {
    68  			panic("nil value passed to WithEgress")
    69  		}
    70  		b.Egress = append(b.Egress, *values[i])
    71  	}
    72  	return b
    73  }
    74  
    75  // WithPolicyTypes adds the given value to the PolicyTypes field in the declarative configuration
    76  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
    77  // If called multiple times, values provided by each call will be appended to the PolicyTypes field.
    78  func (b *NetworkPolicySpecApplyConfiguration) WithPolicyTypes(values ...extensionsv1beta1.PolicyType) *NetworkPolicySpecApplyConfiguration {
    79  	for i := range values {
    80  		b.PolicyTypes = append(b.PolicyTypes, values[i])
    81  	}
    82  	return b
    83  }
    84  

View as plain text