Documentation
      ¶
    
    
  
    
  
    Index ¶
- func KeyToDefaultDeletePath(key Key) (string, error)
 - func KeyToDefaultPath(key Key) (string, error)
 - func ListOptionsToDefaultPathRoot(listOptions ListInterface) string
 - func ParseValue(key Key, rawData []byte) (interface{}, error)
 - type ActiveStatusReportKey
 - type ActiveStatusReportListOptions
 - type AllocationAttribute
 - type AllocationBlock
 - type BGPPeer
 - type BGPPeerKey
 - type BGPPeerListOptions
 - type BlockAffinity
 - type BlockAffinityKey
 - type BlockAffinityListOptions
 - type BlockKey
 - type BlockListOptions
 - type GlobalConfigKey
 - type GlobalConfigListOptions
 - type HostConfigKey
 - type HostConfigListOptions
 - type HostEndpoint
 - type HostEndpointKey
 - type HostEndpointListOptions
 - type HostEndpointStatus
 - type HostEndpointStatusKey
 - type HostEndpointStatusListOptions
 - type HostIP
 - type HostIPKey
 - type IPAMConfig
 - type IPAMConfigKey
 - type IPAMHandle
 - type IPAMHandleKey
 - type IPAMHandleListOptions
 - type IPAMHost
 - type IPAMHostKey
 - type KVPair
 - type Key
 - type LastStatusReportKey
 - type LastStatusReportListOptions
 - type ListInterface
 - type Policy
 - type PolicyKey
 - type PolicyListOptions
 - type Pool
 - type PoolKey
 - type PoolListOptions
 - type Profile
 - type ProfileKey
 - type ProfileLabelsKey
 - type ProfileListOptions
 - type ProfileRules
 - type ProfileRulesKey
 - type ProfileTagsKey
 - type ReadyFlagKey
 - type Rule
 - type StatusReport
 - type WorkloadEndpoint
 - type WorkloadEndpointKey
 - type WorkloadEndpointListOptions
 - type WorkloadEndpointStatus
 - type WorkloadEndpointStatusKey
 - type WorkloadEndpointStatusListOptions
 - Bugs
 
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeyToDefaultDeletePath ¶
KeyToDefaultDeletePath converts one of the Keys from this package into a unique '/'-delimited path, which is suitable for use as the key when (recursively) deleting the value from a hierarchical (i.e. one with directories and leaves) key/value datastore such as etcd v2.
KeyToDefaultDeletePath returns a different path to KeyToDefaultPath when it is a passed a Key that represents a non-leaf, such as a TierKey. (A tier has its own metadata but it also contains policies as children.)
KeyToDefaultDeletePath returns the common prefix of the non-leaf key and its children so that a recursive delete of that key would delete the object itself and any children it has.
For example, KeyToDefaultDeletePath(TierKey{Tier: "a"}) returns
"/calico/v1/policy/tier/a"
which is a prefix of both KeyToDefaultPath(TierKey{Tier: "a"}):
"/calico/v1/policy/tier/a/metadata"
and KeyToDefaultPath(PolicyKey{Tier: "a", Name: "b"}):
"/calico/v1/policy/tier/a/policy/b"
func KeyToDefaultPath ¶
KeyToDefaultPath converts one of the Keys from this package into a unique '/'-delimited path, which is suitable for use as the key when storing the value in a hierarchical (i.e. one with directories and leaves) key/value datastore such as etcd v2.
Each unique key returns a unique path.
Keys with a hierarchical relationship, such as tiers and policies, share a common prefix. However, in order to support datastores that do not support storing data at non-leaf nodes in the hierarchy (such as etcd v2), the path returned for a "parent" key, such as a TierKey, is not a direct ancestor of its children.
For example, KeyToDefaultPath(TierKey{Tier: "a"}) returns
"/calico/v1/policy/tier/a/metadata"
and KeyToDefaultPath(PolicyKey{Tier: "a", Name: "b"}) returns
"/calico/v1/policy/tier/a/policy/b"
In this case, the common tier prefix is "/calico/v1/policy/tier/a".
func ListOptionsToDefaultPathRoot ¶
func ListOptionsToDefaultPathRoot(listOptions ListInterface) string
ListOptionsToDefaultPathRoot converts list options struct into a common-prefix path suitable for querying a datastore that uses the paths returned by KeyToDefaultPath. For example,
ListOptionsToDefaultPathRoot(TierListOptions{})
doesn't specify any particular tier so it returns "/calico/v1/policy/tier" which is a prefix for all tiers. The datastore must then do a recursive query to find all children of that path. However,
ListOptionsToDefaultPathRoot(TierListOptions{Tier:"a"})
returns a more-specific path, which filters down to the specific tier of interest: "/calico/v1/policy/tier/a"
func ParseValue ¶
ParseValue parses the default JSON representation of our data into one of our value structs, according to the type of key. I.e. if passed a PolicyKey as the first parameter, it will try to parse rawData into a Policy struct.
Types ¶
type ActiveStatusReportKey ¶
type ActiveStatusReportKey struct {
	Hostname string `json:"-" validate:"required,hostname"`
}
    func (ActiveStatusReportKey) String ¶
func (key ActiveStatusReportKey) String() string
type ActiveStatusReportListOptions ¶
type ActiveStatusReportListOptions struct {
	Hostname string
}
    func (ActiveStatusReportListOptions) KeyFromDefaultPath ¶
func (options ActiveStatusReportListOptions) KeyFromDefaultPath(ekey string) Key
type AllocationAttribute ¶
type AllocationBlock ¶
type BGPPeerKey ¶
type BGPPeerKey struct {
	Scope    scope.Scope `json:"-" validate:"omitempty"`
	Hostname string      `json:"-" validate:"omitempty"`
	PeerIP   net.IP      `json:"-" validate:"required"`
}
    func (BGPPeerKey) String ¶
func (key BGPPeerKey) String() string
type BGPPeerListOptions ¶
type BGPPeerListOptions struct {
	Scope    scope.Scope `json:"-" validate:"omitempty"`
	Hostname string
	PeerIP   net.IP
}
    func (BGPPeerListOptions) KeyFromDefaultPath ¶
func (options BGPPeerListOptions) KeyFromDefaultPath(path string) Key
type BlockAffinity ¶
type BlockAffinity struct {
}
    type BlockAffinityKey ¶
type BlockAffinityListOptions ¶
func (BlockAffinityListOptions) KeyFromDefaultPath ¶
func (options BlockAffinityListOptions) KeyFromDefaultPath(path string) Key
type BlockListOptions ¶
type BlockListOptions struct {
	IPVersion int `json:"-"`
}
    func (BlockListOptions) KeyFromDefaultPath ¶
func (options BlockListOptions) KeyFromDefaultPath(path string) Key
type GlobalConfigKey ¶
type GlobalConfigKey struct {
	Name string `json:"-" validate:"required,name"`
}
    func (GlobalConfigKey) String ¶
func (key GlobalConfigKey) String() string
type GlobalConfigListOptions ¶
type GlobalConfigListOptions struct {
	Name string
}
    func (GlobalConfigListOptions) KeyFromDefaultPath ¶
func (options GlobalConfigListOptions) KeyFromDefaultPath(path string) Key
type HostConfigKey ¶
type HostConfigKey struct {
	Hostname string `json:"-" validate:"required,name"`
	Name     string `json:"-" validate:"required,name"`
}
    func (HostConfigKey) String ¶
func (key HostConfigKey) String() string
type HostConfigListOptions ¶
func (HostConfigListOptions) KeyFromDefaultPath ¶
func (options HostConfigListOptions) KeyFromDefaultPath(path string) Key
type HostEndpoint ¶
type HostEndpoint struct {
	Name              string            `json:"name,omitempty" validate:"omitempty,interface"`
	ExpectedIPv4Addrs []net.IP          `json:"expected_ipv4_addrs,omitempty" validate:"omitempty,dive,ipv4"`
	ExpectedIPv6Addrs []net.IP          `json:"expected_ipv6_addrs,omitempty" validate:"omitempty,dive,ipv6"`
	Labels            map[string]string `json:"labels,omitempty" validate:"omitempty,labels"`
	ProfileIDs        []string          `json:"profile_ids,omitempty" validate:"omitempty,dive,name"`
}
    type HostEndpointKey ¶
type HostEndpointKey struct {
	Hostname   string `json:"-" validate:"required,hostname"`
	EndpointID string `json:"-" validate:"required,hostname"`
}
    func (HostEndpointKey) String ¶
func (key HostEndpointKey) String() string
type HostEndpointListOptions ¶
func (HostEndpointListOptions) KeyFromDefaultPath ¶
func (options HostEndpointListOptions) KeyFromDefaultPath(path string) Key
type HostEndpointStatusKey ¶
type HostEndpointStatusKey struct {
	Hostname   string `json:"-" validate:"required,hostname"`
	EndpointID string `json:"-" validate:"required,hostname"`
}
    func (HostEndpointStatusKey) String ¶
func (key HostEndpointStatusKey) String() string
type HostEndpointStatusListOptions ¶
func (HostEndpointStatusListOptions) KeyFromDefaultPath ¶
func (options HostEndpointStatusListOptions) KeyFromDefaultPath(ekey string) Key
type HostIP ¶
type HostIP struct {
}
    type IPAMConfig ¶
type IPAMConfigKey ¶
type IPAMConfigKey struct {
}
    type IPAMHandle ¶
type IPAMHandleListOptions ¶
type IPAMHandleListOptions struct {
}
    func (IPAMHandleListOptions) KeyFromDefaultPath ¶
func (options IPAMHandleListOptions) KeyFromDefaultPath(path string) Key
type IPAMHost ¶
type IPAMHost struct {
}
    type KVPair ¶
type KVPair struct {
	Key      Key
	Value    interface{}
	Revision interface{}
	TTL      time.Duration // For writes, if non-zero, key has a TTL.
}
    KVPair holds a typed key and value struct as well as datastore specific revision information.
type Key ¶
type Key interface {
	// contains filtered or unexported methods
}
    Key represents a parsed datastore key.
type LastStatusReportKey ¶
type LastStatusReportKey struct {
	Hostname string `json:"-" validate:"required,hostname"`
}
    func (LastStatusReportKey) String ¶
func (key LastStatusReportKey) String() string
type LastStatusReportListOptions ¶
type LastStatusReportListOptions struct {
	Hostname string
}
    func (LastStatusReportListOptions) KeyFromDefaultPath ¶
func (options LastStatusReportListOptions) KeyFromDefaultPath(ekey string) Key
type ListInterface ¶
type ListInterface interface {
	// BUG(smc) I think we should remove this and use the package KeyFromDefaultPath function.
	// KeyFromDefaultPath parses the default path representation of the
	// Key type for this list.  It returns nil if passed a different kind
	// of path.
	KeyFromDefaultPath(key string) Key
	// contains filtered or unexported methods
}
    Interface used to perform datastore lookups.
type Policy ¶
type PolicyKey ¶
type PolicyListOptions ¶
func (PolicyListOptions) KeyFromDefaultPath ¶
func (options PolicyListOptions) KeyFromDefaultPath(path string) Key
type Pool ¶
type PoolKey ¶
type PoolListOptions ¶
func (PoolListOptions) KeyFromDefaultPath ¶
func (options PoolListOptions) KeyFromDefaultPath(path string) Key
type Profile ¶
type Profile struct {
	Rules  ProfileRules
	Tags   []string
	Labels map[string]string
}
    The profile structure is defined to allow the client to define a conversion interface to map between the API and backend profiles. However, in the actual underlying implementation the profile is written as three separate entries - rules, tags and labels.
type ProfileKey ¶
type ProfileKey struct {
	Name string `json:"-" validate:"required,name"`
}
    The profile key actually returns the common parent of the three separate entries. It is useful to define this to re-use some of the common machinery, and can be used for delete processing since delete needs to remove the common parent.
func (ProfileKey) String ¶
func (key ProfileKey) String() string
type ProfileLabelsKey ¶
type ProfileLabelsKey struct {
	ProfileKey
}
    ProfileLabelsKey implements the KeyInterface for the profile labels
type ProfileListOptions ¶
type ProfileListOptions struct {
	Name string
}
    func (ProfileListOptions) KeyFromDefaultPath ¶
func (options ProfileListOptions) KeyFromDefaultPath(path string) Key
func (*ProfileListOptions) ListConvert ¶
func (_ *ProfileListOptions) ListConvert(ds []*KVPair) []*KVPair
type ProfileRules ¶
type ProfileRulesKey ¶
type ProfileRulesKey struct {
	ProfileKey
}
    ProfileRulesKey implements the KeyInterface for the profile rules
type ProfileTagsKey ¶
type ProfileTagsKey struct {
	ProfileKey
}
    ProfileTagsKey implements the KeyInterface for the profile tags
type ReadyFlagKey ¶
type ReadyFlagKey struct {
}
    type Rule ¶
