summaryrefslogtreecommitdiff
path: root/pkg/bindings
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-07-03 06:17:03 -0400
committerGitHub <noreply@github.com>2021-07-03 06:17:03 -0400
commit895b8151889422aac1f9b72eebe6d62e8e15095c (patch)
tree3694e61ecedcb8c8fb1b59dd12e1e882d7ce6ae0 /pkg/bindings
parent07716133c44c9c9593364029f4b98085d1be3bdd (diff)
parent8f6a0243f4b7f861a116c0dba5967b3cfe23d61f (diff)
downloadpodman-895b8151889422aac1f9b72eebe6d62e8e15095c.tar.gz
podman-895b8151889422aac1f9b72eebe6d62e8e15095c.tar.bz2
podman-895b8151889422aac1f9b72eebe6d62e8e15095c.zip
Merge pull request #10836 from Luap99/diff
podman diff accept two images or containers
Diffstat (limited to 'pkg/bindings')
-rw-r--r--pkg/bindings/containers/diff.go7
-rw-r--r--pkg/bindings/containers/types.go7
-rw-r--r--pkg/bindings/containers/types_diff_options.go32
-rw-r--r--pkg/bindings/images/types.go4
-rw-r--r--pkg/bindings/images/types_diff_options.go32
5 files changed, 79 insertions, 3 deletions
diff --git a/pkg/bindings/containers/diff.go b/pkg/bindings/containers/diff.go
index 0d0516044..7d20ae530 100644
--- a/pkg/bindings/containers/diff.go
+++ b/pkg/bindings/containers/diff.go
@@ -13,13 +13,16 @@ func Diff(ctx context.Context, nameOrID string, options *DiffOptions) ([]archive
if options == nil {
options = new(DiffOptions)
}
- _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
}
- response, err := conn.DoRequest(nil, http.MethodGet, "/containers/%s/changes", nil, nil, nameOrID)
+ params, err := options.ToParams()
+ if err != nil {
+ return nil, err
+ }
+ response, err := conn.DoRequest(nil, http.MethodGet, "/containers/%s/changes", params, nil, nameOrID)
if err != nil {
return nil, err
}
diff --git a/pkg/bindings/containers/types.go b/pkg/bindings/containers/types.go
index db710d3da..1058c7a48 100644
--- a/pkg/bindings/containers/types.go
+++ b/pkg/bindings/containers/types.go
@@ -70,7 +70,12 @@ type CreateOptions struct{}
//go:generate go run ../generator/generator.go DiffOptions
// DiffOptions are optional options for creating containers
-type DiffOptions struct{}
+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 ExecInspectOptions
// ExecInspectOptions are optional options for inspecting
diff --git a/pkg/bindings/containers/types_diff_options.go b/pkg/bindings/containers/types_diff_options.go
index ed356335d..e92594d39 100644
--- a/pkg/bindings/containers/types_diff_options.go
+++ b/pkg/bindings/containers/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
+}
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
+}