hnswrapper

package
v1.5.12 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

View Source
var ErrHNSCallTimeout = errors.New("timed out calling hns")

ErrHNSCallTimeout - hns call timeout

Functions

This section is empty.

Types

type CreateEndpointFuncResult

type CreateEndpointFuncResult struct {
	Err error
	// contains filtered or unexported fields
}

type CreateNetworkFuncResult

type CreateNetworkFuncResult struct {
	Err error
	// contains filtered or unexported fields
}

type EndpointAttachedFuncResult

type EndpointAttachedFuncResult struct {
	Err error
	// contains filtered or unexported fields
}

type EndpointFuncResult

type EndpointFuncResult struct {
	Err error
	// contains filtered or unexported fields
}

type FakeEndpointPolicy

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

type FakeHNSCache

type FakeHNSCache struct {
	// contains filtered or unexported fields
}

func (FakeHNSCache) ACLPolicies

func (fCache FakeHNSCache) ACLPolicies(epList map[string]string, policyID string) (map[string][]*FakeEndpointPolicy, error)

ACLPolicies returns a map of the inputed Endpoint IDs to Policies with the given policyID.

func (FakeHNSCache) AllSetPolicies

func (fCache FakeHNSCache) AllSetPolicies(networkID string) map[string]*hcn.SetPolicySetting

AllSetPolicies returns all SetPolicies in a given network as a map of SetPolicy ID to SetPolicy object.

func (FakeHNSCache) EndpointIP

func (fCache FakeHNSCache) EndpointIP(id string) string

EndpointIP returns the Endpoint's IP or an empty string if the Endpoint doesn't exist.

func (FakeHNSCache) GetAllACLs

func (fCache FakeHNSCache) GetAllACLs() map[string][]*FakeEndpointPolicy

GetAllACLs maps all local Endpoint IDs to ACLs

func (FakeHNSCache) PrettyString

func (fCache FakeHNSCache) PrettyString() string

func (FakeHNSCache) SetPolicy

func (fCache FakeHNSCache) SetPolicy(setID string) *hcn.SetPolicySetting

SetPolicy returns the first SetPolicy found with this ID in any network.

type FakeHostComputeEndpoint

type FakeHostComputeEndpoint struct {
	ID                 string
	Name               string
	HostComputeNetwork string
	Policies           []*FakeEndpointPolicy
	IPConfiguration    string
	Flags              hcn.EndpointFlags
}

func NewFakeHostComputeEndpoint

func NewFakeHostComputeEndpoint(endpoint *hcn.HostComputeEndpoint) *FakeHostComputeEndpoint

func (*FakeHostComputeEndpoint) GetHCNObj

func (fEndpoint *FakeHostComputeEndpoint) GetHCNObj() *hcn.HostComputeEndpoint

func (*FakeHostComputeEndpoint) PrettyString

func (fEndpoint *FakeHostComputeEndpoint) PrettyString() string

func (*FakeHostComputeEndpoint) RemovePolicy

func (fEndpoint *FakeHostComputeEndpoint) RemovePolicy(toRemovePol *FakeEndpointPolicy) error

type FakeHostComputeNetwork

type FakeHostComputeNetwork struct {
	ID   string
	Name string
	// Policies maps SetPolicy ID to SetPolicy object
	Policies map[string]*hcn.SetPolicySetting
}

func NewFakeHostComputeNetwork

func NewFakeHostComputeNetwork(network *hcn.HostComputeNetwork) *FakeHostComputeNetwork

func (*FakeHostComputeNetwork) GetHCNObj

func (fNetwork *FakeHostComputeNetwork) GetHCNObj() *hcn.HostComputeNetwork

func (*FakeHostComputeNetwork) PrettyString

func (fNetwork *FakeHostComputeNetwork) PrettyString() string

type GetEndpointByIDFuncResult

type GetEndpointByIDFuncResult struct {
	Err error
	// contains filtered or unexported fields
}

type GetNamespaceByIDFuncResult

