mirror of https://github.com/docker/cli.git
Convert ContainerTopOKResponse from swagger spec.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
f7e58c8c9b
commit
9eda7f4daf
|
@ -5,13 +5,13 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerTop shows process information from within a container.
|
// ContainerTop shows process information from within a container.
|
||||||
func (cli *Client) ContainerTop(ctx context.Context, containerID string, arguments []string) (types.ContainerProcessList, error) {
|
func (cli *Client) ContainerTop(ctx context.Context, containerID string, arguments []string) (container.ContainerTopOKBody, error) {
|
||||||
var response types.ContainerProcessList
|
var response container.ContainerTopOKBody
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if len(arguments) > 0 {
|
if len(arguments) > 0 {
|
||||||
query.Set("ps_args", strings.Join(arguments, " "))
|
query.Set("ps_args", strings.Join(arguments, " "))
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ func TestContainerTop(t *testing.T) {
|
||||||
return nil, fmt.Errorf("args not set in URL query properly. Expected 'arg1 arg2', got %v", args)
|
return nil, fmt.Errorf("args not set in URL query properly. Expected 'arg1 arg2', got %v", args)
|
||||||
}
|
}
|
||||||
|
|
||||||
b, err := json.Marshal(types.ContainerProcessList{
|
b, err := json.Marshal(container.ContainerTopOKBody{
|
||||||
Processes: [][]string{
|
Processes: [][]string{
|
||||||
{"p1", "p2"},
|
{"p1", "p2"},
|
||||||
{"p3"},
|
{"p3"},
|
||||||
|
|
|
@ -59,7 +59,7 @@ type ContainerAPIClient interface {
|
||||||
ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
|
ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
|
||||||
ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
|
ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
|
||||||
ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
|
ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
|
||||||
ContainerTop(ctx context.Context, container string, arguments []string) (types.ContainerProcessList, error)
|
ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
|
||||||
ContainerUnpause(ctx context.Context, container string) error
|
ContainerUnpause(ctx context.Context, container string) error
|
||||||
ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error)
|
ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error)
|
||||||
ContainerWait(ctx context.Context, container string) (int64, error)
|
ContainerWait(ctx context.Context, container string) (int64, error)
|
||||||
|
|
Loading…
Reference in New Issue