client

package
v0.0.0-...-a79519d Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	HTTPCli *http.Client
	// contains filtered or unexported fields
}

APIClient is a API client that performs all operations against a pouch server

func (*APIClient) BaseURL

func (client *APIClient) BaseURL() string

BaseURL returns the base URL of APIClient

func (*APIClient) ContainerAttach

func (client *APIClient) ContainerAttach(ctx context.Context, name string, stdin bool) (net.Conn, *bufio.Reader, error)

ContainerAttach attachs a container.

func (*APIClient) ContainerCreate

func (client *APIClient) ContainerCreate(ctx context.Context, config types.ContainerConfig, hostConfig *types.HostConfig, networkingConfig *types.NetworkingConfig, containerName string) (*types.ContainerCreateResp, error)

ContainerCreate creates a new container based in the given configuration.

func (*APIClient) ContainerCreateExec

func (client *APIClient) ContainerCreateExec(ctx context.Context, name string, config *types.ExecCreateConfig) (*types.ExecCreateResp, error)

ContainerCreateExec creates exec process.

func (*APIClient) ContainerExecInspect

func (client *APIClient) ContainerExecInspect(ctx context.Context, execid string) (*types.ContainerExecInspect, error)

ContainerExecInspect get exec info with a specified exec id.

func (*APIClient) ContainerGet

func (client *APIClient) ContainerGet(ctx context.Context, name string) (*types.ContainerJSON, error)

ContainerGet returns the detailed information of container.

func (*APIClient) ContainerList

func (client *APIClient) ContainerList(ctx context.Context, all bool) ([]*types.Container, error)

ContainerList returns the list of containers.

func (*APIClient) ContainerLogs

func (client *APIClient) ContainerLogs(ctx context.Context, name string, options types.ContainerLogsOptions) (io.ReadCloser, error)

ContainerLogs return the logs generated by a container in an io.ReadCloser.

func (*APIClient) ContainerPause

func (client *APIClient) ContainerPause(ctx context.Context, name string) error

ContainerPause pauses a container.

func (*APIClient) ContainerRemove

func (client *APIClient) ContainerRemove(ctx context.Context, name string, options *types.ContainerRemoveOptions) error

ContainerRemove removes a container.

func (*APIClient) ContainerRename

func (client *APIClient) ContainerRename(ctx context.Context, id string, name string) error

ContainerRename renames a container.

func (*APIClient) ContainerResize

func (client *APIClient) ContainerResize(ctx context.Context, name, height, width string) error

ContainerResize resizes the size of container tty.

func (*APIClient) ContainerRestart

func (client *APIClient) ContainerRestart(ctx context.Context, name string, timeout string) error

ContainerRestart restarts a running container.

func (*APIClient) ContainerStart

func (client *APIClient) ContainerStart(ctx context.Context, name, detachKeys string) error

ContainerStart starts a created container.

func (*APIClient) ContainerStartExec

func (client *APIClient) ContainerStartExec(ctx context.Context, execid string, config *types.ExecStartConfig) (net.Conn, *bufio.Reader, error)

ContainerStartExec starts exec process.

func (*APIClient) ContainerStop

func (client *APIClient) ContainerStop(ctx context.Context, name string, timeout string) error

ContainerStop stops a container.

func (*APIClient) ContainerTop

func (client *APIClient) ContainerTop(ctx context.Context, name string, arguments []string) (types.ContainerProcessList, error)

ContainerTop shows process information from within a container.

func (*APIClient) ContainerUnpause

func (client *APIClient) ContainerUnpause(ctx context.Context, name string) error

ContainerUnpause unpauses a container.

func (*APIClient) ContainerUpdate

func (client *APIClient) ContainerUpdate(ctx context.Context, name string, config *types.UpdateConfig) error

ContainerUpdate updates the configurations of a container.

func (*APIClient) ContainerUpgrade

func (client *APIClient) ContainerUpgrade(ctx context.Context, name string, config types.ContainerConfig, hostConfig *types.HostConfig) error

ContainerUpgrade upgrade a container with new image and args.

func (*APIClient) ContainerWait

func (client *APIClient) ContainerWait(ctx context.Context, name string) (types.ContainerWaitOKBody, error)

ContainerWait pauses execution until a container exits. It returns the API status code as response of its readiness.

func (*APIClient) GetAPIPath

func (client *APIClient) GetAPIPath(path string, query url.Values) string

