client

package
v0.0.0-...-ba854f2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 24 Imported by: 50

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) ContainerCheckpointCreate

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

ContainerCheckpointCreate creates container checkpoint.

func (*APIClient) ContainerCheckpointDelete

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

ContainerCheckpointDelete deletes a checkpoint from container

func (*APIClient) ContainerCheckpointList

func (client *APIClient) ContainerCheckpointList(ctx context.Context, name string, options types.CheckpointListOptions) ([]string, error)

ContainerCheckpointList lists all checkpoints of a container

func (*APIClient) ContainerCommit

func (client *APIClient) ContainerCommit(ctx context.Context, name string, options types.ContainerCommitOptions) (*types.ContainerCommitResp, error)

ContainerCommit creates an image from 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) ContainerExecResize

func (client *APIClient) ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error

ContainerExecResize changes the size of the tty for an exec process running inside a container.

func (*APIClient) ContainerGet

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

ContainerGet returns the detailed information of container.

func (*APIClient) ContainerKill

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

ContainerKill kill a container.

func (*APIClient) ContainerList

func (client *APIClient) ContainerList(ctx context.Context, option types.ContainerListOptions) ([]*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 string, options types.ContainerStartOptions) 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) ContainerStatPath

func (client *APIClient) ContainerStatPath(ctx context.Context, name string, path string) (types.ContainerPathStat, error)

ContainerStatPath returns Stat information about a path inside the container filesystem.

func (*APIClient) ContainerStats

func (client *APIClient) ContainerStats(ctx context.Context, name string, stream bool) (io.ReadCloser, error)

ContainerStats return the stats related container in an io.ReadCloser.

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.ContainerUpgradeConfig) 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) CopyFromContainer

func (client *APIClient) CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)

CopyFromContainer gets the content from the container and returns it as a Reader to manipulate it in the host. It's up to the caller to close the reader.

func (*APIClient) CopyToContainer

func (client *APIClient) CopyToContainer(ctx context.Context, container, path string, content io.Reader) error

CopyToContainer copies content into the container filesystem.

func (*APIClient) DaemonUpdate

func (client *APIClient) DaemonUpdate(ctx context.Context, config *types.DaemonUpdateConfig) error

DaemonUpdate requests daemon to update daemon config.

func (*APIClient) Events

func (client *APIClient) Events(ctx context.Context, since string, until string, f filters.Args) (io.ReadCloser, error)

Events returns a stream of events in the daemon in a ReadClosed. It's up to the caller to close the stream.

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) ImageHistory

func (client *APIClient) ImageHistory(ctx context.Context, name string) ([]types.HistoryResultItem, error)

ImageHistory requests daemon to get history of an image.

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, filter filters.Args) ([]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) ImagePush

func (client *APIClient) ImagePush(ctx context.Context, ref, encodedAuth string) (io.ReadCloser, error)

ImagePush requests daemon to push an image to registry.

func (*APIClient) ImageRemove

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

ImageRemove deletes an image.

func (*APIClient) ImageSave

func (client *APIClient) ImageSave(ctx context.Context, imageName string) (io.ReadCloser, error)

ImageSave requests daemon to save an image to a tar archive.

func (*APIClient) ImageSearch

func (client *APIClient) ImageSearch(ctx context.Context, term, registry, encodedAuth string) ([]types.SearchResultItem, error)

ImageSearch requests daemon to search an image from registry.

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, filter filters.Args) (*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 string, options types.ContainerStartOptions) error
	ContainerStop(ctx context.Context, name, timeout string) error
	ContainerKill(ctx context.Context, name, signal string) error
	ContainerRemove(ctx context.Context, name string, options *types.ContainerRemoveOptions) error
	ContainerList(ctx context.Context, option types.ContainerListOptions) ([]*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)
	ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) 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.ContainerUpgradeConfig) 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)
	ContainerCheckpointCreate(ctx context.Context, name string, options types.CheckpointCreateOptions) error
	ContainerCheckpointList(ctx context.Context, name string, options types.CheckpointListOptions) ([]string, error)
	ContainerCheckpointDelete(ctx context.Context, name string, options types.CheckpointDeleteOptions) error
	ContainerCommit(ctx context.Context, name string, options types.ContainerCommitOptions) (*types.ContainerCommitResp, error)
	ContainerStats(ctx context.Context, name string, stream bool) (io.ReadCloser, error)
	ContainerStatPath(ctx context.Context, name string, path string) (types.ContainerPathStat, error)
	CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
	CopyToContainer(ctx context.Context, container, path string, content io.Reader) error
}

ContainerAPIClient defines methods of Container client.

type ImageAPIClient

type ImageAPIClient interface {
	ImageList(ctx context.Context, filters filters.Args) ([]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
	ImageSave(ctx context.Context, imageName string) (io.ReadCloser, error)
	ImageHistory(ctx context.Context, name string) ([]types.HistoryResultItem, error)
	ImagePush(ctx context.Context, ref, encodedAuth string) (io.ReadCloser, error)
	ImageSearch(ctx context.Context, term, registry, encodedAuth string) ([]types.SearchResultItem, 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
	Header     http.Header
	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)
	DaemonUpdate(ctx context.Context, daemonConfig *types.DaemonUpdateConfig) error
	Events(ctx context.Context, since string, until string, filters filters.Args) (io.ReadCloser, 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,omitempty"`
	ManagerWhiteList string `json:"manager-whitelist,omitempty"`
}

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, filter filters.Args) (*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