hns

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Allow ActionType = "Allow"
	Block ActionType = "Block"

	In  DirectionType = "In"
	Out DirectionType = "Out"

	Host   RuleType = "Host"
	Switch RuleType = "Switch"
)

Variables

View Source
var (
	HNSVersion1803 = HNSVersion{Major: 7, Minor: 2}
)

Functions

func AddNamespaceEndpoint

func AddNamespaceEndpoint(id string, endpointID string) error

func CreateNamespace

func CreateNamespace() (string, error)

func GetNamespaceEndpoints

func GetNamespaceEndpoints(id string) ([]string, error)

func RemoveNamespace

func RemoveNamespace(id string) error

func RemoveNamespaceEndpoint

func RemoveNamespaceEndpoint(id string, endpointID string) error

Types

type ACLPolicy

type ACLPolicy struct {
	Type            PolicyType `json:"Type"`
	Id              string     `json:"Id,omitempty"`
	Protocol        uint16
	Protocols       string `json:"Protocols,omitempty"`
	InternalPort    uint16
	Action          ActionType
	Direction       DirectionType
	LocalAddresses  string
	RemoteAddresses string
	LocalPorts      string `json:"LocalPorts,omitempty"`
	LocalPort       uint16
	RemotePorts     string `json:"RemotePorts,omitempty"`
	RemotePort      uint16
	RuleType        RuleType `json:"RuleType,omitempty"`
	Priority        uint16
	ServiceName     string
}

type ActionType

type ActionType string

type DirectionType

type DirectionType string

type ELBPolicy

type ELBPolicy struct {
	LBPolicy
	SourceVIP string   `json:"SourceVIP,omitempty"`
	VIPs      []string `json:"VIPs,omitempty"`
	ILB       bool     `json:"ILB,omitempty"`
	DSR       bool     `json:"IsDSR,omitempty"`
}

ELBPolicy is a structure defining schema for ELB LoadBalancing based Policy

type EndpointAttachDetachRequest

type EndpointAttachDetachRequest struct {
	ContainerID    string     `json:"ContainerId,omitempty"`
	SystemType     SystemType `json:"SystemType"`
	CompartmentID  uint16     `json:"CompartmentId,omitempty"`
	VirtualNICName string     `json:"VirtualNicName,omitempty"`
}

EndpointAttachDetachRequest is the structure used to send request to the container to modify the system Supported resource types are Network and Request Types are Add/Remove

type EndpointNotFoundError

type EndpointNotFoundError struct {
	EndpointName string
}

func (EndpointNotFoundError) Error

func (e EndpointNotFoundError) Error() string

type EndpointResquestResponse

type EndpointResquestResponse struct {
	Success bool
	Error   string
}

EndpointResquestResponse is object to get the endpoint request response

type HNSAclFeatures

type HNSAclFeatures struct {
	AclAddressLists       bool `json:"AclAddressLists"`
	AclNoHostRulePriority bool `json:"AclHostRulePriority"`
	AclPortRanges         bool `json:"AclPortRanges"`
	AclRuleId             bool `json:"AclRuleId"`
}

type HNSEndpoint

type HNSEndpoint struct {
	Id                 string            `json:"ID,omitempty"`
	Name               string            `json:",omitempty"`
	VirtualNetwork     string            `json:",omitempty"`
	VirtualNetworkName string            `json:",omitempty"`
	Policies           []json.RawMessage `json:",omitempty"`
	MacAddress         string            `json:",omitempty"`
	IPAddress          net.IP            `json:",omitempty"`
	DNSSuffix          string            `json:",omitempty"`
	DNSServerList      string            `json:",omitempty"`
	GatewayAddress     string            `json:",omitempty"`
	EnableInternalDNS  bool              `json:",omitempty"`
	DisableICC         bool              `json:",omitempty"`
	PrefixLength       uint8             `json:",omitempty"`
	IsRemoteEndpoint   bool              `json:",omitempty"`
	EnableLowMetric    bool              `json:",omitempty"`
	Namespace          *Namespace        `json:",omitempty"`
	EncapOverhead      uint16            `json:",omitempty"`
}

