diff options
author | Aditya R <arajan@redhat.com> | 2022-06-27 15:47:12 +0530 |
---|---|---|
committer | Aditya R <arajan@redhat.com> | 2022-06-29 12:41:57 +0530 |
commit | 5790caaef769ff3dcf8b9ebf43fb6c61d17618bf (patch) | |
tree | e51ee069bc2bf1f1f4cef44ea7d3d7e689b27184 /pkg/bindings/manifests | |
parent | 324435a6486c050de4f06baaf2a3ff7c6b37071f (diff) | |
download | podman-5790caaef769ff3dcf8b9ebf43fb6c61d17618bf.tar.gz podman-5790caaef769ff3dcf8b9ebf43fb6c61d17618bf.tar.bz2 podman-5790caaef769ff3dcf8b9ebf43fb6c61d17618bf.zip |
bindings: Add support for Delete in pkg/bingings/manifest
Bindings already support `Remove` which removes a manifest from the list
following function adds support for removing entire manifest for local
storage.
Similar functionality can be also used indirectly by using `Remove` defined in
image bindings
Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'pkg/bindings/manifests')
-rw-r--r-- | pkg/bindings/manifests/manifests.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/bindings/manifests/manifests.go b/pkg/bindings/manifests/manifests.go index feff5d6e8..aaa26d7e1 100644 --- a/pkg/bindings/manifests/manifests.go +++ b/pkg/bindings/manifests/manifests.go @@ -117,6 +117,26 @@ func Remove(ctx context.Context, name, digest string, _ *RemoveOptions) (string, return Modify(ctx, name, []string{digest}, optionsv4) } +// Delete removes specified manifest from local storage. +func Delete(ctx context.Context, name string) (*entities.ManifestRemoveReport, error) { + var report entities.ManifestRemoveReport + conn, err := bindings.GetClient(ctx) + if err != nil { + return nil, err + } + response, err := conn.DoRequest(ctx, nil, http.MethodDelete, "/manifests/%s", nil, nil, name) + if err != nil { + return nil, err + } + defer response.Body.Close() + + if err := response.Process(&report); err != nil { + return nil, err + } + + return &report, errorhandling.JoinErrors(errorhandling.StringsToErrors(report.Errors)) +} + // Push takes a manifest list and pushes to a destination. If the destination is not specified, // the name will be used instead. If the optional all boolean is specified, all images specified // in the list will be pushed as well. |