diff options
author | Paul Holzinger <pholzing@redhat.com> | 2021-07-01 15:24:20 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2021-07-02 17:11:56 +0200 |
commit | 8f6a0243f4b7f861a116c0dba5967b3cfe23d61f (patch) | |
tree | 4525ea01079f4f61104e34b5f19b0a823c17f6a0 /pkg/bindings/images | |
parent | fd1715568b7c14451dcf2581c385c8d3e307d30e (diff) | |
download | podman-8f6a0243f4b7f861a116c0dba5967b3cfe23d61f.tar.gz podman-8f6a0243f4b7f861a116c0dba5967b3cfe23d61f.tar.bz2 podman-8f6a0243f4b7f861a116c0dba5967b3cfe23d61f.zip |
podman diff accept two images or containers
First, make podman diff accept optionally a second argument. This allows
the user to specify a second image/container to compare the first with.
If it is not set the parent layer will be used as before.
Second, podman container diff should only use containers and podman
image diff should only use images. Previously, podman container diff
would use the image when both an image and container with this name
exists.
To make this work two new parameters have been added to the api. If they
are not used the previous behaviour is used. The same applies to the
bindings.
Fixes #10649
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/bindings/images')
-rw-r--r-- | pkg/bindings/images/types.go | 4 | ||||
-rw-r--r-- | pkg/bindings/images/types_diff_options.go | 32 |
2 files changed, 36 insertions, 0 deletions
diff --git a/pkg/bindings/images/types.go b/pkg/bindings/images/types.go index 0aa75a81e..801f5ed96 100644 --- a/pkg/bindings/images/types.go +++ b/pkg/bindings/images/types.go @@ -16,6 +16,10 @@ type RemoveOptions struct { //go:generate go run ../generator/generator.go DiffOptions // DiffOptions are optional options image diffs type DiffOptions struct { + // By the default diff will compare against the parent layer. Change the Parent if you want to compare against something else. + Parent *string + // Change the type the backend should match. This can be set to "all", "container" or "image". + DiffType *string } //go:generate go run ../generator/generator.go ListOptions diff --git a/pkg/bindings/images/types_diff_options.go b/pkg/bindings/images/types_diff_options.go index f15a9a696..5492323f6 100644 --- a/pkg/bindings/images/types_diff_options.go +++ b/pkg/bindings/images/types_diff_options.go @@ -19,3 +19,35 @@ func (o *DiffOptions) Changed(fieldName string) bool { func (o *DiffOptions) ToParams() (url.Values, error) { return util.ToParams(o) } + +// WithParent +func (o *DiffOptions) WithParent(value string) *DiffOptions { + v := &value + o.Parent = v + return o +} + +// GetParent +func (o *DiffOptions) GetParent() string { + var parent string + if o.Parent == nil { + return parent + } + return *o.Parent +} + +// WithDiffType +func (o *DiffOptions) WithDiffType(value string) *DiffOptions { + v := &value + o.DiffType = v + return o +} + +// GetDiffType +func (o *DiffOptions) GetDiffType() string { + var diffType string + if o.DiffType == nil { + return diffType + } + return *o.DiffType +} |