Skip to content

Commit 5b27e71

Browse files
committed
api/types: move ContainerExecInspect to api/types/container
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent d91638e commit 5b27e71

6 files changed

Lines changed: 18 additions & 13 deletions

File tree

api/types/client.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ import (
1212
units "github.com/docker/go-units"
1313
)
1414

15-
// ContainerExecInspect holds information returned by exec inspect.
16-
type ContainerExecInspect struct {
17-
ExecID string `json:"ID"`
18-
ContainerID string
19-
Running bool
20-
ExitCode int
21-
Pid int
22-
}
23-
2415
// CopyToContainerOptions holds information
2516
// about files to copy into a container
2617
type CopyToContainerOptions struct {

api/types/container/exec.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,12 @@ type ExecStartOptions struct {
3232
//
3333
// TODO(thaJeztah): make this a separate type; ContainerExecAttach does not use the Detach option, and cannot run detached.
3434
type ExecAttachOptions = ExecStartOptions
35+
36+
// ExecInspect holds information returned by exec inspect.
37+
type ExecInspect struct {
38+
ExecID string `json:"ID"`
39+
ContainerID string
40+
Running bool
41+
ExitCode int
42+
Pid int
43+
}

api/types/types_deprecated.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,8 @@ type ExecConfig = container.ExecOptions
6767
//
6868
// Deprecated: use [container.ExecStartOptions] or [container.ExecAttachOptions].
6969
type ExecStartCheck = container.ExecStartOptions
70+
71+
// ContainerExecInspect holds information returned by exec inspect.
72+
//
73+
// Deprecated: use [container.ExecInspect].
74+
type ContainerExecInspect = container.ExecInspect

client/container_exec.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, confi
6363
}
6464

6565
// ContainerExecInspect returns information about a specific exec process on the docker host.
66-
func (cli *Client) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error) {
67-
var response types.ContainerExecInspect
66+
func (cli *Client) ContainerExecInspect(ctx context.Context, execID string) (container.ExecInspect, error) {
67+
var response container.ExecInspect
6868
resp, err := cli.get(ctx, "/exec/"+execID+"/json", nil, nil)
6969
if err != nil {
7070
return response, err

client/container_exec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func TestContainerExecInspect(t *testing.T) {
139139
if !strings.HasPrefix(req.URL.Path, expectedURL) {
140140
return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
141141
}
142-
b, err := json.Marshal(types.ContainerExecInspect{
142+
b, err := json.Marshal(container.ExecInspect{
143143
ExecID: "exec_id",
144144
ContainerID: "container_id",
145145
})

client/interface.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type ContainerAPIClient interface {
5252
ContainerDiff(ctx context.Context, container string) ([]container.FilesystemChange, error)
5353
ContainerExecAttach(ctx context.Context, execID string, options container.ExecAttachOptions) (types.HijackedResponse, error)
5454
ContainerExecCreate(ctx context.Context, container string, options container.ExecOptions) (types.IDResponse, error)
55-
ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
55+
ContainerExecInspect(ctx context.Context, execID string) (container.ExecInspect, error)
5656
ContainerExecResize(ctx context.Context, execID string, options container.ResizeOptions) error
5757
ContainerExecStart(ctx context.Context, execID string, options container.ExecStartOptions) error
5858
ContainerExport(ctx context.Context, container string) (io.ReadCloser, error)

0 commit comments

Comments
 (0)