client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HTTP string
	HTTP = "http"
	// HTTPS string
	HTTPS = "https"
)
View Source
const DefaultOceHost = "http://127.0.0.1:12309/api/v1"

DefaultOceHost default oce server host

Variables

This section is empty.

Functions

func ErrorConnectionFailed

func ErrorConnectionFailed(host string) error

ErrorConnectionFailed returns an error with host in the error message when connection to oce daemon failed.

func IsErrConfigNotFound deprecated

func IsErrConfigNotFound(err error) bool

IsErrConfigNotFound returns true if the error is caused when a config is not found.

Deprecated: Use IsErrNotFound

func IsErrConnectionFailed

func IsErrConnectionFailed(err error) bool

IsErrConnectionFailed returns true if the error is caused by connection failed.

func IsErrContainerNotFound deprecated

func IsErrContainerNotFound(err error) bool

IsErrContainerNotFound returns true if the error is caused when a container is not found in the oce host.

Deprecated: Use IsErrNotFound

func IsErrImageNotFound deprecated

func IsErrImageNotFound(err error) bool

IsErrImageNotFound returns true if the error is caused when an image is not found in the oce host.

Deprecated: Use IsErrNotFound

func IsErrNetworkNotFound deprecated

func IsErrNetworkNotFound(err error) bool

IsErrNetworkNotFound returns true if the error is caused when a network is not found in the oce host.

Deprecated: Use IsErrNotFound

func IsErrNodeNotFound deprecated

func IsErrNodeNotFound(err error) bool

IsErrNodeNotFound returns true if the error is caused when a node is not found.

Deprecated: Use IsErrNotFound

func IsErrNotFound

func IsErrNotFound(err error) bool

IsErrNotFound returns true if the error is a NotFound error, which is returned by the API when some object is not found.

func IsErrNotImplemented

func IsErrNotImplemented(err error) bool

IsErrNotImplemented returns true if the error is a NotImplemented error. This is returned by the API when a requested feature has not been implemented.

func IsErrPluginNotFound deprecated

func IsErrPluginNotFound(err error) bool

IsErrPluginNotFound returns true if the error is caused when a plugin is not found in the oce host.

Deprecated: Use IsErrNotFound

func IsErrPluginPermissionDenied

func IsErrPluginPermissionDenied(err error) bool

IsErrPluginPermissionDenied returns true if the error is caused when a user denies a plugin's permissions

func IsErrSecretNotFound deprecated

func IsErrSecretNotFound(err error) bool

IsErrSecretNotFound returns true if the error is caused when a secret is not found.

Deprecated: Use IsErrNotFound

func IsErrServiceNotFound deprecated

func IsErrServiceNotFound(err error) bool

IsErrServiceNotFound returns true if the error is caused when a service is not found.

Deprecated: Use IsErrNotFound

func IsErrTaskNotFound deprecated

func IsErrTaskNotFound(err error) bool

IsErrTaskNotFound returns true if the error is caused when a task is not found.

Deprecated: Use IsErrNotFound

func IsErrUnauthorized

func IsErrUnauthorized(err error) bool

IsErrUnauthorized returns true if the error is caused when a remote registry authentication fails

func IsErrVolumeNotFound deprecated

func IsErrVolumeNotFound(err error) bool

IsErrVolumeNotFound returns true if the error is caused when a volume is not found in the oce host.

Deprecated: Use IsErrNotFound

func ParseHostURL

func ParseHostURL(host string) (*url.URL, error)

ParseHostURL parses a url string, validates the string is a host url, and returns the parsed URL

Types

type Client

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

Client is the API client that performs all operations against a oce server.

func NewClient

func NewClient(host string, client *http.Client, httpHeaders map[string]string) (*Client, error)

NewClient initializes a new API client for the given host. It uses the given http client as transport. It also initializes the custom http headers to add to each request.

func (*Client) Balance

func (cli *Client) Balance(ctx context.Context, req *types.Status) (exitResp *types.ChanExitResp, err error)

Balance balance of channel

func (*Client) ChannelCreate

func (cli *Client) ChannelCreate(ctx context.Context, req *types.ChanCreate) (nodeID string, err error)

ChannelCreate create channel

func (*Client) ChannelExit

func (cli *Client) ChannelExit(ctx context.Context, req *types.ChanExit) (exitResp *types.ChanExitResp, err error)

ChannelExit exit channel

func (*Client) ChannelJoin

func (cli *Client) ChannelJoin(ctx context.Context, req *types.ChanJoin) (nodeID string, err error)

ChannelJoin join channel

func (*Client) Close

func (cli *Client) Close() error

Close the transport used by the client

func (*Client) Health

func (cli *Client) Health(ctx context.Context) (*types.Health, error)

Health check oce deamon health

func (*Client) Shutdown

func (cli *Client) Shutdown(ctx context.Context) error

Shutdown shutdown oce deamon

func (*Client) Status

func (cli *Client) Status(ctx context.Context, status *types.Status) error

Status status

func (*Client) Trade

func (cli *Client) Trade(ctx context.Context, trade *types.Trade) error

Trade trade

type HealthResponse

type HealthResponse struct {
	Data types.Health `json:"data"`
	// contains filtered or unexported fields
}

HealthResponse 健康检查返回结果定义

Directories

Path Synopsis
Package sockets provides helper functions to create and configure Unix or TCP sockets.
Package sockets provides helper functions to create and configure Unix or TCP sockets.

Jump to

Keyboard shortcuts

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