HNSEndpoint represents a network endpoint in HNS

func GetHNSEndpointByID

func GetHNSEndpointByID(endpointID string) (*HNSEndpoint, error)

GetHNSEndpointByID get the Endpoint by ID

func GetHNSEndpointByName

func GetHNSEndpointByName(endpointName string) (*HNSEndpoint, error)

GetHNSEndpointByName gets the endpoint filtered by Name

func HNSEndpointRequest

func HNSEndpointRequest(method, path, request string) (*HNSEndpoint, error)

HNSEndpointRequest makes a HNS call to modify/query a network endpoint

func HNSListEndpointRequest

func HNSListEndpointRequest() ([]HNSEndpoint, error)

HNSListEndpointRequest makes a HNS call to query the list of available endpoints

func (*HNSEndpoint) ApplyACLPolicy

func (endpoint *HNSEndpoint) ApplyACLPolicy(policies ...*ACLPolicy) error

ApplyACLPolicy applies a set of ACL Policies on the Endpoint

func (*HNSEndpoint) ContainerAttach

func (endpoint *HNSEndpoint) ContainerAttach(containerID string, compartmentID uint16) error

ContainerAttach attaches an endpoint to container

func (*HNSEndpoint) ContainerDetach

func (endpoint *HNSEndpoint) ContainerDetach(containerID string) error

ContainerDetach detaches an endpoint from container

func (*HNSEndpoint) Create

func (endpoint *HNSEndpoint) Create() (*HNSEndpoint, error)

Create Endpoint by sending EndpointRequest to HNS. TODO: Create a separate HNS interface to place all these methods

func (*HNSEndpoint) Delete

func (endpoint *HNSEndpoint) Delete() (*HNSEndpoint, error)

Delete Endpoint by sending EndpointRequest to HNS

func (*HNSEndpoint) HostAttach

func (endpoint *HNSEndpoint) HostAttach(compartmentID uint16) error

HostAttach attaches a nic on the host

func (*HNSEndpoint) HostDetach

func (endpoint *HNSEndpoint) HostDetach() error

HostDetach detaches a nic on the host

func (*HNSEndpoint) Update

func (endpoint *HNSEndpoint) Update() (*HNSEndpoint, error)

Update Endpoint

func (*HNSEndpoint) VirtualMachineNICAttach

func (endpoint *HNSEndpoint) VirtualMachineNICAttach(virtualMachineNICName string) error

VirtualMachineNICAttach attaches a endpoint to a virtual machine

func (*HNSEndpoint) VirtualMachineNICDetach

func (endpoint *HNSEndpoint) VirtualMachineNICDetach() error

VirtualMachineNICDetach detaches a endpoint from a virtual machine

type HNSGlobals

type HNSGlobals struct {
	Version HNSVersion `json:"Version"`
}

func GetHNSGlobals

func GetHNSGlobals() (*HNSGlobals, error)

type HNSNetwork

type HNSNetwork struct {
	Id                   string            `json:"ID,omitempty"`
	Name                 string            `json:",omitempty"`
	Type                 string            `json:",omitempty"`
	NetworkAdapterName   string            `json:",omitempty"`
	SourceMac            string            `json:",omitempty"`
	Policies             []json.RawMessage `json:",omitempty"`
	MacPools             []MacPool         `json:",omitempty"`
	Subnets              []Subnet          `json:",omitempty"`
	DNSSuffix            string            `json:",omitempty"`
	DNSServerList        string            `json:",omitempty"`
	DNSServerCompartment uint32            `json:",omitempty"`
	ManagementIP         string            `json:",omitempty"`
	AutomaticDNS         bool              `json:",omitempty"`
}

HNSNetwork represents a network in HNS

