github.com/endophage/docker@v1.4.2-0.20161027011718-242853499895/client/interface.go (about)

     1  package client
     2  
     3  import (
     4  	"io"
     5  	"time"
     6  
     7  	"github.com/docker/docker/api/types"
     8  	"github.com/docker/docker/api/types/container"
     9  	"github.com/docker/docker/api/types/events"
    10  	"github.com/docker/docker/api/types/filters"
    11  	"github.com/docker/docker/api/types/network"
    12  	"github.com/docker/docker/api/types/registry"
    13  	"github.com/docker/docker/api/types/swarm"
    14  	"golang.org/x/net/context"
    15  )
    16  
    17  // CommonAPIClient is the common methods between stable and experimental versions of APIClient.
    18  type CommonAPIClient interface {
    19  	ContainerAPIClient
    20  	ImageAPIClient
    21  	NodeAPIClient
    22  	NetworkAPIClient
    23  	ServiceAPIClient
    24  	SwarmAPIClient
    25  	SystemAPIClient
    26  	VolumeAPIClient
    27  	ClientVersion() string
    28  	ServerVersion(ctx context.Context) (types.Version, error)
    29  	UpdateClientVersion(v string)
    30  }
    31  
    32  // ContainerAPIClient defines API client methods for the containers
    33  type ContainerAPIClient interface {
    34  	ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
    35  	ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.ContainerCommitResponse, error)
    36  	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (types.ContainerCreateResponse, error)
    37  	ContainerDiff(ctx context.Context, container string) ([]types.ContainerChange, error)
    38  	ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error)
    39  	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.ContainerExecCreateResponse, error)
    40  	ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
    41  	ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error
    42  	ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error
    43  	ContainerExport(ctx context.Context, container string) (io.ReadCloser, error)
    44  	ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
    45  	ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (types.ContainerJSON, []byte, error)
    46  	ContainerKill(ctx context.Context, container, signal string) error
    47  	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
    48  	ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)
    49  	ContainerPause(ctx context.Context, container string) error
    50  	ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error
    51  	ContainerRename(ctx context.Context, container, newContainerName string) error
    52  	ContainerResize(ctx context.Context, container string, options types.ResizeOptions) error
    53  	ContainerRestart(ctx context.Context, container string, timeout *time.Duration) error
    54  	ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error)
    55  	ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
    56  	ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
    57  	ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
    58  	ContainerTop(ctx context.Context, container string, arguments []string) (types.ContainerProcessList, error)
    59  	ContainerUnpause(ctx context.Context, container string) error
    60  	ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (types.ContainerUpdateResponse, error)
    61  	ContainerWait(ctx context.Context, container string) (int, error)
    62  	CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
    63  	CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error
    64  	ContainersPrune(ctx context.Context, cfg types.ContainersPruneConfig) (types.ContainersPruneReport, error)
    65  }
    66  
    67  // ImageAPIClient defines API client methods for the images
    68  type ImageAPIClient interface {
    69  	ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
    70  	ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error)
    71  	ImageHistory(ctx context.Context, image string) ([]types.ImageHistory, error)
    72  	ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
    73  	ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
    74  	ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
    75  	ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
    76  	ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
    77  	ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
    78  	ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDelete, error)
    79  	ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
    80  	ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
    81  	ImageTag(ctx context.Context, image, ref string) error
    82  	ImagesPrune(ctx context.Context, cfg types.ImagesPruneConfig) (types.ImagesPruneReport, error)
    83  }
    84  
    85  // NetworkAPIClient defines API client methods for the networks
    86  type NetworkAPIClient interface {
    87  	NetworkConnect(ctx context.Context, networkID, container string, config *network.EndpointSettings) error
    88  	NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
    89  	NetworkDisconnect(ctx context.Context, networkID, container string, force bool) error
    90  	NetworkInspect(ctx context.Context, networkID string) (types.NetworkResource, error)
    91  	NetworkInspectWithRaw(ctx context.Context, networkID string) (types.NetworkResource, []byte, error)
    92  	NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
    93  	NetworkRemove(ctx context.Context, networkID string) error
    94  	NetworksPrune(ctx context.Context, cfg types.NetworksPruneConfig) (types.NetworksPruneReport, error)
    95  }
    96  
    97  // NodeAPIClient defines API client methods for the nodes
    98  type NodeAPIClient interface {
    99  	NodeInspectWithRaw(ctx context.Context, nodeID string) (swarm.Node, []byte, error)
   100  	NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error)
   101  	NodeRemove(ctx context.Context, nodeID string, options types.NodeRemoveOptions) error
   102  	NodeUpdate(ctx context.Context, nodeID string, version swarm.Version, node swarm.NodeSpec) error
   103  }
   104  
   105  // ServiceAPIClient defines API client methods for the services
   106  type ServiceAPIClient interface {
   107  	ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error)
   108  	ServiceInspectWithRaw(ctx context.Context, serviceID string) (swarm.Service, []byte, error)
   109  	ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
   110  	ServiceRemove(ctx context.Context, serviceID string) error
   111  	ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) error
   112  	TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error)
   113  	TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)
   114  }
   115  
   116  // SwarmAPIClient defines API client methods for the swarm
   117  type SwarmAPIClient interface {
   118  	SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error)
   119  	SwarmJoin(ctx context.Context, req swarm.JoinRequest) error
   120  	SwarmLeave(ctx context.Context, force bool) error
   121  	SwarmInspect(ctx context.Context) (swarm.Swarm, error)
   122  	SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error
   123  }
   124  
   125  // SystemAPIClient defines API client methods for the system
   126  type SystemAPIClient interface {
   127  	Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)
   128  	Info(ctx context.Context) (types.Info, error)
   129  	RegistryLogin(ctx context.Context, auth types.AuthConfig) (types.AuthResponse, error)
   130  	DiskUsage(ctx context.Context) (types.DiskUsage, error)
   131  	Ping(ctx context.Context) (bool, error)
   132  }
   133  
   134  // VolumeAPIClient defines API client methods for the volumes
   135  type VolumeAPIClient interface {
   136  	VolumeCreate(ctx context.Context, options types.VolumeCreateRequest) (types.Volume, error)
   137  	VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error)
   138  	VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error)
   139  	VolumeList(ctx context.Context, filter filters.Args) (types.VolumesListResponse, error)
   140  	VolumeRemove(ctx context.Context, volumeID string, force bool) error
   141  	VolumesPrune(ctx context.Context, cfg types.VolumesPruneConfig) (types.VolumesPruneReport, error)
   142  }