interface.go 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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(options types.ContainerAttachOptions) (types.HijackedResponse, error)
  15. ContainerCommit(options types.ContainerCommitOptions) (types.ContainerCommitResponse, error)
  16. ContainerCreate(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (types.ContainerCreateResponse, error)
  17. ContainerDiff(containerID string) ([]types.ContainerChange, error)
  18. ContainerExecAttach(execID string, config types.ExecConfig) (types.HijackedResponse, error)
  19. ContainerExecCreate(config types.ExecConfig) (types.ContainerExecCreateResponse, error)
  20. ContainerExecInspect(execID string) (types.ContainerExecInspect, error)
  21. ContainerExecResize(options types.ResizeOptions) error
  22. ContainerExecStart(execID string, config types.ExecStartCheck) error
  23. ContainerExport(ctx context.Context, containerID string) (io.ReadCloser, error)
  24. ContainerInspect(containerID string) (types.ContainerJSON, error)
  25. ContainerInspectWithRaw(containerID string, getSize bool) (types.ContainerJSON, []byte, error)
  26. ContainerKill(containerID, signal string) error
  27. ContainerList(options types.ContainerListOptions) ([]types.Container, error)
  28. ContainerLogs(ctx context.Context, options types.ContainerLogsOptions) (io.ReadCloser, error)
  29. ContainerPause(containerID string) error
  30. ContainerRemove(options types.ContainerRemoveOptions) error
  31. ContainerRename(containerID, newContainerName string) error
  32. ContainerResize(options types.ResizeOptions) error
  33. ContainerRestart(containerID string, timeout int) error
  34. ContainerStatPath(containerID, path string) (types.ContainerPathStat, error)
  35. ContainerStats(ctx context.Context, containerID string, stream bool) (io.ReadCloser, error)
  36. ContainerStart(containerID string) error
  37. ContainerStop(containerID string, timeout int) error
  38. ContainerTop(containerID string, arguments []string) (types.ContainerProcessList, error)
  39. ContainerUnpause(containerID string) error
  40. ContainerUpdate(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(imageID string) ([]types.ImageHistory, error)
  48. ImageImport(ctx context.Context, options types.ImageImportOptions) (io.ReadCloser, error)
  49. ImageInspectWithRaw(imageID string, getSize bool) (types.ImageInspect, []byte, error)
  50. ImageList(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(options types.ImageRemoveOptions) ([]types.ImageDelete, error)
  55. ImageSearch(options types.ImageSearchOptions, privilegeFunc RequestPrivilegeFunc) ([]registry.SearchResult, error)
  56. ImageSave(ctx context.Context, imageIDs []string) (io.ReadCloser, error)
  57. ImageTag(options types.ImageTagOptions) error
  58. Info() (types.Info, error)
  59. NetworkConnect(networkID, containerID string, config *network.EndpointSettings) error
  60. NetworkCreate(options types.NetworkCreate) (types.NetworkCreateResponse, error)
  61. NetworkDisconnect(networkID, containerID string, force bool) error
  62. NetworkInspect(networkID string) (types.NetworkResource, error)
  63. NetworkList(options types.NetworkListOptions) ([]types.NetworkResource, error)
  64. NetworkRemove(networkID string) error
  65. RegistryLogin(auth types.AuthConfig) (types.AuthResponse, error)
  66. ServerVersion() (types.Version, error)
  67. VolumeCreate(options types.VolumeCreateRequest) (types.Volume, error)
  68. VolumeInspect(volumeID string) (types.Volume, error)
  69. VolumeList(filter filters.Args) (types.VolumesListResponse, error)
  70. VolumeRemove(volumeID string) error
  71. }
  72. // Ensure that Client always implements APIClient.
  73. var _ APIClient = &Client{}