-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1622 from matejvasek/narrow-docker-iface
cleanup: narrow docker interface Signed-off-by: David Freilich <[email protected]>
- Loading branch information
Showing
12 changed files
with
97 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package build | ||
|
||
import ( | ||
"context" | ||
"io" | ||
|
||
"github.com/docker/docker/api/types" | ||
containertypes "github.com/docker/docker/api/types/container" | ||
networktypes "github.com/docker/docker/api/types/network" | ||
specs "github.com/opencontainers/image-spec/specs-go/v1" | ||
) | ||
|
||
type DockerClient interface { | ||
ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) | ||
VolumeRemove(ctx context.Context, volumeID string, force bool) error | ||
ContainerWait(ctx context.Context, container string, condition containertypes.WaitCondition) (<-chan containertypes.ContainerWaitOKBody, <-chan error) | ||
ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) | ||
ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error | ||
ContainerCreate(ctx context.Context, config *containertypes.Config, hostConfig *containertypes.HostConfig, networkingConfig *networktypes.NetworkingConfig, platform *specs.Platform, containerName string) (containertypes.ContainerCreateCreatedBody, error) | ||
CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) | ||
ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error) | ||
ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error | ||
CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package client | ||
|
||
import ( | ||
"context" | ||
"io" | ||
|
||
"github.com/docker/docker/api/types" | ||
containertypes "github.com/docker/docker/api/types/container" | ||
networktypes "github.com/docker/docker/api/types/network" | ||
specs "github.com/opencontainers/image-spec/specs-go/v1" | ||
) | ||
|
||
// DockerClient is the subset of CommonAPIClient which required by this package | ||
type DockerClient interface { | ||
ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error) | ||
ImageTag(ctx context.Context, image, ref string) error | ||
ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error) | ||
ImageSave(ctx context.Context, images []string) (io.ReadCloser, error) | ||
ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) | ||
ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error) | ||
Info(ctx context.Context) (types.Info, error) | ||
VolumeRemove(ctx context.Context, volumeID string, force bool) error | ||
ContainerCreate(ctx context.Context, config *containertypes.Config, hostConfig *containertypes.HostConfig, networkingConfig *networktypes.NetworkingConfig, platform *specs.Platform, containerName string) (containertypes.ContainerCreateCreatedBody, error) | ||
CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) | ||
ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error) | ||
ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error | ||
CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error | ||
ContainerWait(ctx context.Context, container string, condition containertypes.WaitCondition) (<-chan containertypes.ContainerWaitOKBody, <-chan error) | ||
ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) | ||
ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters