api

package
v2.0.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Max port number for TCP/UDP.
	MaxPortNumber = 65535
	MaxIcmpType   = 255

	// Wildcard
	Wildcard = "any"
)
View Source
const (
	PolicyDirectionIngress = "ingress"
	PolicyDirectionEgress  = "egress"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Peer      string `json:"peer,omitempty"`
	Cidr      string `json:"cidr,omitempty"`
	Dest      string `json:"dest,omitempty"`
	TenantID  string `json:"tenant_id,omitempty"`
	SegmentID string `json:"segment_id,omitempty"`
}

Endpoint represents an endpoint - that is, something that has an IP address and routes to/from. It can be a container, a Kubernetes POD, a VM, etc.

func (Endpoint) String

func (e Endpoint) String() string

type ExposedIPSpec

type ExposedIPSpec struct {
	RomanaVIP     RomanaVIP
	NodeIPAddress string
	Activated     bool
	Namespace     string
}

type GroupOrHost

type GroupOrHost struct {
	// Assignment is a map of key-value pairs that specify what attributes (key=value)
	// of a new host to use to assign it into a group.
	Assignment map[string]string `json:"assignment,omitempty"`
	Routing    string            `json:"routing,omitempty"`
	Groups     []GroupOrHost     `json:"groups,omitempty"`

	// If the below are specified, this GroupSpec really represents a host,
	// therefore the above elements MUST NOT be specified.
	Name string `json:"name"`
	IP   net.IP `json:"ip,omitempty"`

	// This is ignored on import.
	CIDR string `json:"cidr,omitempty"`

	// A dummy group is one used for padding to power of 2; it is not to
	// be assigned hosts to
	Dummy bool `json:"dummy,omitempty"`
}

type Host

type Host struct {
	IP        net.IP `json:"ip"`
	Name      string `json:"name"`
	AgentPort uint   `json:"agent_port"`
	// TODO this is a placeholder for now so that agent builds
	Tags    map[string]string      `json:"tags"`
	K8SInfo map[string]interface{} `json:"k8s_info"`
}

func (Host) String

func (h Host) String() string

type HostList

type HostList struct {
	Hosts    []Host `json:"hosts"`
	Revision int    `json:"revision"`
}

type IPAMAddressRequest

type IPAMAddressRequest struct {
	Name    string `json:"name"`
	Host    string `json:"host"`
	Tenant  string `json:"tenant"`
	Segment string `json:"segment"`
}

type IPAMAddressResponse

type IPAMAddressResponse struct {
	Name string `json:"id"`
	IP   net.IP `json:"ip"`
}

type IPAMBlockResponse

type IPAMBlockResponse struct {
	Revision         int    `json:"revision"`
	CIDR             IPNet  `json:"cidr"`
	Tenant           string `json:"tenant"`
	Segment          string `json:"segment"`
	Host             string `json:"host"`
	AllocatedIPCount int    `json:"allocated_ip_count"`
}

type IPAMBlocksResponse

type IPAMBlocksResponse struct {
	Revision int                 `json:"revision"`
	Blocks   []IPAMBlockResponse `json:"blocks"`
}

type IPAMNetworkResponse

type IPAMNetworkResponse struct {
	Revision int    `json:"revision"`
	Name     string `json:"id"`
	CIDR     IPNet  `json:"cidr"`
}

type IPNet

type IPNet struct {
	net.IPNet
}

func (IPNet) MarshalText

func (ip IPNet) MarshalText() ([]byte, error)

func (*IPNet) UnmarshalText

func (ip *IPNet) UnmarshalText(text []byte) error

type NetworkDefinition

type NetworkDefinition struct {
	Name      string `json:"name"`
	CIDR      string `json:"cidr"`
	BlockMask uint   `json:"block_mask"`
	// List of allowed tenants.
	Tenants []string `json:"tenants,omitempty"`
}

type Policy

type Policy struct {
	ID string `json:"id"`
	// Direction is one of common.PolicyDirectionIngress or common.PolicyDirectionIngress,
	// otherwise common.Validate will return an error.
	Direction string `json:"direction,omitempty" romana:"desc:Direction is one of 'ingress' or egress'."`
	// Description is human-redable description of the policy.
	Description string `json:"description,omitempty"`
	// Datacenter describes a Romana deployment.
	AppliedTo []Endpoint      `json:"applied_to,omitempty"`
	Ingress   []RomanaIngress `json:"ingress,omitempty"`
}

Policy describes Romana network security policy. For examples, see: 1. https://github.com/romana/core/blob/master/policy/policy.sample.json 2. https://github.com/romana/core/blob/master/policy/policy.example.agent.json

func (Policy) String

func (p Policy) String() string

type PortRange

type PortRange [2]uint

func (PortRange) String

func (p PortRange) String() string

type RomanaIngress

type RomanaIngress struct {
	Peers []Endpoint `json:"peers,omitempty"`
	Rules []Rule     `json:"rules,omitempty"`
}

type RomanaVIP

type RomanaVIP struct {
	Auto bool   `json:"auto"`
	IP   string `json:"ip"`
}

type Rule

type Rule struct {
	Protocol   string      `json:"protocol,omitempty"`
	Ports      []uint      `json:"ports,omitempty"`
	PortRanges []PortRange `json:"port_ranges,omitempty"`
	// IcmpType only applies if Protocol value is ICMP and
	// is mutually exclusive with Ports or PortRanges
	IcmpType   uint `json:"icmp_type,omitempty"`
	IcmpCode   uint `json:"icmp_code,omitempty"`
	IsStateful bool `json:"is_stateful,omitempty"`
}

Rule describes a rule of the policy. The following requirements apply (the policy would not be validated otherwise): 1. Protocol must be specified. 2. Protocol must be one of those validated by isValidProto(). 3. Ports cannot be negative or greater than 65535. 4. If Protocol specified is "icmp", Ports and PortRanges fields should be blank. 5. If Protocol specified is not "icmp", Icmptype and IcmpCode should be unspecified.

func (Rule) String

func (r Rule) String() string

type Rules

type Rules []Rule

type Segment

type Segment struct {
	ID     string  `json:"id"`
	Blocks []IPNet `json:"blocks"`
}

type Tag

type Tag struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

Metadata attached to entities for various external environments like Open Stack / Kubernetes

type Tenant

type Tenant struct {
	ID       string    `json:"id"`
	Segments []Segment `json:"segments"`
}

TODO should this really be kept alongside BlocksResponse?

type TopologyDefinition

type TopologyDefinition struct {
	Networks []string      `json:"networks"`
	Map      []GroupOrHost `json:"map"`
}

type TopologyUpdateRequest

type TopologyUpdateRequest struct {
	Networks   []NetworkDefinition  `json:"networks"`
	Topologies []TopologyDefinition `json:"topologies"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL