github.com/olljanat/moby@v1.13.1/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  	volumetypes "github.com/docker/docker/api/types/volume"
    15  	"golang.org/x/net/context"
    16  )
    17  
    18  // CommonAPIClient is the common methods between stable and experimental versions of APIClient.
    19  type CommonAPIClient interface {
    20  	ContainerAPIClient
    21  	ImageAPIClient
    22  	NodeAPIClient
    23  	NetworkAPIClient
    24  	PluginAPIClient
    25  	ServiceAPIClient
    26  	SwarmAPIClient
    27  	SecretAPIClient
    28  	SystemAPIClient
    29  	VolumeAPIClient
    30  	ClientVersion() string
    31  	ServerVersion(ctx context.Context) (types.Version, error)
    32  	UpdateClientVersion(v string)
    33  }
    34  
    35  // ContainerAPIClient defines API client methods for the containers
    36  type ContainerAPIClient interface {
    37  	ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
    38  	ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error)
    39  	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
    40  	ContainerDiff(ctx context.Context, container string) ([]types.ContainerChange, error)
    41  	ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error)
    42  	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
    43  	ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
    44  	ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error
    45  	ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error
    46  	ContainerExport(ctx context.Context, container string) (io.ReadCloser, error)
    47  	ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
    48  	ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (types.ContainerJSON, []byte, error)
    49  	ContainerKill(ctx context.Context, container, signal string) error
    50  	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
    51  	ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)
    52  	ContainerPause(ctx context.Context, container string) error
    53  	ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error
    54  	ContainerRename(ctx context.Context, container, newContainerName string) error
    55  	ContainerResize(ctx context.Context, container string, options types.ResizeOptions) error
    56  	ContainerRestart(ctx context.Context, container string, timeout *time.Duration) error
    57  	ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error)
    58  	ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
    59  	ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
    60  	ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
    61  	ContainerTop(ctx context.Context, container string, arguments []string) (types.ContainerProcessList, error)
    62  	ContainerUnpause(ctx context.Context, container string) error
    63  	ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error)
    64  	ContainerWait(ctx context.Context, container string) (int64, error)
    65  	CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
    66  	CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error
    67  	ContainersPrune(ctx context.Context, pruneFilters filters.Args) (types.ContainersPruneReport, error)
    68  }
    69  
    70  // ImageAPIClient defines API client methods for the images
    71  type ImageAPIClient interface {
    72  	ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
    73  	ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error)
    74  	ImageHistory(ctx context.Context, image string) ([]types.ImageHistory, error)
    75  	ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
    76  	ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
    77  	ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
    78  	ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
    79  	ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
    80  	ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
    81  	ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDelete, error)
    82  	ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
    83  	ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
    84  	ImageTag(ctx context.Context, image, ref string) error
    85  	ImagesPrune(ctx context.Context, pruneFilter filters.Args) (types.ImagesPruneReport, error)
    86  }
    87  
    88  // NetworkAPIClient defines API client methods for the networks
    89  type NetworkAPIClient interface {
    90  	NetworkConnect(ctx context.Context, networkID, container string, config *network.EndpointSettings) error
    91  	NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
    92  	NetworkDisconnect(ctx context.Context, networkID, container string, force bool) error
    93  	NetworkInspect(ctx context.Context, networkID string) (types.NetworkResource, error)
    94  	NetworkInspectWithRaw(ctx context.Context, networkID string) (types.NetworkResource, []byte, error)
    95  	NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
    96  	NetworkRemove(ctx context.Context, networkID string) error
    97  	NetworksPrune(ctx context.Context, pruneFilter filters.Args) (types.NetworksPruneReport, error)
    98  }
    99  
   100  // NodeAPIClient defines API client methods for the nodes
   101  type NodeAPIClient interface {
   102  	NodeInspectWithRaw(ctx context.Context, nodeID string) (swarm.Node, []byte, error)
   103  	NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error)
   104  	NodeRemove(ctx context.Context, nodeID string, options types.NodeRemoveOptions) error
   105  	NodeUpdate(ctx context.Context, nodeID string, version swarm.Version, node swarm.NodeSpec) error
   106  }
   107  
   108  // PluginAPIClient defines API client methods for the plugins
   109  type PluginAPIClient interface {
   110  	PluginList(ctx context.Context) (types.PluginsListResponse, error)
   111  	PluginRemove(ctx context.Context, name string, options types.PluginRemoveOptions) error
   112  	PluginEnable(ctx context.Context, name string, options types.PluginEnableOptions) error
   113  	PluginDisable(ctx context.Context, name string, options types.PluginDisableOptions) error
   114  	PluginInstall(ctx context.Context, name string, options types.PluginInstallOptions) (io.ReadCloser, error)
   115  	PluginUpgrade(ctx context.Context, name string, options types.PluginInstallOptions) (io.ReadCloser, error)
   116  	PluginPush(ctx context.Context, name string, registryAuth string) (io.ReadCloser, error)
   117  	PluginSet(ctx context.Context, name string, args []string) error
   118  	PluginInspectWithRaw(ctx context.Context, name string) (*types.Plugin, []byte, error)
   119  	PluginCreate(ctx context.Context, createContext io.Reader, options types.PluginCreateOptions) error
   120  }
   121  
   122  // ServiceAPIClient defines API client methods for the services
   123  type ServiceAPIClient interface {
   124  	ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error)
   125  	ServiceInspectWithRaw(ctx context.Context, serviceID string) (swarm.Service, []byte, error)
   126  	ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
   127  	ServiceRemove(ctx context.Context, serviceID string) error
   128  	ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
   129  	ServiceLogs(ctx context.Context, serviceID string, options types.ContainerLogsOptions) (io.ReadCloser, error)
   130  	TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error)
   131  	TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)
   132  }
   133  
   134  // SwarmAPIClient defines API client methods for the swarm
   135  type SwarmAPIClient interface {
   136  	SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error)
   137  	SwarmJoin(ctx context.Context, req swarm.JoinRequest) error
   138  	SwarmGetUnlockKey(ctx context.Context) (types.SwarmUnlockKeyResponse, error)
   139  	SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error
   140  	SwarmLeave(ctx context.Context, force bool) error
   141  	SwarmInspect(ctx context.Context) (swarm.Swarm, error)
   142  	SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error
   143  }
   144  
   145  // SystemAPIClient defines API client methods for the system
   146  type SystemAPIClient interface {
   147  	Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)
   148  	Info(ctx context.Context) (types.Info, error)
   149  	RegistryLogin(ctx context.Context, auth types.AuthConfig) (registry.AuthenticateOKBody, error)
   150  	DiskUsage(ctx context.Context) (types.DiskUsage, error)
   151  	Ping(ctx context.Context) (types.Ping, error)
   152  }
   153  
   154  // VolumeAPIClient defines API client methods for the volumes
   155  type VolumeAPIClient interface {
   156  	VolumeCreate(ctx context.Context, options volumetypes.VolumesCreateBody) (types.Volume, error)
   157  	VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error)
   158  	VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error)
   159  	VolumeList(ctx context.Context, filter filters.Args) (volumetypes.VolumesListOKBody, error)
   160  	VolumeRemove(ctx context.Context, volumeID string, force bool) error
   161  	VolumesPrune(ctx context.Context, pruneFilter filters.Args) (types.VolumesPruneReport, error)
   162  }
   163  
   164  // SecretAPIClient defines API client methods for secrets
   165  type SecretAPIClient interface {
   166  	SecretList(ctx context.Context, options types.SecretListOptions) ([]swarm.Secret, error)
   167  	SecretCreate(ctx context.Context, secret swarm.SecretSpec) (types.SecretCreateResponse, error)
   168  	SecretRemove(ctx context.Context, id string) error
   169  	SecretInspectWithRaw(ctx context.Context, name string) (swarm.Secret, []byte, error)
   170  	SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error
   171  }