GetAPIPath returns the versioned request path to call the api. It appends the query parameters to the path if they are not empty.

func (*APIClient) ImageInspect

func (client *APIClient) ImageInspect(ctx context.Context, name string) (types.ImageInfo, error)

ImageInspect requests daemon to inspect an image.

func (*APIClient) ImageList

func (client *APIClient) ImageList(ctx context.Context) ([]types.ImageInfo, error)

ImageList requests daemon to list all images

func (*APIClient) ImageLoad

func (client *APIClient) ImageLoad(ctx context.Context, imageName string, reader io.Reader) error

ImageLoad requests daemon to load an image from tarstream.

func (*APIClient) ImagePull

func (client *APIClient) ImagePull(ctx context.Context, name, tag, encodedAuth string) (io.ReadCloser, error)

ImagePull requests daemon to pull an image from registry.

func (*APIClient) ImageRemove

func (client *APIClient) ImageRemove(ctx context.Context, name string, force bool) error

ImageRemove deletes an image.

func (*APIClient) ImageTag

func (client *APIClient) ImageTag(ctx context.Context, image string, tag string) error

ImageTag creates tag for the image.

func (*APIClient) NetworkConnect

func (client *APIClient) NetworkConnect(ctx context.Context, network string, req *types.NetworkConnect) error

NetworkConnect connects a container to a network.

func (*APIClient) NetworkCreate

func (client *APIClient) NetworkCreate(ctx context.Context, req *types.NetworkCreateConfig) (*types.NetworkCreateResp, error)

NetworkCreate creates a network.

func (*APIClient) NetworkDisconnect

func (client *APIClient) NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error

NetworkDisconnect disconnect a network from a container.

func (*APIClient) NetworkInspect

func (client *APIClient) NetworkInspect(ctx context.Context, networkID string) (*types.NetworkInspectResp, error)

NetworkInspect inspects a network.

func (*APIClient) NetworkList

func (client *APIClient) NetworkList(ctx context.Context) ([]types.NetworkResource, error)

NetworkList lists all the networks.

func (*APIClient) NetworkRemove

func (client *APIClient) NetworkRemove(ctx context.Context, networkID string) error

NetworkRemove removes a network.

func (*APIClient) RegistryLogin

func (client *APIClient) RegistryLogin(ctx context.Context, auth *types.AuthConfig) (*types.AuthResponse, error)

RegistryLogin authenticates the server with a given registry to login.

func (*APIClient) SystemInfo

func (client *APIClient) SystemInfo(ctx context.Context) (*types.SystemInfo, error)

SystemInfo requests daemon for system info.

func (*APIClient) SystemPing

func (client *APIClient) SystemPing(ctx context.Context) (string, error)

SystemPing shows whether server is ok.

func (*APIClient) SystemVersion

func (client *APIClient) SystemVersion(ctx context.Context) (*types.SystemVersion, error)

SystemVersion requests daemon for system version.

func (*APIClient) UpdateClientVersion

func (client *APIClient) UpdateClientVersion(v string)

UpdateClientVersion sets client version new value.

func (*APIClient) VolumeCreate

func (client *APIClient) VolumeCreate(ctx context.Context, config *types.VolumeCreateConfig) (*types.VolumeInfo, error)

VolumeCreate creates a volume.

func (*APIClient) VolumeInspect

func (client *APIClient) VolumeInspect(ctx context.Context, name string) (*types.VolumeInfo, error)

VolumeInspect inspects a volume.

func (*APIClient) VolumeList

func (client *APIClient) VolumeList(ctx context.Context) (*types.VolumeListResp, error)

VolumeList returns the list of volumes.

func (*APIClient) VolumeRemove

func (client *APIClient) VolumeRemove(ctx context.Context, name string) error

VolumeRemove removes a volume.

type CommonAPIClient

CommonAPIClient defines common methods of api client

func NewAPIClient

func NewAPIClient(host string, tls TLSConfig) (CommonAPIClient, error)

NewAPIClient initializes a new API client for the given host

type ContainerAPIClient

