diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-27 13:55:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-27 13:55:17 +0100 |
commit | 7007680bfdee8c36b855a97ee45d268b24bde7d3 (patch) | |
tree | 8680b8ca2e099234e83816c1c71a64e28acc8156 /pkg/domain/infra/tunnel | |
parent | 340312cc1b4487f6f23cd6b671e7ed71a8421eb8 (diff) | |
parent | 500a2d508bc8babe8234f259ab51d4908daf9378 (diff) | |
download | podman-7007680bfdee8c36b855a97ee45d268b24bde7d3.tar.gz podman-7007680bfdee8c36b855a97ee45d268b24bde7d3.tar.bz2 podman-7007680bfdee8c36b855a97ee45d268b24bde7d3.zip |
Merge pull request #5618 from vrothberg/v2-top
podmanV2: implement top
Diffstat (limited to 'pkg/domain/infra/tunnel')
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 367ea6e36..3db38ea5c 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -5,6 +5,7 @@ import ( "github.com/containers/libpod/pkg/bindings/containers" "github.com/containers/libpod/pkg/domain/entities" + "github.com/pkg/errors" ) func (ic *ContainerEngine) ContainerExists(ctx context.Context, nameOrId string) (*entities.BoolReport, error) { @@ -156,3 +157,18 @@ func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []st } return reports, nil } + +func (ic *ContainerEngine) ContainerTop(ctx context.Context, options entities.TopOptions) (*entities.StringSliceReport, error) { + switch { + case options.Latest: + return nil, errors.New("latest is not supported") + case options.NameOrID == "": + return nil, errors.New("NameOrID must be specified") + } + + topOutput, err := containers.Top(ic.ClientCxt, options.NameOrID, options.Descriptors) + if err != nil { + return nil, err + } + return &entities.StringSliceReport{Value: topOutput}, nil +} |