type GetNamespaceByIDFuncResult struct {
	Err error
	// contains filtered or unexported fields
}

type GetNetworkByIDFuncResult

type GetNetworkByIDFuncResult struct {
	Err error
	// contains filtered or unexported fields
}

type GetNetworkByNameFuncResult

type GetNetworkByNameFuncResult struct {
	Err error
	// contains filtered or unexported fields
}

type HnsGlobalFuncResult

type HnsGlobalFuncResult struct {
	HnsGlobals *hcsshim.HNSGlobals
	Err        error
}

type HnsV1WrapperInterface

type HnsV1WrapperInterface interface {
	CreateEndpoint(endpoint *hcsshim.HNSEndpoint, path string) (*hcsshim.HNSEndpoint, error)
	DeleteEndpoint(endpointId string) (*hcsshim.HNSEndpoint, error)
	CreateNetwork(network *hcsshim.HNSNetwork, path string) (*hcsshim.HNSNetwork, error)
	DeleteNetwork(networkId string) (*hcsshim.HNSNetwork, error)
	GetHNSEndpointByName(endpointName string) (*hcsshim.HNSEndpoint, error)
	GetHNSEndpointByID(endpointID string) (*hcsshim.HNSEndpoint, error)
	HotAttachEndpoint(containerID string, endpointID string) error
	IsAttached(hnsep *hcsshim.HNSEndpoint, containerID string) (bool, error)
	GetHNSGlobals() (*hcsshim.HNSGlobals, error)
}

type HnsV2WrapperInterface

type HnsV2WrapperInterface interface {
	CreateEndpoint(endpoint *hcn.HostComputeEndpoint) (*hcn.HostComputeEndpoint, error)
	DeleteEndpoint(endpoint *hcn.HostComputeEndpoint) error
	CreateNetwork(network *hcn.HostComputeNetwork) (*hcn.HostComputeNetwork, error)
	DeleteNetwork(network *hcn.HostComputeNetwork) error
	ModifyNetworkSettings(network *hcn.HostComputeNetwork, request *hcn.ModifyNetworkSettingRequest) error
	AddNetworkPolicy(network *hcn.HostComputeNetwork, networkPolicy hcn.PolicyNetworkRequest) error
	RemoveNetworkPolicy(network *hcn.HostComputeNetwork, networkPolicy hcn.PolicyNetworkRequest) error
	GetNamespaceByID(netNamespacePath string) (*hcn.HostComputeNamespace, error)
	AddNamespaceEndpoint(namespaceId string, endpointId string) error
	RemoveNamespaceEndpoint(namespaceId string, endpointId string) error
	GetNetworkByName(networkName string) (*hcn.HostComputeNetwork, error)
	GetNetworkByID(networkId string) (*hcn.HostComputeNetwork, error)
	GetEndpointByID(endpointId string) (*hcn.HostComputeEndpoint, error)
	ListEndpointsOfNetwork(networkId string) ([]hcn.HostComputeEndpoint, error)
	ListEndpointsQuery(query hcn.HostComputeQuery) ([]hcn.HostComputeEndpoint, error)
	ApplyEndpointPolicy(endpoint *hcn.HostComputeEndpoint, requestType hcn.RequestType, endpointPolicy hcn.PolicyEndpointRequest) error
	GetEndpointByName(endpointName string) (*hcn.HostComputeEndpoint, error)
}

type Hnsv1wrapper

type Hnsv1wrapper struct{}

func (Hnsv1wrapper) CreateEndpoint

func (Hnsv1wrapper) CreateEndpoint(endpoint *hcsshim.HNSEndpoint, path string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapper) CreateNetwork

func (Hnsv1wrapper) CreateNetwork(network *hcsshim.HNSNetwork, path string) (*hcsshim.HNSNetwork, error)

func (Hnsv1wrapper) DeleteEndpoint

func (Hnsv1wrapper) DeleteEndpoint(endpointId string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapper) DeleteNetwork

func (Hnsv1wrapper) DeleteNetwork(networkId string) (*hcsshim.HNSNetwork, error)

func (Hnsv1wrapper) GetHNSEndpointByID

func (Hnsv1wrapper) GetHNSEndpointByID(id string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapper) GetHNSEndpointByName

func (Hnsv1wrapper) GetHNSEndpointByName(endpointName string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapper) GetHNSGlobals

func (w Hnsv1wrapper) GetHNSGlobals() (*hcsshim.HNSGlobals, error)

func (Hnsv1wrapper) HotAttachEndpoint

func (Hnsv1wrapper) HotAttachEndpoint(containerID, endpointID string) error

func (Hnsv1wrapper) IsAttached

func (Hnsv1wrapper) IsAttached(endpoint *hcsshim.HNSEndpoint, containerID string) (bool, error)

type Hnsv1wrapperfake

type Hnsv1wrapperfake struct {
	Delay time.Duration
}

func NewHnsv1wrapperFake

func NewHnsv1wrapperFake() *Hnsv1wrapperfake

func (Hnsv1wrapperfake) CreateEndpoint

func (h Hnsv1wrapperfake) CreateEndpoint(endpoint *hcsshim.HNSEndpoint, path string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapperfake) CreateNetwork

func (h Hnsv1wrapperfake) CreateNetwork(network *hcsshim.HNSNetwork, path string) (*hcsshim.HNSNetwork, error)

func (Hnsv1wrapperfake) DeleteEndpoint

func (h Hnsv1wrapperfake) DeleteEndpoint(endpointId string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapperfake) DeleteNetwork

func (h Hnsv1wrapperfake) DeleteNetwork(networkId string) (*hcsshim.HNSNetwork, error)

func (Hnsv1wrapperfake) GetHNSEndpointByID

func (h Hnsv1wrapperfake) GetHNSEndpointByID(endpointID string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapperfake) GetHNSEndpointByName

func (h Hnsv1wrapperfake) GetHNSEndpointByName(endpointName string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapperfake) GetHNSGlobals

func (h Hnsv1wrapperfake) GetHNSGlobals() (*hcsshim.HNSGlobals, error)

func (Hnsv1wrapperfake) HotAttachEndpoint

func (h Hnsv1wrapperfake) HotAttachEndpoint(containerID string, endpointID string) error

func (Hnsv1wrapperfake) IsAttached

func (h Hnsv1wrapperfake) IsAttached(hnsep *hcsshim.HNSEndpoint, containerID string) (bool, error)

type Hnsv1wrapperwithtimeout

type Hnsv1wrapperwithtimeout struct {
	Hnsv1 HnsV1WrapperInterface
	// hnsCallTimeout indicates the time to wait for hns calls before timing out
	HnsCallTimeout time.Duration
}

func (Hnsv1wrapperwithtimeout) CreateEndpoint

func (h Hnsv1wrapperwithtimeout) CreateEndpoint(endpoint *hcsshim.HNSEndpoint, path string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapperwithtimeout) CreateNetwork

func (h Hnsv1wrapperwithtimeout) CreateNetwork(network *hcsshim.HNSNetwork, path string) (*hcsshim.HNSNetwork, error)

func (Hnsv1wrapperwithtimeout) DeleteEndpoint

func (h Hnsv1wrapperwithtimeout) DeleteEndpoint(endpointId string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapperwithtimeout) DeleteNetwork

func (h Hnsv1wrapperwithtimeout) DeleteNetwork(networkId string) (*hcsshim.HNSNetwork, error)

func (Hnsv1wrapperwithtimeout) GetHNSEndpointByID

func (h Hnsv1wrapperwithtimeout) GetHNSEndpointByID(endpointID string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapperwithtimeout) GetHNSEndpointByName

func (h Hnsv1wrapperwithtimeout) GetHNSEndpointByName(endpointName string) (*hcsshim.HNSEndpoint, error)

func (Hnsv1wrapperwithtimeout) GetHNSGlobals

