interface.go 5.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package client
  2. import (
  3. "io"
  4. "golang.org/x/net/context"
  5. "github.com/docker/engine-api/types"
  6. "github.com/docker/engine-api/types/container"
  7. "github.com/docker/engine-api/types/filters"
  8. "github.com/docker/engine-api/types/network"
  9. "github.com/docker/engine-api/types/registry"
  10. )
  11. // APIClient is an interface that clients that talk with a docker server must implement.
  12. type APIClient interface {
  13. ClientVersion() string
  14. ContainerAttach(ctx context.Context, options types.ContainerAttachOptions) (types.HijackedResponse, error)
  15. ContainerCommit(ctx context.Context, options types.ContainerCommitOptions) (types.ContainerCommitResponse, error)
  16. ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (types.ContainerCreateResponse, error)
  17. ContainerDiff(ctx context.Context, ontainerID string) ([]types.ContainerChange, error)
  18. ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error)
  19. ContainerExecCreate(ctx context.Context, config types.ExecConfig) (types.ContainerExecCreateResponse, error)
  20. ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
  21. ContainerExecResize(ctx context.Context, options types.ResizeOptions) error
  22. ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error
  23. ContainerExport(ctx context.Context, containerID string) (io.ReadCloser, error)
  24. ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
  25. ContainerInspectWithRaw(ctx context.Context, containerID string, getSize bool) (types.ContainerJSON, []byte, error)
  26. ContainerKill(ctx context.Context, containerID, signal string) error
  27. ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
  28. ContainerLogs(ctx context.Context, options types.ContainerLogsOptions) (io.ReadCloser, error)
  29. ContainerPause(ctx context.Context, containerID string) error
  30. ContainerRemove(ctx context.Context, options types.ContainerRemoveOptions) error
  31. ContainerRename(ctx context.Context, containerID, newContainerName string) error
  32. ContainerResize(ctx context.Context, options types.ResizeOptions) error
  33. ContainerRestart(ctx context.Context, containerID string, timeout int) error
  34. ContainerStatPath(ctx context.Context, containerID, path string) (types.ContainerPathStat, error)
  35. ContainerStats(ctx context.Context, containerID string, stream bool) (io.ReadCloser, error)
  36. ContainerStart(ctx context.Context, containerID string) error
  37. ContainerStop(ctx context.Context, containerID string, timeout int) error
  38. ContainerTop(ctx context.Context, containerID string, arguments []string) (types.ContainerProcessList, error)
  39. ContainerUnpause(ctx context.Context, containerID string) error
  40. ContainerUpdate(ctx context.Context, containerID string, updateConfig container.UpdateConfig) error
  41. ContainerWait(ctx context.Context, containerID string) (int, error)
  42. CopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
  43. CopyToContainer(ctx context.Context, options types.CopyToContainerOptions) error
  44. Events(ctx context.Context, options types.EventsOptions) (io.ReadCloser, error)
  45. ImageBuild(ctx context.Context, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
  46. ImageCreate(ctx context.Context, options types.ImageCreateOptions) (io.ReadCloser, error)
  47. ImageHistory(ctx context.Context, imageID string) ([]types.ImageHistory, error)
  48. ImageImport(ctx context.Context, options types.ImageImportOptions) (io.ReadCloser, error)
  49. ImageInspectWithRaw(ctx context.Context, imageID string, getSize bool) (types.ImageInspect, []byte, error)
  50. ImageList(ctx context.Context, options types.ImageListOptions) ([]types.Image, error)
  51. ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
  52. ImagePull(ctx context.Context, options types.ImagePullOptions, privilegeFunc RequestPrivilegeFunc) (io.ReadCloser, error)
  53. ImagePush(ctx context.Context, options types.ImagePushOptions, privilegeFunc RequestPrivilegeFunc) (io.ReadCloser, error)
  54. ImageRemove(ctx context.Context, options types.ImageRemoveOptions) ([]types.ImageDelete, error)
  55. ImageSearch(ctx context.Context, options types.ImageSearchOptions, privilegeFunc RequestPrivilegeFunc) ([]registry.SearchResult, error)
  56. ImageSave(ctx context.Context, imageIDs []string) (io.ReadCloser, error)
  57. ImageTag(ctx context.Context, options types.ImageTagOptions) error
  58. Info(ctx context.Context) (types.Info, error)
  59. NetworkConnect(ctx context.Context, networkID, containerID string, config *network.EndpointSettings) error
  60. NetworkCreate(ctx context.Context, options types.NetworkCreate) (types.NetworkCreateResponse, error)
  61. NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error
  62. NetworkInspect(ctx context.Context, networkID string) (types.NetworkResource, error)
  63. NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
  64. NetworkRemove(ctx context.Context, networkID string) error
  65. RegistryLogin(ctx context.Context, auth types.AuthConfig) (types.AuthResponse, error)
  66. ServerVersion(ctx context.Context) (types.Version, error)
  67. VolumeCreate(ctx context.Context, options types.VolumeCreateRequest) (types.Volume, error)
  68. VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error)
  69. VolumeList(ctx context.Context, filter filters.Args) (types.VolumesListResponse, error)
  70. VolumeRemove(ctx context.Context, volumeID string) error
  71. }
  72. // Ensure that Client always implements APIClient.
  73. var _ APIClient = &Client{}