client

package
v1.4.21 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (

	// DefaultTimeout default timeout duration for CNS Client.
	DefaultTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound tests if the provided error is of type CNSClientError and then further tests if the error code is of type UnknowContainerID

Types

type CNSClientError

type CNSClientError struct {
	Code types.ResponseCode
	Err  error
}

CNSClientError records an error and relevant code

func (*CNSClientError) Error

func (e *CNSClientError) Error() string

type Client

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

Client specifies a client to connect to Ipam Plugin.

func New

func New(baseURL string, requestTimeout time.Duration) (*Client, error)

New returns a new CNS client configured with the passed URL and timeout.

func (*Client) CreateHostNCApipaEndpoint

func (c *Client) CreateHostNCApipaEndpoint(ctx context.Context, networkContainerID string) (string, error)

CreateHostNCApipaEndpoint creates an endpoint in APIPA network for host container connectivity.

func (*Client) DeleteHostNCApipaEndpoint

func (c *Client) DeleteHostNCApipaEndpoint(ctx context.Context, networkContainerID string) error

DeleteHostNCApipaEndpoint deletes the endpoint in APIPA network created for host container connectivity.

func (*Client) GetHTTPServiceData

func (c *Client) GetHTTPServiceData(ctx context.Context) (*restserver.GetHTTPServiceDataResponse, error)

GetHTTPServiceData gets all public in-memory struct details for debugging purpose

func (*Client) GetIPAddressesMatchingStates

func (c *Client) GetIPAddressesMatchingStates(ctx context.Context, stateFilter ...types.IPState) ([]cns.IPConfigurationStatus, error)

GetIPAddressesMatchingStates takes a variadic number of string parameters, to get all IP Addresses matching a number of states usage GetIPAddressesWithStates(ctx, types.Available...)

func (*Client) GetNetworkConfiguration added in v1.4.13

func (c *Client) GetNetworkConfiguration(ctx context.Context, orchestratorContext []byte) (*cns.GetNetworkContainerResponse, error)

GetNetworkConfiguration Request to get network config.

func (*Client) GetPodOrchestratorContext

func (c *Client) GetPodOrchestratorContext(ctx context.Context) (map[string]string, error)

GetPodOrchestratorContext calls GetPodIpOrchestratorContext API on CNS

func (*Client) ReleaseIPAddress

func (c *Client) ReleaseIPAddress(ctx context.Context, ipconfig cns.IPConfigRequest) error

ReleaseIPAddress calls releaseIPAddress on CNS, ipaddress ex: (10.0.0.1)

func (*Client) RequestIPAddress

func (c *Client) RequestIPAddress(ctx context.Context, ipconfig cns.IPConfigRequest) (*cns.IPConfigResponse, error)

RequestIPAddress calls the requestIPAddress in CNS

Jump to

Keyboard shortcuts

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