func NewPolicyList() *PolicyList {
	return &PolicyList{
		TypeMetadata: unversioned.TypeMetadata{
			Kind:       "policyList",
			APIVersion: unversioned.VersionCurrent,
		},
	}
}
NewPolicyList creates a new (zeroed) PolicyList struct with the TypeMetadata initialised to the current
version.
package v1
import (
	"fmt"
	"github.com/projectcalico/libcalico-go/lib/apis/v1/unversioned"
)
type Policy struct {
	unversioned.TypeMetadata
	Metadata PolicyMetadata `json:"metadata,omitempty"`
	Spec     PolicySpec     `json:"spec,omitempty"`
}
func (t Policy) GetResourceMetadata() unversioned.ResourceMetadata {
	return t.Metadata
}
func (t Policy) String() string {
	return fmt.Sprintf("Policy(Name=%s)", t.Metadata.Name)
}
type PolicyMetadata struct {
	unversioned.ObjectMetadata
	Name string `json:"name,omitempty" validate:"omitempty,namespacedName"`
	Annotations map[string]string `json:"annotations,omitempty" validate:"omitempty"`
}
type PolicySpec struct {
	Order *float64 `json:"order,omitempty"`
	IngressRules []Rule `json:"ingress,omitempty" validate:"omitempty,dive"`
	EgressRules []Rule `json:"egress,omitempty" validate:"omitempty,dive"`
	Selector string `json:"selector" validate:"selector"`
	DoNotTrack bool `json:"doNotTrack,omitempty"`
	PreDNAT bool `json:"preDNAT,omitempty"`
	Types []PolicyType `json:"types,omitempty" validate:"omitempty,dive,policyType"`
}
type PolicyType string
const (
	PolicyTypeIngress PolicyType = "ingress"
	PolicyTypeEgress  PolicyType = "egress"
)
func NewPolicy() *Policy {
	return &Policy{
		TypeMetadata: unversioned.TypeMetadata{
			Kind:       "policy",
			APIVersion: unversioned.VersionCurrent,
		},
	}
}
type PolicyList struct {
	unversioned.TypeMetadata
	Metadata unversioned.ListMetadata `json:"metadata,omitempty"`
	Items    []Policy                 `json:"items" validate:"dive"`
}