hcn

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: 11 Imported by: 0

Documentation

Overview

Package hcn is a shim for the Host Compute Networking (HCN) service, which manages networking for Windows Server containers and Hyper-V containers. Previous to RS5, HCN was referred to as Host Networking Service (HNS).

Package hcn is a shim for the Host Compute Networking (HCN) service, which manages networking for Windows Server containers and Hyper-V containers. Previous to RS5, HCN was referred to as Host Networking Service (HNS).

Index

Constants

View Source
const (
	// Allow traffic
	ActionTypeAllow ActionType = "Allow"
	// Block traffic
	ActionTypeBlock ActionType = "Block"

	// In is traffic coming to the Endpoint
	DirectionTypeIn DirectionType = "In"
	// Out is traffic leaving the Endpoint
	DirectionTypeOut DirectionType = "Out"

	// Host creates WFP (Windows Firewall) rules
	RuleTypeHost RuleType = "Host"
	// Switch creates VFP (Virtual Filter Platform) rules
	RuleTypeSwitch RuleType = "Switch"
)

Variables

View Source
var (
	// HNSVersion1803 added ACL functionality.
	HNSVersion1803 = Version{Major: 7, Minor: 2}
	// V2ApiSupport allows the use of V2 Api calls and V2 Schema.
	V2ApiSupport = Version{Major: 9, Minor: 1}
	// Remote Subnet allows for Remote Subnet policies on Overlay networks
	RemoteSubnetVersion = Version{Major: 9, Minor: 2}
	// A Host Route policy allows for local container to local host communication Overlay networks
	HostRouteVersion = Version{Major: 9, Minor: 2}
	// HNS 10.2 allows for Direct Server Return for loadbalancing
	DSRVersion = Version{Major: 10, Minor: 2}
)

Functions

func AddNamespaceEndpoint

func AddNamespaceEndpoint(namespaceId string, endpointId string) error

AddNamespaceEndpoint adds an endpoint to a Namespace.

func DSRSupported added in v0.8.4

func DSRSupported() error

DSRSupported returns an error if the HCN version does not support Direct Server Return.

func GetNamespaceContainerIds

func GetNamespaceContainerIds(namespaceId string) ([]string, error)

GetNamespaceContainerIds returns the containers of the Namespace specified by Id.

func GetNamespaceEndpointIds

func GetNamespaceEndpointIds(namespaceId string) ([]string, error)

GetNamespaceEndpointIds returns the endpoints of the Namespace specified by Id.

func HostRouteSupported added in v0.8.4

func HostRouteSupported() error

HostRouteSupported returns an error if the HCN version does not support Host Route policies.

func IsNotFoundError added in v0.7.5

func IsNotFoundError(err error) bool

IsNotFoundError returns a boolean indicating whether the error was caused by a resource not being found.

func ModifyEndpointSettings

func ModifyEndpointSettings(endpointId string, request *ModifyEndpointSettingRequest) error

ModifyEndpointSettings updates the Port/Policy of an Endpoint.

func ModifyNamespaceSettings

func ModifyNamespaceSettings(namespaceId string, request *ModifyNamespaceSettingRequest) error

ModifyNamespaceSettings updates the Endpoints/Containers of a Namespace.

func RemoteSubnetSupported added in v0.8.4

func RemoteSubnetSupported() error

RemoteSubnetSupported returns an error if the HCN version does not support Remote Subnet policies.

func RemoveNamespaceEndpoint

func RemoveNamespaceEndpoint(namespaceId string, endpointId string) error

RemoveNamespaceEndpoint removes an endpoint from a Namespace.

func V2ApiSupported

func V2ApiSupported() error

V2ApiSupported returns an error if the HCN version does not support the V2 Apis.

Types

type AclFeatures

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

AclFeatures are the supported ACL possibilities.

type AclPolicySetting

type AclPolicySetting struct {
	Protocols       string        `json:",omitempty"` // EX: 6 (TCP), 17 (UDP), 1 (ICMPv4), 58 (ICMPv6), 2 (IGMP)
	Action          ActionType    `json:","`
	Direction       DirectionType `json:","`
	LocalAddresses  string        `json:",omitempty"`
	RemoteAddresses string        `json:",omitempty"`
	LocalPorts      string        `json:",omitempty"`
	RemotePorts     string        `json:",omitempty"`
	RuleType        RuleType      `json:",omitempty"`
	Priority        uint16        `json:",omitempty"`
}

