Convert ContainerTopOKResponse from swagger spec.
Signed-off-by: Daniel Nephin <dnephin@docker.com> Upstream-commit: 16bdbaaa3357dc1be7d74a283a3ed8d0d861a461 Component: engine
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
)
|
||||
|
||||
func validatePSArgs(psArgs string) error {
|
||||
@@ -41,8 +41,8 @@ func fieldsASCII(s string) []string {
|
||||
return strings.FieldsFunc(s, fn)
|
||||
}
|
||||
|
||||
func parsePSOutput(output []byte, pids []int) (*types.ContainerProcessList, error) {
|
||||
procList := &types.ContainerProcessList{}
|
||||
func parsePSOutput(output []byte, pids []int) (*container.ContainerTopOKBody, error) {
|
||||
procList := &container.ContainerTopOKBody{}
|
||||
|
||||
lines := strings.Split(string(output), "\n")
|
||||
procList.Titles = fieldsASCII(lines[0])
|
||||
@@ -86,7 +86,7 @@ func parsePSOutput(output []byte, pids []int) (*types.ContainerProcessList, erro
|
||||
// "-ef" if no args are given. An error is returned if the container
|
||||
// is not found, or is not running, or if there are any problems
|
||||
// running ps, or parsing the output.
|
||||
func (daemon *Daemon) ContainerTop(name string, psArgs string) (*types.ContainerProcessList, error) {
|
||||
func (daemon *Daemon) ContainerTop(name string, psArgs string) (*container.ContainerTopOKBody, error) {
|
||||
if psArgs == "" {
|
||||
psArgs = "-ef"
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/go-units"
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
// task manager does and use the private working set as the memory counter.
|
||||
// We could return more info for those who really understand how memory
|
||||
// management works in Windows if we introduced a "raw" stats (above).
|
||||
func (daemon *Daemon) ContainerTop(name string, psArgs string) (*types.ContainerProcessList, error) {
|
||||
func (daemon *Daemon) ContainerTop(name string, psArgs string) (*containertypes.ContainerTopOKBody, error) {
|
||||
// It's not at all an equivalent to linux 'ps' on Windows
|
||||
if psArgs != "" {
|
||||
return nil, errors.New("Windows does not support arguments to top")
|
||||
@@ -38,7 +38,7 @@ func (daemon *Daemon) ContainerTop(name string, psArgs string) (*types.Container
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
procList := &types.ContainerProcessList{}
|
||||
procList := &containertypes.ContainerTopOKBody{}
|
||||
procList.Titles = []string{"Name", "PID", "CPU", "Private Working Set"}
|
||||
|
||||
for _, j := range s {
|
||||
|
||||
Reference in New Issue
Block a user