client/interface.go
7c36a1af
 package client
 
 import (
 	"io"
ec7b6238
 	"net"
7c36a1af
 	"time"
 
 	"github.com/docker/docker/api/types"
7732ca94
 	containertypes "github.com/docker/docker/api/types/container"
d6bd79c1
 	"github.com/docker/docker/api/types/events"
7c36a1af
 	"github.com/docker/docker/api/types/filters"
b462c93e
 	"github.com/docker/docker/api/types/image"
7732ca94
 	networktypes "github.com/docker/docker/api/types/network"
7c36a1af
 	"github.com/docker/docker/api/types/registry"
 	"github.com/docker/docker/api/types/swarm"
29df3bdb
 	volumetypes "github.com/docker/docker/api/types/volume"
7c36a1af
 	"golang.org/x/net/context"
 )
 
 // CommonAPIClient is the common methods between stable and experimental versions of APIClient.
 type CommonAPIClient interface {
10273810
 	ConfigAPIClient
7c36a1af
 	ContainerAPIClient
c1635c1a
 	DistributionAPIClient
7c36a1af
 	ImageAPIClient
 	NodeAPIClient
 	NetworkAPIClient
c410222e
 	PluginAPIClient
7c36a1af
 	ServiceAPIClient
 	SwarmAPIClient
3716ec25
 	SecretAPIClient
7c36a1af
 	SystemAPIClient
 	VolumeAPIClient
 	ClientVersion() string
6ce6ae1c
 	DaemonHost() string
7c36a1af
 	ServerVersion(ctx context.Context) (types.Version, error)
5f1d94e5
 	NegotiateAPIVersion(ctx context.Context)
 	NegotiateAPIVersionPing(types.Ping)
ec7b6238
 	DialSession(ctx context.Context, proto string, meta map[string][]string) (net.Conn, error)
7c36a1af
 }
 
 // ContainerAPIClient defines API client methods for the containers
 type ContainerAPIClient interface {
 	ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
c8d5e720
 	ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error)
7732ca94
 	ContainerCreate(ctx context.Context, config *containertypes.Config, hostConfig *containertypes.HostConfig, networkingConfig *networktypes.NetworkingConfig, containerName string) (containertypes.ContainerCreateCreatedBody, error)
 	ContainerDiff(ctx context.Context, container string) ([]containertypes.ContainerChangeResponseItem, error)
5fee8bdd
 	ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
01883c13
 	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
7c36a1af
 	ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
 	ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error
 	ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error
 	ContainerExport(ctx context.Context, container string) (io.ReadCloser, error)
 	ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
 	ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (types.ContainerJSON, []byte, error)
 	ContainerKill(ctx context.Context, container, signal string) error
 	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
 	ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)
 	ContainerPause(ctx context.Context, container string) error
 	ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error
 	ContainerRename(ctx context.Context, container, newContainerName string) error
 	ContainerResize(ctx context.Context, container string, options types.ResizeOptions) error
 	ContainerRestart(ctx context.Context, container string, timeout *time.Duration) error
 	ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error)
340e5233
 	ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
7c36a1af
 	ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
 	ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
7732ca94
 	ContainerTop(ctx context.Context, container string, arguments []string) (containertypes.ContainerTopOKBody, error)
7c36a1af
 	ContainerUnpause(ctx context.Context, container string) error
7732ca94
 	ContainerUpdate(ctx context.Context, container string, updateConfig containertypes.UpdateConfig) (containertypes.ContainerUpdateOKBody, error)
 	ContainerWait(ctx context.Context, container string, condition containertypes.WaitCondition) (<-chan containertypes.ContainerWaitOKBody, <-chan error)
7c36a1af
 	CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
 	CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error
a6be56b5
 	ContainersPrune(ctx context.Context, pruneFilters filters.Args) (types.ContainersPruneReport, error)
7c36a1af
 }
 
c1635c1a
 // DistributionAPIClient defines API client methods for the registry
 type DistributionAPIClient interface {
 	DistributionInspect(ctx context.Context, image, encodedRegistryAuth string) (registry.DistributionInspect, error)
 }
 
7c36a1af
 // ImageAPIClient defines API client methods for the images
 type ImageAPIClient interface {
 	ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
5c3d2d55
 	BuildCachePrune(ctx context.Context) (*types.BuildCachePruneReport, error)
7c36a1af
 	ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error)
b462c93e
 	ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error)
7c36a1af
 	ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
 	ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
b06c3527
 	ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
7c36a1af
 	ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
 	ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
 	ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
5988b84e
 	ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
7c36a1af
 	ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
 	ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
 	ImageTag(ctx context.Context, image, ref string) error
a6be56b5
 	ImagesPrune(ctx context.Context, pruneFilter filters.Args) (types.ImagesPruneReport, error)
