-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.go
36 lines (32 loc) · 1.42 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package dockerop
import (
"context"
"time"
"github.com/docker/docker/api/types"
)
var _ DockerOp = new(OpClient)
// DockerOp interface of dockerop
type DockerOp interface {
// client basic function:
// NewOpClient create a new client of docker engine
Close() error // close
Ping(ctx context.Context) (types.Ping, error)
Info(ctx context.Context) (types.Info, error)
RegistryLogin(ctx context.Context, auth types.AuthConfig) error
// client image function:
ImageList(ctx context.Context) ([]types.ImageSummary, error)
ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (string, error)
ImageRemove(ctx context.Context, imageID string) error
ImagesPrune(ctx context.Context) error
// client container function:
ContainerList(ctx context.Context) ([]types.Container, error)
ContainerCreate(ctx context.Context, def *ContainerDef) (string, error)
ContainerStart(ctx context.Context, containerID string) error
ContainerPause(ctx context.Context, containerID string) error
ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
ContainerRemove(ctx context.Context, containerID string) error
ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
ContainerLogs(ctx context.Context, containerID string) (string, error)
ContainerExec(ctx context.Context, containerID string, cmd []string) (string, error)
//ContainersPrune(ctx context.Context) error
}