func (h Hnsv1wrapperwithtimeout) GetHNSGlobals() (*hcsshim.HNSGlobals, error)

func (Hnsv1wrapperwithtimeout) HotAttachEndpoint

func (h Hnsv1wrapperwithtimeout) HotAttachEndpoint(containerID string, endpointID string) error

func (Hnsv1wrapperwithtimeout) IsAttached

func (h Hnsv1wrapperwithtimeout) IsAttached(hnsep *hcsshim.HNSEndpoint, containerID string) (bool, error)

type Hnsv2wrapper

type Hnsv2wrapper struct{}

func (Hnsv2wrapper) AddNamespaceEndpoint

func (Hnsv2wrapper) AddNamespaceEndpoint(namespaceID, endpointID string) error

func (Hnsv2wrapper) AddNetworkPolicy

func (Hnsv2wrapper) AddNetworkPolicy(network *hcn.HostComputeNetwork, networkPolicy hcn.PolicyNetworkRequest) error

func (Hnsv2wrapper) ApplyEndpointPolicy

func (Hnsv2wrapper) ApplyEndpointPolicy(endpoint *hcn.HostComputeEndpoint, requestType hcn.RequestType, endpointPolicy hcn.PolicyEndpointRequest) error

func (Hnsv2wrapper) CreateEndpoint

func (Hnsv2wrapper) CreateEndpoint(endpoint *hcn.HostComputeEndpoint) (*hcn.HostComputeEndpoint, error)

func (Hnsv2wrapper) CreateNetwork

func (Hnsv2wrapper) CreateNetwork(network *hcn.HostComputeNetwork) (*hcn.HostComputeNetwork, error)

func (Hnsv2wrapper) DeleteEndpoint

func (Hnsv2wrapper) DeleteEndpoint(endpoint *hcn.HostComputeEndpoint) error

func (Hnsv2wrapper) DeleteNetwork

func (Hnsv2wrapper) DeleteNetwork(network *hcn.HostComputeNetwork) error

func (Hnsv2wrapper) GetEndpointByID

func (Hnsv2wrapper) GetEndpointByID(endpointID string) (*hcn.HostComputeEndpoint, error)

func (Hnsv2wrapper) GetEndpointByName

func (Hnsv2wrapper) GetEndpointByName(endpointName string) (*hcn.HostComputeEndpoint, error)

func (Hnsv2wrapper) GetNamespaceByID

func (Hnsv2wrapper) GetNamespaceByID(netNamespacePath string) (*hcn.HostComputeNamespace, error)

func (Hnsv2wrapper) GetNetworkByID

func (Hnsv2wrapper) GetNetworkByID(networkID string) (*hcn.HostComputeNetwork, error)

func (Hnsv2wrapper) GetNetworkByName

func (Hnsv2wrapper) GetNetworkByName(networkName string) (*hcn.HostComputeNetwork, error)

func (Hnsv2wrapper) ListEndpointsOfNetwork

func (Hnsv2wrapper) ListEndpointsOfNetwork(networkID string) ([]hcn.HostComputeEndpoint, error)

func (Hnsv2wrapper) ListEndpointsQuery

func (Hnsv2wrapper) ListEndpointsQuery(query hcn.HostComputeQuery) ([]hcn.HostComputeEndpoint, error)

func (Hnsv2wrapper) ModifyNetworkSettings

func (Hnsv2wrapper) ModifyNetworkSettings(network *hcn.HostComputeNetwork, request *hcn.ModifyNetworkSettingRequest) error

func (Hnsv2wrapper) RemoveNamespaceEndpoint

func (Hnsv2wrapper) RemoveNamespaceEndpoint(namespaceID, endpointID string) error

func (Hnsv2wrapper) RemoveNetworkPolicy

func (Hnsv2wrapper) RemoveNetworkPolicy(network *hcn.HostComputeNetwork, networkPolicy hcn.PolicyNetworkRequest) error

type Hnsv2wrapperFake

type Hnsv2wrapperFake struct {
	Cache FakeHNSCache
	*sync.Mutex
	Delay time.Duration
}

