-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclient.go
More file actions
80 lines (63 loc) · 2.64 KB
/
client.go
File metadata and controls
80 lines (63 loc) · 2.64 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package dockercommand
import docker "github.com/fsouza/go-dockerclient"
type Client interface {
ListContainers(opts docker.ListContainersOptions) ([]docker.APIContainers, error)
ListImages(opts docker.ListImagesOptions) ([]docker.APIImages, error)
BuildImage(opts docker.BuildImageOptions) error
InspectContainer(id string) (*docker.Container, error)
PullImage(opts docker.PullImageOptions, auth docker.AuthConfiguration) error
RemoveContainer(opts docker.RemoveContainerOptions) error
CreateContainer(opts docker.CreateContainerOptions) (*docker.Container, error)
StartContainer(id string, hostConfig *docker.HostConfig) error
WaitContainer(id string) (int, error)
StopContainer(id string, timeout uint) error
InspectImage(name string) (*docker.Image, error)
Logs(opts docker.LogsOptions) error
ListNetworks() ([]docker.Network, error)
CreateNetwork(docker.CreateNetworkOptions) (*docker.Network, error)
}
type FsouzaClient struct {
client *docker.Client
}
func (c *FsouzaClient) Logs(opts docker.LogsOptions) error {
return c.client.Logs(opts)
}
func (c *FsouzaClient) InspectImage(name string) (*docker.Image, error) {
return c.client.InspectImage(name)
}
func (c *FsouzaClient) StopContainer(id string, timeout uint) error {
return c.client.StopContainer(id, timeout)
}
func (c *FsouzaClient) WaitContainer(id string) (int, error) {
return c.client.WaitContainer(id)
}
func (c *FsouzaClient) StartContainer(id string, hostConfig *docker.HostConfig) error {
return c.client.StartContainer(id, hostConfig)
}
func (c *FsouzaClient) CreateContainer(opts docker.CreateContainerOptions) (*docker.Container, error) {
return c.client.CreateContainer(opts)
}
func (c *FsouzaClient) ListContainers(opts docker.ListContainersOptions) ([]docker.APIContainers, error) {
return c.client.ListContainers(opts)
}
func (c *FsouzaClient) ListImages(opts docker.ListImagesOptions) ([]docker.APIImages, error) {
return c.client.ListImages(opts)
}
func (c *FsouzaClient) BuildImage(opts docker.BuildImageOptions) error {
return c.client.BuildImage(opts)
}
func (c *FsouzaClient) InspectContainer(id string) (*docker.Container, error) {
return c.client.InspectContainer(id)
}
func (c *FsouzaClient) PullImage(opts docker.PullImageOptions, auth docker.AuthConfiguration) error {
return c.client.PullImage(opts, auth)
}
func (c *FsouzaClient) RemoveContainer(opts docker.RemoveContainerOptions) error {
return c.client.RemoveContainer(opts)
}
func (c *FsouzaClient) ListNetworks() ([]docker.Network, error) {
return c.client.ListNetworks()
}
func (c *FsouzaClient) CreateNetwork(opts docker.CreateNetworkOptions) (*docker.Network, error) {
return c.client.CreateNetwork(opts)
}