@@ -9,18 +9,18 @@ import (
9
9
"github.com/docker/docker/api/types/container"
10
10
"github.com/docker/docker/api/types/swarm"
11
11
"github.com/docker/docker/api/types/system"
12
- dockerClient "github.com/docker/docker/client"
12
+ "github.com/docker/docker/client"
13
13
)
14
14
15
15
var (
16
16
defaultHeaders = map [string ]string {"User-Agent" : "engine-api-cli-1.0" }
17
17
)
18
18
19
- type Client interface {
19
+ type dockerClient interface {
20
20
Info (ctx context.Context ) (system.Info , error )
21
- ContainerList (ctx context.Context , options container.ListOptions ) ([]types. Container , error )
22
- ContainerStats (ctx context.Context , containerID string , stream bool ) (types. ContainerStats , error )
23
- ContainerInspect (ctx context.Context , containerID string ) (types. ContainerJSON , error )
21
+ ContainerList (ctx context.Context , options container.ListOptions ) ([]container. Summary , error )
22
+ ContainerStats (ctx context.Context , containerID string , stream bool ) (container. StatsResponseReader , error )
23
+ ContainerInspect (ctx context.Context , containerID string ) (container. InspectResponse , error )
24
24
ServiceList (ctx context.Context , options types.ServiceListOptions ) ([]swarm.Service , error )
25
25
TaskList (ctx context.Context , options types.TaskListOptions ) ([]swarm.Task , error )
26
26
NodeList (ctx context.Context , options types.NodeListOptions ) ([]swarm.Node , error )
@@ -29,65 +29,65 @@ type Client interface {
29
29
Close () error
30
30
}
31
31
32
- func NewEnvClient () (Client , error ) {
33
- client , err := dockerClient .NewClientWithOpts (dockerClient .FromEnv )
32
+ func newEnvClient () (dockerClient , error ) {
33
+ dockerClient , err := client .NewClientWithOpts (client .FromEnv )
34
34
if err != nil {
35
35
return nil , err
36
36
}
37
- return & SocketClient { client }, nil
37
+ return & socketClient { dockerClient }, nil
38
38
}
39
39
40
- func NewClient (host string , tlsConfig * tls.Config ) (Client , error ) {
40
+ func newClient (host string , tlsConfig * tls.Config ) (dockerClient , error ) {
41
41
transport := & http.Transport {
42
42
TLSClientConfig : tlsConfig ,
43
43
}
44
44
httpClient := & http.Client {Transport : transport }
45
45
46
- client , err := dockerClient .NewClientWithOpts (
47
- dockerClient .WithHTTPHeaders (defaultHeaders ),
48
- dockerClient .WithHTTPClient (httpClient ),
49
- dockerClient .WithAPIVersionNegotiation (),
50
- dockerClient .WithHost (host ))
46
+ dockerClient , err := client .NewClientWithOpts (
47
+ client .WithHTTPHeaders (defaultHeaders ),
48
+ client .WithHTTPClient (httpClient ),
49
+ client .WithAPIVersionNegotiation (),
50
+ client .WithHost (host ))
51
51
if err != nil {
52
52
return nil , err
53
53
}
54
54
55
- return & SocketClient { client }, nil
55
+ return & socketClient { dockerClient }, nil
56
56
}
57
57
58
- type SocketClient struct {
59
- client * dockerClient .Client
58
+ type socketClient struct {
59
+ client * client .Client
60
60
}
61
61
62
- func (c * SocketClient ) Info (ctx context.Context ) (system.Info , error ) {
62
+ func (c * socketClient ) Info (ctx context.Context ) (system.Info , error ) {
63
63
return c .client .Info (ctx )
64
64
}
65
- func (c * SocketClient ) ContainerList (ctx context.Context , options container.ListOptions ) ([]types. Container , error ) {
65
+ func (c * socketClient ) ContainerList (ctx context.Context , options container.ListOptions ) ([]container. Summary , error ) {
66
66
return c .client .ContainerList (ctx , options )
67
67
}
68
- func (c * SocketClient ) ContainerStats (ctx context.Context , containerID string , stream bool ) (types. ContainerStats , error ) {
68
+ func (c * socketClient ) ContainerStats (ctx context.Context , containerID string , stream bool ) (container. StatsResponseReader , error ) {
69
69
return c .client .ContainerStats (ctx , containerID , stream )
70
70
}
71
- func (c * SocketClient ) ContainerInspect (ctx context.Context , containerID string ) (types. ContainerJSON , error ) {
71
+ func (c * socketClient ) ContainerInspect (ctx context.Context , containerID string ) (container. InspectResponse , error ) {
72
72
return c .client .ContainerInspect (ctx , containerID )
73
73
}
74
- func (c * SocketClient ) ServiceList (ctx context.Context , options types.ServiceListOptions ) ([]swarm.Service , error ) {
74
+ func (c * socketClient ) ServiceList (ctx context.Context , options types.ServiceListOptions ) ([]swarm.Service , error ) {
75
75
return c .client .ServiceList (ctx , options )
76
76
}
77
- func (c * SocketClient ) TaskList (ctx context.Context , options types.TaskListOptions ) ([]swarm.Task , error ) {
77
+ func (c * socketClient ) TaskList (ctx context.Context , options types.TaskListOptions ) ([]swarm.Task , error ) {
78
78
return c .client .TaskList (ctx , options )
79
79
}
80
- func (c * SocketClient ) NodeList (ctx context.Context , options types.NodeListOptions ) ([]swarm.Node , error ) {
80
+ func (c * socketClient ) NodeList (ctx context.Context , options types.NodeListOptions ) ([]swarm.Node , error ) {
81
81
return c .client .NodeList (ctx , options )
82
82
}
83
- func (c * SocketClient ) DiskUsage (ctx context.Context , options types.DiskUsageOptions ) (types.DiskUsage , error ) {
83
+ func (c * socketClient ) DiskUsage (ctx context.Context , options types.DiskUsageOptions ) (types.DiskUsage , error ) {
84
84
return c .client .DiskUsage (ctx , options )
85
85
}
86
86
87
- func (c * SocketClient ) ClientVersion () string {
87
+ func (c * socketClient ) ClientVersion () string {
88
88
return c .client .ClientVersion ()
89
89
}
90
90
91
- func (c * SocketClient ) Close () error {
91
+ func (c * socketClient ) Close () error {
92
92
return c .client .Close ()
93
93
}
0 commit comments