summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-12-21 15:00:22 -0500
committerGitHub <noreply@github.com>2020-12-21 15:00:22 -0500
commit182646b01a4544902c9fdf9326889a0ced7d9a8e (patch)
treed37e89ca4c27877098a4136910db68158e71d855
parent076f77b964329c830664b4d6fa3234f608f07591 (diff)
parent401dcff8389e10c6fd88ad34f82daccb8f800d3f (diff)
downloadpodman-182646b01a4544902c9fdf9326889a0ced7d9a8e.tar.gz
podman-182646b01a4544902c9fdf9326889a0ced7d9a8e.tar.bz2
podman-182646b01a4544902c9fdf9326889a0ced7d9a8e.zip
Merge pull request #8775 from baude/bindings3cons
podman v3 container bindings
-rw-r--r--pkg/bindings/containers/attach.go67
-rw-r--r--pkg/bindings/containers/checkpoint.go57
-rw-r--r--pkg/bindings/containers/commit.go33
-rw-r--r--pkg/bindings/containers/containers.go179
-rw-r--r--pkg/bindings/containers/create.go6
-rw-r--r--pkg/bindings/containers/diff.go6
-rw-r--r--pkg/bindings/containers/exec.go12
-rw-r--r--pkg/bindings/containers/healthcheck.go6
-rw-r--r--pkg/bindings/containers/logs.go32
-rw-r--r--pkg/bindings/containers/mount.go18
-rw-r--r--pkg/bindings/containers/types.go206
-rw-r--r--pkg/bindings/containers/types_attach_options.go136
-rw-r--r--pkg/bindings/containers/types_checkpoint_options.go168
-rw-r--r--pkg/bindings/containers/types_commit_options.go200
-rw-r--r--pkg/bindings/containers/types_create_options.go88
-rw-r--r--pkg/bindings/containers/types_diff_options.go88
-rw-r--r--pkg/bindings/containers/types_execinspect_options.go88
-rw-r--r--pkg/bindings/containers/types_execstart_options.go88
-rw-r--r--pkg/bindings/containers/types_execstartandattach_options.go186
-rw-r--r--pkg/bindings/containers/types_export_options.go88
-rw-r--r--pkg/bindings/containers/types_healthcheck_options.go88
-rw-r--r--pkg/bindings/containers/types_init_options.go88
-rw-r--r--pkg/bindings/containers/types_inspect_options.go104
-rw-r--r--pkg/bindings/containers/types_kill_options.go88
-rw-r--r--pkg/bindings/containers/types_list_options.go186
-rw-r--r--pkg/bindings/containers/types_log_options.go200
-rw-r--r--pkg/bindings/containers/types_mount_options.go88
-rw-r--r--pkg/bindings/containers/types_mountedcontainerpaths_options.go88
-rw-r--r--pkg/bindings/containers/types_pause_options.go88
-rw-r--r--pkg/bindings/containers/types_prune_options.go104
-rw-r--r--pkg/bindings/containers/types_remove_options.go120
-rw-r--r--pkg/bindings/containers/types_resizeexectty_options.go120
-rw-r--r--pkg/bindings/containers/types_resizetty_options.go120
-rw-r--r--pkg/bindings/containers/types_restart_options.go104
-rw-r--r--pkg/bindings/containers/types_restore_options.go200
-rw-r--r--pkg/bindings/containers/types_shouldrestart_options.go88
-rw-r--r--pkg/bindings/containers/types_start_options.go104
-rw-r--r--pkg/bindings/containers/types_stats_options.go104
-rw-r--r--pkg/bindings/containers/types_stop_options.go104
-rw-r--r--pkg/bindings/containers/types_top_options.go104
-rw-r--r--pkg/bindings/containers/types_unmount_options.go88
-rw-r--r--pkg/bindings/containers/types_unpause_options.go88
-rw-r--r--pkg/bindings/containers/types_wait_options.go105
-rw-r--r--pkg/bindings/generate/types_kube_options.go6
-rw-r--r--pkg/bindings/generate/types_systemd_options.go6
-rw-r--r--pkg/bindings/generator/generator.go4
-rw-r--r--pkg/bindings/images/types_diff_options.go6
-rw-r--r--pkg/bindings/images/types_export_options.go6
-rw-r--r--pkg/bindings/images/types_get_options.go6
-rw-r--r--pkg/bindings/images/types_history_options.go6
-rw-r--r--pkg/bindings/images/types_import_options.go6
-rw-r--r--pkg/bindings/images/types_list_options.go6
-rw-r--r--pkg/bindings/images/types_load_options.go6
-rw-r--r--pkg/bindings/images/types_prune_options.go6
-rw-r--r--pkg/bindings/images/types_pull_options.go6
-rw-r--r--pkg/bindings/images/types_push_options.go6
-rw-r--r--pkg/bindings/images/types_remove_options.go6
-rw-r--r--pkg/bindings/images/types_search_options.go6
-rw-r--r--pkg/bindings/images/types_tag_options.go6
-rw-r--r--pkg/bindings/images/types_tree_options.go6
-rw-r--r--pkg/bindings/images/types_untag_options.go6
-rw-r--r--pkg/bindings/manifests/types_add_options.go6
-rw-r--r--pkg/bindings/manifests/types_create_options.go6
-rw-r--r--pkg/bindings/manifests/types_inspect_options.go6
-rw-r--r--pkg/bindings/manifests/types_push_options.go6
-rw-r--r--pkg/bindings/manifests/types_remove_options.go6
-rw-r--r--pkg/bindings/network/types_connect_options.go6
-rw-r--r--pkg/bindings/network/types_create_options.go6
-rw-r--r--pkg/bindings/network/types_disconnect_options.go6
-rw-r--r--pkg/bindings/network/types_inspect_options.go6
-rw-r--r--pkg/bindings/network/types_list_options.go6
-rw-r--r--pkg/bindings/network/types_remove_options.go6
-rw-r--r--pkg/bindings/play/types_kube_options.go6
-rw-r--r--pkg/bindings/pods/types_create_options.go6
-rw-r--r--pkg/bindings/pods/types_inspect_options.go6
-rw-r--r--pkg/bindings/pods/types_kill_options.go6
-rw-r--r--pkg/bindings/pods/types_list_options.go6
-rw-r--r--pkg/bindings/pods/types_pause_options.go6
-rw-r--r--pkg/bindings/pods/types_prune_options.go6
-rw-r--r--pkg/bindings/pods/types_remove_options.go6
-rw-r--r--pkg/bindings/pods/types_restart_options.go6
-rw-r--r--pkg/bindings/pods/types_start_options.go6
-rw-r--r--pkg/bindings/pods/types_stats_options.go6
-rw-r--r--pkg/bindings/pods/types_stop_options.go6
-rw-r--r--pkg/bindings/pods/types_top_options.go6
-rw-r--r--pkg/bindings/pods/types_unpause_options.go6
-rw-r--r--pkg/bindings/system/types_disk_options.go6
-rw-r--r--pkg/bindings/system/types_events_options.go6
-rw-r--r--pkg/bindings/system/types_info_options.go6
-rw-r--r--pkg/bindings/system/types_prune_options.go6
-rw-r--r--pkg/bindings/system/types_version_options.go6
-rw-r--r--pkg/bindings/test/attach_test.go17
-rw-r--r--pkg/bindings/test/common_test.go4
-rw-r--r--pkg/bindings/test/containers_test.go117
-rw-r--r--pkg/bindings/test/create_test.go2
-rw-r--r--pkg/bindings/test/exec_test.go4
-rw-r--r--pkg/bindings/test/images_test.go2
-rw-r--r--pkg/bindings/test/info_test.go4
-rw-r--r--pkg/bindings/test/volumes_test.go3
-rw-r--r--pkg/bindings/volumes/types_create_options.go6
-rw-r--r--pkg/bindings/volumes/types_inspect_options.go6
-rw-r--r--pkg/bindings/volumes/types_list_options.go6
-rw-r--r--pkg/bindings/volumes/types_prune_options.go6
-rw-r--r--pkg/bindings/volumes/types_remove_options.go6
-rw-r--r--pkg/domain/infra/tunnel/containers.go212
-rw-r--r--pkg/domain/infra/tunnel/healthcheck.go2
-rw-r--r--pkg/domain/infra/tunnel/helpers.go7
107 files changed, 4474 insertions, 539 deletions
diff --git a/pkg/bindings/containers/attach.go b/pkg/bindings/containers/attach.go
index 91b155fc4..69ae7a32f 100644
--- a/pkg/bindings/containers/attach.go
+++ b/pkg/bindings/containers/attach.go
@@ -26,7 +26,10 @@ import (
)
// Attach attaches to a running container
-func Attach(ctx context.Context, nameOrID string, detachKeys *string, logs, stream *bool, stdin io.Reader, stdout io.Writer, stderr io.Writer, attachReady chan bool) error {
+func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Writer, stderr io.Writer, attachReady chan bool, options *AttachOptions) error {
+ if options == nil {
+ options = new(AttachOptions)
+ }
isSet := struct {
stdin bool
stdout bool
@@ -55,27 +58,24 @@ func Attach(ctx context.Context, nameOrID string, detachKeys *string, logs, stre
}
// Do we need to wire in stdin?
- ctnr, err := Inspect(ctx, nameOrID, bindings.PFalse)
+ ctnr, err := Inspect(ctx, nameOrID, new(InspectOptions).WithSize(false))
if err != nil {
return err
}
- params := url.Values{}
+ params, err := options.ToParams()
+ if err != nil {
+ return err
+ }
detachKeysInBytes := []byte{}
- if detachKeys != nil {
- params.Add("detachKeys", *detachKeys)
+ if options.Changed("DetachKeys") {
+ params.Add("detachKeys", options.GetDetachKeys())
- detachKeysInBytes, err = term.ToBytes(*detachKeys)
+ detachKeysInBytes, err = term.ToBytes(options.GetDetachKeys())
if err != nil {
return errors.Wrapf(err, "invalid detach keys")
}
}
- if logs != nil {
- params.Add("logs", fmt.Sprintf("%t", *logs))
- }
- if stream != nil {
- params.Add("stream", fmt.Sprintf("%t", *stream))
- }
if isSet.stdin {
params.Add("stdin", "true")
}
@@ -278,13 +278,19 @@ func DemuxFrame(r io.Reader, buffer []byte, length int) (frame []byte, err error
}
// ResizeContainerTTY sets container's TTY height and width in characters
-func ResizeContainerTTY(ctx context.Context, nameOrID string, height *int, width *int) error {
- return resizeTTY(ctx, bindings.JoinURL("containers", nameOrID, "resize"), height, width)
+func ResizeContainerTTY(ctx context.Context, nameOrID string, options *ResizeTTYOptions) error {
+ if options == nil {
+ options = new(ResizeTTYOptions)
+ }
+ return resizeTTY(ctx, bindings.JoinURL("containers", nameOrID, "resize"), options.Height, options.Width)
}
// ResizeExecTTY sets session's TTY height and width in characters
-func ResizeExecTTY(ctx context.Context, nameOrID string, height *int, width *int) error {
- return resizeTTY(ctx, bindings.JoinURL("exec", nameOrID, "resize"), height, width)
+func ResizeExecTTY(ctx context.Context, nameOrID string, options *ResizeExecTTYOptions) error {
+ if options == nil {
+ options = new(ResizeExecTTYOptions)
+ }
+ return resizeTTY(ctx, bindings.JoinURL("exec", nameOrID, "resize"), options.Height, options.Width)
}
// resizeTTY set size of TTY of container
@@ -337,9 +343,9 @@ func attachHandleResize(ctx, winCtx context.Context, winChange chan os.Signal, i
var resizeErr error
if isExec {
- resizeErr = ResizeExecTTY(ctx, id, &h, &w)
+ resizeErr = ResizeExecTTY(ctx, id, new(ResizeExecTTYOptions).WithHeight(h).WithWidth(w))
} else {
- resizeErr = ResizeContainerTTY(ctx, id, &h, &w)
+ resizeErr = ResizeContainerTTY(ctx, id, new(ResizeTTYOptions).WithHeight(h).WithWidth(w))
}
if resizeErr != nil {
logrus.Warnf("failed to resize TTY: %v", err)
@@ -361,7 +367,10 @@ func setRawTerminal(file *os.File) (*terminal.State, error) {
}
// ExecStartAndAttach starts and attaches to a given exec session.
-func ExecStartAndAttach(ctx context.Context, sessionID string, streams *define.AttachStreams) error {
+func ExecStartAndAttach(ctx context.Context, sessionID string, options *ExecStartAndAttachOptions) error {
+ if options == nil {
+ options = new(ExecStartAndAttachOptions)
+ }
conn, err := bindings.GetClient(ctx)
if err != nil {
return err
@@ -450,10 +459,10 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, streams *define.A
go attachHandleResize(ctx, winCtx, winChange, true, sessionID, terminalFile)
}
- if streams.AttachInput {
+ if options.GetAttachInput() {
go func() {
logrus.Debugf("Copying STDIN to socket")
- _, err := utils.CopyDetachable(socket, streams.InputStream, []byte{})
+ _, err := utils.CopyDetachable(socket, options.InputStream, []byte{})
if err != nil {
logrus.Error("failed to write input to service: " + err.Error())
}
@@ -463,11 +472,11 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, streams *define.A
buffer := make([]byte, 1024)
if isTerm {
logrus.Debugf("Handling terminal attach to exec")
- if !streams.AttachOutput {
+ if !options.GetAttachOutput() {
return fmt.Errorf("exec session %s has a terminal and must have STDOUT enabled", sessionID)
}
// If not multiplex'ed, read from server and write to stdout
- _, err := utils.CopyDetachable(streams.OutputStream, socket, []byte{})
+ _, err := utils.CopyDetachable(options.GetOutputStream(), socket, []byte{})
if err != nil {
return err
}
@@ -489,22 +498,22 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, streams *define.A
switch {
case fd == 0:
- if streams.AttachInput {
+ if options.GetAttachInput() {
// Write STDIN to STDOUT (echoing characters
// typed by another attach session)
- if _, err := streams.OutputStream.Write(frame[0:l]); err != nil {
+ if _, err := options.GetOutputStream().Write(frame[0:l]); err != nil {
return err
}
}
case fd == 1:
- if streams.AttachOutput {
- if _, err := streams.OutputStream.Write(frame[0:l]); err != nil {
+ if options.GetAttachOutput() {
+ if _, err := options.GetOutputStream().Write(frame[0:l]); err != nil {
return err
}
}
case fd == 2:
- if streams.AttachError {
- if _, err := streams.ErrorStream.Write(frame[0:l]); err != nil {
+ if options.GetAttachError() {
+ if _, err := options.GetErrorStream().Write(frame[0:l]); err != nil {
return err
}
}
diff --git a/pkg/bindings/containers/checkpoint.go b/pkg/bindings/containers/checkpoint.go
index f466f8a34..c250558a6 100644
--- a/pkg/bindings/containers/checkpoint.go
+++ b/pkg/bindings/containers/checkpoint.go
@@ -3,8 +3,6 @@ package containers
import (
"context"
"net/http"
- "net/url"
- "strconv"
"github.com/containers/podman/v2/pkg/bindings"
"github.com/containers/podman/v2/pkg/domain/entities"
@@ -12,27 +10,18 @@ import (
// Checkpoint checkpoints the given container (identified by nameOrID). All additional
// options are options and allow for more fine grained control of the checkpoint process.
-func Checkpoint(ctx context.Context, nameOrID string, keep, leaveRunning, tcpEstablished, ignoreRootFS *bool, export *string) (*entities.CheckpointReport, error) {
+func Checkpoint(ctx context.Context, nameOrID string, options *CheckpointOptions) (*entities.CheckpointReport, error) {
var report entities.CheckpointReport
+ if options == nil {
+ options = new(CheckpointOptions)
+ }
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
}
- params := url.Values{}
- if keep != nil {
- params.Set("keep", strconv.FormatBool(*keep))
- }
- if leaveRunning != nil {
- params.Set("leaveRunning", strconv.FormatBool(*leaveRunning))
- }
- if tcpEstablished != nil {
- params.Set("TCPestablished", strconv.FormatBool(*tcpEstablished))
- }
- if ignoreRootFS != nil {
- params.Set("ignoreRootFS", strconv.FormatBool(*ignoreRootFS))
- }
- if export != nil {
- params.Set("export", *export)
+ params, err := options.ToParams()
+ if err != nil {
+ return nil, err
}
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/checkpoint", params, nil, nameOrID)
if err != nil {
@@ -43,33 +32,23 @@ func Checkpoint(ctx context.Context, nameOrID string, keep, leaveRunning, tcpEst
// Restore restores a checkpointed container to running. The container is identified by the nameOrID option. All
// additional options are optional and allow finer control of the restore process.
-func Restore(ctx context.Context, nameOrID string, keep, tcpEstablished, ignoreRootFS, ignoreStaticIP, ignoreStaticMAC *bool, name, importArchive *string) (*entities.RestoreReport, error) {
+func Restore(ctx context.Context, nameOrID string, options *RestoreOptions) (*entities.RestoreReport, error) {
var report entities.RestoreReport
+ if options == nil {
+ options = new(RestoreOptions)
+ }
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
}
- params := url.Values{}
- if keep != nil {
- params.Set("keep", strconv.FormatBool(*keep))
- }
- if tcpEstablished != nil {
- params.Set("TCPestablished", strconv.FormatBool(*tcpEstablished))
- }
- if ignoreRootFS != nil {
- params.Set("ignoreRootFS", strconv.FormatBool(*ignoreRootFS))
- }
- if ignoreStaticIP != nil {
- params.Set("ignoreStaticIP", strconv.FormatBool(*ignoreStaticIP))
- }
- if ignoreStaticMAC != nil {
- params.Set("ignoreStaticMAC", strconv.FormatBool(*ignoreStaticMAC))
- }
- if name != nil {
- params.Set("name", *name)
+ params, err := options.ToParams()
+ if err != nil {
+ return nil, err
}
- if importArchive != nil {
- params.Set("import", *importArchive)
+ // The import key is a reserved golang term
+ params.Del("ImportArchive")
+ if i := options.GetImportAchive(); options.Changed("ImportArchive") {
+ params.Set("import", i)
}
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/restore", params, nil, nameOrID)
if err != nil {
diff --git a/pkg/bindings/containers/commit.go b/pkg/bindings/containers/commit.go
index 9ab4456a3..6205c75bd 100644
--- a/pkg/bindings/containers/commit.go
+++ b/pkg/bindings/containers/commit.go
@@ -3,8 +3,6 @@ package containers
import (
"context"
"net/http"
- "net/url"
- "strconv"
"github.com/containers/podman/v2/pkg/api/handlers"
"github.com/containers/podman/v2/pkg/bindings"
@@ -12,35 +10,20 @@ import (
// Commit creates a container image from a container. The container is defined by nameOrID. Use
// the CommitOptions for finer grain control on characteristics of the resulting image.
-func Commit(ctx context.Context, nameOrID string, options CommitOptions) (handlers.IDResponse, error) {
+func Commit(ctx context.Context, nameOrID string, options *CommitOptions) (handlers.IDResponse, error) {
+ if options == nil {
+ options = new(CommitOptions)
+ }
id := handlers.IDResponse{}
conn, err := bindings.GetClient(ctx)
if err != nil {
return id, err
}
- params := url.Values{}
- params.Set("container", nameOrID)
- if options.Author != nil {
- params.Set("author", *options.Author)
- }
- for _, change := range options.Changes {
- params.Set("changes", change)
- }
- if options.Comment != nil {
- params.Set("comment", *options.Comment)
- }
- if options.Format != nil {
- params.Set("format", *options.Format)
- }
- if options.Pause != nil {
- params.Set("pause", strconv.FormatBool(*options.Pause))
- }
- if options.Repo != nil {
- params.Set("repo", *options.Repo)
- }
- if options.Tag != nil {
- params.Set("tag", *options.Tag)
+ params, err := options.ToParams()
+ if err != nil {
+ return handlers.IDResponse{}, err
}
+ params.Set("container", nameOrID)
response, err := conn.DoRequest(nil, http.MethodPost, "/commit", params, nil)
if err != nil {
return id, err
diff --git a/pkg/bindings/containers/containers.go b/pkg/bindings/containers/containers.go
index 4331ae6c2..650aa9ac5 100644
--- a/pkg/bindings/containers/containers.go
+++ b/pkg/bindings/containers/containers.go
@@ -25,34 +25,18 @@ var (
// the most recent number of containers. The pod and size booleans indicate that pod information and rootfs
// size information should also be included. Finally, the sync bool synchronizes the OCI runtime and
// container state.
-func List(ctx context.Context, filters map[string][]string, all *bool, last *int, namespace, size, sync *bool) ([]entities.ListContainer, error) { // nolint:typecheck
+func List(ctx context.Context, options *ListOptions) ([]entities.ListContainer, error) { // nolint:typecheck
+ if options == nil {
+ options = new(ListOptions)
+ }
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
}
var containers []entities.ListContainer
- params := url.Values{}
- if all != nil {
- params.Set("all", strconv.FormatBool(*all))
- }
- if last != nil {
- params.Set("limit", strconv.Itoa(*last))
- }
- if size != nil {
- params.Set("size", strconv.FormatBool(*size))
- }
- if sync != nil {
- params.Set("sync", strconv.FormatBool(*sync))
- }
- if namespace != nil {
- params.Set("namespace", strconv.FormatBool(*namespace))
- }
- if filters != nil {
- filterString, err := bindings.FiltersToString(filters)
- if err != nil {
- return nil, err
- }
- params.Set("filters", filterString)
+ params, err := options.ToParams()
+ if err != nil {
+ return nil, err
}
response, err := conn.DoRequest(nil, http.MethodGet, "/containers/json", params, nil)
if err != nil {
@@ -65,19 +49,18 @@ func List(ctx context.Context, filters map[string][]string, all *bool, last *int
// used for more granular selection of containers. The main error returned indicates if there were runtime
// errors like finding containers. Errors specific to the removal of a container are in the PruneContainerResponse
// structure.
-func Prune(ctx context.Context, filters map[string][]string) (*entities.ContainerPruneReport, error) {
+func Prune(ctx context.Context, options *PruneOptions) (*entities.ContainerPruneReport, error) {
+ if options == nil {
+ options = new(PruneOptions)
+ }
var reports *entities.ContainerPruneReport
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
}
- params := url.Values{}
- if filters != nil {
- filterString, err := bindings.FiltersToString(filters)
- if err != nil {
- return nil, err
- }
- params.Set("filters", filterString)
+ params, err := options.ToParams()
+ if err != nil {
+ return nil, err
}
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/prune", params, nil)
if err != nil {
@@ -89,17 +72,20 @@ func Prune(ctx context.Context, filters map[string][]string) (*entities.Containe
// Remove removes a container from local storage. The force bool designates
// that the container should be removed forcibly (example, even it is running). The volumes
// bool dictates that a container's volumes should also be removed.
-func Remove(ctx context.Context, nameOrID string, force, volumes *bool) error {
+func Remove(ctx context.Context, nameOrID string, options *RemoveOptions) error {
+ if options == nil {
+ options = new(RemoveOptions)
+ }
conn, err := bindings.GetClient(ctx)
if err != nil {
return err
}
params := url.Values{}
- if force != nil {
- params.Set("force", strconv.FormatBool(*force))
+ if v := options.GetVolumes(); options.Changed("Volumes") {
+ params.Set("v", strconv.FormatBool(v))
}
- if volumes != nil {
- params.Set("v", strconv.FormatBool(*volumes))
+ if force := options.GetForce(); options.Changed("Force") {
+ params.Set("force", strconv.FormatBool(force))
}
response, err := conn.DoRequest(nil, http.MethodDelete, "/containers/%s", params, nil, nameOrID)
if err != nil {
@@ -112,14 +98,17 @@ func Remove(ctx context.Context, nameOrID string, force, volumes *bool) error {
// or a partial/full ID. The size bool determines whether the size of the container's root filesystem
// should be calculated. Calculating the size of a container requires extra work from the filesystem and
// is therefore slower.
-func Inspect(ctx context.Context, nameOrID string, size *bool) (*define.InspectContainerData, error) {
+func Inspect(ctx context.Context, nameOrID string, options *InspectOptions) (*define.InspectContainerData, error) {
+ if options == nil {
+ options = new(InspectOptions)
+ }
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
}
- params := url.Values{}
- if size != nil {
- params.Set("size", strconv.FormatBool(*size))
+ params, err := options.ToParams()
+ if err != nil {
+ return nil, err
}
response, err := conn.DoRequest(nil, http.MethodGet, "/containers/%s/json", params, nil, nameOrID)
if err != nil {
@@ -132,12 +121,18 @@ func Inspect(ctx context.Context, nameOrID string, size *bool) (*define.InspectC
// Kill sends a given signal to a given container. The signal should be the string
// representation of a signal like 'SIGKILL'. The nameOrID can be a container name
// or a partial/full ID
-func Kill(ctx context.Context, nameOrID string, sig string) error {
+func Kill(ctx context.Context, nameOrID string, sig string, options *KillOptions) error {
+ if options == nil {
+ options = new(KillOptions)
+ }
conn, err := bindings.GetClient(ctx)
if err != nil {
return err
}
- params := url.Values{}
+ params, err := options.ToParams()
+ if err != nil {
+ return err
+ }
params.Set("signal", sig)
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/kill", params, nil, nameOrID)
if err != nil {
@@ -149,7 +144,11 @@ func Kill(ctx context.Context, nameOrID string, sig string) error {
// Pause pauses a given container. The nameOrID can be a container name
// or a partial/full ID.
-func Pause(ctx context.Context, nameOrID string) error {
+func Pause(ctx context.Context, nameOrID string, options *PauseOptions) error {
+ if options == nil {
+ options = new(PauseOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return err
@@ -164,14 +163,17 @@ func Pause(ctx context.Context, nameOrID string) error {
// Restart restarts a running container. The nameOrID can be a container name
// or a partial/full ID. The optional timeout specifies the number of seconds to wait
// for the running container to stop before killing it.
-func Restart(ctx context.Context, nameOrID string, timeout *int) error {
+func Restart(ctx context.Context, nameOrID string, options *RestartOptions) error {
+ if options == nil {
+ options = new(RestartOptions)
+ }
conn, err := bindings.GetClient(ctx)
if err != nil {
return err
}
params := url.Values{}
- if timeout != nil {
- params.Set("t", strconv.Itoa(*timeout))
+ if options.Changed("Timeout") {
+ params.Set("t", strconv.Itoa(options.GetTimeout()))
}
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/restart", params, nil, nameOrID)
if err != nil {
@@ -183,15 +185,18 @@ func Restart(ctx context.Context, nameOrID string, timeout *int) error {
// Start starts a non-running container.The nameOrID can be a container name
// or a partial/full ID. The optional parameter for detach keys are to override the default
// detach key sequence.
-func Start(ctx context.Context, nameOrID string, detachKeys *string) error {
+func Start(ctx context.Context, nameOrID string, options *StartOptions) error {
+ if options == nil {
+ options = new(StartOptions)
+ }
logrus.Infof("Going to start container %q", nameOrID)
conn, err := bindings.GetClient(ctx)
if err != nil {
return err
}
- params := url.Values{}
- if detachKeys != nil {
- params.Set("detachKeys", *detachKeys)
+ params, err := options.ToParams()
+ if err != nil {
+ return err
}
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/start", params, nil, nameOrID)
if err != nil {
@@ -200,14 +205,18 @@ func Start(ctx context.Context, nameOrID string, detachKeys *string) error {
return response.Process(nil)
}
-func Stats(ctx context.Context, containers []string, stream *bool) (chan entities.ContainerStatsReport, error) {
+func Stats(ctx context.Context, containers []string, options *StatsOptions) (chan entities.ContainerStatsReport, error) {
+ if options == nil {
+ options = new(StatsOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
}
- params := url.Values{}
- if stream != nil {
- params.Set("stream", strconv.FormatBool(*stream))
+ params, err := options.ToParams()
+ if err != nil {
+ return nil, err
}
for _, c := range containers {
params.Add("containers", c)
@@ -225,8 +234,8 @@ func Stats(ctx context.Context, containers []string, stream *bool) (chan entitie
dec := json.NewDecoder(response.Body)
doStream := true
- if stream != nil {
- doStream = *stream
+ if options.Changed("Stream") {
+ doStream = options.GetStream()
}
streamLabel: // label to flatten the scope
@@ -253,16 +262,18 @@ func Stats(ctx context.Context, containers []string, stream *bool) (chan entitie
// Top gathers statistics about the running processes in a container. The nameOrID can be a container name
// or a partial/full ID. The descriptors allow for specifying which data to collect from the process.
-func Top(ctx context.Context, nameOrID string, descriptors []string) ([]string, error) {
+func Top(ctx context.Context, nameOrID string, options *TopOptions) ([]string, error) {
+ if options == nil {
+ options = new(TopOptions)
+ }
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
}
params := url.Values{}
-
- if len(descriptors) > 0 {
- // flatten the slice into one string
- params.Set("ps_args", strings.Join(descriptors, ","))
+ if options.Changed("Descriptors") {
+ ps_args := strings.Join(options.GetDescriptors(), ",")
+ params.Add("ps_args", ps_args)
}
response, err := conn.DoRequest(nil, http.MethodGet, "/containers/%s/top", params, nil, nameOrID)
if err != nil {
@@ -287,7 +298,11 @@ func Top(ctx context.Context, nameOrID string, descriptors []string) ([]string,
// Unpause resumes the given paused container. The nameOrID can be a container name
// or a partial/full ID.
-func Unpause(ctx context.Context, nameOrID string) error {
+func Unpause(ctx context.Context, nameOrID string, options *UnpauseOptions) error {
+ if options == nil {
+ options = new(UnpauseOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return err
@@ -302,15 +317,18 @@ func Unpause(ctx context.Context, nameOrID string) error {
// Wait blocks until the given container reaches a condition. If not provided, the condition will
// default to stopped. If the condition is stopped, an exit code for the container will be provided. The
// nameOrID can be a container name or a partial/full ID.
-func Wait(ctx context.Context, nameOrID string, condition *define.ContainerStatus) (int32, error) { // nolint
+func Wait(ctx context.Context, nameOrID string, options *WaitOptions) (int32, error) { // nolint
+ if options == nil {
+ options = new(WaitOptions)
+ }
var exitCode int32
conn, err := bindings.GetClient(ctx)
if err != nil {
return exitCode, err
}
params := url.Values{}
- if condition != nil {
- params.Set("condition", condition.String())
+ if options.Changed("Condition") {
+ params.Set("condition", options.GetCondition().String())
}
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/wait", params, nil, nameOrID)
if err != nil {
@@ -338,14 +356,17 @@ func Exists(ctx context.Context, nameOrID string, external bool) (bool, error) {
// Stop stops a running container. The timeout is optional. The nameOrID can be a container name
// or a partial/full ID
-func Stop(ctx context.Context, nameOrID string, timeout *uint) error {
- params := url.Values{}
- conn, err := bindings.GetClient(ctx)
+func Stop(ctx context.Context, nameOrID string, options *StopOptions) error {
+ if options == nil {
+ options = new(StopOptions)
+ }
+ params, err := options.ToParams()
if err != nil {
return err
}
- if timeout != nil {
- params.Set("t", strconv.Itoa(int(*timeout)))
+ conn, err := bindings.GetClient(ctx)
+ if err != nil {
+ return err
}
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/stop", params, nil, nameOrID)
if err != nil {
@@ -356,7 +377,11 @@ func Stop(ctx context.Context, nameOrID string, timeout *uint) error {
// Export creates a tarball of the given name or ID of a container. It
// requires an io.Writer be provided to write the tarball.
-func Export(ctx context.Context, nameOrID string, w io.Writer) error {
+func Export(ctx context.Context, nameOrID string, w io.Writer, options *ExportOptions) error {
+ if options == nil {
+ options = new(ExportOptions)
+ }
+ _ = options
params := url.Values{}
conn, err := bindings.GetClient(ctx)
if err != nil {
@@ -376,7 +401,11 @@ func Export(ctx context.Context, nameOrID string, w io.Writer) error {
// ContainerInit takes a created container and executes all of the
// preparations to run the container except it will not start
// or attach to the container
-func ContainerInit(ctx context.Context, nameOrID string) error {
+func ContainerInit(ctx context.Context, nameOrID string, options *InitOptions) error {
+ if options == nil {
+ options = new(InitOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return err
@@ -391,7 +420,11 @@ func ContainerInit(ctx context.Context, nameOrID string) error {
return response.Process(nil)
}
-func ShouldRestart(ctx context.Context, nameOrID string) (bool, error) {
+func ShouldRestart(ctx context.Context, nameOrID string, options *ShouldRestartOptions) (bool, error) {
+ if options == nil {
+ options = new(ShouldRestartOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return false, err
diff --git a/pkg/bindings/containers/create.go b/pkg/bindings/containers/create.go
index 5c29ec577..177cf2e9c 100644
--- a/pkg/bindings/containers/create.go
+++ b/pkg/bindings/containers/create.go
@@ -11,8 +11,12 @@ import (
jsoniter "github.com/json-iterator/go"
)
-func CreateWithSpec(ctx context.Context, s *specgen.SpecGenerator) (entities.ContainerCreateResponse, error) {
+func CreateWithSpec(ctx context.Context, s *specgen.SpecGenerator, options *CreateOptions) (entities.ContainerCreateResponse, error) {
var ccr entities.ContainerCreateResponse
+ if options == nil {
+ options = new(CreateOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return ccr, err
diff --git a/pkg/bindings/containers/diff.go b/pkg/bindings/containers/diff.go
index 1478bd940..015172360 100644
--- a/pkg/bindings/containers/diff.go
+++ b/pkg/bindings/containers/diff.go
@@ -9,7 +9,11 @@ import (
)
// Diff provides the changes between two container layers
-func Diff(ctx context.Context, nameOrID string) ([]archive.Change, error) {
+func Diff(ctx context.Context, nameOrID string, options *DiffOptions) ([]archive.Change, error) {
+ if options == nil {
+ options = new(DiffOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
diff --git a/pkg/bindings/containers/exec.go b/pkg/bindings/containers/exec.go
index e080077c8..98ca975a0 100644
--- a/pkg/bindings/containers/exec.go
+++ b/pkg/bindings/containers/exec.go
@@ -50,7 +50,11 @@ func ExecCreate(ctx context.Context, nameOrID string, config *handlers.ExecCreat
// ExecInspect inspects an existing exec session, returning detailed information
// about it.
-func ExecInspect(ctx context.Context, sessionID string) (*define.InspectExecSession, error) {
+func ExecInspect(ctx context.Context, sessionID string, options *ExecInspectOptions) (*define.InspectExecSession, error) {
+ if options == nil {
+ options = new(ExecInspectOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
@@ -72,7 +76,11 @@ func ExecInspect(ctx context.Context, sessionID string) (*define.InspectExecSess
}
// ExecStart starts (but does not attach to) a given exec session.
-func ExecStart(ctx context.Context, sessionID string) error {
+func ExecStart(ctx context.Context, sessionID string, options *ExecStartOptions) error {
+ if options == nil {
+ options = new(ExecStartOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return err
diff --git a/pkg/bindings/containers/healthcheck.go b/pkg/bindings/containers/healthcheck.go
index 9de6ffbe0..44b27629b 100644
--- a/pkg/bindings/containers/healthcheck.go
+++ b/pkg/bindings/containers/healthcheck.go
@@ -10,7 +10,11 @@ import (
// RunHealthCheck executes the container's healthcheck and returns the health status of the
// container.
-func RunHealthCheck(ctx context.Context, nameOrID string) (*define.HealthCheckResults, error) {
+func RunHealthCheck(ctx context.Context, nameOrID string, options *HealthCheckOptions) (*define.HealthCheckResults, error) {
+ if options == nil {
+ options = new(HealthCheckOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
diff --git a/pkg/bindings/containers/logs.go b/pkg/bindings/containers/logs.go
index a73517bac..04307d880 100644
--- a/pkg/bindings/containers/logs.go
+++ b/pkg/bindings/containers/logs.go
@@ -5,7 +5,6 @@ import (
"fmt"
"io"
"net/http"
- "net/url"
"strconv"
"github.com/containers/podman/v2/pkg/bindings"
@@ -14,35 +13,20 @@ import (
// Logs obtains a container's logs given the options provided. The logs are then sent to the
// stdout|stderr channels as strings.
-func Logs(ctx context.Context, nameOrID string, opts LogOptions, stdoutChan, stderrChan chan string) error {
+func Logs(ctx context.Context, nameOrID string, options *LogOptions, stdoutChan, stderrChan chan string) error {
+ if options == nil {
+ options = new(LogOptions)
+ }
conn, err := bindings.GetClient(ctx)
if err != nil {
return err
}
- params := url.Values{}
- if opts.Follow != nil {
- params.Set("follow", strconv.FormatBool(*opts.Follow))
- }
- if opts.Since != nil {
- params.Set("since", *opts.Since)
- }
- if opts.Stderr != nil {
- params.Set("stderr", strconv.FormatBool(*opts.Stderr))
- }
- if opts.Stdout != nil {
- params.Set("stdout", strconv.FormatBool(*opts.Stdout))
- }
- if opts.Tail != nil {
- params.Set("tail", *opts.Tail)
- }
- if opts.Timestamps != nil {
- params.Set("timestamps", strconv.FormatBool(*opts.Timestamps))
- }
- if opts.Until != nil {
- params.Set("until", *opts.Until)
+ params, err := options.ToParams()
+ if err != nil {
+ return err
}
// The API requires either stdout|stderr be used. If neither are specified, we specify stdout
- if opts.Stdout == nil && opts.Stderr == nil {
+ if options.Stdout == nil && options.Stderr == nil {
params.Set("stdout", strconv.FormatBool(true))
}
response, err := conn.DoRequest(nil, http.MethodGet, "/containers/%s/logs", params, nil, nameOrID)
diff --git a/pkg/bindings/containers/mount.go b/pkg/bindings/containers/mount.go
index 4c2e0c188..4fd9f89bc 100644
--- a/pkg/bindings/containers/mount.go
+++ b/pkg/bindings/containers/mount.go
@@ -9,7 +9,11 @@ import (
// Mount mounts an existing container to the filesystem. It returns the path
// of the mounted container in string format.
-func Mount(ctx context.Context, nameOrID string) (string, error) {
+func Mount(ctx context.Context, nameOrID string, options *MountOptions) (string, error) {
+ if options == nil {
+ options = new(MountOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return "", err
@@ -26,7 +30,11 @@ func Mount(ctx context.Context, nameOrID string) (string, error) {
// Unmount unmounts a container from the filesystem. The container must not be running
// or the unmount will fail.
-func Unmount(ctx context.Context, nameOrID string) error {
+func Unmount(ctx context.Context, nameOrID string, options *UnmountOptions) error {
+ if options == nil {
+ options = new(UnmountOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return err
@@ -39,7 +47,11 @@ func Unmount(ctx context.Context, nameOrID string) error {
}
// GetMountedContainerPaths returns a map of mounted containers and their mount locations.
-func GetMountedContainerPaths(ctx context.Context) (map[string]string, error) {
+func GetMountedContainerPaths(ctx context.Context, options *MountedContainerPathsOptions) (map[string]string, error) {
+ if options == nil {
+ options = new(MountedContainerPathsOptions)
+ }
+ _ = options
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
diff --git a/pkg/bindings/containers/types.go b/pkg/bindings/containers/types.go
index f288c2944..24402e982 100644
--- a/pkg/bindings/containers/types.go
+++ b/pkg/bindings/containers/types.go
@@ -1,5 +1,13 @@
package containers
+import (
+ "bufio"
+ "io"
+
+ "github.com/containers/podman/v2/libpod/define"
+)
+
+//go:generate go run ../generator/generator.go LogOptions
// LogOptions describe finer control of log content or
// how the content is formatted.
type LogOptions struct {
@@ -12,6 +20,7 @@ type LogOptions struct {
Until *string
}
+//go:generate go run ../generator/generator.go CommitOptions
// CommitOptions describe details about the resulting committed
// image as defined by repo and tag. None of these options
// are required.
@@ -24,3 +33,200 @@ type CommitOptions struct {
Repo *string
Tag *string
}
+
+//go:generate go run ../generator/generator.go AttachOptions
+// AttachOptions are optional options for attaching to containers
+type AttachOptions struct {
+ DetachKeys *string
+ Logs *bool
+ Stream *bool
+}
+
+//go:generate go run ../generator/generator.go CheckpointOptions
+// CheckpointOptions are optional options for checkpointing containers
+type CheckpointOptions struct {
+ Export *string
+ IgnoreRootfs *bool
+ Keep *bool
+ LeaveRunning *bool
+ TCPEstablished *bool
+}
+
+//go:generate go run ../generator/generator.go RestoreOptions
+// RestoreOptions are optional options for restoring containers
+type RestoreOptions struct {
+ IgnoreRootfs *bool
+ IgnoreStaticIP *bool
+ IgnoreStaticMAC *bool
+ ImportAchive *string
+ Keep *bool
+ Name *string
+ TCPEstablished *bool
+}
+
+//go:generate go run ../generator/generator.go CreateOptions
+// CreateOptions are optional options for creating containers
+type CreateOptions struct{}
+
+//go:generate go run ../generator/generator.go DiffOptions
+// DiffOptions are optional options for creating containers
+type DiffOptions struct{}
+
+//go:generate go run ../generator/generator.go ExecInspectOptions
+// ExecInspectOptions are optional options for inspecting
+// exec sessions
+type ExecInspectOptions struct{}
+
+//go:generate go run ../generator/generator.go ExecStartOptions
+// ExecStartOptions are optional options for starting
+// exec sessions
+type ExecStartOptions struct{}
+
+//go:generate go run ../generator/generator.go HealthCheckOptions
+// HealthCheckOptions are optional options for checking
+// the health of a container
+type HealthCheckOptions struct{}
+
+//go:generate go run ../generator/generator.go MountOptions
+// MountOptions are optional options for mounting
+// containers
+type MountOptions struct{}
+
+//go:generate go run ../generator/generator.go UnmountOptions
+// UnmountOptions are optional options for unmounting
+// containers
+type UnmountOptions struct{}
+
+//go:generate go run ../generator/generator.go MountedContainerPathsOptions
+// MountedContainerPathsOptions are optional options for getting
+// container mount paths
+type MountedContainerPathsOptions struct{}
+
+//go:generate go run ../generator/generator.go ListOptions
+// ListOptions are optional options for listing containers
+type ListOptions struct {
+ All *bool
+ Filters map[string][]string
+ Last *int
+ Namespace *bool
+ Size *bool
+ Sync *bool
+}
+
+//go:generate go run ../generator/generator.go PruneOptions
+// PruneOptions are optional options for pruning containers
+type PruneOptions struct {
+ Filters map[string][]string
+}
+
+//go:generate go run ../generator/generator.go RemoveOptions
+// RemoveOptions are optional options for removing containers
+type RemoveOptions struct {
+ Force *bool
+ Volumes *bool
+}
+
+//go:generate go run ../generator/generator.go InspectOptions
+// InspectOptions are optional options for inspecting containers
+type InspectOptions struct {
+ Size *bool
+}
+
+//go:generate go run ../generator/generator.go KillOptions
+// KillOptions are optional options for killing containers
+type KillOptions struct {
+}
+
+//go:generate go run ../generator/generator.go PauseOptions
+// PauseOptions are optional options for pausing containers
+type PauseOptions struct{}
+
+//go:generate go run ../generator/generator.go RestartOptions
+// RestartOptions are optional options for restarting containers
+type RestartOptions struct {
+ Timeout *int
+}
+
+//go:generate go run ../generator/generator.go StartOptions
+// StartOptions are optional options for starting containers
+type StartOptions struct {
+ DetachKeys *string
+}
+
+//go:generate go run ../generator/generator.go StatsOptions
+// StatsOptions are optional options for getting stats on containers
+type StatsOptions struct {
+ Stream *bool
+}
+
+//go:generate go run ../generator/generator.go TopOptions
+// TopOptions are optional options for getting running
+// processes in containers
+type TopOptions struct {
+ Descriptors *[]string
+}
+
+//go:generate go run ../generator/generator.go UnpauseOptions
+// UnpauseOptions are optional options for unpausing containers
+type UnpauseOptions struct{}
+
+//go:generate go run ../generator/generator.go WaitOptions
+// WaitOptions are optional options for waiting on containers
+type WaitOptions struct {
+ Condition *define.ContainerStatus
+}
+
+//go:generate go run ../generator/generator.go StopOptions
+// StopOptions are optional options for stopping containers
+type StopOptions struct {
+ Timeout *uint
+}
+
+//go:generate go run ../generator/generator.go ExportOptions
+// ExportOptions are optional options for exporting containers
+type ExportOptions struct{}
+
+//go:generate go run ../generator/generator.go InitOptions
+// InitOptions are optional options for initing containers
+type InitOptions struct{}
+
+//go:generate go run ../generator/generator.go ShouldRestartOptions
+// ShouldRestartOptions
+type ShouldRestartOptions struct{}
+
+//go:generate go run ../generator/generator.go ResizeTTYOptions
+// ResizeTTYOptions are optional options for resizing
+// container TTYs
+type ResizeTTYOptions struct {
+ Height *int
+ Width *int
+}
+
+//go:generate go run ../generator/generator.go ResizeExecTTYOptions
+// ResizeExecTTYOptions are optional options for resizing
+// container ExecTTYs
+type ResizeExecTTYOptions struct {
+ Height *int
+ Width *int
+}
+
+//go:generate go run ../generator/generator.go ExecStartAndAttachOptions
+// ExecStartAndAttachOptions are optional options for resizing
+// container ExecTTYs
+type ExecStartAndAttachOptions struct {
+ // OutputStream will be attached to container's STDOUT
+ OutputStream *io.WriteCloser
+ // ErrorStream will be attached to container's STDERR
+ ErrorStream *io.WriteCloser
+ // InputStream will be attached to container's STDIN
+ InputStream *bufio.Reader
+ // AttachOutput is whether to attach to STDOUT
+ // If false, stdout will not be attached
+ AttachOutput *bool
+ // AttachError is whether to attach to STDERR
+ // If false, stdout will not be attached
+ AttachError *bool
+ // AttachInput is whether to attach to STDIN
+ // If false, stdout will not be attached
+ AttachInput *bool
+}
diff --git a/pkg/bindings/containers/types_attach_options.go b/pkg/bindings/containers/types_attach_options.go
new file mode 100644
index 000000000..4ffb8ab17
--- /dev/null
+++ b/pkg/bindings/containers/types_attach_options.go
@@ -0,0 +1,136 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:18.566804404 -0600 CST m=+0.000258831
+*/
+
+// Changed
+func (o *AttachOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *AttachOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithDetachKeys
+func (o *AttachOptions) WithDetachKeys(value string) *AttachOptions {
+ v := &value
+ o.DetachKeys = v
+ return o
+}
+
+// GetDetachKeys
+func (o *AttachOptions) GetDetachKeys() string {
+ var detachKeys string
+ if o.DetachKeys == nil {
+ return detachKeys
+ }
+ return *o.DetachKeys
+}
+
+// WithLogs
+func (o *AttachOptions) WithLogs(value bool) *AttachOptions {
+ v := &value
+ o.Logs = v
+ return o
+}
+
+// GetLogs
+func (o *AttachOptions) GetLogs() bool {
+ var logs bool
+ if o.Logs == nil {
+ return logs
+ }
+ return *o.Logs
+}
+
+// WithStream
+func (o *AttachOptions) WithStream(value bool) *AttachOptions {
+ v := &value
+ o.Stream = v
+ return o
+}
+
+// GetStream
+func (o *AttachOptions) GetStream() bool {
+ var stream bool
+ if o.Stream == nil {
+ return stream
+ }
+ return *o.Stream
+}
diff --git a/pkg/bindings/containers/types_checkpoint_options.go b/pkg/bindings/containers/types_checkpoint_options.go
new file mode 100644
index 000000000..d03dc8231
--- /dev/null
+++ b/pkg/bindings/containers/types_checkpoint_options.go
@@ -0,0 +1,168 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:18.714853285 -0600 CST m=+0.000319103
+*/
+
+// Changed
+func (o *CheckpointOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *CheckpointOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithExport
+func (o *CheckpointOptions) WithExport(value string) *CheckpointOptions {
+ v := &value
+ o.Export = v
+ return o
+}
+
+// GetExport
+func (o *CheckpointOptions) GetExport() string {
+ var export string
+ if o.Export == nil {
+ return export
+ }
+ return *o.Export
+}
+
+// WithIgnoreRootfs
+func (o *CheckpointOptions) WithIgnoreRootfs(value bool) *CheckpointOptions {
+ v := &value
+ o.IgnoreRootfs = v
+ return o
+}
+
+// GetIgnoreRootfs
+func (o *CheckpointOptions) GetIgnoreRootfs() bool {
+ var ignoreRootfs bool
+ if o.IgnoreRootfs == nil {
+ return ignoreRootfs
+ }
+ return *o.IgnoreRootfs
+}
+
+// WithKeep
+func (o *CheckpointOptions) WithKeep(value bool) *CheckpointOptions {
+ v := &value
+ o.Keep = v
+ return o
+}
+
+// GetKeep
+func (o *CheckpointOptions) GetKeep() bool {
+ var keep bool
+ if o.Keep == nil {
+ return keep
+ }
+ return *o.Keep
+}
+
+// WithLeaveRunning
+func (o *CheckpointOptions) WithLeaveRunning(value bool) *CheckpointOptions {
+ v := &value
+ o.LeaveRunning = v
+ return o
+}
+
+// GetLeaveRunning
+func (o *CheckpointOptions) GetLeaveRunning() bool {
+ var leaveRunning bool
+ if o.LeaveRunning == nil {
+ return leaveRunning
+ }
+ return *o.LeaveRunning
+}
+
+// WithTCPEstablished
+func (o *CheckpointOptions) WithTCPEstablished(value bool) *CheckpointOptions {
+ v := &value
+ o.TCPEstablished = v
+ return o
+}
+
+// GetTCPEstablished
+func (o *CheckpointOptions) GetTCPEstablished() bool {
+ var tCPEstablished bool
+ if o.TCPEstablished == nil {
+ return tCPEstablished
+ }
+ return *o.TCPEstablished
+}
diff --git a/pkg/bindings/containers/types_commit_options.go b/pkg/bindings/containers/types_commit_options.go
new file mode 100644
index 000000000..a8b215141
--- /dev/null
+++ b/pkg/bindings/containers/types_commit_options.go
@@ -0,0 +1,200 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:18.420656951 -0600 CST m=+0.000259662
+*/
+
+// Changed
+func (o *CommitOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *CommitOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithAuthor
+func (o *CommitOptions) WithAuthor(value string) *CommitOptions {
+ v := &value
+ o.Author = v
+ return o
+}
+
+// GetAuthor
+func (o *CommitOptions) GetAuthor() string {
+ var author string
+ if o.Author == nil {
+ return author
+ }
+ return *o.Author
+}
+
+// WithChanges
+func (o *CommitOptions) WithChanges(value []string) *CommitOptions {
+ v := value
+ o.Changes = v
+ return o
+}
+
+// GetChanges
+func (o *CommitOptions) GetChanges() []string {
+ var changes []string
+ if o.Changes == nil {
+ return changes
+ }
+ return o.Changes
+}
+
+// WithComment
+func (o *CommitOptions) WithComment(value string) *CommitOptions {
+ v := &value
+ o.Comment = v
+ return o
+}
+
+// GetComment
+func (o *CommitOptions) GetComment() string {
+ var comment string
+ if o.Comment == nil {
+ return comment
+ }
+ return *o.Comment
+}
+
+// WithFormat
+func (o *CommitOptions) WithFormat(value string) *CommitOptions {
+ v := &value
+ o.Format = v
+ return o
+}
+
+// GetFormat
+func (o *CommitOptions) GetFormat() string {
+ var format string
+ if o.Format == nil {
+ return format
+ }
+ return *o.Format
+}
+
+// WithPause
+func (o *CommitOptions) WithPause(value bool) *CommitOptions {
+ v := &value
+ o.Pause = v
+ return o
+}
+
+// GetPause
+func (o *CommitOptions) GetPause() bool {
+ var pause bool
+ if o.Pause == nil {
+ return pause
+ }
+ return *o.Pause
+}
+
+// WithRepo
+func (o *CommitOptions) WithRepo(value string) *CommitOptions {
+ v := &value
+ o.Repo = v
+ return o
+}
+
+// GetRepo
+func (o *CommitOptions) GetRepo() string {
+ var repo string
+ if o.Repo == nil {
+ return repo
+ }
+ return *o.Repo
+}
+
+// WithTag
+func (o *CommitOptions) WithTag(value string) *CommitOptions {
+ v := &value
+ o.Tag = v
+ return o
+}
+
+// GetTag
+func (o *CommitOptions) GetTag() string {
+ var tag string
+ if o.Tag == nil {
+ return tag
+ }
+ return *o.Tag
+}
diff --git a/pkg/bindings/containers/types_create_options.go b/pkg/bindings/containers/types_create_options.go
new file mode 100644
index 000000000..4dbce0203
--- /dev/null
+++ b/pkg/bindings/containers/types_create_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:19.011789618 -0600 CST m=+0.000259413
+*/
+
+// Changed
+func (o *CreateOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *CreateOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_diff_options.go b/pkg/bindings/containers/types_diff_options.go
new file mode 100644
index 000000000..be3bbf554
--- /dev/null
+++ b/pkg/bindings/containers/types_diff_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:19.159128927 -0600 CST m=+0.000255635
+*/
+
+// Changed
+func (o *DiffOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *DiffOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_execinspect_options.go b/pkg/bindings/containers/types_execinspect_options.go
new file mode 100644
index 000000000..3c4c870be
--- /dev/null
+++ b/pkg/bindings/containers/types_execinspect_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:19.303239014 -0600 CST m=+0.000256861
+*/
+
+// Changed
+func (o *ExecInspectOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *ExecInspectOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_execstart_options.go b/pkg/bindings/containers/types_execstart_options.go
new file mode 100644
index 000000000..66fdc82cb
--- /dev/null
+++ b/pkg/bindings/containers/types_execstart_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:19.447714428 -0600 CST m=+0.000257278
+*/
+
+// Changed
+func (o *ExecStartOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *ExecStartOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_execstartandattach_options.go b/pkg/bindings/containers/types_execstartandattach_options.go
new file mode 100644
index 000000000..43900d29d
--- /dev/null
+++ b/pkg/bindings/containers/types_execstartandattach_options.go
@@ -0,0 +1,186 @@
+package containers
+
+import (
+ "bufio"
+ "io"
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:22.827903078 -0600 CST m=+0.000269906
+*/
+
+// Changed
+func (o *ExecStartAndAttachOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *ExecStartAndAttachOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithOutputStream
+func (o *ExecStartAndAttachOptions) WithOutputStream(value io.WriteCloser) *ExecStartAndAttachOptions {
+ v := &value
+ o.OutputStream = v
+ return o
+}
+
+// GetOutputStream
+func (o *ExecStartAndAttachOptions) GetOutputStream() io.WriteCloser {
+ var outputStream io.WriteCloser
+ if o.OutputStream == nil {
+ return outputStream
+ }
+ return *o.OutputStream
+}
+
+// WithErrorStream
+func (o *ExecStartAndAttachOptions) WithErrorStream(value io.WriteCloser) *ExecStartAndAttachOptions {
+ v := &value
+ o.ErrorStream = v
+ return o
+}
+
+// GetErrorStream
+func (o *ExecStartAndAttachOptions) GetErrorStream() io.WriteCloser {
+ var errorStream io.WriteCloser
+ if o.ErrorStream == nil {
+ return errorStream
+ }
+ return *o.ErrorStream
+}
+
+// WithInputStream
+func (o *ExecStartAndAttachOptions) WithInputStream(value bufio.Reader) *ExecStartAndAttachOptions {
+ v := &value
+ o.InputStream = v
+ return o
+}
+
+// GetInputStream
+func (o *ExecStartAndAttachOptions) GetInputStream() bufio.Reader {
+ var inputStream bufio.Reader
+ if o.InputStream == nil {
+ return inputStream
+ }
+ return *o.InputStream
+}
+
+// WithAttachOutput
+func (o *ExecStartAndAttachOptions) WithAttachOutput(value bool) *ExecStartAndAttachOptions {
+ v := &value
+ o.AttachOutput = v
+ return o
+}
+
+// GetAttachOutput
+func (o *ExecStartAndAttachOptions) GetAttachOutput() bool {
+ var attachOutput bool
+ if o.AttachOutput == nil {
+ return attachOutput
+ }
+ return *o.AttachOutput
+}
+
+// WithAttachError
+func (o *ExecStartAndAttachOptions) WithAttachError(value bool) *ExecStartAndAttachOptions {
+ v := &value
+ o.AttachError = v
+ return o
+}
+
+// GetAttachError
+func (o *ExecStartAndAttachOptions) GetAttachError() bool {
+ var attachError bool
+ if o.AttachError == nil {
+ return attachError
+ }
+ return *o.AttachError
+}
+
+// WithAttachInput
+func (o *ExecStartAndAttachOptions) WithAttachInput(value bool) *ExecStartAndAttachOptions {
+ v := &value
+ o.AttachInput = v
+ return o
+}
+
+// GetAttachInput
+func (o *ExecStartAndAttachOptions) GetAttachInput() bool {
+ var attachInput bool
+ if o.AttachInput == nil {
+ return attachInput
+ }
+ return *o.AttachInput
+}
diff --git a/pkg/bindings/containers/types_export_options.go b/pkg/bindings/containers/types_export_options.go
new file mode 100644
index 000000000..e325bd2cd
--- /dev/null
+++ b/pkg/bindings/containers/types_export_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:22.101679998 -0600 CST m=+0.000261669
+*/
+
+// Changed
+func (o *ExportOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *ExportOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_healthcheck_options.go b/pkg/bindings/containers/types_healthcheck_options.go
new file mode 100644
index 000000000..8c4300366
--- /dev/null
+++ b/pkg/bindings/containers/types_healthcheck_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:19.593883686 -0600 CST m=+0.000289845
+*/
+
+// Changed
+func (o *HealthCheckOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *HealthCheckOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_init_options.go b/pkg/bindings/containers/types_init_options.go
new file mode 100644
index 000000000..655362f62
--- /dev/null
+++ b/pkg/bindings/containers/types_init_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:22.245077233 -0600 CST m=+0.000255461
+*/
+
+// Changed
+func (o *InitOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *InitOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_inspect_options.go b/pkg/bindings/containers/types_inspect_options.go
new file mode 100644
index 000000000..884f5524d
--- /dev/null
+++ b/pkg/bindings/containers/types_inspect_options.go
@@ -0,0 +1,104 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:20.635987603 -0600 CST m=+0.000260270
+*/
+
+// Changed
+func (o *InspectOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *InspectOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithSize
+func (o *InspectOptions) WithSize(value bool) *InspectOptions {
+ v := &value
+ o.Size = v
+ return o
+}
+
+// GetSize
+func (o *InspectOptions) GetSize() bool {
+ var size bool
+ if o.Size == nil {
+ return size
+ }
+ return *o.Size
+}
diff --git a/pkg/bindings/containers/types_kill_options.go b/pkg/bindings/containers/types_kill_options.go
new file mode 100644
index 000000000..3d6fa6224
--- /dev/null
+++ b/pkg/bindings/containers/types_kill_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:20.781581076 -0600 CST m=+0.000259040
+*/
+
+// Changed
+func (o *KillOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *KillOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_list_options.go b/pkg/bindings/containers/types_list_options.go
new file mode 100644
index 000000000..dd74d37b7
--- /dev/null
+++ b/pkg/bindings/containers/types_list_options.go
@@ -0,0 +1,186 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+ "strings"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:20.199081744 -0600 CST m=+0.000270626
+*/
+
+// Changed
+func (o *ListOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *ListOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ fieldName = strings.ToLower(fieldName)
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithAll
+func (o *ListOptions) WithAll(value bool) *ListOptions {
+ v := &value
+ o.All = v
+ return o
+}
+
+// GetAll
+func (o *ListOptions) GetAll() bool {
+ var all bool
+ if o.All == nil {
+ return all
+ }
+ return *o.All
+}
+
+// WithFilters
+func (o *ListOptions) WithFilters(value map[string][]string) *ListOptions {
+ v := value
+ o.Filters = v
+ return o
+}
+
+// GetFilters
+func (o *ListOptions) GetFilters() map[string][]string {
+ var filters map[string][]string
+ if o.Filters == nil {
+ return filters
+ }
+ return o.Filters
+}
+
+// WithLast
+func (o *ListOptions) WithLast(value int) *ListOptions {
+ v := &value
+ o.Last = v
+ return o
+}
+
+// GetLast
+func (o *ListOptions) GetLast() int {
+ var last int
+ if o.Last == nil {
+ return last
+ }
+ return *o.Last
+}
+
+// WithNamespace
+func (o *ListOptions) WithNamespace(value bool) *ListOptions {
+ v := &value
+ o.Namespace = v
+ return o
+}
+
+// GetNamespace
+func (o *ListOptions) GetNamespace() bool {
+ var namespace bool
+ if o.Namespace == nil {
+ return namespace
+ }
+ return *o.Namespace
+}
+
+// WithSize
+func (o *ListOptions) WithSize(value bool) *ListOptions {
+ v := &value
+ o.Size = v
+ return o
+}
+
+// GetSize
+func (o *ListOptions) GetSize() bool {
+ var size bool
+ if o.Size == nil {
+ return size
+ }
+ return *o.Size
+}
+
+// WithSync
+func (o *ListOptions) WithSync(value bool) *ListOptions {
+ v := &value
+ o.Sync = v
+ return o
+}
+
+// GetSync
+func (o *ListOptions) GetSync() bool {
+ var sync bool
+ if o.Sync == nil {
+ return sync
+ }
+ return *o.Sync
+}
diff --git a/pkg/bindings/containers/types_log_options.go b/pkg/bindings/containers/types_log_options.go
new file mode 100644
index 000000000..a6958242f
--- /dev/null
+++ b/pkg/bindings/containers/types_log_options.go
@@ -0,0 +1,200 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:18.273264471 -0600 CST m=+0.000274536
+*/
+
+// Changed
+func (o *LogOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *LogOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithFollow
+func (o *LogOptions) WithFollow(value bool) *LogOptions {
+ v := &value
+ o.Follow = v
+ return o
+}
+
+// GetFollow
+func (o *LogOptions) GetFollow() bool {
+ var follow bool
+ if o.Follow == nil {
+ return follow
+ }
+ return *o.Follow
+}
+
+// WithSince
+func (o *LogOptions) WithSince(value string) *LogOptions {
+ v := &value
+ o.Since = v
+ return o
+}
+
+// GetSince
+func (o *LogOptions) GetSince() string {
+ var since string
+ if o.Since == nil {
+ return since
+ }
+ return *o.Since
+}
+
+// WithStderr
+func (o *LogOptions) WithStderr(value bool) *LogOptions {
+ v := &value
+ o.Stderr = v
+ return o
+}
+
+// GetStderr
+func (o *LogOptions) GetStderr() bool {
+ var stderr bool
+ if o.Stderr == nil {
+ return stderr
+ }
+ return *o.Stderr
+}
+
+// WithStdout
+func (o *LogOptions) WithStdout(value bool) *LogOptions {
+ v := &value
+ o.Stdout = v
+ return o
+}
+
+// GetStdout
+func (o *LogOptions) GetStdout() bool {
+ var stdout bool
+ if o.Stdout == nil {
+ return stdout
+ }
+ return *o.Stdout
+}
+
+// WithTail
+func (o *LogOptions) WithTail(value string) *LogOptions {
+ v := &value
+ o.Tail = v
+ return o
+}
+
+// GetTail
+func (o *LogOptions) GetTail() string {
+ var tail string
+ if o.Tail == nil {
+ return tail
+ }
+ return *o.Tail
+}
+
+// WithTimestamps
+func (o *LogOptions) WithTimestamps(value bool) *LogOptions {
+ v := &value
+ o.Timestamps = v
+ return o
+}
+
+// GetTimestamps
+func (o *LogOptions) GetTimestamps() bool {
+ var timestamps bool
+ if o.Timestamps == nil {
+ return timestamps
+ }
+ return *o.Timestamps
+}
+
+// WithUntil
+func (o *LogOptions) WithUntil(value string) *LogOptions {
+ v := &value
+ o.Until = v
+ return o
+}
+
+// GetUntil
+func (o *LogOptions) GetUntil() string {
+ var until string
+ if o.Until == nil {
+ return until
+ }
+ return *o.Until
+}
diff --git a/pkg/bindings/containers/types_mount_options.go b/pkg/bindings/containers/types_mount_options.go
new file mode 100644
index 000000000..c0e253094
--- /dev/null
+++ b/pkg/bindings/containers/types_mount_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:19.740822464 -0600 CST m=+0.000250074
+*/
+
+// Changed
+func (o *MountOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *MountOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_mountedcontainerpaths_options.go b/pkg/bindings/containers/types_mountedcontainerpaths_options.go
new file mode 100644
index 000000000..e368ff131
--- /dev/null
+++ b/pkg/bindings/containers/types_mountedcontainerpaths_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:20.048233253 -0600 CST m=+0.000307223
+*/
+
+// Changed
+func (o *MountedContainerPathsOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *MountedContainerPathsOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_pause_options.go b/pkg/bindings/containers/types_pause_options.go
new file mode 100644
index 000000000..26ad86793
--- /dev/null
+++ b/pkg/bindings/containers/types_pause_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:20.929891294 -0600 CST m=+0.000261081
+*/
+
+// Changed
+func (o *PauseOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *PauseOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_prune_options.go b/pkg/bindings/containers/types_prune_options.go
new file mode 100644
index 000000000..e3c0f4de7
--- /dev/null
+++ b/pkg/bindings/containers/types_prune_options.go
@@ -0,0 +1,104 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:20.344278799 -0600 CST m=+0.000263499
+*/
+
+// Changed
+func (o *PruneOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *PruneOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithFilters
+func (o *PruneOptions) WithFilters(value map[string][]string) *PruneOptions {
+ v := value
+ o.Filters = v
+ return o
+}
+
+// GetFilters
+func (o *PruneOptions) GetFilters() map[string][]string {
+ var filters map[string][]string
+ if o.Filters == nil {
+ return filters
+ }
+ return o.Filters
+}
diff --git a/pkg/bindings/containers/types_remove_options.go b/pkg/bindings/containers/types_remove_options.go
new file mode 100644
index 000000000..6f59f0ed5
--- /dev/null
+++ b/pkg/bindings/containers/types_remove_options.go
@@ -0,0 +1,120 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:20.489968735 -0600 CST m=+0.000264450
+*/
+
+// Changed
+func (o *RemoveOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *RemoveOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithForce
+func (o *RemoveOptions) WithForce(value bool) *RemoveOptions {
+ v := &value
+ o.Force = v
+ return o
+}
+
+// GetForce
+func (o *RemoveOptions) GetForce() bool {
+ var force bool
+ if o.Force == nil {
+ return force
+ }
+ return *o.Force
+}
+
+// WithVolumes
+func (o *RemoveOptions) WithVolumes(value bool) *RemoveOptions {
+ v := &value
+ o.Volumes = v
+ return o
+}
+
+// GetVolumes
+func (o *RemoveOptions) GetVolumes() bool {
+ var volumes bool
+ if o.Volumes == nil {
+ return volumes
+ }
+ return *o.Volumes
+}
diff --git a/pkg/bindings/containers/types_resizeexectty_options.go b/pkg/bindings/containers/types_resizeexectty_options.go
new file mode 100644
index 000000000..33bb4e78b
--- /dev/null
+++ b/pkg/bindings/containers/types_resizeexectty_options.go
@@ -0,0 +1,120 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:22.680735758 -0600 CST m=+0.000267081
+*/
+
+// Changed
+func (o *ResizeExecTTYOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *ResizeExecTTYOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithHeight
+func (o *ResizeExecTTYOptions) WithHeight(value int) *ResizeExecTTYOptions {
+ v := &value
+ o.Height = v
+ return o
+}
+
+// GetHeight
+func (o *ResizeExecTTYOptions) GetHeight() int {
+ var height int
+ if o.Height == nil {
+ return height
+ }
+ return *o.Height
+}
+
+// WithWidth
+func (o *ResizeExecTTYOptions) WithWidth(value int) *ResizeExecTTYOptions {
+ v := &value
+ o.Width = v
+ return o
+}
+
+// GetWidth
+func (o *ResizeExecTTYOptions) GetWidth() int {
+ var width int
+ if o.Width == nil {
+ return width
+ }
+ return *o.Width
+}
diff --git a/pkg/bindings/containers/types_resizetty_options.go b/pkg/bindings/containers/types_resizetty_options.go
new file mode 100644
index 000000000..29ec54988
--- /dev/null
+++ b/pkg/bindings/containers/types_resizetty_options.go
@@ -0,0 +1,120 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:22.535788375 -0600 CST m=+0.000266528
+*/
+
+// Changed
+func (o *ResizeTTYOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *ResizeTTYOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithHeight
+func (o *ResizeTTYOptions) WithHeight(value int) *ResizeTTYOptions {
+ v := &value
+ o.Height = v
+ return o
+}
+
+// GetHeight
+func (o *ResizeTTYOptions) GetHeight() int {
+ var height int
+ if o.Height == nil {
+ return height
+ }
+ return *o.Height
+}
+
+// WithWidth
+func (o *ResizeTTYOptions) WithWidth(value int) *ResizeTTYOptions {
+ v := &value
+ o.Width = v
+ return o
+}
+
+// GetWidth
+func (o *ResizeTTYOptions) GetWidth() int {
+ var width int
+ if o.Width == nil {
+ return width
+ }
+ return *o.Width
+}
diff --git a/pkg/bindings/containers/types_restart_options.go b/pkg/bindings/containers/types_restart_options.go
new file mode 100644
index 000000000..13ac099b1
--- /dev/null
+++ b/pkg/bindings/containers/types_restart_options.go
@@ -0,0 +1,104 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:21.076709643 -0600 CST m=+0.000303354
+*/
+
+// Changed
+func (o *RestartOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *RestartOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithTimeout
+func (o *RestartOptions) WithTimeout(value int) *RestartOptions {
+ v := &value
+ o.Timeout = v
+ return o
+}
+
+// GetTimeout
+func (o *RestartOptions) GetTimeout() int {
+ var timeout int
+ if o.Timeout == nil {
+ return timeout
+ }
+ return *o.Timeout
+}
diff --git a/pkg/bindings/containers/types_restore_options.go b/pkg/bindings/containers/types_restore_options.go
new file mode 100644
index 000000000..be6e94736
--- /dev/null
+++ b/pkg/bindings/containers/types_restore_options.go
@@ -0,0 +1,200 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:18.861536405 -0600 CST m=+0.000300026
+*/
+
+// Changed
+func (o *RestoreOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *RestoreOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithIgnoreRootfs
+func (o *RestoreOptions) WithIgnoreRootfs(value bool) *RestoreOptions {
+ v := &value
+ o.IgnoreRootfs = v
+ return o
+}
+
+// GetIgnoreRootfs
+func (o *RestoreOptions) GetIgnoreRootfs() bool {
+ var ignoreRootfs bool
+ if o.IgnoreRootfs == nil {
+ return ignoreRootfs
+ }
+ return *o.IgnoreRootfs
+}
+
+// WithIgnoreStaticIP
+func (o *RestoreOptions) WithIgnoreStaticIP(value bool) *RestoreOptions {
+ v := &value
+ o.IgnoreStaticIP = v
+ return o
+}
+
+// GetIgnoreStaticIP
+func (o *RestoreOptions) GetIgnoreStaticIP() bool {
+ var ignoreStaticIP bool
+ if o.IgnoreStaticIP == nil {
+ return ignoreStaticIP
+ }
+ return *o.IgnoreStaticIP
+}
+
+// WithIgnoreStaticMAC
+func (o *RestoreOptions) WithIgnoreStaticMAC(value bool) *RestoreOptions {
+ v := &value
+ o.IgnoreStaticMAC = v
+ return o
+}
+
+// GetIgnoreStaticMAC
+func (o *RestoreOptions) GetIgnoreStaticMAC() bool {
+ var ignoreStaticMAC bool
+ if o.IgnoreStaticMAC == nil {
+ return ignoreStaticMAC
+ }
+ return *o.IgnoreStaticMAC
+}
+
+// WithImportAchive
+func (o *RestoreOptions) WithImportAchive(value string) *RestoreOptions {
+ v := &value
+ o.ImportAchive = v
+ return o
+}
+
+// GetImportAchive
+func (o *RestoreOptions) GetImportAchive() string {
+ var importAchive string
+ if o.ImportAchive == nil {
+ return importAchive
+ }
+ return *o.ImportAchive
+}
+
+// WithKeep
+func (o *RestoreOptions) WithKeep(value bool) *RestoreOptions {
+ v := &value
+ o.Keep = v
+ return o
+}
+
+// GetKeep
+func (o *RestoreOptions) GetKeep() bool {
+ var keep bool
+ if o.Keep == nil {
+ return keep
+ }
+ return *o.Keep
+}
+
+// WithName
+func (o *RestoreOptions) WithName(value string) *RestoreOptions {
+ v := &value
+ o.Name = v
+ return o
+}
+
+// GetName
+func (o *RestoreOptions) GetName() string {
+ var name string
+ if o.Name == nil {
+ return name
+ }
+ return *o.Name
+}
+
+// WithTCPEstablished
+func (o *RestoreOptions) WithTCPEstablished(value bool) *RestoreOptions {
+ v := &value
+ o.TCPEstablished = v
+ return o
+}
+
+// GetTCPEstablished
+func (o *RestoreOptions) GetTCPEstablished() bool {
+ var tCPEstablished bool
+ if o.TCPEstablished == nil {
+ return tCPEstablished
+ }
+ return *o.TCPEstablished
+}
diff --git a/pkg/bindings/containers/types_shouldrestart_options.go b/pkg/bindings/containers/types_shouldrestart_options.go
new file mode 100644
index 000000000..c833d0d8b
--- /dev/null
+++ b/pkg/bindings/containers/types_shouldrestart_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:22.388596051 -0600 CST m=+0.000253693
+*/
+
+// Changed
+func (o *ShouldRestartOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *ShouldRestartOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_start_options.go b/pkg/bindings/containers/types_start_options.go
new file mode 100644
index 000000000..5918af89b
--- /dev/null
+++ b/pkg/bindings/containers/types_start_options.go
@@ -0,0 +1,104 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:21.221364502 -0600 CST m=+0.000276575
+*/
+
+// Changed
+func (o *StartOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *StartOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithDetachKeys
+func (o *StartOptions) WithDetachKeys(value string) *StartOptions {
+ v := &value
+ o.DetachKeys = v
+ return o
+}
+
+// GetDetachKeys
+func (o *StartOptions) GetDetachKeys() string {
+ var detachKeys string
+ if o.DetachKeys == nil {
+ return detachKeys
+ }
+ return *o.DetachKeys
+}
diff --git a/pkg/bindings/containers/types_stats_options.go b/pkg/bindings/containers/types_stats_options.go
new file mode 100644
index 000000000..f821ea1cd
--- /dev/null
+++ b/pkg/bindings/containers/types_stats_options.go
@@ -0,0 +1,104 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:21.370213399 -0600 CST m=+0.000264334
+*/
+
+// Changed
+func (o *StatsOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *StatsOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithStream
+func (o *StatsOptions) WithStream(value bool) *StatsOptions {
+ v := &value
+ o.Stream = v
+ return o
+}
+
+// GetStream
+func (o *StatsOptions) GetStream() bool {
+ var stream bool
+ if o.Stream == nil {
+ return stream
+ }
+ return *o.Stream
+}
diff --git a/pkg/bindings/containers/types_stop_options.go b/pkg/bindings/containers/types_stop_options.go
new file mode 100644
index 000000000..14d7633a0
--- /dev/null
+++ b/pkg/bindings/containers/types_stop_options.go
@@ -0,0 +1,104 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:21.95469621 -0600 CST m=+0.000261399
+*/
+
+// Changed
+func (o *StopOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *StopOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithTimeout
+func (o *StopOptions) WithTimeout(value uint) *StopOptions {
+ v := &value
+ o.Timeout = v
+ return o
+}
+
+// GetTimeout
+func (o *StopOptions) GetTimeout() uint {
+ var timeout uint
+ if o.Timeout == nil {
+ return timeout
+ }
+ return *o.Timeout
+}
diff --git a/pkg/bindings/containers/types_top_options.go b/pkg/bindings/containers/types_top_options.go
new file mode 100644
index 000000000..95a1ee686
--- /dev/null
+++ b/pkg/bindings/containers/types_top_options.go
@@ -0,0 +1,104 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:21.515867629 -0600 CST m=+0.000257106
+*/
+
+// Changed
+func (o *TopOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *TopOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithDescriptors
+func (o *TopOptions) WithDescriptors(value []string) *TopOptions {
+ v := &value
+ o.Descriptors = v
+ return o
+}
+
+// GetDescriptors
+func (o *TopOptions) GetDescriptors() []string {
+ var descriptors []string
+ if o.Descriptors == nil {
+ return descriptors
+ }
+ return *o.Descriptors
+}
diff --git a/pkg/bindings/containers/types_unmount_options.go b/pkg/bindings/containers/types_unmount_options.go
new file mode 100644
index 000000000..a29bd8216
--- /dev/null
+++ b/pkg/bindings/containers/types_unmount_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:19.891657824 -0600 CST m=+0.000326668
+*/
+
+// Changed
+func (o *UnmountOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *UnmountOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_unpause_options.go b/pkg/bindings/containers/types_unpause_options.go
new file mode 100644
index 000000000..44c077df2
--- /dev/null
+++ b/pkg/bindings/containers/types_unpause_options.go
@@ -0,0 +1,88 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:21.661356277 -0600 CST m=+0.000262608
+*/
+
+// Changed
+func (o *UnpauseOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *UnpauseOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
diff --git a/pkg/bindings/containers/types_wait_options.go b/pkg/bindings/containers/types_wait_options.go
new file mode 100644
index 000000000..18d36c377
--- /dev/null
+++ b/pkg/bindings/containers/types_wait_options.go
@@ -0,0 +1,105 @@
+package containers
+
+import (
+ "net/url"
+ "reflect"
+ "strconv"
+
+ "github.com/containers/podman/v2/libpod/define"
+ jsoniter "github.com/json-iterator/go"
+ "github.com/pkg/errors"
+)
+
+/*
+This file is generated automatically by go generate. Do not edit.
+
+Created 2020-12-18 13:33:21.809397978 -0600 CST m=+0.000267049
+*/
+
+// Changed
+func (o *WaitOptions) Changed(fieldName string) bool {
+ r := reflect.ValueOf(o)
+ value := reflect.Indirect(r).FieldByName(fieldName)
+ return !value.IsNil()
+}
+
+// ToParams
+func (o *WaitOptions) ToParams() (url.Values, error) {
+ params := url.Values{}
+ if o == nil {
+ return params, nil
+ }
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
+ s := reflect.ValueOf(o)
+ if reflect.Ptr == s.Kind() {
+ s = s.Elem()
+ }
+ sType := s.Type()
+ for i := 0; i < s.NumField(); i++ {
+ fieldName := sType.Field(i).Name
+ if !o.Changed(fieldName) {
+ continue
+ }
+ f := s.Field(i)
+ if reflect.Ptr == f.Kind() {
+ f = f.Elem()
+ }
+ switch f.Kind() {
+ case reflect.Bool:
+ params.Set(fieldName, strconv.FormatBool(f.Bool()))
+ case reflect.String:
+ params.Set(fieldName, f.String())
+ case reflect.Int, reflect.Int64:
+ // f.Int() is always an int64
+ params.Set(fieldName, strconv.FormatInt(f.Int(), 10))
+ case reflect.Uint, reflect.Uint64:
+ // f.Uint() is always an uint64
+ params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
+ case reflect.Slice:
+ typ := reflect.TypeOf(f.Interface()).Elem()
+ switch typ.Kind() {
+ case reflect.String:
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
+ if !ok {
+ return nil, errors.New("failed to convert to string slice")
+ }
+ for _, val := range s {
+ params.Add(fieldName, val)
+ }
+ default:
+ return nil, errors.Errorf("unknown slice type %s", f.Kind().String())
+ }
+ case reflect.Map:
+ lowerCaseKeys := make(map[string][]string)
+ iter := f.MapRange()
+ for iter.Next() {
+ lowerCaseKeys[iter.Key().Interface().(string)] = iter.Value().Interface().([]string)
+
+ }
+ s, err := json.MarshalToString(lowerCaseKeys)
+ if err != nil {
+ return nil, err
+ }
+
+ params.Set(fieldName, s)
+ }
+ }
+ return params, nil
+}
+
+// WithCondition
+func (o *WaitOptions) WithCondition(value define.ContainerStatus) *WaitOptions {
+ v := &value
+ o.Condition = v
+ return o
+}
+
+// GetCondition
+func (o *WaitOptions) GetCondition() define.ContainerStatus {
+ var condition define.ContainerStatus
+ if o.Condition == nil {
+ return condition
+ }
+ return *o.Condition
+}
diff --git a/pkg/bindings/generate/types_kube_options.go b/pkg/bindings/generate/types_kube_options.go
index fbb26f554..68488aaee 100644
--- a/pkg/bindings/generate/types_kube_options.go
+++ b/pkg/bindings/generate/types_kube_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 09:35:23.528143172 -0600 CST m=+0.000203394
+Created 2020-12-18 15:58:20.522950566 -0600 CST m=+0.000154384
*/
// Changed
@@ -56,10 +56,10 @@ func (o *KubeOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/generate/types_systemd_options.go b/pkg/bindings/generate/types_systemd_options.go
index 20e032f5a..0e8a46aa0 100644
--- a/pkg/bindings/generate/types_systemd_options.go
+++ b/pkg/bindings/generate/types_systemd_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 09:35:23.663318384 -0600 CST m=+0.000158454
+Created 2020-12-18 15:58:20.661450253 -0600 CST m=+0.000135779
*/
// Changed
@@ -56,10 +56,10 @@ func (o *SystemdOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/generator/generator.go b/pkg/bindings/generator/generator.go
index 1fd428451..8c79aebae 100644
--- a/pkg/bindings/generator/generator.go
+++ b/pkg/bindings/generator/generator.go
@@ -69,10 +69,10 @@ func (o *{{.StructName}}) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_diff_options.go b/pkg/bindings/images/types_diff_options.go
index e3ec8ea3d..d27c8945e 100644
--- a/pkg/bindings/images/types_diff_options.go
+++ b/pkg/bindings/images/types_diff_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:07.253097326 -0600 CST m=+0.000283385
+Created 2020-12-18 15:58:26.320022698 -0600 CST m=+0.000277796
*/
// Changed
@@ -56,10 +56,10 @@ func (o *DiffOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_export_options.go b/pkg/bindings/images/types_export_options.go
index a14f9d267..078b27fc0 100644
--- a/pkg/bindings/images/types_export_options.go
+++ b/pkg/bindings/images/types_export_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:08.103165436 -0600 CST m=+0.000245546
+Created 2020-12-18 15:58:27.173810543 -0600 CST m=+0.000239871
*/
// Changed
@@ -56,10 +56,10 @@ func (o *ExportOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_get_options.go b/pkg/bindings/images/types_get_options.go
index a1c0f9b09..1161657f7 100644
--- a/pkg/bindings/images/types_get_options.go
+++ b/pkg/bindings/images/types_get_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:07.536472335 -0600 CST m=+0.000251379
+Created 2020-12-18 15:58:26.609005517 -0600 CST m=+0.000241828
*/
// Changed
@@ -56,10 +56,10 @@ func (o *GetOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_history_options.go b/pkg/bindings/images/types_history_options.go
index 7b3d82097..6f9854e03 100644
--- a/pkg/bindings/images/types_history_options.go
+++ b/pkg/bindings/images/types_history_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:07.818738329 -0600 CST m=+0.000253937
+Created 2020-12-18 15:58:26.890854681 -0600 CST m=+0.000243668
*/
// Changed
@@ -56,10 +56,10 @@ func (o *HistoryOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_import_options.go b/pkg/bindings/images/types_import_options.go
index 6552d63bd..f5e6c8f7e 100644
--- a/pkg/bindings/images/types_import_options.go
+++ b/pkg/bindings/images/types_import_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:08.67072755 -0600 CST m=+0.000238081
+Created 2020-12-18 15:58:27.740585278 -0600 CST m=+0.000340441
*/
// Changed
@@ -56,10 +56,10 @@ func (o *ImportOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_list_options.go b/pkg/bindings/images/types_list_options.go
index 0365d0e71..209d72e34 100644
--- a/pkg/bindings/images/types_list_options.go
+++ b/pkg/bindings/images/types_list_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:07.39332655 -0600 CST m=+0.000275349
+Created 2020-12-18 15:58:26.462967928 -0600 CST m=+0.000289760
*/
// Changed
@@ -56,10 +56,10 @@ func (o *ListOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_load_options.go b/pkg/bindings/images/types_load_options.go
index ffba08fcc..6bba573d4 100644
--- a/pkg/bindings/images/types_load_options.go
+++ b/pkg/bindings/images/types_load_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:07.961817946 -0600 CST m=+0.000243444
+Created 2020-12-18 15:58:27.031848205 -0600 CST m=+0.000279409
*/
// Changed
@@ -56,10 +56,10 @@ func (o *LoadOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_prune_options.go b/pkg/bindings/images/types_prune_options.go
index 1f7f2cd8b..c29fdae12 100644
--- a/pkg/bindings/images/types_prune_options.go
+++ b/pkg/bindings/images/types_prune_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:08.24781882 -0600 CST m=+0.000244039
+Created 2020-12-18 15:58:27.316938584 -0600 CST m=+0.000239843
*/
// Changed
@@ -56,10 +56,10 @@ func (o *PruneOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_pull_options.go b/pkg/bindings/images/types_pull_options.go
index f22517d9e..07f3e079d 100644
--- a/pkg/bindings/images/types_pull_options.go
+++ b/pkg/bindings/images/types_pull_options.go
@@ -13,7 +13,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:09.104988433 -0600 CST m=+0.000274515
+Created 2020-12-18 15:58:28.164648348 -0600 CST m=+0.000243264
*/
// Changed
@@ -57,10 +57,10 @@ func (o *PullOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_push_options.go b/pkg/bindings/images/types_push_options.go
index b1d6b78fe..f9ce1b835 100644
--- a/pkg/bindings/images/types_push_options.go
+++ b/pkg/bindings/images/types_push_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:08.817442617 -0600 CST m=+0.000259111
+Created 2020-12-18 15:58:27.881232044 -0600 CST m=+0.000242458
*/
// Changed
@@ -56,10 +56,10 @@ func (o *PushOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_remove_options.go b/pkg/bindings/images/types_remove_options.go
index 1245aec64..c9692c2b7 100644
--- a/pkg/bindings/images/types_remove_options.go
+++ b/pkg/bindings/images/types_remove_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:07.115421951 -0600 CST m=+0.000310512
+Created 2020-12-18 15:58:26.180391541 -0600 CST m=+0.000290244
*/
// Changed
@@ -56,10 +56,10 @@ func (o *RemoveOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_search_options.go b/pkg/bindings/images/types_search_options.go
index 3b89f7acc..e6168ac33 100644
--- a/pkg/bindings/images/types_search_options.go
+++ b/pkg/bindings/images/types_search_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:08.958897824 -0600 CST m=+0.000238136
+Created 2020-12-18 15:58:28.023569573 -0600 CST m=+0.000245548
*/
// Changed
@@ -56,10 +56,10 @@ func (o *SearchOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_tag_options.go b/pkg/bindings/images/types_tag_options.go
index 8d1070750..f6396e590 100644
--- a/pkg/bindings/images/types_tag_options.go
+++ b/pkg/bindings/images/types_tag_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:08.388404224 -0600 CST m=+0.000253809
+Created 2020-12-18 15:58:27.457906682 -0600 CST m=+0.000245071
*/
// Changed
@@ -56,10 +56,10 @@ func (o *TagOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_tree_options.go b/pkg/bindings/images/types_tree_options.go
index 765f99e83..fb2493f85 100644
--- a/pkg/bindings/images/types_tree_options.go
+++ b/pkg/bindings/images/types_tree_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:07.676177228 -0600 CST m=+0.000254279
+Created 2020-12-18 15:58:26.749625305 -0600 CST m=+0.000267624
*/
// Changed
@@ -56,10 +56,10 @@ func (o *TreeOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/images/types_untag_options.go b/pkg/bindings/images/types_untag_options.go
index d6ce1f1c7..8faf5c14e 100644
--- a/pkg/bindings/images/types_untag_options.go
+++ b/pkg/bindings/images/types_untag_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:47:08.530676487 -0600 CST m=+0.000238259
+Created 2020-12-18 15:58:27.600379913 -0600 CST m=+0.000251449
*/
// Changed
@@ -56,10 +56,10 @@ func (o *UntagOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/manifests/types_add_options.go b/pkg/bindings/manifests/types_add_options.go
index 304779f6e..d45effedc 100644
--- a/pkg/bindings/manifests/types_add_options.go
+++ b/pkg/bindings/manifests/types_add_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:58:59.192715649 -0600 CST m=+0.000150326
+Created 2020-12-18 15:57:55.92237379 -0600 CST m=+0.000150701
*/
// Changed
@@ -56,10 +56,10 @@ func (o *AddOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/manifests/types_create_options.go b/pkg/bindings/manifests/types_create_options.go
index 6fccc08b6..da07f1abf 100644
--- a/pkg/bindings/manifests/types_create_options.go
+++ b/pkg/bindings/manifests/types_create_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:58:59.053719568 -0600 CST m=+0.000144061
+Created 2020-12-18 15:57:55.784206871 -0600 CST m=+0.000157049
*/
// Changed
@@ -56,10 +56,10 @@ func (o *CreateOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/manifests/types_inspect_options.go b/pkg/bindings/manifests/types_inspect_options.go
index 8cbcbf376..0d32d5bb9 100644
--- a/pkg/bindings/manifests/types_inspect_options.go
+++ b/pkg/bindings/manifests/types_inspect_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:58:58.908440858 -0600 CST m=+0.000142730
+Created 2020-12-18 15:57:55.631746481 -0600 CST m=+0.000143104
*/
// Changed
@@ -56,10 +56,10 @@ func (o *InspectOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/manifests/types_push_options.go b/pkg/bindings/manifests/types_push_options.go
index a56b29049..4226733c9 100644
--- a/pkg/bindings/manifests/types_push_options.go
+++ b/pkg/bindings/manifests/types_push_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:58:59.466796313 -0600 CST m=+0.000143189
+Created 2020-12-18 15:57:56.197438009 -0600 CST m=+0.000149060
*/
// Changed
@@ -56,10 +56,10 @@ func (o *PushOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/manifests/types_remove_options.go b/pkg/bindings/manifests/types_remove_options.go
index 4f8ca9e95..f99220f6c 100644
--- a/pkg/bindings/manifests/types_remove_options.go
+++ b/pkg/bindings/manifests/types_remove_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:58:59.33119706 -0600 CST m=+0.000143915
+Created 2020-12-18 15:57:56.059954408 -0600 CST m=+0.000146015
*/
// Changed
@@ -56,10 +56,10 @@ func (o *RemoveOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/network/types_connect_options.go b/pkg/bindings/network/types_connect_options.go
index 22d1905e4..6fcc4536e 100644
--- a/pkg/bindings/network/types_connect_options.go
+++ b/pkg/bindings/network/types_connect_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:06.213411549 -0600 CST m=+0.000201795
+Created 2020-12-18 15:58:34.075822786 -0600 CST m=+0.000167237
*/
// Changed
@@ -56,10 +56,10 @@ func (o *ConnectOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/network/types_create_options.go b/pkg/bindings/network/types_create_options.go
index 6af7929c4..e35762912 100644
--- a/pkg/bindings/network/types_create_options.go
+++ b/pkg/bindings/network/types_create_options.go
@@ -13,7 +13,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:05.523424301 -0600 CST m=+0.000180953
+Created 2020-12-18 15:58:33.37307678 -0600 CST m=+0.000176739
*/
// Changed
@@ -57,10 +57,10 @@ func (o *CreateOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/network/types_disconnect_options.go b/pkg/bindings/network/types_disconnect_options.go
index 183032998..821279976 100644
--- a/pkg/bindings/network/types_disconnect_options.go
+++ b/pkg/bindings/network/types_disconnect_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:06.07634068 -0600 CST m=+0.000179587
+Created 2020-12-18 15:58:33.936088242 -0600 CST m=+0.000168680
*/
// Changed
@@ -56,10 +56,10 @@ func (o *DisconnectOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/network/types_inspect_options.go b/pkg/bindings/network/types_inspect_options.go
index 91adac8f4..7704904ce 100644
--- a/pkg/bindings/network/types_inspect_options.go
+++ b/pkg/bindings/network/types_inspect_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:05.661597872 -0600 CST m=+0.000168252
+Created 2020-12-18 15:58:33.520438264 -0600 CST m=+0.000172934
*/
// Changed
@@ -56,10 +56,10 @@ func (o *InspectOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/network/types_list_options.go b/pkg/bindings/network/types_list_options.go
index 3f1909ee1..bbd2a71db 100644
--- a/pkg/bindings/network/types_list_options.go
+++ b/pkg/bindings/network/types_list_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:05.936262707 -0600 CST m=+0.000172058
+Created 2020-12-18 15:58:33.796794129 -0600 CST m=+0.000180368
*/
// Changed
@@ -56,10 +56,10 @@ func (o *ListOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/network/types_remove_options.go b/pkg/bindings/network/types_remove_options.go
index 5f3dc70ec..b24835ae4 100644
--- a/pkg/bindings/network/types_remove_options.go
+++ b/pkg/bindings/network/types_remove_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:05.798818224 -0600 CST m=+0.000173420
+Created 2020-12-18 15:58:33.658228151 -0600 CST m=+0.000172527
*/
// Changed
@@ -56,10 +56,10 @@ func (o *RemoveOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/play/types_kube_options.go b/pkg/bindings/play/types_kube_options.go
index 29a5fc9b1..91cdd30aa 100644
--- a/pkg/bindings/play/types_kube_options.go
+++ b/pkg/bindings/play/types_kube_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:11.20490387 -0600 CST m=+0.000181859
+Created 2020-12-18 15:58:02.386833736 -0600 CST m=+0.000171080
*/
// Changed
@@ -56,10 +56,10 @@ func (o *KubeOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_create_options.go b/pkg/bindings/pods/types_create_options.go
index a4d195f45..b6cf0fc53 100644
--- a/pkg/bindings/pods/types_create_options.go
+++ b/pkg/bindings/pods/types_create_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:32.352415253 -0600 CST m=+0.000183834
+Created 2020-12-18 15:58:40.05490508 -0600 CST m=+0.000156396
*/
// Changed
@@ -56,10 +56,10 @@ func (o *CreateOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_inspect_options.go b/pkg/bindings/pods/types_inspect_options.go
index 938c81e5b..1c881ce9c 100644
--- a/pkg/bindings/pods/types_inspect_options.go
+++ b/pkg/bindings/pods/types_inspect_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:32.765915823 -0600 CST m=+0.000180826
+Created 2020-12-18 15:58:40.258801519 -0600 CST m=+0.000175055
*/
// Changed
@@ -56,10 +56,10 @@ func (o *InspectOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_kill_options.go b/pkg/bindings/pods/types_kill_options.go
index 93b36f12f..cb5bdfd01 100644
--- a/pkg/bindings/pods/types_kill_options.go
+++ b/pkg/bindings/pods/types_kill_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:32.905440724 -0600 CST m=+0.000171399
+Created 2020-12-18 15:58:40.398857339 -0600 CST m=+0.000160135
*/
// Changed
@@ -56,10 +56,10 @@ func (o *KillOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_list_options.go b/pkg/bindings/pods/types_list_options.go
index a6dc62ea3..d095bf3db 100644
--- a/pkg/bindings/pods/types_list_options.go
+++ b/pkg/bindings/pods/types_list_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:33.326756506 -0600 CST m=+0.000223292
+Created 2020-12-18 15:58:40.818123838 -0600 CST m=+0.000164328
*/
// Changed
@@ -56,10 +56,10 @@ func (o *ListOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_pause_options.go b/pkg/bindings/pods/types_pause_options.go
index 1ba32f1a1..06ee6f81d 100644
--- a/pkg/bindings/pods/types_pause_options.go
+++ b/pkg/bindings/pods/types_pause_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:33.042658764 -0600 CST m=+0.000177336
+Created 2020-12-18 15:58:40.538407099 -0600 CST m=+0.000193274
*/
// Changed
@@ -56,10 +56,10 @@ func (o *PauseOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_prune_options.go b/pkg/bindings/pods/types_prune_options.go
index abc579383..6610aa7cc 100644
--- a/pkg/bindings/pods/types_prune_options.go
+++ b/pkg/bindings/pods/types_prune_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:33.183777637 -0600 CST m=+0.000163998
+Created 2020-12-18 15:58:40.678507342 -0600 CST m=+0.000183891
*/
// Changed
@@ -56,10 +56,10 @@ func (o *PruneOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_remove_options.go b/pkg/bindings/pods/types_remove_options.go
index f3f04a1ba..8f18e43c9 100644
--- a/pkg/bindings/pods/types_remove_options.go
+++ b/pkg/bindings/pods/types_remove_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:34.321961766 -0600 CST m=+0.000169681
+Created 2020-12-18 15:58:41.80320679 -0600 CST m=+0.000158149
*/
// Changed
@@ -56,10 +56,10 @@ func (o *RemoveOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_restart_options.go b/pkg/bindings/pods/types_restart_options.go
index f4992bf12..9030de1e7 100644
--- a/pkg/bindings/pods/types_restart_options.go
+++ b/pkg/bindings/pods/types_restart_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:33.468350594 -0600 CST m=+0.000198305
+Created 2020-12-18 15:58:40.958315383 -0600 CST m=+0.000168360
*/
// Changed
@@ -56,10 +56,10 @@ func (o *RestartOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_start_options.go b/pkg/bindings/pods/types_start_options.go
index 21e382db8..0fce21099 100644
--- a/pkg/bindings/pods/types_start_options.go
+++ b/pkg/bindings/pods/types_start_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:33.610327478 -0600 CST m=+0.000190011
+Created 2020-12-18 15:58:41.099102916 -0600 CST m=+0.000159629
*/
// Changed
@@ -56,10 +56,10 @@ func (o *StartOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_stats_options.go b/pkg/bindings/pods/types_stats_options.go
index eb10d16ce..d38a9a115 100644
--- a/pkg/bindings/pods/types_stats_options.go
+++ b/pkg/bindings/pods/types_stats_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:34.181335419 -0600 CST m=+0.000176684
+Created 2020-12-18 15:58:41.658228243 -0600 CST m=+0.000160769
*/
// Changed
@@ -56,10 +56,10 @@ func (o *StatsOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_stop_options.go b/pkg/bindings/pods/types_stop_options.go
index 088c095e0..ac698b8c5 100644
--- a/pkg/bindings/pods/types_stop_options.go
+++ b/pkg/bindings/pods/types_stop_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:33.753353816 -0600 CST m=+0.000168107
+Created 2020-12-18 15:58:41.237892781 -0600 CST m=+0.000155040
*/
// Changed
@@ -56,10 +56,10 @@ func (o *StopOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_top_options.go b/pkg/bindings/pods/types_top_options.go
index 385f8655d..895f62957 100644
--- a/pkg/bindings/pods/types_top_options.go
+++ b/pkg/bindings/pods/types_top_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:33.897063 -0600 CST m=+0.000164071
+Created 2020-12-18 15:58:41.375876994 -0600 CST m=+0.000154839
*/
// Changed
@@ -56,10 +56,10 @@ func (o *TopOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/pods/types_unpause_options.go b/pkg/bindings/pods/types_unpause_options.go
index 5ac588d9f..3d647cf25 100644
--- a/pkg/bindings/pods/types_unpause_options.go
+++ b/pkg/bindings/pods/types_unpause_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 07:45:34.038858053 -0600 CST m=+0.000173181
+Created 2020-12-18 15:58:41.515225789 -0600 CST m=+0.000158667
*/
// Changed
@@ -56,10 +56,10 @@ func (o *UnpauseOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/system/types_disk_options.go b/pkg/bindings/system/types_disk_options.go
index 2336db19b..f7d2cca06 100644
--- a/pkg/bindings/system/types_disk_options.go
+++ b/pkg/bindings/system/types_disk_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 09:13:10.734962166 -0600 CST m=+0.000145336
+Created 2020-12-18 15:58:08.087362343 -0600 CST m=+0.000150636
*/
// Changed
@@ -56,10 +56,10 @@ func (o *DiskOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/system/types_events_options.go b/pkg/bindings/system/types_events_options.go
index cb4c5eb0e..6dd64b055 100644
--- a/pkg/bindings/system/types_events_options.go
+++ b/pkg/bindings/system/types_events_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 09:13:10.308724359 -0600 CST m=+0.000145204
+Created 2020-12-18 15:58:07.675150173 -0600 CST m=+0.000140977
*/
// Changed
@@ -56,10 +56,10 @@ func (o *EventsOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/system/types_info_options.go b/pkg/bindings/system/types_info_options.go
index 7614e084c..3a8960e1b 100644
--- a/pkg/bindings/system/types_info_options.go
+++ b/pkg/bindings/system/types_info_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 09:13:10.872420889 -0600 CST m=+0.000136023
+Created 2020-12-18 15:58:08.233760126 -0600 CST m=+0.000142369
*/
// Changed
@@ -56,10 +56,10 @@ func (o *InfoOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/system/types_prune_options.go b/pkg/bindings/system/types_prune_options.go
index 6a1e38333..2cd3c8000 100644
--- a/pkg/bindings/system/types_prune_options.go
+++ b/pkg/bindings/system/types_prune_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 09:13:10.456894557 -0600 CST m=+0.000141897
+Created 2020-12-18 15:58:07.812719858 -0600 CST m=+0.000143214
*/
// Changed
@@ -56,10 +56,10 @@ func (o *PruneOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/system/types_version_options.go b/pkg/bindings/system/types_version_options.go
index fbe29f07c..4974e8d8f 100644
--- a/pkg/bindings/system/types_version_options.go
+++ b/pkg/bindings/system/types_version_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-17 09:13:10.596882708 -0600 CST m=+0.000141540
+Created 2020-12-18 15:58:07.950759332 -0600 CST m=+0.000140376
*/
// Changed
@@ -56,10 +56,10 @@ func (o *VersionOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/test/attach_test.go b/pkg/bindings/test/attach_test.go
index 12e51e734..9a46f6309 100644
--- a/pkg/bindings/test/attach_test.go
+++ b/pkg/bindings/test/attach_test.go
@@ -6,7 +6,6 @@ import (
"time"
"github.com/containers/podman/v2/libpod/define"
- "github.com/containers/podman/v2/pkg/bindings"
"github.com/containers/podman/v2/pkg/bindings/containers"
"github.com/containers/podman/v2/pkg/specgen"
. "github.com/onsi/ginkgo"
@@ -43,7 +42,7 @@ var _ = Describe("Podman containers attach", func() {
go func() {
<-tickTock.C
timeout := uint(5)
- err := containers.Stop(bt.conn, id, &timeout)
+ err := containers.Stop(bt.conn, id, new(containers.StopOptions).WithTimeout(timeout))
if err != nil {
GinkgoWriter.Write([]byte(err.Error()))
}
@@ -53,8 +52,8 @@ var _ = Describe("Podman containers attach", func() {
stderr := &bytes.Buffer{}
go func() {
defer GinkgoRecover()
-
- err := containers.Attach(bt.conn, id, nil, bindings.PTrue, bindings.PTrue, nil, stdout, stderr, nil)
+ options := new(containers.AttachOptions).WithLogs(true).WithStream(true)
+ err := containers.Attach(bt.conn, id, nil, stdout, stderr, nil, options)
Expect(err).ShouldNot(HaveOccurred())
}()
@@ -69,21 +68,21 @@ var _ = Describe("Podman containers attach", func() {
s.Name = "CatAttachTest"
s.Terminal = true
s.Command = []string{"/bin/cat"}
- ctnr, err := containers.CreateWithSpec(bt.conn, s)
+ ctnr, err := containers.CreateWithSpec(bt.conn, s, nil)
Expect(err).ShouldNot(HaveOccurred())
err = containers.Start(bt.conn, ctnr.ID, nil)
Expect(err).ShouldNot(HaveOccurred())
wait := define.ContainerStateRunning
- _, err = containers.Wait(bt.conn, ctnr.ID, &wait)
+ _, err = containers.Wait(bt.conn, ctnr.ID, new(containers.WaitOptions).WithCondition(wait))
Expect(err).ShouldNot(HaveOccurred())
tickTock := time.NewTimer(2 * time.Second)
go func() {
<-tickTock.C
timeout := uint(5)
- err := containers.Stop(bt.conn, ctnr.ID, &timeout)
+ err := containers.Stop(bt.conn, ctnr.ID, new(containers.StopOptions).WithTimeout(timeout))
if err != nil {
GinkgoWriter.Write([]byte(err.Error()))
}
@@ -97,8 +96,8 @@ var _ = Describe("Podman containers attach", func() {
stderr := &bytes.Buffer{}
go func() {
defer GinkgoRecover()
-
- err := containers.Attach(bt.conn, ctnr.ID, nil, bindings.PFalse, bindings.PTrue, stdin, stdout, stderr, nil)
+ options := new(containers.AttachOptions).WithStream(true)
+ err := containers.Attach(bt.conn, ctnr.ID, stdin, stdout, stderr, nil, options)
Expect(err).ShouldNot(HaveOccurred())
}()
diff --git a/pkg/bindings/test/common_test.go b/pkg/bindings/test/common_test.go
index 9dff2985f..232d7136f 100644
--- a/pkg/bindings/test/common_test.go
+++ b/pkg/bindings/test/common_test.go
@@ -198,7 +198,7 @@ func (b *bindingTest) RunTopContainer(containerName *string, insidePod *bool, po
if insidePod != nil && podName != nil {
s.Pod = *podName
}
- ctr, err := containers.CreateWithSpec(b.conn, s)
+ ctr, err := containers.CreateWithSpec(b.conn, s, nil)
if err != nil {
return "", nil
}
@@ -207,7 +207,7 @@ func (b *bindingTest) RunTopContainer(containerName *string, insidePod *bool, po
return "", err
}
wait := define.ContainerStateRunning
- _, err = containers.Wait(b.conn, ctr.ID, &wait)
+ _, err = containers.Wait(b.conn, ctr.ID, new(containers.WaitOptions).WithCondition(wait))
return ctr.ID, err
}
diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go
index 15066ff1a..2ab5e45d0 100644
--- a/pkg/bindings/test/containers_test.go
+++ b/pkg/bindings/test/containers_test.go
@@ -37,7 +37,7 @@ var _ = Describe("Podman containers ", func() {
It("podman pause a bogus container", func() {
// Pausing bogus container should return 404
- err = containers.Pause(bt.conn, "foobar")
+ err = containers.Pause(bt.conn, "foobar", nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound))
@@ -45,7 +45,7 @@ var _ = Describe("Podman containers ", func() {
It("podman unpause a bogus container", func() {
// Unpausing bogus container should return 404
- err = containers.Unpause(bt.conn, "foobar")
+ err = containers.Unpause(bt.conn, "foobar", nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound))
@@ -56,7 +56,7 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
_, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, name)
+ err = containers.Pause(bt.conn, name, nil)
Expect(err).To(BeNil())
// Ensure container is paused
@@ -70,7 +70,7 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, cid)
+ err = containers.Pause(bt.conn, cid, nil)
Expect(err).To(BeNil())
// Ensure container is paused
@@ -84,9 +84,9 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
_, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, name)
+ err = containers.Pause(bt.conn, name, nil)
Expect(err).To(BeNil())
- err = containers.Unpause(bt.conn, name)
+ err = containers.Unpause(bt.conn, name, nil)
Expect(err).To(BeNil())
// Ensure container is unpaused
@@ -101,11 +101,11 @@ var _ = Describe("Podman containers ", func() {
_, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
// Pause by name
- err = containers.Pause(bt.conn, name)
+ err = containers.Pause(bt.conn, name, nil)
//paused := "paused"
//_, err = containers.Wait(bt.conn, cid, &paused)
//Expect(err).To(BeNil())
- err = containers.Unpause(bt.conn, name)
+ err = containers.Unpause(bt.conn, name, nil)
Expect(err).To(BeNil())
// Ensure container is unpaused
@@ -119,9 +119,9 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
_, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, name)
+ err = containers.Pause(bt.conn, name, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, name)
+ err = containers.Pause(bt.conn, name, nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -132,9 +132,9 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, cid)
+ err = containers.Pause(bt.conn, cid, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, cid)
+ err = containers.Pause(bt.conn, cid, nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -147,7 +147,7 @@ var _ = Describe("Podman containers ", func() {
Expect(err).To(BeNil())
err = containers.Stop(bt.conn, name, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, name)
+ err = containers.Pause(bt.conn, name, nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -160,7 +160,7 @@ var _ = Describe("Podman containers ", func() {
Expect(err).To(BeNil())
err = containers.Stop(bt.conn, cid, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, cid)
+ err = containers.Pause(bt.conn, cid, nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -171,9 +171,9 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, cid)
+ err = containers.Pause(bt.conn, cid, nil)
Expect(err).To(BeNil())
- err = containers.Remove(bt.conn, cid, bindings.PFalse, bindings.PFalse)
+ err = containers.Remove(bt.conn, cid, nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -184,9 +184,9 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, cid)
+ err = containers.Pause(bt.conn, cid, nil)
Expect(err).To(BeNil())
- err = containers.Remove(bt.conn, cid, bindings.PTrue, bindings.PFalse)
+ err = containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithForce(true))
Expect(err).To(BeNil())
})
@@ -195,7 +195,7 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
_, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, name)
+ err = containers.Pause(bt.conn, name, nil)
Expect(err).To(BeNil())
err = containers.Stop(bt.conn, name, nil)
Expect(err).ToNot(BeNil())
@@ -208,7 +208,7 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, cid)
+ err = containers.Pause(bt.conn, cid, nil)
Expect(err).To(BeNil())
err = containers.Stop(bt.conn, cid, nil)
Expect(err).ToNot(BeNil())
@@ -280,11 +280,11 @@ var _ = Describe("Podman containers ", func() {
_, err := bt.RunTopContainer(&name, nil, nil)
Expect(err).To(BeNil())
go func() {
- exitCode, err = containers.Wait(bt.conn, name, &pause)
+ exitCode, err = containers.Wait(bt.conn, name, new(containers.WaitOptions).WithCondition(pause))
errChan <- err
close(errChan)
}()
- err = containers.Pause(bt.conn, name)
+ err = containers.Pause(bt.conn, name, nil)
Expect(err).To(BeNil())
wait := <-errChan
Expect(wait).To(BeNil())
@@ -294,11 +294,11 @@ var _ = Describe("Podman containers ", func() {
go func() {
defer GinkgoRecover()
- _, waitErr := containers.Wait(bt.conn, name, &running)
+ _, waitErr := containers.Wait(bt.conn, name, new(containers.WaitOptions).WithCondition(running))
unpauseErrChan <- waitErr
close(unpauseErrChan)
}()
- err = containers.Unpause(bt.conn, name)
+ err = containers.Unpause(bt.conn, name, nil)
Expect(err).To(BeNil())
unPausewait := <-unpauseErrChan
Expect(unPausewait).To(BeNil())
@@ -309,7 +309,7 @@ var _ = Describe("Podman containers ", func() {
bt.runPodman([]string{"run", "-d", "--name", "hc", "--health-interval", "disable", "--health-retries", "2", "--health-cmd", "ls / || exit 1", alpine.name, "top"})
// bogus name should result in 404
- _, err := containers.RunHealthCheck(bt.conn, "foobar")
+ _, err := containers.RunHealthCheck(bt.conn, "foobar", nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound))
@@ -317,7 +317,7 @@ var _ = Describe("Podman containers ", func() {
// a container that has no healthcheck should be a 409
var name = "top"
bt.RunTopContainer(&name, bindings.PFalse, nil)
- _, err = containers.RunHealthCheck(bt.conn, name)
+ _, err = containers.RunHealthCheck(bt.conn, name, nil)
Expect(err).ToNot(BeNil())
code, _ = bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusConflict))
@@ -355,7 +355,7 @@ var _ = Describe("Podman containers ", func() {
s := specgen.NewSpecGenerator(alpine.name, false)
s.Terminal = true
s.Command = []string{"date", "-R"}
- r, err := containers.CreateWithSpec(bt.conn, s)
+ r, err := containers.CreateWithSpec(bt.conn, s, nil)
Expect(err).To(BeNil())
err = containers.Start(bt.conn, r.ID, nil)
Expect(err).To(BeNil())
@@ -363,7 +363,7 @@ var _ = Describe("Podman containers ", func() {
_, err = containers.Wait(bt.conn, r.ID, nil)
Expect(err).To(BeNil())
- opts := containers.LogOptions{Stdout: bindings.PTrue, Follow: bindings.PTrue}
+ opts := new(containers.LogOptions).WithStdout(true).WithFollow(true)
go func() {
containers.Logs(bt.conn, r.ID, opts, stdoutChan, nil)
}()
@@ -387,7 +387,7 @@ var _ = Describe("Podman containers ", func() {
Expect(err).To(BeNil())
// With descriptors
- output, err := containers.Top(bt.conn, cid, []string{"user,pid,hpid"})
+ output, err := containers.Top(bt.conn, cid, new(containers.TopOptions).WithDescriptors([]string{"user", "pid", "hpid"}))
Expect(err).To(BeNil())
header := strings.Split(output[0], "\t")
for _, d := range []string{"USER", "PID", "HPID"} {
@@ -399,7 +399,7 @@ var _ = Describe("Podman containers ", func() {
Expect(err).ToNot(BeNil())
// With bogus descriptors
- _, err = containers.Top(bt.conn, cid, []string{"Me,Neither"})
+ _, err = containers.Top(bt.conn, cid, new(containers.TopOptions).WithDescriptors([]string{"Me,Neither"}))
Expect(err).To(BeNil())
})
@@ -442,7 +442,7 @@ var _ = Describe("Podman containers ", func() {
It("podman kill bogus container", func() {
// Killing bogus container should return 404
- err := containers.Kill(bt.conn, "foobar", "SIGTERM")
+ err := containers.Kill(bt.conn, "foobar", "SIGTERM", nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound))
@@ -453,7 +453,7 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
_, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Kill(bt.conn, name, "SIGINT")
+ err = containers.Kill(bt.conn, name, "SIGINT", nil)
Expect(err).To(BeNil())
_, err = containers.Exists(bt.conn, name, false)
Expect(err).To(BeNil())
@@ -464,7 +464,7 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Kill(bt.conn, cid, "SIGTERM")
+ err = containers.Kill(bt.conn, cid, "SIGTERM", nil)
Expect(err).To(BeNil())
_, err = containers.Exists(bt.conn, cid, false)
Expect(err).To(BeNil())
@@ -475,7 +475,7 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Kill(bt.conn, cid, "SIGKILL")
+ err = containers.Kill(bt.conn, cid, "SIGKILL", nil)
Expect(err).To(BeNil())
})
@@ -484,7 +484,7 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- err = containers.Kill(bt.conn, cid, "foobar")
+ err = containers.Kill(bt.conn, cid, "foobar", nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -494,19 +494,18 @@ var _ = Describe("Podman containers ", func() {
// Killing latest container should work
var name1 = "first"
var name2 = "second"
- var latestContainers = 1
_, err := bt.RunTopContainer(&name1, bindings.PFalse, nil)
Expect(err).To(BeNil())
_, err = bt.RunTopContainer(&name2, bindings.PFalse, nil)
Expect(err).To(BeNil())
- containerLatestList, err := containers.List(bt.conn, nil, nil, &latestContainers, nil, nil, nil)
+ containerLatestList, err := containers.List(bt.conn, new(containers.ListOptions).WithLast(1))
Expect(err).To(BeNil())
- err = containers.Kill(bt.conn, containerLatestList[0].Names[0], "SIGTERM")
+ err = containers.Kill(bt.conn, containerLatestList[0].Names[0], "SIGTERM", nil)
Expect(err).To(BeNil())
})
It("container init on a bogus container", func() {
- err := containers.ContainerInit(bt.conn, "doesnotexist")
+ err := containers.ContainerInit(bt.conn, "doesnotexist", nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound))
@@ -514,12 +513,12 @@ var _ = Describe("Podman containers ", func() {
It("container init", func() {
s := specgen.NewSpecGenerator(alpine.name, false)
- ctr, err := containers.CreateWithSpec(bt.conn, s)
+ ctr, err := containers.CreateWithSpec(bt.conn, s, nil)
Expect(err).To(BeNil())
- err = containers.ContainerInit(bt.conn, ctr.ID)
+ err = containers.ContainerInit(bt.conn, ctr.ID, nil)
Expect(err).To(BeNil())
// trying to init again should be an error
- err = containers.ContainerInit(bt.conn, ctr.ID)
+ err = containers.ContainerInit(bt.conn, ctr.ID, nil)
Expect(err).ToNot(BeNil())
})
@@ -550,14 +549,14 @@ var _ = Describe("Podman containers ", func() {
filtersIncorrect := map[string][]string{
"status": {"dummy"},
}
- pruneResponse, err := containers.Prune(bt.conn, filtersIncorrect)
+ pruneResponse, err := containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filtersIncorrect))
Expect(err).ToNot(BeNil())
// Mismatched filter params no container should be pruned.
filtersIncorrect = map[string][]string{
"name": {"r"},
}
- pruneResponse, err = containers.Prune(bt.conn, filtersIncorrect)
+ pruneResponse, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filtersIncorrect))
Expect(err).To(BeNil())
Expect(len(pruneResponse.Err)).To(Equal(0))
Expect(len(pruneResponse.ID)).To(Equal(0))
@@ -566,7 +565,7 @@ var _ = Describe("Podman containers ", func() {
filters := map[string][]string{
"name": {"top"},
}
- pruneResponse, err = containers.Prune(bt.conn, filters)
+ pruneResponse, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filters))
Expect(err).To(BeNil())
Expect(len(pruneResponse.Err)).To(Equal(0))
Expect(len(pruneResponse.ID)).To(Equal(1))
@@ -620,7 +619,7 @@ var _ = Describe("Podman containers ", func() {
var name = "top"
_, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
- _, err = containers.Inspect(bt.conn, name, bindings.PTrue)
+ _, err = containers.Inspect(bt.conn, name, new(containers.InspectOptions).WithSize(true))
Expect(err).To(BeNil())
})
@@ -631,12 +630,12 @@ var _ = Describe("Podman containers ", func() {
err = containers.Stop(bt.conn, name, nil)
Expect(err).To(BeNil())
// Inspecting stopped container with size should succeed
- _, err = containers.Inspect(bt.conn, name, bindings.PTrue)
+ _, err = containers.Inspect(bt.conn, name, new(containers.InspectOptions).WithSize(true))
Expect(err).To(BeNil())
})
It("podman remove bogus container", func() {
- err = containers.Remove(bt.conn, "foobar", nil, nil)
+ err = containers.Remove(bt.conn, "foobar", nil)
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound))
})
@@ -646,7 +645,7 @@ var _ = Describe("Podman containers ", func() {
_, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
// Removing running container should fail
- err = containers.Remove(bt.conn, name, nil, nil)
+ err = containers.Remove(bt.conn, name, nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -657,7 +656,7 @@ var _ = Describe("Podman containers ", func() {
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
// Removing running container should fail
- err = containers.Remove(bt.conn, cid, nil, nil)
+ err = containers.Remove(bt.conn, cid, nil)
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -668,7 +667,7 @@ var _ = Describe("Podman containers ", func() {
_, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
// Removing running container should fail
- err = containers.Remove(bt.conn, name, bindings.PTrue, nil)
+ err = containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithForce(true))
Expect(err).To(BeNil())
//code, _ := bindings.CheckResponseCode(err)
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -679,7 +678,7 @@ var _ = Describe("Podman containers ", func() {
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
// Removing running container should fail
- err = containers.Remove(bt.conn, cid, bindings.PTrue, nil)
+ err = containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithForce(true))
Expect(err).To(BeNil())
//code, _ := bindings.CheckResponseCode(err)
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -690,7 +689,7 @@ var _ = Describe("Podman containers ", func() {
_, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
// Removing running container should fail
- err = containers.Remove(bt.conn, name, nil, bindings.PTrue)
+ err = containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithVolumes(true))
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -701,7 +700,7 @@ var _ = Describe("Podman containers ", func() {
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
// Removing running container should fail
- err = containers.Remove(bt.conn, cid, nil, bindings.PTrue)
+ err = containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithVolumes(true))
Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -712,7 +711,7 @@ var _ = Describe("Podman containers ", func() {
_, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
// Removing running container should fail
- err = containers.Remove(bt.conn, name, bindings.PTrue, bindings.PTrue)
+ err = containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithVolumes(true).WithForce(true))
Expect(err).To(BeNil())
//code, _ := bindings.CheckResponseCode(err)
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -723,7 +722,7 @@ var _ = Describe("Podman containers ", func() {
cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil())
// Removing running container should fail
- err = containers.Remove(bt.conn, cid, bindings.PTrue, bindings.PTrue)
+ err = containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithForce(true).WithVolumes(true))
Expect(err).To(BeNil())
//code, _ := bindings.CheckResponseCode(err)
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -739,12 +738,12 @@ var _ = Describe("Podman containers ", func() {
s := specgen.NewSpecGenerator(alpine.name, false)
s.Terminal = true
s.Command = []string{"date", "-R"}
- _, err = containers.CreateWithSpec(bt.conn, s)
+ _, err = containers.CreateWithSpec(bt.conn, s, nil)
Expect(err).To(BeNil())
// Validate list container with id filter
filters := make(map[string][]string)
filters["id"] = []string{cid}
- c, err := containers.List(bt.conn, filters, bindings.PTrue, nil, nil, nil, nil)
+ c, err := containers.List(bt.conn, new(containers.ListOptions).WithFilters(filters).WithAll(true))
Expect(err).To(BeNil())
Expect(len(c)).To(Equal(1))
})
@@ -758,7 +757,7 @@ var _ = Describe("Podman containers ", func() {
lastNum := 1
- c, err := containers.List(bt.conn, nil, bindings.PTrue, &lastNum, nil, nil, nil)
+ c, err := containers.List(bt.conn, new(containers.ListOptions).WithAll(true).WithLast(lastNum))
Expect(err).To(BeNil())
Expect(len(c)).To(Equal(1))
Expect(c[0].PodName).To(Equal(podName))
diff --git a/pkg/bindings/test/create_test.go b/pkg/bindings/test/create_test.go
index fd9ce23ca..2d2d657de 100644
--- a/pkg/bindings/test/create_test.go
+++ b/pkg/bindings/test/create_test.go
@@ -35,7 +35,7 @@ var _ = Describe("Create containers ", func() {
s.Command = []string{"top"}
s.Terminal = true
s.Name = "top"
- ctr, err := containers.CreateWithSpec(bt.conn, s)
+ ctr, err := containers.CreateWithSpec(bt.conn, s, nil)
Expect(err).To(BeNil())
data, err := containers.Inspect(bt.conn, ctr.ID, nil)
Expect(err).To(BeNil())
diff --git a/pkg/bindings/test/exec_test.go b/pkg/bindings/test/exec_test.go
index e3d90b9ea..8e20a192f 100644
--- a/pkg/bindings/test/exec_test.go
+++ b/pkg/bindings/test/exec_test.go
@@ -43,7 +43,7 @@ var _ = Describe("Podman containers exec", func() {
Expect(err).To(BeNil())
Expect(sessionID).To(Not(Equal("")))
- inspectOut, err := containers.ExecInspect(bt.conn, sessionID)
+ inspectOut, err := containers.ExecInspect(bt.conn, sessionID, nil)
Expect(err).To(BeNil())
Expect(inspectOut.ContainerID).To(Equal(cid))
Expect(inspectOut.ProcessConfig.Entrypoint).To(Equal("echo"))
@@ -71,7 +71,7 @@ var _ = Describe("Podman containers exec", func() {
})
It("Podman exec inspect on invalid session fails", func() {
- _, err := containers.ExecInspect(bt.conn, "0000000000000000000000000000000000000000000000000000000000000000")
+ _, err := containers.ExecInspect(bt.conn, "0000000000000000000000000000000000000000000000000000000000000000", nil)
Expect(err).To(Not(BeNil()))
})
})
diff --git a/pkg/bindings/test/images_test.go b/pkg/bindings/test/images_test.go
index b6362a631..ae41eced9 100644
--- a/pkg/bindings/test/images_test.go
+++ b/pkg/bindings/test/images_test.go
@@ -118,7 +118,7 @@ var _ = Describe("Podman images", func() {
Expect(len(errs)).To(BeZero())
// To be extra sure, check if the previously created container
// is gone as well.
- _, err = containers.Inspect(bt.conn, "top", bindings.PFalse)
+ _, err = containers.Inspect(bt.conn, "top", nil)
code, _ = bindings.CheckResponseCode(err)
// Now make sure both images are gone.
diff --git a/pkg/bindings/test/info_test.go b/pkg/bindings/test/info_test.go
index c4473cd19..4d696b59e 100644
--- a/pkg/bindings/test/info_test.go
+++ b/pkg/bindings/test/info_test.go
@@ -46,12 +46,12 @@ var _ = Describe("Podman info", func() {
It("podman info container counts", func() {
s := specgen.NewSpecGenerator(alpine.name, false)
- _, err := containers.CreateWithSpec(bt.conn, s)
+ _, err := containers.CreateWithSpec(bt.conn, s, nil)
Expect(err).To(BeNil())
idPause, err := bt.RunTopContainer(nil, nil, nil)
Expect(err).To(BeNil())
- err = containers.Pause(bt.conn, idPause)
+ err = containers.Pause(bt.conn, idPause, nil)
Expect(err).To(BeNil())
idStop, err := bt.RunTopContainer(nil, nil, nil)
diff --git a/pkg/bindings/test/volumes_test.go b/pkg/bindings/test/volumes_test.go
index 0664a99e4..e0d854b66 100644
--- a/pkg/bindings/test/volumes_test.go
+++ b/pkg/bindings/test/volumes_test.go
@@ -102,8 +102,7 @@ var _ = Describe("Podman volumes", func() {
Expect(code).To(BeNumerically("==", http.StatusConflict))
// Removing with a volume in use with force should work with a stopped container
- zero := uint(0)
- err = containers.Stop(connText, "vtest", &zero)
+ err = containers.Stop(connText, "vtest", new(containers.StopOptions).WithTimeout(0))
Expect(err).To(BeNil())
options := new(volumes.RemoveOptions).WithForce(true)
err = volumes.Remove(connText, vol.Name, options)
diff --git a/pkg/bindings/volumes/types_create_options.go b/pkg/bindings/volumes/types_create_options.go
index 442dedc8a..80bdac2d2 100644
--- a/pkg/bindings/volumes/types_create_options.go
+++ b/pkg/bindings/volumes/types_create_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:25.536700522 -0600 CST m=+0.000174605
+Created 2020-12-18 15:58:14.043860791 -0600 CST m=+0.000188944
*/
// Changed
@@ -56,10 +56,10 @@ func (o *CreateOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/volumes/types_inspect_options.go b/pkg/bindings/volumes/types_inspect_options.go
index f9fc9096b..ba8c70b63 100644
--- a/pkg/bindings/volumes/types_inspect_options.go
+++ b/pkg/bindings/volumes/types_inspect_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:25.697109241 -0600 CST m=+0.000142064
+Created 2020-12-18 15:58:14.189902005 -0600 CST m=+0.000151439
*/
// Changed
@@ -56,10 +56,10 @@ func (o *InspectOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/volumes/types_list_options.go b/pkg/bindings/volumes/types_list_options.go
index 673643cf1..99dec132c 100644
--- a/pkg/bindings/volumes/types_list_options.go
+++ b/pkg/bindings/volumes/types_list_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:25.835646604 -0600 CST m=+0.000141801
+Created 2020-12-18 15:58:14.326721724 -0600 CST m=+0.000172471
*/
// Changed
@@ -56,10 +56,10 @@ func (o *ListOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/volumes/types_prune_options.go b/pkg/bindings/volumes/types_prune_options.go
index 94d81e737..cdbc03fc9 100644
--- a/pkg/bindings/volumes/types_prune_options.go
+++ b/pkg/bindings/volumes/types_prune_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:25.972202545 -0600 CST m=+0.000209541
+Created 2020-12-18 15:58:14.463307398 -0600 CST m=+0.000180868
*/
// Changed
@@ -56,10 +56,10 @@ func (o *PruneOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/bindings/volumes/types_remove_options.go b/pkg/bindings/volumes/types_remove_options.go
index 499abf0f2..923d1353c 100644
--- a/pkg/bindings/volumes/types_remove_options.go
+++ b/pkg/bindings/volumes/types_remove_options.go
@@ -12,7 +12,7 @@ import (
/*
This file is generated automatically by go generate. Do not edit.
-Created 2020-12-16 11:59:26.109834902 -0600 CST m=+0.000175439
+Created 2020-12-18 15:58:14.60278922 -0600 CST m=+0.000134408
*/
// Changed
@@ -56,10 +56,10 @@ func (o *RemoveOptions) ToParams() (url.Values, error) {
params.Set(fieldName, strconv.FormatUint(f.Uint(), 10))
case reflect.Slice:
typ := reflect.TypeOf(f.Interface()).Elem()
- slice := reflect.MakeSlice(reflect.SliceOf(typ), f.Len(), f.Cap())
switch typ.Kind() {
case reflect.String:
- s, ok := slice.Interface().([]string)
+ sl := f.Slice(0, f.Len())
+ s, ok := sl.Interface().([]string)
if !ok {
return nil, errors.New("failed to convert to string slice")
}
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go
index 855339fef..ad8394675 100644
--- a/pkg/domain/infra/tunnel/containers.go
+++ b/pkg/domain/infra/tunnel/containers.go
@@ -16,7 +16,6 @@ import (
"github.com/containers/podman/v2/libpod/define"
"github.com/containers/podman/v2/libpod/events"
"github.com/containers/podman/v2/pkg/api/handlers"
- "github.com/containers/podman/v2/pkg/bindings"
"github.com/containers/podman/v2/pkg/bindings/containers"
"github.com/containers/podman/v2/pkg/domain/entities"
"github.com/containers/podman/v2/pkg/errorhandling"
@@ -35,15 +34,16 @@ func (ic *ContainerEngine) ContainerExists(ctx context.Context, nameOrID string,
return &entities.BoolReport{Value: exists}, err
}
-func (ic *ContainerEngine) ContainerWait(ctx context.Context, namesOrIds []string, options entities.WaitOptions) ([]entities.WaitReport, error) {
+func (ic *ContainerEngine) ContainerWait(ctx context.Context, namesOrIds []string, opts entities.WaitOptions) ([]entities.WaitReport, error) {
cons, err := getContainersByContext(ic.ClientCxt, false, false, namesOrIds)
if err != nil {
return nil, err
}
responses := make([]entities.WaitReport, 0, len(cons))
+ options := new(containers.WaitOptions).WithCondition(opts.Condition)
for _, c := range cons {
response := entities.WaitReport{Id: c.ID}
- exitCode, err := containers.Wait(ic.ClientCxt, c.ID, &options.Condition)
+ exitCode, err := containers.Wait(ic.ClientCxt, c.ID, options)
if err != nil {
response.Error = err
} else {
@@ -61,7 +61,7 @@ func (ic *ContainerEngine) ContainerPause(ctx context.Context, namesOrIds []stri
}
reports := make([]*entities.PauseUnpauseReport, 0, len(ctrs))
for _, c := range ctrs {
- err := containers.Pause(ic.ClientCxt, c.ID)
+ err := containers.Pause(ic.ClientCxt, c.ID, nil)
reports = append(reports, &entities.PauseUnpauseReport{Id: c.ID, Err: err})
}
return reports, nil
@@ -74,15 +74,15 @@ func (ic *ContainerEngine) ContainerUnpause(ctx context.Context, namesOrIds []st
}
reports := make([]*entities.PauseUnpauseReport, 0, len(ctrs))
for _, c := range ctrs {
- err := containers.Unpause(ic.ClientCxt, c.ID)
+ err := containers.Unpause(ic.ClientCxt, c.ID, nil)
reports = append(reports, &entities.PauseUnpauseReport{Id: c.ID, Err: err})
}
return reports, nil
}
-func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []string, options entities.StopOptions) ([]*entities.StopReport, error) {
+func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []string, opts entities.StopOptions) ([]*entities.StopReport, error) {
reports := []*entities.StopReport{}
- for _, cidFile := range options.CIDFiles {
+ for _, cidFile := range opts.CIDFiles {
content, err := ioutil.ReadFile(cidFile)
if err != nil {
return nil, errors.Wrap(err, "error reading CIDFile")
@@ -90,19 +90,23 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
id := strings.Split(string(content), "\n")[0]
namesOrIds = append(namesOrIds, id)
}
- ctrs, err := getContainersByContext(ic.ClientCxt, options.All, options.Ignore, namesOrIds)
+ ctrs, err := getContainersByContext(ic.ClientCxt, opts.All, opts.Ignore, namesOrIds)
if err != nil {
return nil, err
}
+ options := new(containers.StopOptions)
+ if to := opts.Timeout; to != nil {
+ options.WithTimeout(*to)
+ }
for _, c := range ctrs {
report := entities.StopReport{Id: c.ID}
- if err = containers.Stop(ic.ClientCxt, c.ID, options.Timeout); err != nil {
+ if err = containers.Stop(ic.ClientCxt, c.ID, options); err != nil {
// These first two are considered non-fatal under the right conditions
if errors.Cause(err).Error() == define.ErrCtrStopped.Error() {
logrus.Debugf("Container %s is already stopped", c.ID)
reports = append(reports, &report)
continue
- } else if options.All && errors.Cause(err).Error() == define.ErrCtrStateInvalid.Error() {
+ } else if opts.All && errors.Cause(err).Error() == define.ErrCtrStateInvalid.Error() {
logrus.Debugf("Container %s is not running, could not stop", c.ID)
reports = append(reports, &report)
continue
@@ -120,8 +124,8 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
return reports, nil
}
-func (ic *ContainerEngine) ContainerKill(ctx context.Context, namesOrIds []string, options entities.KillOptions) ([]*entities.KillReport, error) {
- ctrs, err := getContainersByContext(ic.ClientCxt, options.All, false, namesOrIds)
+func (ic *ContainerEngine) ContainerKill(ctx context.Context, namesOrIds []string, opts entities.KillOptions) ([]*entities.KillReport, error) {
+ ctrs, err := getContainersByContext(ic.ClientCxt, opts.All, false, namesOrIds)
if err != nil {
return nil, err
}
@@ -129,40 +133,38 @@ func (ic *ContainerEngine) ContainerKill(ctx context.Context, namesOrIds []strin
for _, c := range ctrs {
reports = append(reports, &entities.KillReport{
Id: c.ID,
- Err: containers.Kill(ic.ClientCxt, c.ID, options.Signal),
+ Err: containers.Kill(ic.ClientCxt, c.ID, opts.Signal, nil),
})
}
return reports, nil
}
-func (ic *ContainerEngine) ContainerRestart(ctx context.Context, namesOrIds []string, options entities.RestartOptions) ([]*entities.RestartReport, error) {
+func (ic *ContainerEngine) ContainerRestart(ctx context.Context, namesOrIds []string, opts entities.RestartOptions) ([]*entities.RestartReport, error) {
var (
reports = []*entities.RestartReport{}
- timeout *int
)
- if options.Timeout != nil {
- t := int(*options.Timeout)
- timeout = &t
+ options := new(containers.RestartOptions)
+ if to := opts.Timeout; to != nil {
+ options.WithTimeout(int(*to))
}
-
- ctrs, err := getContainersByContext(ic.ClientCxt, options.All, false, namesOrIds)
+ ctrs, err := getContainersByContext(ic.ClientCxt, opts.All, false, namesOrIds)
if err != nil {
return nil, err
}
for _, c := range ctrs {
- if options.Running && c.State != define.ContainerStateRunning.String() {
+ if opts.Running && c.State != define.ContainerStateRunning.String() {
continue
}
reports = append(reports, &entities.RestartReport{
Id: c.ID,
- Err: containers.Restart(ic.ClientCxt, c.ID, timeout),
+ Err: containers.Restart(ic.ClientCxt, c.ID, options),
})
}
return reports, nil
}
-func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string, options entities.RmOptions) ([]*entities.RmReport, error) {
- for _, cidFile := range options.CIDFiles {
+func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string, opts entities.RmOptions) ([]*entities.RmReport, error) {
+ for _, cidFile := range opts.CIDFiles {
content, err := ioutil.ReadFile(cidFile)
if err != nil {
return nil, errors.Wrap(err, "error reading CIDFile")
@@ -170,32 +172,35 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string,
id := strings.Split(string(content), "\n")[0]
namesOrIds = append(namesOrIds, id)
}
- ctrs, err := getContainersByContext(ic.ClientCxt, options.All, options.Ignore, namesOrIds)
+ ctrs, err := getContainersByContext(ic.ClientCxt, opts.All, opts.Ignore, namesOrIds)
if err != nil {
return nil, err
}
// TODO there is no endpoint for container eviction. Need to discuss
reports := make([]*entities.RmReport, 0, len(ctrs))
+ options := new(containers.RemoveOptions).WithForce(opts.Force).WithVolumes(opts.Volumes)
for _, c := range ctrs {
reports = append(reports, &entities.RmReport{
Id: c.ID,
- Err: containers.Remove(ic.ClientCxt, c.ID, &options.Force, &options.Volumes),
+ Err: containers.Remove(ic.ClientCxt, c.ID, options),
})
}
return reports, nil
}
-func (ic *ContainerEngine) ContainerPrune(ctx context.Context, options entities.ContainerPruneOptions) (*entities.ContainerPruneReport, error) {
- return containers.Prune(ic.ClientCxt, options.Filters)
+func (ic *ContainerEngine) ContainerPrune(ctx context.Context, opts entities.ContainerPruneOptions) (*entities.ContainerPruneReport, error) {
+ options := new(containers.PruneOptions).WithFilters(opts.Filters)
+ return containers.Prune(ic.ClientCxt, options)
}
-func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []string, options entities.InspectOptions) ([]*entities.ContainerInspectReport, []error, error) {
+func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []string, opts entities.InspectOptions) ([]*entities.ContainerInspectReport, []error, error) {
var (
reports = make([]*entities.ContainerInspectReport, 0, len(namesOrIds))
errs = []error{}
)
+ options := new(containers.InspectOptions).WithSize(opts.Size)
for _, name := range namesOrIds {
- inspect, err := containers.Inspect(ic.ClientCxt, name, &options.Size)
+ inspect, err := containers.Inspect(ic.ClientCxt, name, options)
if err != nil {
errModel, ok := err.(entities.ErrorModel)
if !ok {
@@ -212,30 +217,30 @@ func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []st
return reports, errs, nil
}
-func (ic *ContainerEngine) ContainerTop(ctx context.Context, options entities.TopOptions) (*entities.StringSliceReport, error) {
+func (ic *ContainerEngine) ContainerTop(ctx context.Context, opts entities.TopOptions) (*entities.StringSliceReport, error) {
switch {
- case options.Latest:
+ case opts.Latest:
return nil, errors.New("latest is not supported")
- case options.NameOrID == "":
+ case opts.NameOrID == "":
return nil, errors.New("NameOrID must be specified")
}
-
- topOutput, err := containers.Top(ic.ClientCxt, options.NameOrID, options.Descriptors)
+ options := new(containers.TopOptions).WithDescriptors(opts.Descriptors)
+ topOutput, err := containers.Top(ic.ClientCxt, opts.NameOrID, options)
if err != nil {
return nil, err
}
return &entities.StringSliceReport{Value: topOutput}, nil
}
-func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrID string, options entities.CommitOptions) (*entities.CommitReport, error) {
+func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrID string, opts entities.CommitOptions) (*entities.CommitReport, error) {
var (
repo string
tag = "latest"
)
- if len(options.ImageName) > 0 {
- ref, err := reference.Parse(options.ImageName)
+ if len(opts.ImageName) > 0 {
+ ref, err := reference.Parse(opts.ImageName)
if err != nil {
- return nil, errors.Wrapf(err, "error parsing reference %q", options.ImageName)
+ return nil, errors.Wrapf(err, "error parsing reference %q", opts.ImageName)
}
if t, ok := ref.(reference.Tagged); ok {
tag = t.Tag()
@@ -244,19 +249,12 @@ func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrID string,
repo = r.Name()
}
if len(repo) < 1 {
- return nil, errors.Errorf("invalid image name %q", options.ImageName)
+ return nil, errors.Errorf("invalid image name %q", opts.ImageName)
}
}
- commitOpts := containers.CommitOptions{
- Author: &options.Author,
- Changes: options.Changes,
- Comment: &options.Message,
- Format: &options.Format,
- Pause: &options.Pause,
- Repo: &repo,
- Tag: &tag,
- }
- response, err := containers.Commit(ic.ClientCxt, nameOrID, commitOpts)
+ options := new(containers.CommitOptions).WithAuthor(opts.Author).WithChanges(opts.Changes).WithComment(opts.Message)
+ options.WithFormat(opts.Format).WithPause(opts.Pause).WithRepo(repo).WithTag(tag)
+ response, err := containers.Commit(ic.ClientCxt, nameOrID, options)
if err != nil {
return nil, err
}
@@ -274,16 +272,16 @@ func (ic *ContainerEngine) ContainerExport(ctx context.Context, nameOrID string,
return err
}
}
- return containers.Export(ic.ClientCxt, nameOrID, w)
+ return containers.Export(ic.ClientCxt, nameOrID, w, nil)
}
-func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds []string, options entities.CheckpointOptions) ([]*entities.CheckpointReport, error) {
+func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds []string, opts entities.CheckpointOptions) ([]*entities.CheckpointReport, error) {
var (
err error
ctrs = []entities.ListContainer{}
)
- if options.All {
+ if opts.All {
allCtrs, err := getContainersByContext(ic.ClientCxt, true, false, []string{})
if err != nil {
return nil, err
@@ -302,8 +300,10 @@ func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds [
}
}
reports := make([]*entities.CheckpointReport, 0, len(ctrs))
+ options := new(containers.CheckpointOptions).WithExport(opts.Export).WithIgnoreRootfs(opts.IgnoreRootFS).WithKeep(opts.Keep)
+ options.WithLeaveRunning(opts.LeaveRunning).WithTCPEstablished(opts.TCPEstablished)
for _, c := range ctrs {
- report, err := containers.Checkpoint(ic.ClientCxt, c.ID, &options.Keep, &options.LeaveRunning, &options.TCPEstablished, &options.IgnoreRootFS, &options.Export)
+ report, err := containers.Checkpoint(ic.ClientCxt, c.ID, options)
if err != nil {
reports = append(reports, &entities.CheckpointReport{Id: c.ID, Err: err})
}
@@ -312,12 +312,12 @@ func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds [
return reports, nil
}
-func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []string, options entities.RestoreOptions) ([]*entities.RestoreReport, error) {
+func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []string, opts entities.RestoreOptions) ([]*entities.RestoreReport, error) {
var (
err error
ctrs = []entities.ListContainer{}
)
- if options.All {
+ if opts.All {
allCtrs, err := getContainersByContext(ic.ClientCxt, true, false, []string{})
if err != nil {
return nil, err
@@ -336,8 +336,9 @@ func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []st
}
}
reports := make([]*entities.RestoreReport, 0, len(ctrs))
+ options := new(containers.RestoreOptions)
for _, c := range ctrs {
- report, err := containers.Restore(ic.ClientCxt, c.ID, &options.Keep, &options.TCPEstablished, &options.IgnoreRootFS, &options.IgnoreStaticIP, &options.IgnoreStaticMAC, &options.Name, &options.Import)
+ report, err := containers.Restore(ic.ClientCxt, c.ID, options)
if err != nil {
reports = append(reports, &entities.RestoreReport{Id: c.ID, Err: err})
}
@@ -347,7 +348,7 @@ func (ic *ContainerEngine) ContainerRestore(ctx context.Context, namesOrIds []st
}
func (ic *ContainerEngine) ContainerCreate(ctx context.Context, s *specgen.SpecGenerator) (*entities.ContainerCreateReport, error) {
- response, err := containers.CreateWithSpec(ic.ClientCxt, s)
+ response, err := containers.CreateWithSpec(ic.ClientCxt, s, nil)
if err != nil {
return nil, err
}
@@ -357,27 +358,20 @@ func (ic *ContainerEngine) ContainerCreate(ctx context.Context, s *specgen.SpecG
return &entities.ContainerCreateReport{Id: response.ID}, nil
}
-func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIDs []string, options entities.ContainerLogsOptions) error {
- since := options.Since.Format(time.RFC3339)
- tail := strconv.FormatInt(options.Tail, 10)
- stdout := options.StdoutWriter != nil
- stderr := options.StderrWriter != nil
- opts := containers.LogOptions{
- Follow: &options.Follow,
- Since: &since,
- Stderr: &stderr,
- Stdout: &stdout,
- Tail: &tail,
- Timestamps: &options.Timestamps,
- Until: nil,
- }
+func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIDs []string, opts entities.ContainerLogsOptions) error {
+ since := opts.Since.Format(time.RFC3339)
+ tail := strconv.FormatInt(opts.Tail, 10)
+ stdout := opts.StdoutWriter != nil
+ stderr := opts.StderrWriter != nil
+ options := new(containers.LogOptions).WithFollow(opts.Follow).WithSince(since).WithStderr(stderr)
+ options.WithStdout(stdout).WithTail(tail)
var err error
stdoutCh := make(chan string)
stderrCh := make(chan string)
ctx, cancel := context.WithCancel(context.Background())
go func() {
- err = containers.Logs(ic.ClientCxt, nameOrIDs[0], opts, stdoutCh, stderrCh)
+ err = containers.Logs(ic.ClientCxt, nameOrIDs[0], options, stdoutCh, stderrCh)
cancel()
}()
@@ -386,18 +380,18 @@ func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIDs []string,
case <-ctx.Done():
return err
case line := <-stdoutCh:
- if options.StdoutWriter != nil {
- _, _ = io.WriteString(options.StdoutWriter, line+"\n")
+ if opts.StdoutWriter != nil {
+ _, _ = io.WriteString(opts.StdoutWriter, line+"\n")
}
case line := <-stderrCh:
- if options.StderrWriter != nil {
- _, _ = io.WriteString(options.StderrWriter, line+"\n")
+ if opts.StderrWriter != nil {
+ _, _ = io.WriteString(opts.StderrWriter, line+"\n")
}
}
}
}
-func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrID string, options entities.AttachOptions) error {
+func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrID string, opts entities.AttachOptions) error {
ctrs, err := getContainersByContext(ic.ClientCxt, false, false, []string{nameOrID})
if err != nil {
return err
@@ -406,8 +400,8 @@ func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrID string,
if ctr.State != define.ContainerStateRunning.String() {
return errors.Errorf("you can only attach to running containers")
}
-
- return containers.Attach(ic.ClientCxt, nameOrID, &options.DetachKeys, nil, bindings.PTrue, options.Stdin, options.Stdout, options.Stderr, nil)
+ options := new(containers.AttachOptions).WithStream(true).WithDetachKeys(opts.DetachKeys)
+ return containers.Attach(ic.ClientCxt, nameOrID, opts.Stdin, opts.Stdout, opts.Stderr, nil, options)
}
func makeExecConfig(options entities.ExecOptions) *handlers.ExecCreateConfig {
@@ -439,12 +433,17 @@ func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrID string, o
if err != nil {
return 125, err
}
-
- if err := containers.ExecStartAndAttach(ic.ClientCxt, sessionID, &streams); err != nil {
+ startAndAttachOptions := new(containers.ExecStartAndAttachOptions)
+ startAndAttachOptions.WithOutputStream(streams.OutputStream).WithErrorStream(streams.ErrorStream)
+ if streams.InputStream != nil {
+ startAndAttachOptions.WithInputStream(*streams.InputStream)
+ }
+ startAndAttachOptions.WithAttachError(streams.AttachError).WithAttachOutput(streams.AttachOutput).WithAttachInput(streams.AttachInput)
+ if err := containers.ExecStartAndAttach(ic.ClientCxt, sessionID, startAndAttachOptions); err != nil {
return 125, err
}
- inspectOut, err := containers.ExecInspect(ic.ClientCxt, sessionID)
+ inspectOut, err := containers.ExecInspect(ic.ClientCxt, sessionID, nil)
if err != nil {
return 125, err
}
@@ -460,7 +459,7 @@ func (ic *ContainerEngine) ContainerExecDetached(ctx context.Context, nameOrID s
return "", err
}
- if err := containers.ExecStart(ic.ClientCxt, sessionID); err != nil {
+ if err := containers.ExecStart(ic.ClientCxt, sessionID, nil); err != nil {
return "", err
}
@@ -470,15 +469,23 @@ func (ic *ContainerEngine) ContainerExecDetached(ctx context.Context, nameOrID s
func startAndAttach(ic *ContainerEngine, name string, detachKeys *string, input, output, errput *os.File) error { //nolint
attachErr := make(chan error)
attachReady := make(chan bool)
+ options := new(containers.AttachOptions).WithStream(true)
+ if dk := detachKeys; dk != nil {
+ options.WithDetachKeys(*dk)
+ }
go func() {
- err := containers.Attach(ic.ClientCxt, name, detachKeys, bindings.PFalse, bindings.PTrue, input, output, errput, attachReady)
+ err := containers.Attach(ic.ClientCxt, name, input, output, errput, attachReady, options)
attachErr <- err
}()
// Wait for the attach to actually happen before starting
// the container.
select {
case <-attachReady:
- if err := containers.Start(ic.ClientCxt, name, detachKeys); err != nil {
+ startOptions := new(containers.StartOptions)
+ if dk := detachKeys; dk != nil {
+ startOptions.WithDetachKeys(*dk)
+ }
+ if err := containers.Start(ic.ClientCxt, name, startOptions); err != nil {
return err
}
case err := <-attachErr:
@@ -495,6 +502,7 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
if err != nil {
return nil, err
}
+ removeOptions := new(containers.RemoveOptions).WithVolumes(true).WithForce(false)
// There can only be one container if attach was used
for i, ctr := range ctrs {
name := ctr.ID
@@ -527,14 +535,14 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
// Defer the removal, so we can return early if needed and
// de-spaghetti the code.
defer func() {
- shouldRestart, err := containers.ShouldRestart(ic.ClientCxt, ctr.ID)
+ shouldRestart, err := containers.ShouldRestart(ic.ClientCxt, ctr.ID, nil)
if err != nil {
logrus.Errorf("Failed to check if %s should restart: %v", ctr.ID, err)
return
}
if !shouldRestart {
- if err := containers.Remove(ic.ClientCxt, ctr.ID, bindings.PFalse, bindings.PTrue); err != nil {
+ if err := containers.Remove(ic.ClientCxt, ctr.ID, removeOptions); err != nil {
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
errorhandling.Contains(err, define.ErrCtrRemoved) {
logrus.Warnf("Container %s does not exist: %v", ctr.ID, err)
@@ -564,10 +572,12 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
}
// Start the container if it's not running already.
if !ctrRunning {
- err = containers.Start(ic.ClientCxt, name, &options.DetachKeys)
+
+ err = containers.Start(ic.ClientCxt, name, new(containers.StartOptions).WithDetachKeys(options.DetachKeys))
if err != nil {
if ctr.AutoRemove {
- if err := containers.Remove(ic.ClientCxt, ctr.ID, bindings.PFalse, bindings.PTrue); err != nil {
+ rmOptions := new(containers.RemoveOptions).WithForce(false).WithVolumes(true)
+ if err := containers.Remove(ic.ClientCxt, ctr.ID, rmOptions); err != nil {
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
errorhandling.Contains(err, define.ErrCtrRemoved) {
logrus.Warnf("Container %s does not exist: %v", ctr.ID, err)
@@ -588,12 +598,14 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
return reports, nil
}
-func (ic *ContainerEngine) ContainerList(ctx context.Context, options entities.ContainerListOptions) ([]entities.ListContainer, error) {
- return containers.List(ic.ClientCxt, options.Filters, &options.All, &options.Last, &options.Namespace, &options.Size, &options.Sync)
+func (ic *ContainerEngine) ContainerList(ctx context.Context, opts entities.ContainerListOptions) ([]entities.ListContainer, error) {
+ options := new(containers.ListOptions).WithFilters(opts.Filters).WithAll(opts.All).WithLast(opts.Last)
+ options.WithNamespace(opts.Namespace).WithSize(opts.Size).WithSync(opts.Sync)
+ return containers.List(ic.ClientCxt, options)
}
func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.ContainerRunOptions) (*entities.ContainerRunReport, error) {
- con, err := containers.CreateWithSpec(ic.ClientCxt, opts.Spec)
+ con, err := containers.CreateWithSpec(ic.ClientCxt, opts.Spec, nil)
if err != nil {
return nil, err
}
@@ -625,7 +637,7 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta
report.ExitCode = define.ExitCode(err)
if opts.Rm {
- if rmErr := containers.Remove(ic.ClientCxt, con.ID, bindings.PFalse, bindings.PTrue); rmErr != nil {
+ if rmErr := containers.Remove(ic.ClientCxt, con.ID, new(containers.RemoveOptions).WithForce(false).WithVolumes(true)); rmErr != nil {
logrus.Debugf("unable to remove container %s after failing to start and attach to it", con.ID)
}
}
@@ -636,14 +648,14 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta
// Defer the removal, so we can return early if needed and
// de-spaghetti the code.
defer func() {
- shouldRestart, err := containers.ShouldRestart(ic.ClientCxt, con.ID)
+ shouldRestart, err := containers.ShouldRestart(ic.ClientCxt, con.ID, nil)
if err != nil {
logrus.Errorf("Failed to check if %s should restart: %v", con.ID, err)
return
}
if !shouldRestart {
- if err := containers.Remove(ic.ClientCxt, con.ID, bindings.PFalse, bindings.PTrue); err != nil {
+ if err := containers.Remove(ic.ClientCxt, con.ID, new(containers.RemoveOptions).WithForce(false).WithVolumes(true)); err != nil {
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
errorhandling.Contains(err, define.ErrCtrRemoved) {
logrus.Warnf("Container %s does not exist: %v", con.ID, err)
@@ -705,7 +717,7 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta
}
func (ic *ContainerEngine) ContainerDiff(ctx context.Context, nameOrID string, _ entities.DiffOptions) (*entities.DiffReport, error) {
- changes, err := containers.Diff(ic.ClientCxt, nameOrID)
+ changes, err := containers.Diff(ic.ClientCxt, nameOrID, nil)
return &entities.DiffReport{Changes: changes}, err
}
@@ -720,7 +732,7 @@ func (ic *ContainerEngine) ContainerInit(ctx context.Context, namesOrIds []strin
}
reports := make([]*entities.ContainerInitReport, 0, len(ctrs))
for _, ctr := range ctrs {
- err := containers.ContainerInit(ic.ClientCxt, ctr.ID)
+ err := containers.ContainerInit(ic.ClientCxt, ctr.ID, nil)
// When using all, it is NOT considered an error if a container
// has already been init'd.
if err != nil && options.All && strings.Contains(errors.Cause(err).Error(), define.ErrCtrStateInvalid.Error()) {
@@ -792,10 +804,10 @@ func (ic *ContainerEngine) ContainerStats(ctx context.Context, namesOrIds []stri
if options.Latest {
return nil, errors.New("latest is not supported for the remote client")
}
- return containers.Stats(ic.ClientCxt, namesOrIds, &options.Stream)
+ return containers.Stats(ic.ClientCxt, namesOrIds, new(containers.StatsOptions).WithStream(options.Stream))
}
// ShouldRestart reports back whether the containre will restart
func (ic *ContainerEngine) ShouldRestart(_ context.Context, id string) (bool, error) {
- return containers.ShouldRestart(ic.ClientCxt, id)
+ return containers.ShouldRestart(ic.ClientCxt, id, nil)
}
diff --git a/pkg/domain/infra/tunnel/healthcheck.go b/pkg/domain/infra/tunnel/healthcheck.go
index ac28712ce..b3ff888d8 100644
--- a/pkg/domain/infra/tunnel/healthcheck.go
+++ b/pkg/domain/infra/tunnel/healthcheck.go
@@ -9,5 +9,5 @@ import (
)
func (ic *ContainerEngine) HealthCheckRun(ctx context.Context, nameOrID string, options entities.HealthCheckOptions) (*define.HealthCheckResults, error) {
- return containers.RunHealthCheck(ic.ClientCxt, nameOrID)
+ return containers.RunHealthCheck(ic.ClientCxt, nameOrID, nil)
}
diff --git a/pkg/domain/infra/tunnel/helpers.go b/pkg/domain/infra/tunnel/helpers.go
index cd116995f..0a806d860 100644
--- a/pkg/domain/infra/tunnel/helpers.go
+++ b/pkg/domain/infra/tunnel/helpers.go
@@ -4,7 +4,6 @@ import (
"context"
"github.com/containers/podman/v2/libpod/define"
- "github.com/containers/podman/v2/pkg/bindings"
"github.com/containers/podman/v2/pkg/bindings/containers"
"github.com/containers/podman/v2/pkg/bindings/pods"
"github.com/containers/podman/v2/pkg/domain/entities"
@@ -18,8 +17,8 @@ func getContainersByContext(contextWithConnection context.Context, all, ignore b
if all && len(namesOrIDs) > 0 {
return nil, errors.New("cannot lookup containers and all")
}
-
- allContainers, err := containers.List(contextWithConnection, nil, bindings.PTrue, nil, nil, nil, bindings.PTrue)
+ options := new(containers.ListOptions).WithAll(true).WithSync(true)
+ allContainers, err := containers.List(contextWithConnection, options)
if err != nil {
return nil, err
}
@@ -38,7 +37,7 @@ func getContainersByContext(contextWithConnection context.Context, all, ignore b
// First determine if the container exists by doing an inspect.
// Inspect takes supports names and IDs and let's us determine
// a containers full ID.
- inspectData, err := containers.Inspect(contextWithConnection, nameOrID, bindings.PFalse)
+ inspectData, err := containers.Inspect(contextWithConnection, nameOrID, new(containers.InspectOptions).WithSize(false))
if err != nil {
if ignore && errorhandling.Contains(err, define.ErrNoSuchCtr) {
continue