From 3fea2f0a91fb62848d481e027fde7109cdb0ebeb Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Wed, 13 May 2020 09:34:46 -0500 Subject: enable remote image tree Signed-off-by: Brent Baude --- pkg/bindings/images/images.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'pkg/bindings/images') diff --git a/pkg/bindings/images/images.go b/pkg/bindings/images/images.go index 034ade618..a15ce56e5 100644 --- a/pkg/bindings/images/images.go +++ b/pkg/bindings/images/images.go @@ -74,8 +74,22 @@ func GetImage(ctx context.Context, nameOrID string, size *bool) (*entities.Image return &inspectedData, response.Process(&inspectedData) } -func Tree(ctx context.Context, nameOrId string) error { - return bindings.ErrNotImplemented +// Tree retrieves a "tree" based representation of the given image +func Tree(ctx context.Context, nameOrId string, whatRequires *bool) (*entities.ImageTreeReport, error) { + var report entities.ImageTreeReport + conn, err := bindings.GetClient(ctx) + if err != nil { + return nil, err + } + params := url.Values{} + if whatRequires != nil { + params.Set("size", strconv.FormatBool(*whatRequires)) + } + response, err := conn.DoRequest(nil, http.MethodGet, "/images/%s/tree", params, nameOrId) + if err != nil { + return nil, err + } + return &report, response.Process(&report) } // History returns the parent layers of an image. -- cgit v1.2.3-54-g00ecf