networkpolicyegressrule.go 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. Copyright The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // Code generated by applyconfiguration-gen. DO NOT EDIT.
  14. package v1beta1
  15. // NetworkPolicyEgressRuleApplyConfiguration represents an declarative configuration of the NetworkPolicyEgressRule type for use
  16. // with apply.
  17. type NetworkPolicyEgressRuleApplyConfiguration struct {
  18. Ports []NetworkPolicyPortApplyConfiguration `json:"ports,omitempty"`
  19. To []NetworkPolicyPeerApplyConfiguration `json:"to,omitempty"`
  20. }
  21. // NetworkPolicyEgressRuleApplyConfiguration constructs an declarative configuration of the NetworkPolicyEgressRule type for use with
  22. // apply.
  23. func NetworkPolicyEgressRule() *NetworkPolicyEgressRuleApplyConfiguration {
  24. return &NetworkPolicyEgressRuleApplyConfiguration{}
  25. }
  26. // WithPorts adds the given value to the Ports field in the declarative configuration
  27. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  28. // If called multiple times, values provided by each call will be appended to the Ports field.
  29. func (b *NetworkPolicyEgressRuleApplyConfiguration) WithPorts(values ...*NetworkPolicyPortApplyConfiguration) *NetworkPolicyEgressRuleApplyConfiguration {
  30. for i := range values {
  31. if values[i] == nil {
  32. panic("nil value passed to WithPorts")
  33. }
  34. b.Ports = append(b.Ports, *values[i])
  35. }
  36. return b
  37. }
  38. // WithTo adds the given value to the To field in the declarative configuration
  39. // and returns the receiver, so that objects can be build by chaining "With" function invocations.
  40. // If called multiple times, values provided by each call will be appended to the To field.
  41. func (b *NetworkPolicyEgressRuleApplyConfiguration) WithTo(values ...*NetworkPolicyPeerApplyConfiguration) *NetworkPolicyEgressRuleApplyConfiguration {
  42. for i := range values {
  43. if values[i] == nil {
  44. panic("nil value passed to WithTo")
  45. }
  46. b.To = append(b.To, *values[i])
  47. }
  48. return b
  49. }