Version: v1.8.21 Latest Latest

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

Go to latest
Published: Dec 6, 2019 License: GPL-3.0 Imports: 8 Imported by: 1




This section is empty.


This section is empty.


This section is empty.


type Client

type Client interface {
	//ContainerAttach attaches a connection to a container in the server. It returns a types.HijackedConnection with
	//the hijacked connection and the a reader to get output. It's up to the called to close
	//the hijacked connection by calling types.HijackedResponse.Close.
	ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)

	//ContainerCreate creates a new container based in the given configuration. It can be associated with a name, but it's not mandatory.
	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig,
		networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)

	//ContainerList returns the list of containers in the docker host.
	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)

	//ContainerRemove kills and removes a container from the docker host.
	ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error

	//ContainerStart sends a request to the docker daemon to start a container.
	ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error

	//CopyToContainer copies content into the container filesystem. Note that `content` must be a Reader for a TAR archive
	CopyToContainer(ctx context.Context, containerID, dstPath string, content io.Reader,
		options types.CopyToContainerOptions) error

	//ImageList returns a list of images in the docker host
	ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)

	//ImageLoad is used to upload a docker image
	ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)

	//ImagePull is used to pull a docker image
	ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error)

	//NetworkCreate sends a request to the docker daemon to create a network
	NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)

	//NetworkConnect connects a container to an existent network in the docker host.
	NetworkConnect(ctx context.Context, networkID, containerID string, config *network.EndpointSettings) error

	//NetworkDisconnect disconnects a container from an existent network in the docker host.
	NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error

	//NetworkInspect returns the information for a specific network configured in the docker host.
	NetworkInspect(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, error)

	//NetworkRemove sends a request to the docker daemon to remove a network
	NetworkRemove(ctx context.Context, networkID string) error

	//NetworkList lists the networks known to the docker daemon
	NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)

	VolumeCreate(ctx context.Context, options volume.VolumeCreateBody) (types.Volume, error)

	//VolumeList returns the volumes configured in the docker host.
	VolumeList(ctx context.Context, filter filters.Args) (volume.VolumeListOKBody, error)

	//VolumeRemove removes a volume from the docker host.
	VolumeRemove(ctx context.Context, volumeID string, force bool) error

Client is an interface which contains the needed methods from the docker client

type DockerConfig

type DockerConfig struct {
	//CACertPath is the filepath to the CA Certificate
	CACertPath string `json:"caCertPath"`
	//CertPath is the filepath to the Certificate for TLS
	CertPath string `json:"certPath"`
	//KeyPath is the filepath to the private key for TLS
	KeyPath string `json:"keyPath"`
	//LocalMode causes the TLS parameters to be ignored and Genesis
	//to assume that the docker daemon is on the local machine
	LocalMode bool `json:"localMode"`

DockerConfig represents the configuration needed to communicate with docker daemons

type RestConfig

type RestConfig struct {
	//Listen is the socket to listen on
	Listen string `json:"listen"`

RestConfig represents the configuration needed for the REST API

type Result

type Result struct {
	// Error is where the error is stored if this result is not a successful result
	Error error
	// Type is the type of result
	Type ResultType

Result is the result of executing the command, contains a type and possibly an error

func NewAllDoneResult

func NewAllDoneResult() Result

NewAllDoneResult creates a result for the all done condition

func NewErrorResult

func NewErrorResult(err interface{}) Result

NewErrorResult creates a result which indicates a non-fatal error. Commands with this result should be requeued.

func NewFatalResult

func NewFatalResult(err interface{}) Result

NewFatalResult creates a fatal error result. Commands with fatal errors are not retried

func NewRequeueResult added in v1.8.21

func NewRequeueResult() Result

NewRequeueResult creates a new requeue result non-error

func NewSuccessResult

func NewSuccessResult() Result

NewSuccessResult indicates a successful result

func (Result) IsAllDone

func (res Result) IsAllDone() bool

IsAllDone checks whether the request is completely finished. If true, then the completion protocol should be followed

func (Result) IsFatal

func (res Result) IsFatal() bool

IsFatal returns true if there is an errr and it is marked as a fatal error, meaning it should not be reattempted

func (Result) IsRequeue

func (res Result) IsRequeue() bool

IsRequeue returns true if this result indicates that the command should be retried at a later time

func (Result) IsSuccess

func (res Result) IsSuccess() bool

IsSuccess returns whether or not the result indicates success. Both AllDoneType and SuccessType count as being successful

type ResultType

type ResultType int

ResultType is the type of the result

const (
	//SuccessType is the type of a successful result
	SuccessType ResultType = iota + 1

	// AllDoneType is the type for when all of the commands executed successfully and
	// there are not anymore commands to execute

	//TooSoonType is the type of a result from a cmd which tried to execute too soon
	//FatalType is the type of a result which indicates a fatal error
	//ErrorType is the generic error type

	//RequeueType is when there is no error but should requeue something

Jump to

Keyboard shortcuts

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