summaryrefslogtreecommitdiff
path: root/pkg/bindings/images/images.go
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-03-31 14:45:19 -0500
committerBrent Baude <bbaude@redhat.com>2020-04-01 15:56:26 -0500
commit043308198337941a8086113619d6341528c10cd0 (patch)
tree0d8ce52e6178e464ce5689c4695c42223aeeeae3 /pkg/bindings/images/images.go
parent0f357be5aeaa5dc651659cf0945a58780641e77d (diff)
downloadpodman-043308198337941a8086113619d6341528c10cd0.tar.gz
podman-043308198337941a8086113619d6341528c10cd0.tar.bz2
podman-043308198337941a8086113619d6341528c10cd0.zip
podmanv2 import
add the ability to import a container image from a container export Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/bindings/images/images.go')
-rw-r--r--pkg/bindings/images/images.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/bindings/images/images.go b/pkg/bindings/images/images.go
index 6c739494b..470ce546c 100644
--- a/pkg/bindings/images/images.go
+++ b/pkg/bindings/images/images.go
@@ -217,14 +217,14 @@ func Build(nameOrId string) {}
// Imports adds the given image to the local image store. This can be done by file and the given reader
// or via the url parameter. Additional metadata can be associated with the image by using the changes and
// message parameters. The image can also be tagged given a reference. One of url OR r must be provided.
-func Import(ctx context.Context, changes []string, message, reference, u *string, r io.Reader) (string, error) {
- var id handlers.IDResponse
+func Import(ctx context.Context, changes []string, message, reference, u *string, r io.Reader) (*entities.ImageImportReport, error) {
+ var report entities.ImageImportReport
if r != nil && u != nil {
- return "", errors.New("url and r parameters cannot be used together")
+ return nil, errors.New("url and r parameters cannot be used together")
}
conn, err := bindings.GetClient(ctx)
if err != nil {
- return "", err
+ return nil, err
}
params := url.Values{}
for _, change := range changes {
@@ -241,9 +241,9 @@ func Import(ctx context.Context, changes []string, message, reference, u *string
}
response, err := conn.DoRequest(r, http.MethodPost, "/images/import", params)
if err != nil {
- return "", err
+ return nil, err
}
- return id.ID, response.Process(&id)
+ return &report, response.Process(&report)
}
// Pull is the binding for libpod's v2 endpoints for pulling images. Note that