AclPolicySetting creates firewall rules on an endpoint

type ActionType

type ActionType string

ActionType associated with ACLs. Value is either Allow or Block.

type ApiSupport

type ApiSupport struct {
	V1 bool `json:"V1"`
	V2 bool `json:"V2"`
}

ApiSupport lists the supported API versions.

type AutomaticDNSNetworkPolicySetting

type AutomaticDNSNetworkPolicySetting struct {
	Enable bool `json:",omitempty"`
}

AutomaticDNSNetworkPolicySetting enables/disables automatic DNS on a network.

type DirectionType

type DirectionType string

DirectionType associated with ACLs. Value is either In or Out.

type Dns

type Dns struct {
	Domain     string   `json:",omitempty"`
	Search     []string `json:",omitempty"`
	ServerList []string `json:",omitempty"`
	Options    []string `json:",omitempty"`
}

Dns (Domain Name System is associated with a network.

type DrMacAddressNetworkPolicySetting

type DrMacAddressNetworkPolicySetting struct {
	Address string `json:",omitempty"`
}

DrMacAddressNetworkPolicySetting sets the DR MAC for a network.

type EncapOverheadEndpointPolicySetting

type EncapOverheadEndpointPolicySetting struct {
	Overhead uint16 `json:",omitempty"`
}

EncapOverheadEndpointPolicySetting sets the encap overhead for an endpoint.

type EndpointFlags

type EndpointFlags uint32

EndpointFlags are special settings on an endpoint.

var (
	// EndpointFlagsNone is the default.
	EndpointFlagsNone EndpointFlags
	// EndpointFlagsRemoteEndpoint means that an endpoint is on another host.
	EndpointFlagsRemoteEndpoint EndpointFlags = 1
)

type EndpointNotFoundError added in v0.7.5

type EndpointNotFoundError struct {
	EndpointName string
	EndpointID   string
}

EndpointNotFoundError results from a failed seach for an endpoint by Id or Name

func (EndpointNotFoundError) Error added in v0.7.5

func (e EndpointNotFoundError) Error() string

type EndpointPolicy

type EndpointPolicy struct {
	Type     EndpointPolicyType `json:""`
	Settings json.RawMessage    `json:",omitempty"`
}

EndpointPolicy is a collection of Policy settings for an Endpoint.

type EndpointPolicyType

type EndpointPolicyType string

EndpointPolicyType are the potential Policies that apply to Endpoints.

const (
	PortMapping   EndpointPolicyType = "PortMapping"
	ACL           EndpointPolicyType = "ACL"
	QOS           EndpointPolicyType = "QOS"
	L2Driver      EndpointPolicyType = "L2Driver"
	OutBoundNAT   EndpointPolicyType = "OutBoundNAT"
	SDNRoute      EndpointPolicyType = "SDNRoute"
	L4Proxy       EndpointPolicyType = "L4Proxy"
	PortName      EndpointPolicyType = "PortName"
	EncapOverhead EndpointPolicyType = "EncapOverhead"
	// Endpoint and Network have InterfaceConstraint and ProviderAddress
	NetworkProviderAddress     EndpointPolicyType = "ProviderAddress"
	NetworkInterfaceConstraint EndpointPolicyType = "InterfaceConstraint"
)

EndpointPolicyType const

type EndpointResourceType

type EndpointResourceType string

EndpointResourceType are the two different Endpoint settings resources.

var (
	// EndpointResourceTypePolicy is for Endpoint Policies. Ex: ACL, NAT
	EndpointResourceTypePolicy EndpointResourceType = "Policy"
	// EndpointResourceTypePort is for Endpoint Port settings.
	EndpointResourceTypePort EndpointResourceType = "Port"
)

type Globals

type Globals struct {
	Version Version `json:"Version"`
}

Globals are all global properties of the HCN Service.

func GetGlobals

func GetGlobals() (*Globals, error)

GetGlobals returns the global properties of the HCN Service.

type HostComputeEndpoint

type HostComputeEndpoint struct {
	Id                   string           `json:"ID,omitempty"`
	Name                 string           `json:",omitempty"`
	HostComputeNetwork   string           `json:",omitempty"` // GUID
	HostComputeNamespace string           `json:",omitempty"` // GUID
	Policies             []EndpointPolicy `json:",omitempty"`
	IpConfigurations     []IpConfig       `json:",omitempty"`
	Dns                  Dns              `json:",omitempty"`
	Routes               []Route          `json:",omitempty"`
	MacAddress           string           `json:",omitempty"`
	Flags                EndpointFlags    `json:",omitempty"`
	SchemaVersion        SchemaVersion    `json:",omitempty"`
}

HostComputeEndpoint represents a network endpoint

func GetEndpointByID

func GetEndpointByID(endpointId string) (*HostComputeEndpoint, error)

GetEndpointByID returns an endpoint specified by Id

func GetEndpointByName

func GetEndpointByName(endpointName string) (*HostComputeEndpoint, error)

GetEndpointByName returns an endpoint specified by Name

func ListEndpoints

func ListEndpoints() ([]HostComputeEndpoint, error)

ListEndpoints makes a call to list all available endpoints.

func ListEndpointsOfNetwork

func ListEndpointsOfNetwork(networkId string) ([]HostComputeEndpoint, error)

ListEndpointsOfNetwork queries the list of endpoints on a network.

func ListEndpointsQuery

func ListEndpointsQuery(query HostComputeQuery) ([]HostComputeEndpoint, error)

ListEndpointsQuery makes a call to query the list of available endpoints.

func (*HostComputeEndpoint) ApplyPolicy

func (endpoint *HostComputeEndpoint) ApplyPolicy(endpointPolicy PolicyEndpointRequest) error

ApplyPolicy applies a Policy (ex: ACL) on the Endpoint.

func (*HostComputeEndpoint) Create

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

Create Endpoint.

func (*HostComputeEndpoint) Delete

func (endpoint *HostComputeEndpoint) Delete() error

Delete Endpoint.

func (*HostComputeEndpoint) NamespaceAttach

func (endpoint *HostComputeEndpoint) NamespaceAttach(namespaceId string) error

NamespaceAttach modifies a Namespace to add an endpoint.

func (*HostComputeEndpoint) NamespaceDetach

func (endpoint *HostComputeEndpoint) NamespaceDetach(namespaceId string) error

NamespaceDetach modifies a Namespace to remove an endpoint.

type HostComputeLoadBalancer

type HostComputeLoadBalancer struct {
	Id                   string                    `json:"ID,omitempty"`
	HostComputeEndpoints []string                  `json:",omitempty"`
	SourceVIP            string                    `json:",omitempty"`
	FrontendVIPs         []string                  `json:",omitempty"`
	PortMappings         []LoadBalancerPortMapping `json:",omitempty"`
	SchemaVersion        SchemaVersion             `json:",omitempty"`
	Flags                LoadBalancerFlags         `json:",omitempty"` // 0: None, 1: EnableDirectServerReturn
}

HostComputeLoadBalancer represents software load balancer.

func AddLoadBalancer

func AddLoadBalancer(endpoints []HostComputeEndpoint, flags LoadBalancerFlags, portMappingFlags LoadBalancerPortMappingFlags, sourceVIP string, frontendVIPs []string, protocol uint16, internalPort uint16, externalPort uint16) (*HostComputeLoadBalancer, error)

AddLoadBalancer for the specified endpoints

func GetLoadBalancerByID

func GetLoadBalancerByID(loadBalancerId string) (*HostComputeLoadBalancer, error)

GetLoadBalancerByID returns the LoadBalancer specified by Id.

func ListLoadBalancers

func ListLoadBalancers() ([]HostComputeLoadBalancer, error)

ListLoadBalancers makes a call to list all available loadBalancers.

func ListLoadBalancersQuery

func ListLoadBalancersQuery(query HostComputeQuery) ([]HostComputeLoadBalancer, error)

ListLoadBalancersQuery makes a call to query the list of available loadBalancers.

func (*HostComputeLoadBalancer) AddEndpoint

func (loadBalancer *HostComputeLoadBalancer) AddEndpoint(endpoint *HostComputeEndpoint) (*HostComputeLoadBalancer, error)

AddEndpoint add an endpoint to a LoadBalancer

func (*HostComputeLoadBalancer) Create

func (loadBalancer *HostComputeLoadBalancer) Create() (*HostComputeLoadBalancer, error)

Create LoadBalancer.

func (*HostComputeLoadBalancer) Delete

func (loadBalancer *HostComputeLoadBalancer) Delete() error

Delete LoadBalancer.

func (*HostComputeLoadBalancer) RemoveEndpoint

func (loadBalancer *HostComputeLoadBalancer) RemoveEndpoint(endpoint *HostComputeEndpoint) (*HostComputeLoadBalancer, error)

RemoveEndpoint removes an endpoint from a LoadBalancer

type HostComputeNamespace

type HostComputeNamespace struct {
	Id            string              `json:"ID,omitempty"`
	NamespaceId   uint32              `json:",omitempty"`
	Type          NamespaceType       `json:",omitempty"` // Host, HostDefault, Guest, GuestDefault
	Resources     []NamespaceResource `json:",omitempty"`
	SchemaVersion SchemaVersion       `json:",omitempty"`
}

HostComputeNamespace represents a namespace (AKA compartment) in

func GetNamespaceByID

func GetNamespaceByID(namespaceId string) (*HostComputeNamespace, error)

GetNamespaceByID returns the Namespace specified by Id.

func ListNamespaces

func ListNamespaces() ([]HostComputeNamespace, error)

ListNamespaces makes a call to list all available namespaces.

func ListNamespacesQuery

func ListNamespacesQuery(query HostComputeQuery) ([]HostComputeNamespace, error)

ListNamespacesQuery makes a call to query the list of available namespaces.

func NewNamespace added in v0.7.7

func NewNamespace(nsType NamespaceType) *HostComputeNamespace

NewNamespace creates a new Namespace object

func (*HostComputeNamespace) Create

func (namespace *HostComputeNamespace) Create() (*HostComputeNamespace, error)

Create Namespace.

func (*HostComputeNamespace) Delete

func (namespace *HostComputeNamespace) Delete() error

Delete Namespace.

func (*HostComputeNamespace) Sync added in v0.7.7

func (namespace *HostComputeNamespace) Sync() error

Sync Namespace endpoints with the appropriate sandbox container holding the network namespace open. If no sandbox container is found for this namespace this method is determined to be a success and will not return an error in this case. If the sandbox container is found and a sync is initiated any failures will be returned via this method.

This call initiates a sync between endpoints and the matching UtilityVM hosting those endpoints. It is safe to call for any `NamespaceType` but `NamespaceTypeGuest` is the only case when a sync will actually occur. For `NamespaceTypeHost` the process container will be automatically synchronized when the the endpoint is added via `AddNamespaceEndpoint`.

Note: This method sync's both additions and removals of endpoints from a `NamespaceTypeGuest` namespace.

type HostComputeNetwork

type HostComputeNetwork struct {
	Id            string          `json:"ID,omitempty"`
	Name          string          `json:",omitempty"`
	Type          NetworkType     `json:",omitempty"`
	Policies      []NetworkPolicy `json:",omitempty"`
	MacPool       MacPool         `json:",omitempty"`
	Dns           Dns             `json:",omitempty"`
	Ipams         []Ipam          `json:",omitempty"`
	Flags         NetworkFlags    `json:",omitempty"` // 0: None
	SchemaVersion SchemaVersion   `json:",omitempty"`
}

HostComputeNetwork represents a network

func GetNetworkByID

func GetNetworkByID(networkID string) (*HostComputeNetwork, error)

GetNetworkByID returns the network specified by Id.

func GetNetworkByName

func GetNetworkByName(networkName string) (*HostComputeNetwork, error)

GetNetworkByName returns the network specified by Name.

func ListNetworks

func ListNetworks() ([]HostComputeNetwork, error)

ListNetworks makes a call to list all available networks.

func ListNetworksQuery

func ListNetworksQuery(query HostComputeQuery) ([]HostComputeNetwork, error)

ListNetworksQuery makes a call to query the list of available networks.

func (*HostComputeNetwork) AddPolicy added in v0.7.13

func (network *HostComputeNetwork) AddPolicy(networkPolicy PolicyNetworkRequest) error

AddPolicy applies a Policy (ex: RemoteSubnet) on the Network.

func (*HostComputeNetwork) Create

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

Create Network.

func (*HostComputeNetwork) CreateEndpoint

func (network *HostComputeNetwork) CreateEndpoint(endpoint *HostComputeEndpoint) (*HostComputeEndpoint, error)

CreateEndpoint creates an endpoint on the Network.

func (*HostComputeNetwork) CreateRemoteEndpoint

func (network *HostComputeNetwork) CreateRemoteEndpoint(endpoint *HostComputeEndpoint) (*HostComputeEndpoint, error)

CreateRemoteEndpoint creates a remote endpoint on the Network.

func (*HostComputeNetwork) Delete

func (network *HostComputeNetwork) Delete() error

Delete Network.

func (*HostComputeNetwork) ModifyNetworkSettings added in v0.7.13

func (network *HostComputeNetwork) ModifyNetworkSettings(request *ModifyNetworkSettingRequest) error

ModifyNetworkSettings updates the Policy for a network.

func (*HostComputeNetwork) RemovePolicy added in v0.7.13

func (network *HostComputeNetwork) RemovePolicy(networkPolicy PolicyNetworkRequest) error

RemovePolicy removes a Policy (ex: RemoteSubnet) from the Network.

type HostComputeQuery

type HostComputeQuery struct {
	SchemaVersion SchemaVersion         `json:""`
	Flags         HostComputeQueryFlags `json:",omitempty"`
	Filter        string                `json:",omitempty"`
}

HostComputeQuery is the format for HCN queries.

type HostComputeQueryFlags

type HostComputeQueryFlags uint32

HostComputeQueryFlags are passed in to a HostComputeQuery to determine which properties of an object are returned.

var (
	// HostComputeQueryFlagsNone returns an object with the standard properties.
	HostComputeQueryFlagsNone HostComputeQueryFlags
	// HostComputeQueryFlagsDetailed returns an object with all properties.
	HostComputeQueryFlagsDetailed HostComputeQueryFlags = 1
)

type InterfaceConstraintPolicySetting

type InterfaceConstraintPolicySetting struct {
	InterfaceGuid        string `json:",omitempty"`
	InterfaceLuid        uint64 `json:",omitempty"`
	InterfaceIndex       uint32 `json:",omitempty"`
	InterfaceMediaType   uint32 `json:",omitempty"`
	InterfaceAlias       string `json:",omitempty"`
	InterfaceDescription string `json:",omitempty"`
}

InterfaceConstraintPolicySetting limits an Endpoint or Network to a specific Nic.

type IpConfig

type IpConfig struct {
	IpAddress    string `json:",omitempty"`
	PrefixLength uint8  `json:",omitempty"`
}

IpConfig is assoicated with an endpoint

type Ipam

type Ipam struct {
	Type    string   `json:",omitempty"` // Ex: Static, DHCP
	Subnets []Subnet `json:",omitempty"`
}

Ipam (Internet Protocol Addres Management) is assoicated with a network and represents the address space(s) of a network.

type L4ProxyPolicySetting

type L4ProxyPolicySetting struct {
	IP            string   `json:",omitempty"`
	Port          string   `json:",omitempty"`
	Protocol      uint32   `json:",omitempty"` // EX: TCP = 6, UDP = 17
	ExceptionList []string `json:",omitempty"`
	Destination   string   `json:","`
	OutboundNat   bool     `json:",omitempty"`
}

L4ProxyPolicySetting sets Layer-4 Proxy on an endpoint.

type LoadBalancerFlags added in v0.8.4

type LoadBalancerFlags uint32

LoadBalancerFlags modify settings for a loadbalancer.

var (
	// LoadBalancerFlagsNone is the default.
	LoadBalancerFlagsNone LoadBalancerFlags = 0
	// LoadBalancerFlagsDSR enables Direct Server Return (DSR)
	LoadBalancerFlagsDSR LoadBalancerFlags = 1
)

type LoadBalancerNotFoundError added in v0.7.5

type LoadBalancerNotFoundError struct {
	LoadBalancerId string
}

LoadBalancerNotFoundError results from a failed seach for a loadbalancer by Id

func (LoadBalancerNotFoundError) Error added in v0.7.5

type LoadBalancerPortMapping

type LoadBalancerPortMapping struct {
	Protocol     uint32                       `json:",omitempty"` // EX: TCP = 6, UDP = 17
	InternalPort uint16                       `json:",omitempty"`
	ExternalPort uint16                       `json:",omitempty"`
	Flags        LoadBalancerPortMappingFlags `json:",omitempty"`
}

LoadBalancerPortMapping is associated with HostComputeLoadBalancer

type LoadBalancerPortMappingFlags added in v0.8.4

type LoadBalancerPortMappingFlags uint32

LoadBalancerPortMappingFlags are special settings on a loadbalancer.

var (
	// LoadBalancerPortMappingFlagsNone is the default.
	LoadBalancerPortMappingFlagsNone LoadBalancerPortMappingFlags
	// LoadBalancerPortMappingFlagsILB enables internal loadbalancing.
	LoadBalancerPortMappingFlagsILB LoadBalancerPortMappingFlags = 1
	// LoadBalancerPortMappingFlagsLocalRoutedVIP enables VIP access from the host.
	LoadBalancerPortMappingFlagsLocalRoutedVIP LoadBalancerPortMappingFlags = 2
	// LoadBalancerPortMappingFlagsUseMux enables DSR for NodePort access of VIP.
	LoadBalancerPortMappingFlagsUseMux LoadBalancerPortMappingFlags = 4
	// LoadBalancerPortMappingFlagsPreserveDIP delivers packets with destination IP as the VIP.
	LoadBalancerPortMappingFlagsPreserveDIP LoadBalancerPortMappingFlags = 8
)

type MacPool

type MacPool struct {
	Ranges []MacRange `json:",omitempty"`
}

MacPool is assoicated with a network and represents pool of MacRanges.

type MacRange

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

MacRange is associated with MacPool and respresents the start and end addresses.

type ModifyEndpointSettingRequest

type ModifyEndpointSettingRequest struct {
	ResourceType EndpointResourceType `json:",omitempty"` // Policy, Port
	RequestType  RequestType          `json:",omitempty"` // Add, Remove, Update, Refresh
	Settings     json.RawMessage      `json:",omitempty"`
}

ModifyEndpointSettingRequest is the structure used to send request to modify an endpoint. Used to update policy/port on an endpoint.

type ModifyNamespaceSettingRequest

type ModifyNamespaceSettingRequest struct {
	ResourceType NamespaceResourceType `json:",omitempty"` // Container, Endpoint
	RequestType  RequestType           `json:",omitempty"` // Add, Remove, Update, Refresh
	Settings     json.RawMessage       `json:",omitempty"`
}

ModifyNamespaceSettingRequest is the structure used to send request to modify a namespace. Used to Add/Remove an endpoints and containers to/from a namespace.

type ModifyNetworkSettingRequest added in v0.7.13

type ModifyNetworkSettingRequest struct {
	ResourceType NetworkResourceType `json:",omitempty"` // Policy, DNS, Extension
	RequestType  RequestType         `json:",omitempty"` // Add, Remove, Update, Refresh
	Settings     json.RawMessage     `json:",omitempty"`
}

ModifyNetworkSettingRequest is the structure used to send request to modify an network. Used to update DNS/extension/policy on an network.

type NamespaceNotFoundError added in v0.7.5

type NamespaceNotFoundError struct {
	NamespaceID string
}

NamespaceNotFoundError results from a failed seach for a namsepace by Id

func (NamespaceNotFoundError) Error added in v0.7.5

func (e NamespaceNotFoundError) Error() string

type NamespaceResource

type NamespaceResource struct {
	Type NamespaceResourceType `json:","` // Container, Endpoint
	Data json.RawMessage       `json:","`
}

NamespaceResource is associated with a namespace

type NamespaceResourceContainer

type NamespaceResourceContainer struct {
	Id string `json:"ID,"`
}

NamespaceResourceContainer represents a Container attached to a Namespace.

type NamespaceResourceEndpoint

type NamespaceResourceEndpoint struct {
	Id string `json:"ID,"`
}

NamespaceResourceEndpoint represents an Endpoint attached to a Namespace.

type NamespaceResourceType

type NamespaceResourceType string

NamespaceResourceType determines whether the Namespace resource is a Container or Endpoint.

var (
	// NamespaceResourceTypeContainer are contianers associated with a Namespace.
	NamespaceResourceTypeContainer NamespaceResourceType = "Container"
	// NamespaceResourceTypeEndpoint are endpoints associated with a Namespace.
	NamespaceResourceTypeEndpoint NamespaceResourceType = "Endpoint"
)

type NamespaceType

type NamespaceType string

NamespaceType determines whether the Namespace is for a Host or Guest

var (
	// NamespaceTypeHost are host namespaces.
	NamespaceTypeHost NamespaceType = "Host"
	// NamespaceTypeHostDefault are host namespaces in the default compartment.
	NamespaceTypeHostDefault NamespaceType = "HostDefault"
	// NamespaceTypeGuest are guest namespaces.
	NamespaceTypeGuest NamespaceType = "Guest"
	// NamespaceTypeGuestDefault are guest namespaces in the default compartment.
	NamespaceTypeGuestDefault NamespaceType = "GuestDefault"
)

type NetAdapterNameNetworkPolicySetting

type NetAdapterNameNetworkPolicySetting struct {
	NetworkAdapterName string `json:",omitempty"`
}

NetAdapterNameNetworkPolicySetting sets network adapter of a network.

type NetworkFlags added in v0.8.4

type NetworkFlags uint32

NetworkFlags are various network flags.

const (
	None                NetworkFlags = 0
	EnableNonPersistent NetworkFlags = 8
)

NetworkFlags const

type NetworkNotFoundError added in v0.7.5

type NetworkNotFoundError struct {
	NetworkName string
	NetworkID   string
}

NetworkNotFoundError results from a failed seach for a network by Id or Name

func (NetworkNotFoundError) Error added in v0.7.5

func (e NetworkNotFoundError) Error() string

type NetworkPolicy

type NetworkPolicy struct {
	Type     NetworkPolicyType `json:""`
	Settings json.RawMessage   `json:",omitempty"`
}

NetworkPolicy is a collection of Policy settings for a Network.

type NetworkPolicyType

type NetworkPolicyType string

NetworkPolicyType are the potential Policies that apply to Networks.

const (
	SourceMacAddress    NetworkPolicyType = "SourceMacAddress"
	NetAdapterName      NetworkPolicyType = "NetAdapterName"
	VSwitchExtension    NetworkPolicyType = "VSwitchExtension"
	DrMacAddress        NetworkPolicyType = "DrMacAddress"
	AutomaticDNS        NetworkPolicyType = "AutomaticDNS"
	InterfaceConstraint NetworkPolicyType = "InterfaceConstraint"
	ProviderAddress     NetworkPolicyType = "ProviderAddress"
	RemoteSubnetRoute   NetworkPolicyType = "RemoteSubnetRoute"
	HostRoute           NetworkPolicyType = "HostRoute"
)

NetworkPolicyType const

type NetworkResourceType added in v0.7.13

type NetworkResourceType string

NetworkResourceType are the 3 different Network settings resources.

var (
	// NetworkResourceTypePolicy is for Network's policies. Ex: RemoteSubnet
	NetworkResourceTypePolicy NetworkResourceType = "Policy"
	// NetworkResourceTypeDNS is for Network's DNS settings.
	NetworkResourceTypeDNS NetworkResourceType = "DNS"
	// NetworkResourceTypeExtension is for Network's extension settings.
	NetworkResourceTypeExtension NetworkResourceType = "Extension"
)

type NetworkType added in v0.7.5

type NetworkType string

NetworkType are various networks.

const (
	NAT         NetworkType = "NAT"
	Transparent NetworkType = "Transparent"
	L2Bridge    NetworkType = "L2Bridge"
	L2Tunnel    NetworkType = "L2Tunnel"
	ICS         NetworkType = "ICS"
	Private     NetworkType = "Private"
	Overlay     NetworkType = "Overlay"
)

NetworkType const

type OutboundNatPolicySetting

type OutboundNatPolicySetting struct {
	VirtualIP  string   `json:",omitempty"`
	Exceptions []string `json:",omitempty"`
}

OutboundNatPolicySetting sets outbound Network Address Translation on an Endpoint.

type PolicyEndpointRequest

type PolicyEndpointRequest struct {
	Policies []EndpointPolicy `json:",omitempty"`
}

type PolicyNetworkRequest added in v0.7.13

type PolicyNetworkRequest struct {
	Policies []NetworkPolicy `json:",omitempty"`
}

type PortMappingPolicySetting

type PortMappingPolicySetting struct {
	Protocol     uint32 `json:",omitempty"` // EX: TCP = 6, UDP = 17
	InternalPort uint16 `json:",omitempty"`
	ExternalPort uint16 `json:",omitempty"`
	VIP          string `json:",omitempty"`
}

PortMappingPolicySetting defines Port Mapping (NAT)

type PortnameEndpointPolicySetting

type PortnameEndpointPolicySetting struct {
	Name string `json:",omitempty"`
}

PortnameEndpointPolicySetting sets the port name for an endpoint.

type ProviderAddressEndpointPolicySetting

type ProviderAddressEndpointPolicySetting struct {
	ProviderAddress string `json:",omitempty"`
}

ProviderAddressEndpointPolicySetting sets the PA for an endpoint.

type QosPolicySetting

type QosPolicySetting struct {
	MaximumOutgoingBandwidthInBytes uint64
}

QosPolicySetting sets Quality of Service bandwidth caps on an Endpoint.

type RemoteSubnetRoutePolicySetting added in v0.7.13

type RemoteSubnetRoutePolicySetting struct {
	DestinationPrefix           string
	IsolationId                 uint16
	ProviderAddress             string
	DistributedRouterMacAddress string
}

RemoteSubnetRoutePolicySetting creates remote subnet route rules on a network

type RequestType

type RequestType string

RequestType are the different operations performed to settings. Used to update the settings of Endpoint/Namespace objects.

var (
	// RequestTypeAdd adds the provided settings object.
	RequestTypeAdd RequestType = "Add"
	// RequestTypeRemove removes the provided settings object.
	RequestTypeRemove RequestType = "Remove"
	// RequestTypeUpdate replaces settings with the ones provided.
	RequestTypeUpdate RequestType = "Update"
	// RequestTypeRefresh refreshes the settings provided.
	RequestTypeRefresh RequestType = "Refresh"
)

type Route

type Route struct {
	NextHop           string `json:",omitempty"`
	DestinationPrefix string `json:",omitempty"`
	Metric            uint16 `json:",omitempty"`
}

Route is assoicated with a subnet.

type RuleType

type RuleType string

RuleType associated with ACLs. Value is either Host (WFP) or Switch (VFP).

type SDNRoutePolicySetting

type SDNRoutePolicySetting struct {
	DestinationPrefix string `json:",omitempty"`
	NextHop           string `json:",omitempty"`
	NeedEncap         bool   `json:",omitempty"`
}

SDNRoutePolicySetting sets SDN Route on an Endpoint.

type SchemaVersion

type SchemaVersion = Version // hcnglobals.go

SchemaVersion for HCN Objects/Queries.

func V2SchemaVersion added in v0.7.7

func V2SchemaVersion() SchemaVersion

type SourceMacAddressNetworkPolicySetting

type SourceMacAddressNetworkPolicySetting struct {
	SourceMacAddress string `json:",omitempty"`
}

SourceMacAddressNetworkPolicySetting sets source MAC for a network.

type Subnet

type Subnet struct {
	IpAddressPrefix string            `json:",omitempty"`
	Policies        []json.RawMessage `json:",omitempty"`
	Routes          []Route           `json:",omitempty"`
}

Subnet is assoicated with a Ipam.

type SubnetPolicy

type SubnetPolicy struct {
	Type     SubnetPolicyType `json:""`
	Settings json.RawMessage  `json:",omitempty"`
}

SubnetPolicy is a collection of Policy settings for a Subnet.

type SubnetPolicyType

type SubnetPolicyType string

SubnetPolicyType are the potential Policies that apply to Subnets.

const (
	VLAN SubnetPolicyType = "VLAN"
	VSID SubnetPolicyType = "VSID"
)

SubnetPolicyType const

type SupportedFeatures

type SupportedFeatures struct {
	Acl          AclFeatures `json:"ACL"`
	Api          ApiSupport  `json:"API"`
	RemoteSubnet bool        `json:"RemoteSubnet"`
	HostRoute    bool        `json:"HostRoute"`
	DSR          bool        `json:"DSR"`
}

SupportedFeatures are the features provided by the Service.

func GetSupportedFeatures

func GetSupportedFeatures() SupportedFeatures

GetSupportedFeatures returns the features supported by the Service.

type VSwitchExtensionNetworkPolicySetting

type VSwitchExtensionNetworkPolicySetting struct {
	ExtensionID string `json:",omitempty"`
	Enable      bool   `json:",omitempty"`
}

VSwitchExtensionNetworkPolicySetting enables/disabled VSwitch extensions for a network.

type Version

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

Version is the HCN Service version.

type VlanPolicySetting

type VlanPolicySetting struct {
	IsolationId uint32 `json:","`
}

VlanPolicySetting isolates a subnet with VLAN tagging.

type VsidPolicySetting

type VsidPolicySetting struct {
	IsolationId uint32 `json:","`
}

VsidPolicySetting isolates a subnet with VSID tagging.

Jump to

Keyboard shortcuts

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