type ContainerAPIClient interface {
	ContainerCreate(ctx context.Context, config types.ContainerConfig, hostConfig *types.HostConfig, networkConfig *types.NetworkingConfig, containerName string) (*types.ContainerCreateResp, error)
	ContainerStart(ctx context.Context, name, detachKeys string) error
	ContainerStop(ctx context.Context, name, timeout string) error
	ContainerRemove(ctx context.Context, name string, options *types.ContainerRemoveOptions) error
	ContainerList(ctx context.Context, all bool) ([]*types.Container, error)
	ContainerAttach(ctx context.Context, name string, stdin bool) (net.Conn, *bufio.Reader, error)
	ContainerCreateExec(ctx context.Context, name string, config *types.ExecCreateConfig) (*types.ExecCreateResp, error)
	ContainerStartExec(ctx context.Context, execid string, config *types.ExecStartConfig) (net.Conn, *bufio.Reader, error)
	ContainerExecInspect(ctx context.Context, execid string) (*types.ContainerExecInspect, error)
	ContainerGet(ctx context.Context, name string) (*types.ContainerJSON, error)
	ContainerRename(ctx context.Context, id string, name string) error
	ContainerRestart(ctx context.Context, name string, timeout string) error
	ContainerPause(ctx context.Context, name string) error
	ContainerUnpause(ctx context.Context, name string) error
	ContainerUpdate(ctx context.Context, name string, config *types.UpdateConfig) error
	ContainerUpgrade(ctx context.Context, name string, config types.ContainerConfig, hostConfig *types.HostConfig) error
	ContainerTop(ctx context.Context, name string, arguments []string) (types.ContainerProcessList, error)
	ContainerLogs(ctx context.Context, name string, options types.ContainerLogsOptions) (io.ReadCloser, error)
	ContainerResize(ctx context.Context, name, height, width string) error
	ContainerWait(ctx context.Context, name string) (types.ContainerWaitOKBody, error)
}

ContainerAPIClient defines methods of Container client.

type ImageAPIClient

type ImageAPIClient interface {
	ImageList(ctx context.Context) ([]types.ImageInfo, error)
	ImageInspect(ctx context.Context, name string) (types.ImageInfo, error)
	ImagePull(ctx context.Context, name, tag, encodedAuth string) (io.ReadCloser, error)
	ImageRemove(ctx context.Context, name string, force bool) error
	ImageTag(ctx context.Context, image string, tag string) error
	ImageLoad(ctx context.Context, name string, r io.Reader) error
}

ImageAPIClient defines methods of Image client.

type NetworkAPIClient

type NetworkAPIClient interface {
	NetworkCreate(ctx context.Context, req *types.NetworkCreateConfig) (*types.NetworkCreateResp, error)
	NetworkRemove(ctx context.Context, networkID string) error
	NetworkInspect(ctx context.Context, networkID string) (*types.NetworkInspectResp, error)
	NetworkList(ctx context.Context) ([]types.NetworkResource, error)
	NetworkConnect(ctx context.Context, network string, req *types.NetworkConnect) error
	NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error
}

NetworkAPIClient defines methods of Network client.

type RespError

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

RespError defines the response error.

func (RespError) Code

func (e RespError) Code() int

Code returns the response code

func (RespError) Error

func (e RespError) Error() string

Error implements the error interface.

type Response

type Response struct {
	StatusCode int
	Status     string
	Body       io.ReadCloser
}

Response wraps the http.Response and other states.

type SystemAPIClient

type SystemAPIClient interface {
	SystemPing(ctx context.Context) (string, error)
	SystemVersion(ctx context.Context) (*types.SystemVersion, error)
	SystemInfo(ctx context.Context) (*types.SystemInfo, error)
	RegistryLogin(ctx context.Context, auth *types.AuthConfig) (*types.AuthResponse, error)
}

SystemAPIClient defines methods of System client.

type TLSConfig

type TLSConfig struct {
	CA               string `json:"tlscacert,omitempty"`
	Cert             string `json:"tlscert,omitempty"`
	Key              string `json:"tlskey,omitempty"`
	VerifyRemote     bool   `json:"tlsverify"`
	ManagerWhiteList string `json:"manager-whitelist"`
}

TLSConfig contains information of tls which users can specify

type VolumeAPIClient

type VolumeAPIClient interface {
	VolumeCreate(ctx context.Context, config *types.VolumeCreateConfig) (*types.VolumeInfo, error)
	VolumeRemove(ctx context.Context, name string) error
	VolumeInspect(ctx context.Context, name string) (*types.VolumeInfo, error)
	VolumeList(ctx context.Context) (*types.VolumeListResp, error)
}

VolumeAPIClient defines methods of Volume client.

Jump to

Keyboard shortcuts

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