func NewHnsv2wrapperFake

func NewHnsv2wrapperFake() *Hnsv2wrapperFake

func (Hnsv2wrapperFake) AddNamespaceEndpoint

func (f Hnsv2wrapperFake) AddNamespaceEndpoint(namespaceId string, endpointId string) error

func (Hnsv2wrapperFake) AddNetworkPolicy

func (f Hnsv2wrapperFake) AddNetworkPolicy(network *hcn.HostComputeNetwork, networkPolicy hcn.PolicyNetworkRequest) error

func (Hnsv2wrapperFake) ApplyEndpointPolicy

func (f Hnsv2wrapperFake) ApplyEndpointPolicy(endpoint *hcn.HostComputeEndpoint, requestType hcn.RequestType, endpointPolicy hcn.PolicyEndpointRequest) error

func (Hnsv2wrapperFake) CreateEndpoint

func (f Hnsv2wrapperFake) CreateEndpoint(endpoint *hcn.HostComputeEndpoint) (*hcn.HostComputeEndpoint, error)

func (Hnsv2wrapperFake) CreateNetwork

func (f Hnsv2wrapperFake) CreateNetwork(network *hcn.HostComputeNetwork) (*hcn.HostComputeNetwork, error)

NewMockIOShim is dependent on this function never returning an error

func (Hnsv2wrapperFake) DeleteEndpoint

func (f Hnsv2wrapperFake) DeleteEndpoint(endpoint *hcn.HostComputeEndpoint) error

func (Hnsv2wrapperFake) DeleteNetwork

func (f Hnsv2wrapperFake) DeleteNetwork(network *hcn.HostComputeNetwork) error

func (Hnsv2wrapperFake) GetEndpointByID

func (f Hnsv2wrapperFake) GetEndpointByID(endpointID string) (*hcn.HostComputeEndpoint, error)

func (Hnsv2wrapperFake) GetEndpointByName

func (f Hnsv2wrapperFake) GetEndpointByName(endpointName string) (*hcn.HostComputeEndpoint, error)

func (Hnsv2wrapperFake) GetNamespaceByID

func (f Hnsv2wrapperFake) GetNamespaceByID(netNamespacePath string) (*hcn.HostComputeNamespace, error)

func (Hnsv2wrapperFake) GetNetworkByID

func (f Hnsv2wrapperFake) GetNetworkByID(networkID string) (*hcn.HostComputeNetwork, error)

func (Hnsv2wrapperFake) GetNetworkByName

func (f Hnsv2wrapperFake) GetNetworkByName(networkName string) (*hcn.HostComputeNetwork, error)

func (Hnsv2wrapperFake) ListEndpointsOfNetwork

func (f Hnsv2wrapperFake) ListEndpointsOfNetwork(networkId string) ([]hcn.HostComputeEndpoint, error)

func (Hnsv2wrapperFake) ListEndpointsQuery

func (f Hnsv2wrapperFake) ListEndpointsQuery(_ hcn.HostComputeQuery) ([]hcn.HostComputeEndpoint, error)

NOTE: hard assumption that the query just filters for local endpoints via hcn.EndpointFlagsNone

func (Hnsv2wrapperFake) ModifyNetworkSettings

func (f Hnsv2wrapperFake) ModifyNetworkSettings(network *hcn.HostComputeNetwork, request *hcn.ModifyNetworkSettingRequest) error

func (Hnsv2wrapperFake) RemoveNamespaceEndpoint

func (f Hnsv2wrapperFake) RemoveNamespaceEndpoint(namespaceId string, endpointId string) error

func (Hnsv2wrapperFake) RemoveNetworkPolicy

func (f Hnsv2wrapperFake) RemoveNetworkPolicy(network *hcn.HostComputeNetwork, networkPolicy hcn.PolicyNetworkRequest) error

type Hnsv2wrapperwithtimeout

