networkpolicyspec.go 3.6 KB

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