7c36a1af
 }
 
 // NetworkAPIClient defines API client methods for the networks
 type NetworkAPIClient interface {
7732ca94
 	NetworkConnect(ctx context.Context, network, container string, config *networktypes.EndpointSettings) error
7c36a1af
 	NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
7732ca94
 	NetworkDisconnect(ctx context.Context, network, container string, force bool) error
 	NetworkInspect(ctx context.Context, network string, options types.NetworkInspectOptions) (types.NetworkResource, error)
 	NetworkInspectWithRaw(ctx context.Context, network string, options types.NetworkInspectOptions) (types.NetworkResource, []byte, error)
7c36a1af
 	NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
7732ca94
 	NetworkRemove(ctx context.Context, network string) error
a6be56b5
 	NetworksPrune(ctx context.Context, pruneFilter filters.Args) (types.NetworksPruneReport, error)
7c36a1af
 }
 
 // NodeAPIClient defines API client methods for the nodes
 type NodeAPIClient interface {
 	NodeInspectWithRaw(ctx context.Context, nodeID string) (swarm.Node, []byte, error)
 	NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error)
 	NodeRemove(ctx context.Context, nodeID string, options types.NodeRemoveOptions) error
 	NodeUpdate(ctx context.Context, nodeID string, version swarm.Version, node swarm.NodeSpec) error
 }
 
c410222e
 // PluginAPIClient defines API client methods for the plugins
 type PluginAPIClient interface {
a66e0dc3
 	PluginList(ctx context.Context, filter filters.Args) (types.PluginsListResponse, error)
c410222e
 	PluginRemove(ctx context.Context, name string, options types.PluginRemoveOptions) error
83ca993c
 	PluginEnable(ctx context.Context, name string, options types.PluginEnableOptions) error
8cb2229c
 	PluginDisable(ctx context.Context, name string, options types.PluginDisableOptions) error
3d86b0c7
 	PluginInstall(ctx context.Context, name string, options types.PluginInstallOptions) (io.ReadCloser, error)
03c69497
 	PluginUpgrade(ctx context.Context, name string, options types.PluginInstallOptions) (io.ReadCloser, error)
3d86b0c7
 	PluginPush(ctx context.Context, name string, registryAuth string) (io.ReadCloser, error)
c410222e
 	PluginSet(ctx context.Context, name string, args []string) error
 	PluginInspectWithRaw(ctx context.Context, name string) (*types.Plugin, []byte, error)
 	PluginCreate(ctx context.Context, createContext io.Reader, options types.PluginCreateOptions) error
 }
 
7c36a1af
 // ServiceAPIClient defines API client methods for the services
 type ServiceAPIClient interface {
 	ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error)
1d274e9a
 	ServiceInspectWithRaw(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
7c36a1af
 	ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
 	ServiceRemove(ctx context.Context, serviceID string) error
948e6069
 	ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
819d0159
 	ServiceLogs(ctx context.Context, serviceID string, options types.ContainerLogsOptions) (io.ReadCloser, error)
d330dc32
 	TaskLogs(ctx context.Context, taskID string, options types.ContainerLogsOptions) (io.ReadCloser, error)
7c36a1af
 	TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error)
 	TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)
 }
 
 // SwarmAPIClient defines API client methods for the swarm
 type SwarmAPIClient interface {
 	SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error)
 	SwarmJoin(ctx context.Context, req swarm.JoinRequest) error
0f9fc54d
 	SwarmGetUnlockKey(ctx context.Context) (types.SwarmUnlockKeyResponse, error)
b4a667c8
 	SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error
7c36a1af
 	SwarmLeave(ctx context.Context, force bool) error
 	SwarmInspect(ctx context.Context) (swarm.Swarm, error)
 	SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error
 }
 
 // SystemAPIClient defines API client methods for the system
 type SystemAPIClient interface {
d6bd79c1
 	Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)
7c36a1af
 	Info(ctx context.Context) (types.Info, error)
2732b8a9
 	RegistryLogin(ctx context.Context, auth types.AuthConfig) (registry.AuthenticateOKBody, error)
280c8723
 	DiskUsage(ctx context.Context) (types.DiskUsage, error)
e98e4a71
 	Ping(ctx context.Context) (types.Ping, error)
7c36a1af
 }
 
 // VolumeAPIClient defines API client methods for the volumes
 type VolumeAPIClient interface {
5c2498fd
 	VolumeCreate(ctx context.Context, options volumetypes.VolumesCreateBody) (types.Volume, error)
7c36a1af
 	VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error)
 	VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error)
d459e83b
 	VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumesListOKBody, error)
7c36a1af
 	VolumeRemove(ctx context.Context, volumeID string, force bool) error
a6be56b5
 	VolumesPrune(ctx context.Context, pruneFilter filters.Args) (types.VolumesPruneReport, error)
7c36a1af
 }
3716ec25
 
 // SecretAPIClient defines API client methods for secrets
 type SecretAPIClient interface {
 	SecretList(ctx context.Context, options types.SecretListOptions) ([]swarm.Secret, error)
 	SecretCreate(ctx context.Context, secret swarm.SecretSpec) (types.SecretCreateResponse, error)
 	SecretRemove(ctx context.Context, id string) error
 	SecretInspectWithRaw(ctx context.Context, name string) (swarm.Secret, []byte, error)
77b8465d
 	SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error
3716ec25
 }
10273810
 
 // ConfigAPIClient defines API client methods for configs
 type ConfigAPIClient interface {
 	ConfigList(ctx context.Context, options types.ConfigListOptions) ([]swarm.Config, error)
 	ConfigCreate(ctx context.Context, config swarm.ConfigSpec) (types.ConfigCreateResponse, error)
 	ConfigRemove(ctx context.Context, id string) error
 	ConfigInspectWithRaw(ctx context.Context, name string) (swarm.Config, []byte, error)
 	ConfigUpdate(ctx context.Context, id string, version swarm.Version, config swarm.ConfigSpec) error
 }