func GetHNSNetworkByID

func GetHNSNetworkByID(networkID string) (*HNSNetwork, error)

GetHNSNetworkByID

func GetHNSNetworkByName

func GetHNSNetworkByName(networkName string) (*HNSNetwork, error)

GetHNSNetworkName filtered by Name

func HNSListNetworkRequest

func HNSListNetworkRequest(method, path, request string) ([]HNSNetwork, error)

HNSListNetworkRequest makes a HNS call to query the list of available networks

func HNSNetworkRequest

func HNSNetworkRequest(method, path, request string) (*HNSNetwork, error)

HNSNetworkRequest makes a call into HNS to update/query a single network

func (*HNSNetwork) Create

func (network *HNSNetwork) Create() (*HNSNetwork, error)

Create Network by sending NetworkRequest to HNS.

func (*HNSNetwork) CreateEndpoint

func (network *HNSNetwork) CreateEndpoint(endpoint *HNSEndpoint) (*HNSEndpoint, error)

func (*HNSNetwork) CreateRemoteEndpoint

func (network *HNSNetwork) CreateRemoteEndpoint(endpoint *HNSEndpoint) (*HNSEndpoint, error)

func (*HNSNetwork) Delete

func (network *HNSNetwork) Delete() (*HNSNetwork, error)

Delete Network by sending NetworkRequest to HNS

func (*HNSNetwork) NewEndpoint

func (network *HNSNetwork) NewEndpoint(ipAddress net.IP, macAddress net.HardwareAddr) *HNSEndpoint

Creates an endpoint on the Network.

type HNSSupportedFeatures

type HNSSupportedFeatures struct {
	Acl HNSAclFeatures `json:"ACL"`
}

func GetHNSSupportedFeatures

func GetHNSSupportedFeatures() HNSSupportedFeatures

type HNSVersion

type HNSVersion struct {
	Major int `json:"Major"`
	Minor int `json:"Minor"`
}

type IsolationPolicy

type IsolationPolicy struct {
	Type               PolicyType `json:"Type"`
	VLAN               uint
	VSID               uint
	InDefaultIsolation bool
}

type LBPolicy

type LBPolicy struct {
	Policy
	Protocol     uint16 `json:"Protocol,omitempty"`
	InternalPort uint16
	ExternalPort uint16
}

LBPolicy is a structure defining schema for LoadBalancing based Policy

type MacPool

type MacPool struct {
	StartMacAddress string `json:",omitempty"`
	EndMacAddress   string `json:",omitempty"`
}

MacPool is assoicated with a network and represents a list of macaddresses available to the network

type Namespace

type Namespace struct {
	ID           string
	IsDefault    bool                `json:",omitempty"`
	ResourceList []NamespaceResource `json:",omitempty"`
}

type NamespaceResource

type NamespaceResource struct {
	Type string
	Data json.RawMessage
}

type NatPolicy

type NatPolicy struct {
	Type         PolicyType `json:"Type"`
	Protocol     string
	InternalPort uint16
	ExternalPort uint16
}

type NetworkNotFoundError

type NetworkNotFoundError struct {
	NetworkName string
}

func (NetworkNotFoundError) Error

func (e NetworkNotFoundError) Error() string

type OutboundNatPolicy

type OutboundNatPolicy struct {
	Policy
	VIP        string   `json:"VIP,omitempty"`
	Exceptions []string `json:"ExceptionList,omitempty"`
}

type PaPolicy

type PaPolicy struct {
	Type PolicyType `json:"Type"`
	PA   string     `json:"PA"`
}

type Policy

type Policy struct {
	Type PolicyType `json:"Type"`
}

type PolicyList

type PolicyList struct {
	ID                 string            `json:"ID,omitempty"`
	EndpointReferences []string          `json:"References,omitempty"`
	Policies           []json.RawMessage `json:"Policies,omitempty"`
}

