Convert ContainerTopOKResponse from swagger spec.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2016-11-14 14:50:16 -05:00
parent f7e58c8c9b
commit 9eda7f4daf
3 changed files with 6 additions and 6 deletions

View File

@ -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, " "))

View File

@ -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"},

View File

@ -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)