diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2022-06-28 17:46:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-28 17:46:12 +0000 |
commit | d8f197cc1491dace1ff12bff281d9adfbfd35761 (patch) | |
tree | cae59afd4e9f31f1859e24617643c3d0939ca249 /pkg/bindings | |
parent | 50fa651a4e3cfde2b64aa818ad1009f4289f0afd (diff) | |
parent | 6d3520e8b7d7f57d389da08d1c8104c2cfbdd016 (diff) | |
download | podman-d8f197cc1491dace1ff12bff281d9adfbfd35761.tar.gz podman-d8f197cc1491dace1ff12bff281d9adfbfd35761.tar.bz2 podman-d8f197cc1491dace1ff12bff281d9adfbfd35761.zip |
Merge pull request #14400 from cdoern/scp
podman image scp remote support & podman image scp tagging
Diffstat (limited to 'pkg/bindings')
-rw-r--r-- | pkg/bindings/images/images.go | 20 | ||||
-rw-r--r-- | pkg/bindings/images/types.go | 5 | ||||
-rw-r--r-- | pkg/bindings/images/types_scp_options.go | 12 |
3 files changed, 37 insertions, 0 deletions
diff --git a/pkg/bindings/images/images.go b/pkg/bindings/images/images.go index 32372019b..57c8bd597 100644 --- a/pkg/bindings/images/images.go +++ b/pkg/bindings/images/images.go @@ -346,3 +346,23 @@ func Search(ctx context.Context, term string, options *SearchOptions) ([]entitie return results, nil } + +func Scp(ctx context.Context, source, destination *string, options ScpOptions) (reports.ScpReport, error) { + rep := reports.ScpReport{} + + conn, err := bindings.GetClient(ctx) + if err != nil { + return rep, err + } + params, err := options.ToParams() + if err != nil { + return rep, err + } + response, err := conn.DoRequest(ctx, nil, http.MethodPost, fmt.Sprintf("/images/scp/%s", *source), params, nil) + if err != nil { + return rep, err + } + defer response.Body.Close() + + return rep, response.Process(&rep) +} diff --git a/pkg/bindings/images/types.go b/pkg/bindings/images/types.go index 16dbad380..2c00c20cd 100644 --- a/pkg/bindings/images/types.go +++ b/pkg/bindings/images/types.go @@ -188,3 +188,8 @@ type BuildOptions struct { // ExistsOptions are optional options for checking if an image exists type ExistsOptions struct { } + +type ScpOptions struct { + Quiet *bool + Destination *string +} diff --git a/pkg/bindings/images/types_scp_options.go b/pkg/bindings/images/types_scp_options.go new file mode 100644 index 000000000..5a1178cb1 --- /dev/null +++ b/pkg/bindings/images/types_scp_options.go @@ -0,0 +1,12 @@ +package images + +import ( + "net/url" + + "github.com/containers/podman/v4/pkg/bindings/internal/util" +) + +// ToParams formats struct fields to be passed to API service +func (o *ScpOptions) ToParams() (url.Values, error) { + return util.ToParams(o) +} |