PolicyList is a structure defining schema for Policy list request

func AddLoadBalancer

func AddLoadBalancer(endpoints []HNSEndpoint, isILB bool, sourceVIP, vip string, protocol uint16, internalPort uint16, externalPort uint16) (*PolicyList, error)

AddLoadBalancer policy list for the specified endpoints

func AddRoute

func AddRoute(endpoints []HNSEndpoint, destinationPrefix string, nextHop string, encapEnabled bool) (*PolicyList, error)

AddRoute adds route policy list for the specified endpoints

func GetPolicyListByID

func GetPolicyListByID(policyListID string) (*PolicyList, error)

GetPolicyListByID get the policy list by ID

func HNSListPolicyListRequest

func HNSListPolicyListRequest() ([]PolicyList, error)

HNSListPolicyListRequest gets all the policy list

func HNSPolicyListRequest

func HNSPolicyListRequest(method, path, request string) (*PolicyList, error)

HNSPolicyListRequest makes a call into HNS to update/query a single network

func PolicyListRequest

func PolicyListRequest(method, path, request string) (*PolicyList, error)

PolicyListRequest makes a HNS call to modify/query a network policy list

func (*PolicyList) AddEndpoint

func (policylist *PolicyList) AddEndpoint(endpoint *HNSEndpoint) (*PolicyList, error)

AddEndpoint add an endpoint to a Policy List

func (*PolicyList) Create

func (policylist *PolicyList) Create() (*PolicyList, error)

Create PolicyList by sending PolicyListRequest to HNS.

func (*PolicyList) Delete

func (policylist *PolicyList) Delete() (*PolicyList, error)

Delete deletes PolicyList

func (*PolicyList) RemoveEndpoint

func (policylist *PolicyList) RemoveEndpoint(endpoint *HNSEndpoint) (*PolicyList, error)

RemoveEndpoint removes an endpoint from the Policy List

type PolicyType

type PolicyType string

Type of Request Support in ModifySystem

const (
	Nat                  PolicyType = "NAT"
	ACL                  PolicyType = "ACL"
	PA                   PolicyType = "PA"
	VLAN                 PolicyType = "VLAN"
	VSID                 PolicyType = "VSID"
	VNet                 PolicyType = "VNET"
	L2Driver             PolicyType = "L2Driver"
	Isolation            PolicyType = "Isolation"
	QOS                  PolicyType = "QOS"
	OutboundNat          PolicyType = "OutBoundNAT"
	ExternalLoadBalancer PolicyType = "ELB"
	Route                PolicyType = "ROUTE"
)

RequestType const

type QosPolicy

type QosPolicy struct {
	Type                            PolicyType `json:"Type"`
	MaximumOutgoingBandwidthInBytes uint64
}

type RoutePolicy

type RoutePolicy struct {
	Policy
	DestinationPrefix string `json:"DestinationPrefix,omitempty"`
	NextHop           string `json:"NextHop,omitempty"`
	EncapEnabled      bool   `json:"NeedEncap,omitempty"`
}

RoutePolicy is a structure defining schema for Route based Policy

type RuleType

type RuleType string

type Subnet

type Subnet struct {
	AddressPrefix  string            `json:",omitempty"`
	GatewayAddress string            `json:",omitempty"`
	Policies       []json.RawMessage `json:",omitempty"`
}

Subnet is assoicated with a network and represents a list of subnets available to the network

type SystemType

type SystemType string

SystemType represents the type of the system on which actions are done

const (
	ContainerType      SystemType = "Container"
	VirtualMachineType SystemType = "VirtualMachine"
	HostType           SystemType = "Host"
)

SystemType const

type VlanPolicy

type VlanPolicy struct {
	Type PolicyType `json:"Type"`
	VLAN uint
}

type VsidPolicy

type VsidPolicy struct {
	Type PolicyType `json:"Type"`
	VSID uint
}

Jump to

Keyboard shortcuts

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