client

package
v0.0.0-...-43d1ab5 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDockerHost = "unix:///var/run/docker.sock"

DefaultDockerHost defines os specific default if DOCKER_HOST is unset

Variables

View Source
var ErrRedirect = errors.New("unexpected redirect in response")

ErrRedirect returned when unexpected redirects encountered

Functions

func ErrorConnectionFailed

func ErrorConnectionFailed(host string) error

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

func IsErrConnectionFailed

func IsErrConnectionFailed(err error) bool

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

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 IsErrPluginPermissionDenied

func IsErrPluginPermissionDenied(err error) bool

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

func IsErrUnauthorized

func IsErrUnauthorized(err error) bool

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

Types

type Client

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

Client is designed to augment the existing Docker API Client with Stacks support

func NewClientWithSettings

func NewClientWithSettings(settings Settings) (*Client, error)

NewClientWithSettings creates a new Stack client with settings

func (*Client) NewVersionError

func (cli *Client) NewVersionError(APIrequired, feature string) error

NewVersionError returns an error if the APIVersion required if less than the current supported version

func (*Client) StackCreate

func (cli *Client) StackCreate(ctx context.Context, spec types.StackSpec, options types.StackCreateOptions) (types.StackCreateResponse, error)

StackCreate creates a new Stack

func (*Client) StackDelete

func (cli *Client) StackDelete(ctx context.Context, id string) error

StackDelete returns the details of a Stack

func (*Client) StackInspect

func (cli *Client) StackInspect(ctx context.Context, id string) (types.Stack, error)

StackInspect returns the details of a Stack

func (*Client) StackList

func (cli *Client) StackList(ctx context.Context, options types.StackListOptions) ([]types.Stack, error)

StackList returns the list of Stacks on the server

func (*Client) StackUpdate

func (cli *Client) StackUpdate(ctx context.Context, id string, version types.Version, spec types.StackSpec, options types.StackUpdateOptions) error

StackUpdate updates an existing Stack

type Settings

type Settings struct {
	// scheme sets the scheme for the client
	Scheme string
	// host holds the server address to connect to
	Host string
	// proto holds the client protocol i.e. unix.
	Proto string
	// addr holds the client address.
	Addr string
	// basePath holds the path to prepend to the requests.
	BasePath string
	// client used to send and receive http requests.
	Client *http.Client
	// version of the server to talk to.
	Version string
	// custom http headers configured by users.
	CustomHTTPHeaders map[string]string
}

Settings stores the settings in use by this client

TODO this should move to a common pkg for sub-client implementations to leverage.

func SettingsFromEnv

func SettingsFromEnv() (*Settings, error)

SettingsFromEnv creates a Settings based on the standard Docker env vars

type StackAPIClient

type StackAPIClient interface {
	StackCreate(ctx context.Context, stack types.StackSpec, options types.StackCreateOptions) (types.StackCreateResponse, error)
	StackInspect(ctx context.Context, id string) (types.Stack, error)
	StackList(ctx context.Context, options types.StackListOptions) ([]types.Stack, error)
	StackUpdate(ctx context.Context, id string, version types.Version, spec types.StackSpec, options types.StackUpdateOptions) error
	StackDelete(ctx context.Context, id string) error
}

StackAPIClient defines the client interface for managing Stacks

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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