type Hnsv2wrapperwithtimeout struct {
	Hnsv2 HnsV2WrapperInterface
	// hnsCallTimeout indicates the time to wait for hns calls before timing out
	HnsCallTimeout time.Duration
}

func (Hnsv2wrapperwithtimeout) AddNamespaceEndpoint

func (h Hnsv2wrapperwithtimeout) AddNamespaceEndpoint(namespaceId string, endpointId string) error

func (Hnsv2wrapperwithtimeout) AddNetworkPolicy

func (h Hnsv2wrapperwithtimeout) AddNetworkPolicy(network *hcn.HostComputeNetwork, networkPolicy hcn.PolicyNetworkRequest) error

func (Hnsv2wrapperwithtimeout) ApplyEndpointPolicy

func (h Hnsv2wrapperwithtimeout) ApplyEndpointPolicy(endpoint *hcn.HostComputeEndpoint, requestType hcn.RequestType, endpointPolicy hcn.PolicyEndpointRequest) error

func (Hnsv2wrapperwithtimeout) CreateEndpoint

func (Hnsv2wrapperwithtimeout) CreateNetwork

func (Hnsv2wrapperwithtimeout) DeleteEndpoint

func (h Hnsv2wrapperwithtimeout) DeleteEndpoint(endpoint *hcn.HostComputeEndpoint) error

func (Hnsv2wrapperwithtimeout) DeleteNetwork

func (h Hnsv2wrapperwithtimeout) DeleteNetwork(network *hcn.HostComputeNetwork) error

func (Hnsv2wrapperwithtimeout) GetEndpointByID

func (h Hnsv2wrapperwithtimeout) GetEndpointByID(endpointId string) (*hcn.HostComputeEndpoint, error)

func (Hnsv2wrapperwithtimeout) GetEndpointByName

func (h Hnsv2wrapperwithtimeout) GetEndpointByName(endpointName string) (*hcn.HostComputeEndpoint, error)

func (Hnsv2wrapperwithtimeout) GetNamespaceByID

func (h Hnsv2wrapperwithtimeout) GetNamespaceByID(netNamespacePath string) (*hcn.HostComputeNamespace, error)

func (Hnsv2wrapperwithtimeout) GetNetworkByID

func (h Hnsv2wrapperwithtimeout) GetNetworkByID(networkId string) (*hcn.HostComputeNetwork, error)

func (Hnsv2wrapperwithtimeout) GetNetworkByName

func (h Hnsv2wrapperwithtimeout) GetNetworkByName(networkName string) (*hcn.HostComputeNetwork, error)

func (Hnsv2wrapperwithtimeout) ListEndpointsOfNetwork

func (h Hnsv2wrapperwithtimeout) ListEndpointsOfNetwork(networkId string) ([]hcn.HostComputeEndpoint, error)

func (Hnsv2wrapperwithtimeout) ListEndpointsQuery

func (h Hnsv2wrapperwithtimeout) ListEndpointsQuery(query hcn.HostComputeQuery) ([]hcn.HostComputeEndpoint, error)

NOTE see assumptions of hnsv2wrapperfake.ListEndpointsQuery

func (Hnsv2wrapperwithtimeout) ModifyNetworkSettings

func (h Hnsv2wrapperwithtimeout) ModifyNetworkSettings(network *hcn.HostComputeNetwork, request *hcn.ModifyNetworkSettingRequest) error

func (Hnsv2wrapperwithtimeout) RemoveNamespaceEndpoint

func (h Hnsv2wrapperwithtimeout) RemoveNamespaceEndpoint(namespaceId string, endpointId string) error

func (Hnsv2wrapperwithtimeout) RemoveNetworkPolicy

func (h Hnsv2wrapperwithtimeout) RemoveNetworkPolicy(network *hcn.HostComputeNetwork, networkPolicy hcn.PolicyNetworkRequest) error

type ListEndpointsFuncResult

type ListEndpointsFuncResult struct {
	Err error
	// contains filtered or unexported fields
}

type NetworkFuncResult

type NetworkFuncResult struct {
	Err error
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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