type Rule struct {
	Action string `json:"action,omitempty" validate:"backendaction"`
	Protocol    *numorstring.Protocol `json:"protocol,omitempty" validate:"omitempty"`
	NotProtocol *numorstring.Protocol `json:"!protocol,omitempty" validate:"omitempty"`
	ICMPType    *int `json:"icmp_type,omitempty" validate:"omitempty,gte=1,lte=255"`
	ICMPCode    *int `json:"icmp_code,omitempty" validate:"omitempty,gte=1,lte=255"`
	NotICMPType *int `json:"!icmp_type,omitempty" validate:"omitempty,gte=1,lte=255"`
	NotICMPCode *int `json:"!icmp_code,omitempty" validate:"omitempty,gte=1,lte=255"`
	SrcTag      string             `json:"src_tag,omitempty" validate:"omitempty,tag"`
	SrcNet      *net.IPNet         `json:"src_net,omitempty" validate:"omitempty"`
	SrcSelector string             `json:"src_selector,omitempty" validate:"omitempty,selector"`
	SrcPorts    []numorstring.Port `json:"src_ports,omitempty" validate:"omitempty"`
	DstTag      string             `json:"dst_tag,omitempty" validate:"omitempty,tag"`
	DstSelector string             `json:"dst_selector,omitempty" validate:"omitempty,selector"`
	DstNet      *net.IPNet         `json:"dst_net,omitempty" validate:"omitempty"`
	DstPorts    []numorstring.Port `json:"dst_ports,omitempty" validate:"omitempty"`
	NotSrcTag      string             `json:"!src_tag,omitempty" validate:"omitempty,tag"`
	NotSrcNet      *net.IPNet         `json:"!src_net,omitempty" validate:"omitempty"`
	NotSrcSelector string             `json:"!src_selector,omitempty" validate:"omitempty,selector"`
	NotSrcPorts    []numorstring.Port `json:"!src_ports,omitempty" validate:"omitempty"`
	NotDstTag      string             `json:"!dst_tag,omitempty" validate:"omitempty"`
	NotDstSelector string             `json:"!dst_selector,omitempty" validate:"omitempty,selector"`
	NotDstNet      *net.IPNet         `json:"!dst_net,omitempty" validate:"omitempty"`
	NotDstPorts    []numorstring.Port `json:"!dst_ports,omitempty" validate:"omitempty"`
	LogPrefix string `json:"log_prefix,omitempty" validate:"omitempty"`
}
    type StatusReport ¶
type WorkloadEndpoint ¶
type WorkloadEndpoint struct {
	// TODO: Validation for workload endpoint.
	State      string            `json:"state"`
	Name       string            `json:"name"`
	Mac        net.MAC           `json:"mac"`
	ProfileIDs []string          `json:"profile_ids"`
	IPv4Nets   []net.IPNet       `json:"ipv4_nets"`
	IPv6Nets   []net.IPNet       `json:"ipv6_nets"`
	Labels     map[string]string `json:"labels"`
}
    type WorkloadEndpointKey ¶
type WorkloadEndpointKey struct {
	Hostname       string `json:"-"`
	OrchestratorID string `json:"-"`
	WorkloadID     string `json:"-"`
	EndpointID     string `json:"-"`
}
    func (WorkloadEndpointKey) String ¶
func (key WorkloadEndpointKey) String() string
type WorkloadEndpointListOptions ¶
type WorkloadEndpointListOptions struct {
	Hostname       string
	OrchestratorID string
	WorkloadID     string
	EndpointID     string
}
    func (WorkloadEndpointListOptions) KeyFromDefaultPath ¶
func (options WorkloadEndpointListOptions) KeyFromDefaultPath(path string) Key
type WorkloadEndpointStatusKey ¶
type WorkloadEndpointStatusKey struct {
	Hostname       string `json:"-"`
	OrchestratorID string `json:"-"`
	WorkloadID     string `json:"-"`
	EndpointID     string `json:"-"`
}
    func (WorkloadEndpointStatusKey) String ¶
func (key WorkloadEndpointStatusKey) String() string
type WorkloadEndpointStatusListOptions ¶
type WorkloadEndpointStatusListOptions struct {
	Hostname       string
	OrchestratorID string
	WorkloadID     string
	EndpointID     string
}
    func (WorkloadEndpointStatusListOptions) KeyFromDefaultPath ¶
func (options WorkloadEndpointStatusListOptions) KeyFromDefaultPath(ekey string) Key
Notes ¶
Bugs ¶
I think we should remove this and use the package KeyFromDefaultPath function. KeyFromDefaultPath parses the default path representation of the Key type for this list. It returns nil if passed a different kind of path.
      
      Source Files
      ¶
    
- bgppeer.go
 - block.go
 - block_affinity.go
 - config.go
 - hostendpoint.go
 - hostendpointstatus.go
 - hostip.go
 - ipam_config.go
 - ipam_handle.go
 - ipam_host.go
 - keys.go
 - policy.go
 - pool.go
 - profile.go
 - rule.go
 - statusreports.go
 - workloadendpoint.go
 - workloadendpointstatus.go