Documentation ¶
Overview ¶
Package client is a containerz grpc client.
Index ¶
- Variables
- type Client
- func (c *Client) CreateVolume(ctx context.Context, name, driver string, labels, options map[string]string) (string, error)
- func (c *Client) ListContainer(ctx context.Context, all bool, limit int32, filter map[string][]string) (<-chan *ContainerInfo, error)
- func (c *Client) ListImage(ctx context.Context, limit int32, filter map[string][]string) (<-chan *ImageInfo, error)
- func (c *Client) ListPlugin(ctx context.Context, instance string) ([]*cpb.Plugin, error)
- func (c *Client) ListVolume(ctx context.Context, filter map[string][]string) (<-chan *VolumeInfo, error)
- func (c *Client) Logs(ctx context.Context, instance string, follow bool) (<-chan *LogMessage, error)
- func (c *Client) PullImage(ctx context.Context, image string, tag string, creds *tpb.Credentials) (<-chan *Progress, error)
- func (c *Client) PushImage(ctx context.Context, image string, tag string, file string, isPlugin bool) (<-chan *Progress, error)
- func (c *Client) RemoveContainer(ctx context.Context, cnt string, forceopt ...bool) error
- func (c *Client) RemoveImage(ctx context.Context, image string, tag string, force bool) error
- func (c *Client) RemovePlugin(ctx context.Context, instance string) error
- func (c *Client) RemoveVolume(ctx context.Context, name string, force bool) error
- func (c *Client) StartContainer(ctx context.Context, image string, tag string, cmd string, instance string, ...) (string, error)
- func (c *Client) StartPlugin(ctx context.Context, name, instance, configFile string) error
- func (c *Client) StopContainer(ctx context.Context, instance string, force bool) error
- func (c *Client) StopPlugin(ctx context.Context, instance string) error
- func (c *Client) UpdateContainer(ctx context.Context, image string, tag string, cmd string, instance string, ...) (string, error)
- type ContainerInfo
- type ImageInfo
- type LogMessage
- type Progress
- type StartOption
- func WithCPUs(cpus float64) StartOption
- func WithCapabilities(add, remove []string) StartOption
- func WithEnv(envs []string) StartOption
- func WithHardLimit(mem int64) StartOption
- func WithLabels(labels map[string]string) StartOption
- func WithNetwork(network string) StartOption
- func WithPorts(ports []string) StartOption
- func WithRestartPolicy(policy string) StartOption
- func WithRunAs(runAs string) StartOption
- func WithSoftLimit(mem int64) StartOption
- func WithVolumes(volumes []string) StartOption
- type State
- type VolumeInfo
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound indicates that the specified image was not found on the target system. ErrNotFound = status.Error(codes.NotFound, "resource was not found") // ErrRunning indicates that there is a container running this image. ErrRunning = status.Error(codes.FailedPrecondition, "resource is running") )
var ( // Dial is the dailer to use to read containerz Dial = grpc.DialContext )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a grpc containerz client.
func NewClientWithConn ¶
func NewClientWithConn(conn *grpc.ClientConn) *Client
NewClientWithConn creates a client given a ClientConn.
func (*Client) CreateVolume ¶
func (c *Client) CreateVolume(ctx context.Context, name, driver string, labels, options map[string]string) (string, error)
CreateVolume creates a volume. If the name is empty, the target system will create one. The driver default to the target defined option.
func (*Client) ListContainer ¶
func (c *Client) ListContainer(ctx context.Context, all bool, limit int32, filter map[string][]string) (<-chan *ContainerInfo, error)
ListContainer implements the client logic for listing the existing containers on the target system.
func (*Client) ListImage ¶
func (c *Client) ListImage(ctx context.Context, limit int32, filter map[string][]string) (<-chan *ImageInfo, error)
ListImage implements the client logic for listing the existing images on the target system.
func (*Client) ListPlugin ¶
ListPlugin lists the plugins present on the target.
func (*Client) ListVolume ¶
func (c *Client) ListVolume(ctx context.Context, filter map[string][]string) (<-chan *VolumeInfo, error)
ListVolume implements the client logic for listing the existing volumes on the target system.
func (*Client) Logs ¶
func (c *Client) Logs(ctx context.Context, instance string, follow bool) (<-chan *LogMessage, error)
Logs retrieves the logs for a given container. It can optionally follow the logs as they are being produced.
func (*Client) PullImage ¶
func (c *Client) PullImage(ctx context.Context, image string, tag string, creds *tpb.Credentials) (<-chan *Progress, error)
PullImage implements the client logic for the target to pull an image from a remote location.
func (*Client) PushImage ¶
func (c *Client) PushImage(ctx context.Context, image string, tag string, file string, isPlugin bool) (<-chan *Progress, error)
PushImage implements the client logic to push an image to the target containerz server.
func (*Client) RemoveContainer ¶
RemoveContainer removes an image from the target system. It returns nil upon success. Otherwise it returns an error indicating whether the image was not found or is associated to running container.
Deprecated -- Use ImageRemove instead.
func (*Client) RemoveImage ¶
RemoveImage removes an image from the target system. It returns nil upon success. Otherwise it returns an error indicating whether the image was not found or is associated to running container.
func (*Client) RemovePlugin ¶
RemovePlugin removes the requested plugin identified by instance.
func (*Client) RemoveVolume ¶
func (*Client) StartContainer ¶
func (c *Client) StartContainer(ctx context.Context, image string, tag string, cmd string, instance string, opts ...StartOption) (string, error)
StartContainer starts a container with the provided configuration and returns its instance name if the operation succeeded or an error otherwise.
func (*Client) StartPlugin ¶
StartPlugin starts the requested plugin identified by instance.
func (*Client) StopContainer ¶
StopContainer stops the requested instance. Stop can also force termination.
func (*Client) StopPlugin ¶
StopPlugin stops the requested plugin identified by instance.
func (*Client) UpdateContainer ¶
func (c *Client) UpdateContainer(ctx context.Context, image string, tag string, cmd string, instance string, async bool, opts ...StartOption) (string, error)
UpdateContainer updates an existing container with the provided configuration and returns its instance name if the operation succeeded or an error otherwise.
type ContainerInfo ¶
ContainerInfo contains information about a container on the target system.
type LogMessage ¶
LogMessage contains the log message retrieved from the target system as well as any error that may have occurred
type StartOption ¶
type StartOption func(*startOptions)
StartOption is an option passed to a start container call.
func WithCPUs ¶
func WithCPUs(cpus float64) StartOption
WithCPUs sets the CPU limit to be passed to the start operation.
func WithCapabilities ¶
func WithCapabilities(add, remove []string) StartOption
WithCapabilities sets the capablities to be passed to the start operation.
func WithEnv ¶
func WithEnv(envs []string) StartOption
WithEnv sets the environment to be passed to the start operation.
func WithHardLimit ¶
func WithHardLimit(mem int64) StartOption
WithHardLimit sets the hard memory limit to be passed to the start operation.
func WithLabels ¶
func WithLabels(labels map[string]string) StartOption
WithLabels sets the labels to be passed to the start operation.
func WithNetwork ¶
func WithNetwork(network string) StartOption
WithNetwork sets the network to be passed to the start operation.
func WithPorts ¶
func WithPorts(ports []string) StartOption
WithPorts sets the ports to be passed to the start operation.
func WithRestartPolicy ¶
func WithRestartPolicy(policy string) StartOption
WithRestartPolicy sets the restart policy to be passed to the start operation.
func WithRunAs ¶
func WithRunAs(runAs string) StartOption
WithRunAs sets the run user and group to be passed to the start operation.
func WithSoftLimit ¶
func WithSoftLimit(mem int64) StartOption
WithSoftLimit sets the soft memory limit to be passed to the start operation.
func WithVolumes ¶
func WithVolumes(volumes []string) StartOption
WithVolumes sets the volumes to be passed to the start operation.