diff options
Diffstat (limited to 'pkg')
117 files changed, 1514 insertions, 2026 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index 26e1bf00b..a15fdb553 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -104,8 +104,12 @@ func ListContainers(w http.ResponseWriter, r *http.Request) { } filterMap, err := util.PrepareFilters(r) + if err != nil { + utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to decode filter parameters for %s", r.URL.String())) + return + } - if dErr := decoder.Decode(&query, r.URL.Query()); dErr != nil || err != nil { + if err := decoder.Decode(&query, r.URL.Query()); err != nil { utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) return } diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index 6855742b2..606c52e41 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -106,7 +106,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { NamespaceOptions string `schema:"nsoptions"` NoCache bool `schema:"nocache"` OutputFormat string `schema:"outputformat"` - Platform string `schema:"platform"` + Platform []string `schema:"platform"` Pull bool `schema:"pull"` PullPolicy string `schema:"pullpolicy"` Quiet bool `schema:"q"` @@ -126,7 +126,6 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { Registry: "docker.io", Rm: true, ShmSize: 64 * 1024 * 1024, - Tag: []string{}, } decoder := r.Context().Value(api.DecoderKey).(*schema.Decoder) @@ -481,16 +480,17 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { }, } - if len(query.Platform) > 0 { - variant := "" - buildOptions.OS, buildOptions.Architecture, variant, err = parse.Platform(query.Platform) + for _, platformSpec := range query.Platform { + os, arch, variant, err := parse.Platform(platformSpec) if err != nil { - utils.BadRequest(w, "platform", query.Platform, err) + utils.BadRequest(w, "platform", platformSpec, err) return } - buildOptions.SystemContext.OSChoice = buildOptions.OS - buildOptions.SystemContext.ArchitectureChoice = buildOptions.Architecture - buildOptions.SystemContext.VariantChoice = variant + buildOptions.Platforms = append(buildOptions.Platforms, struct{ OS, Arch, Variant string }{ + OS: os, + Arch: arch, + Variant: variant, + }) } if _, found := r.URL.Query()["timestamp"]; found { ts := time.Unix(query.Timestamp, 0) diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go index 4639093f2..343c0d0b3 100644 --- a/pkg/api/handlers/libpod/containers.go +++ b/pkg/api/handlers/libpod/containers.go @@ -73,8 +73,13 @@ func ListContainers(w http.ResponseWriter, r *http.Request) { } filterMap, err := util.PrepareFilters(r) + if err != nil { + utils.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError, + errors.Wrapf(err, "failed to decode filter parameters for %s", r.URL.String())) + return + } - if dErr := decoder.Decode(&query, r.URL.Query()); dErr != nil || err != nil { + if err := decoder.Decode(&query, r.URL.Query()); err != nil { utils.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) return diff --git a/pkg/api/handlers/libpod/images.go b/pkg/api/handlers/libpod/images.go index 72093c492..b4f08a746 100644 --- a/pkg/api/handlers/libpod/images.go +++ b/pkg/api/handlers/libpod/images.go @@ -156,8 +156,14 @@ func PruneImages(w http.ResponseWriter, r *http.Request) { } filterMap, err := util.PrepareFilters(r) + if err != nil { + utils.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError, + errors. + Wrapf(err, "failed to decode filter parameters for %s", r.URL.String())) + return + } - if dErr := decoder.Decode(&query, r.URL.Query()); dErr != nil || err != nil { + if err := decoder.Decode(&query, r.URL.Query()); err != nil { utils.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError, errors. Wrapf(err, "failed to parse parameters for %s", r.URL.String())) diff --git a/pkg/api/handlers/libpod/pods.go b/pkg/api/handlers/libpod/pods.go index cc686c69d..1f03e121e 100644 --- a/pkg/api/handlers/libpod/pods.go +++ b/pkg/api/handlers/libpod/pods.go @@ -52,13 +52,11 @@ func PodCreate(w http.ResponseWriter, r *http.Request) { utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "failed to decode specgen")) return } - tempSpec := &specgen.SpecGenerator{} // temporary spec since infra cannot be decoded into - err = json.Unmarshal(out, tempSpec) // unmarhal matching options + err = json.Unmarshal(out, psg.InfraContainerSpec) // unmarhal matching options if err != nil { utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "failed to decode specgen")) return } - psg.InfraContainerSpec = tempSpec // set infra spec equal to temp // a few extra that do not have the same json tags psg.InfraContainerSpec.Name = psg.InfraName psg.InfraContainerSpec.ConmonPidFile = psg.InfraConmonPidFile diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go index 2630acac2..95981226c 100644 --- a/pkg/api/server/register_images.go +++ b/pkg/api/server/register_images.go @@ -1038,6 +1038,12 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // description: Remove images that are not being used by a container // parameters: // - in: query + // name: all + // default: false + // type: boolean + // description: | + // Remove all images not in use by containers, not just dangling ones + // - in: query // name: filters // type: string // description: | diff --git a/pkg/bindings/README.md b/pkg/bindings/README.md index f41304e0f..9e3610043 100644 --- a/pkg/bindings/README.md +++ b/pkg/bindings/README.md @@ -57,6 +57,10 @@ to interact with containers. ### Examples The following examples build upon the connection example from above. They are all rootful connections as well. +Note: Optional arguments to the bindings methods are set using With*() methods on *Option structures. +Composite types are not duplicated rather the address is used. As such, you should not change an underlying +field between initializing the *Option structure and calling the bindings method. + #### Inspect a container The following example obtains the inspect information for a container named `foorbar` and then prints the container's ID. Note the use of optional inspect options for size. diff --git a/pkg/bindings/containers/types.go b/pkg/bindings/containers/types.go index 3e9a384de..3fe3442bb 100644 --- a/pkg/bindings/containers/types.go +++ b/pkg/bindings/containers/types.go @@ -37,9 +37,9 @@ type CommitOptions struct { //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 + DetachKeys *string // Keys to detach from running container + Logs *bool // Flag to return all logs from container when true + Stream *bool // Flag only return container logs when false and Logs is true } //go:generate go run ../generator/generator.go CheckpointOptions diff --git a/pkg/bindings/containers/types_attach_options.go b/pkg/bindings/containers/types_attach_options.go index cb8f9ea65..6db21c41a 100644 --- a/pkg/bindings/containers/types_attach_options.go +++ b/pkg/bindings/containers/types_attach_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,64 +7,57 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *AttachOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *AttachOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithDetachKeys +// WithDetachKeys set keys to detach from running container func (o *AttachOptions) WithDetachKeys(value string) *AttachOptions { - v := &value - o.DetachKeys = v + o.DetachKeys = &value return o } -// GetDetachKeys +// GetDetachKeys returns value of keys to detach from running container func (o *AttachOptions) GetDetachKeys() string { - var detachKeys string if o.DetachKeys == nil { - return detachKeys + var z string + return z } return *o.DetachKeys } -// WithLogs +// WithLogs set flag to return all logs from container when true func (o *AttachOptions) WithLogs(value bool) *AttachOptions { - v := &value - o.Logs = v + o.Logs = &value return o } -// GetLogs +// GetLogs returns value of flag to return all logs from container when true func (o *AttachOptions) GetLogs() bool { - var logs bool if o.Logs == nil { - return logs + var z bool + return z } return *o.Logs } -// WithStream +// WithStream set flag only return container logs when false and Logs is true func (o *AttachOptions) WithStream(value bool) *AttachOptions { - v := &value - o.Stream = v + o.Stream = &value return o } -// GetStream +// GetStream returns value of flag only return container logs when false and Logs is true func (o *AttachOptions) GetStream() bool { - var stream bool if o.Stream == nil { - return stream + var z bool + return z } return *o.Stream } diff --git a/pkg/bindings/containers/types_checkpoint_options.go b/pkg/bindings/containers/types_checkpoint_options.go index a2a9a913e..7b28c4045 100644 --- a/pkg/bindings/containers/types_checkpoint_options.go +++ b/pkg/bindings/containers/types_checkpoint_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,96 +7,87 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *CheckpointOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *CheckpointOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithExport +// WithExport set field Export to given value func (o *CheckpointOptions) WithExport(value string) *CheckpointOptions { - v := &value - o.Export = v + o.Export = &value return o } -// GetExport +// GetExport returns value of field Export func (o *CheckpointOptions) GetExport() string { - var export string if o.Export == nil { - return export + var z string + return z } return *o.Export } -// WithIgnoreRootfs +// WithIgnoreRootfs set field IgnoreRootfs to given value func (o *CheckpointOptions) WithIgnoreRootfs(value bool) *CheckpointOptions { - v := &value - o.IgnoreRootfs = v + o.IgnoreRootfs = &value return o } -// GetIgnoreRootfs +// GetIgnoreRootfs returns value of field IgnoreRootfs func (o *CheckpointOptions) GetIgnoreRootfs() bool { - var ignoreRootfs bool if o.IgnoreRootfs == nil { - return ignoreRootfs + var z bool + return z } return *o.IgnoreRootfs } -// WithKeep +// WithKeep set field Keep to given value func (o *CheckpointOptions) WithKeep(value bool) *CheckpointOptions { - v := &value - o.Keep = v + o.Keep = &value return o } -// GetKeep +// GetKeep returns value of field Keep func (o *CheckpointOptions) GetKeep() bool { - var keep bool if o.Keep == nil { - return keep + var z bool + return z } return *o.Keep } -// WithLeaveRunning +// WithLeaveRunning set field LeaveRunning to given value func (o *CheckpointOptions) WithLeaveRunning(value bool) *CheckpointOptions { - v := &value - o.LeaveRunning = v + o.LeaveRunning = &value return o } -// GetLeaveRunning +// GetLeaveRunning returns value of field LeaveRunning func (o *CheckpointOptions) GetLeaveRunning() bool { - var leaveRunning bool if o.LeaveRunning == nil { - return leaveRunning + var z bool + return z } return *o.LeaveRunning } -// WithTCPEstablished +// WithTCPEstablished set field TCPEstablished to given value func (o *CheckpointOptions) WithTCPEstablished(value bool) *CheckpointOptions { - v := &value - o.TCPEstablished = v + o.TCPEstablished = &value return o } -// GetTCPEstablished +// GetTCPEstablished returns value of field TCPEstablished func (o *CheckpointOptions) GetTCPEstablished() bool { - var tCPEstablished bool if o.TCPEstablished == nil { - return tCPEstablished + var z bool + return z } return *o.TCPEstablished } diff --git a/pkg/bindings/containers/types_commit_options.go b/pkg/bindings/containers/types_commit_options.go index dfb7b2ced..ab506720c 100644 --- a/pkg/bindings/containers/types_commit_options.go +++ b/pkg/bindings/containers/types_commit_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,128 +7,117 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *CommitOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *CommitOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAuthor +// WithAuthor set field Author to given value func (o *CommitOptions) WithAuthor(value string) *CommitOptions { - v := &value - o.Author = v + o.Author = &value return o } -// GetAuthor +// GetAuthor returns value of field Author func (o *CommitOptions) GetAuthor() string { - var author string if o.Author == nil { - return author + var z string + return z } return *o.Author } -// WithChanges +// WithChanges set field Changes to given value func (o *CommitOptions) WithChanges(value []string) *CommitOptions { - v := value - o.Changes = v + o.Changes = value return o } -// GetChanges +// GetChanges returns value of field Changes func (o *CommitOptions) GetChanges() []string { - var changes []string if o.Changes == nil { - return changes + var z []string + return z } return o.Changes } -// WithComment +// WithComment set field Comment to given value func (o *CommitOptions) WithComment(value string) *CommitOptions { - v := &value - o.Comment = v + o.Comment = &value return o } -// GetComment +// GetComment returns value of field Comment func (o *CommitOptions) GetComment() string { - var comment string if o.Comment == nil { - return comment + var z string + return z } return *o.Comment } -// WithFormat +// WithFormat set field Format to given value func (o *CommitOptions) WithFormat(value string) *CommitOptions { - v := &value - o.Format = v + o.Format = &value return o } -// GetFormat +// GetFormat returns value of field Format func (o *CommitOptions) GetFormat() string { - var format string if o.Format == nil { - return format + var z string + return z } return *o.Format } -// WithPause +// WithPause set field Pause to given value func (o *CommitOptions) WithPause(value bool) *CommitOptions { - v := &value - o.Pause = v + o.Pause = &value return o } -// GetPause +// GetPause returns value of field Pause func (o *CommitOptions) GetPause() bool { - var pause bool if o.Pause == nil { - return pause + var z bool + return z } return *o.Pause } -// WithRepo +// WithRepo set field Repo to given value func (o *CommitOptions) WithRepo(value string) *CommitOptions { - v := &value - o.Repo = v + o.Repo = &value return o } -// GetRepo +// GetRepo returns value of field Repo func (o *CommitOptions) GetRepo() string { - var repo string if o.Repo == nil { - return repo + var z string + return z } return *o.Repo } -// WithTag +// WithTag set field Tag to given value func (o *CommitOptions) WithTag(value string) *CommitOptions { - v := &value - o.Tag = v + o.Tag = &value return o } -// GetTag +// GetTag returns value of field Tag func (o *CommitOptions) GetTag() string { - var tag string if o.Tag == nil { - return tag + var z string + return z } return *o.Tag } diff --git a/pkg/bindings/containers/types_copy_options.go b/pkg/bindings/containers/types_copy_options.go index 0624b450e..6c6981d64 100644 --- a/pkg/bindings/containers/types_copy_options.go +++ b/pkg/bindings/containers/types_copy_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,48 +7,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *CopyOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *CopyOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithChown +// WithChown set field Chown to given value func (o *CopyOptions) WithChown(value bool) *CopyOptions { - v := &value - o.Chown = v + o.Chown = &value return o } -// GetChown +// GetChown returns value of field Chown func (o *CopyOptions) GetChown() bool { - var chown bool if o.Chown == nil { - return chown + var z bool + return z } return *o.Chown } -// WithRename +// WithRename set field Rename to given value func (o *CopyOptions) WithRename(value map[string]string) *CopyOptions { - v := value - o.Rename = v + o.Rename = value return o } -// GetRename +// GetRename returns value of field Rename func (o *CopyOptions) GetRename() map[string]string { - var rename map[string]string if o.Rename == nil { - return rename + var z map[string]string + return z } return o.Rename } diff --git a/pkg/bindings/containers/types_create_options.go b/pkg/bindings/containers/types_create_options.go index dd8c82c15..eaef377e7 100644 --- a/pkg/bindings/containers/types_create_options.go +++ b/pkg/bindings/containers/types_create_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *CreateOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *CreateOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_diff_options.go b/pkg/bindings/containers/types_diff_options.go index e92594d39..cde0ca392 100644 --- a/pkg/bindings/containers/types_diff_options.go +++ b/pkg/bindings/containers/types_diff_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,48 +7,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *DiffOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *DiffOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithParent +// WithParent set field Parent to given value func (o *DiffOptions) WithParent(value string) *DiffOptions { - v := &value - o.Parent = v + o.Parent = &value return o } -// GetParent +// GetParent returns value of field Parent func (o *DiffOptions) GetParent() string { - var parent string if o.Parent == nil { - return parent + var z string + return z } return *o.Parent } -// WithDiffType +// WithDiffType set field DiffType to given value func (o *DiffOptions) WithDiffType(value string) *DiffOptions { - v := &value - o.DiffType = v + o.DiffType = &value return o } -// GetDiffType +// GetDiffType returns value of field DiffType func (o *DiffOptions) GetDiffType() string { - var diffType string if o.DiffType == nil { - return diffType + var z string + return z } return *o.DiffType } diff --git a/pkg/bindings/containers/types_execinspect_options.go b/pkg/bindings/containers/types_execinspect_options.go index b14ce9edb..7a047548a 100644 --- a/pkg/bindings/containers/types_execinspect_options.go +++ b/pkg/bindings/containers/types_execinspect_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ExecInspectOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ExecInspectOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_execstart_options.go b/pkg/bindings/containers/types_execstart_options.go index 052270c49..543e6b09b 100644 --- a/pkg/bindings/containers/types_execstart_options.go +++ b/pkg/bindings/containers/types_execstart_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ExecStartOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ExecStartOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_execstartandattach_options.go b/pkg/bindings/containers/types_execstartandattach_options.go index feda9cc83..741e59972 100644 --- a/pkg/bindings/containers/types_execstartandattach_options.go +++ b/pkg/bindings/containers/types_execstartandattach_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -8,112 +9,102 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ExecStartAndAttachOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ExecStartAndAttachOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithOutputStream +// WithOutputStream set field OutputStream to given value func (o *ExecStartAndAttachOptions) WithOutputStream(value io.WriteCloser) *ExecStartAndAttachOptions { - v := &value - o.OutputStream = v + o.OutputStream = &value return o } -// GetOutputStream +// GetOutputStream returns value of field OutputStream func (o *ExecStartAndAttachOptions) GetOutputStream() io.WriteCloser { - var outputStream io.WriteCloser if o.OutputStream == nil { - return outputStream + var z io.WriteCloser + return z } return *o.OutputStream } -// WithErrorStream +// WithErrorStream set field ErrorStream to given value func (o *ExecStartAndAttachOptions) WithErrorStream(value io.WriteCloser) *ExecStartAndAttachOptions { - v := &value - o.ErrorStream = v + o.ErrorStream = &value return o } -// GetErrorStream +// GetErrorStream returns value of field ErrorStream func (o *ExecStartAndAttachOptions) GetErrorStream() io.WriteCloser { - var errorStream io.WriteCloser if o.ErrorStream == nil { - return errorStream + var z io.WriteCloser + return z } return *o.ErrorStream } -// WithInputStream +// WithInputStream set field InputStream to given value func (o *ExecStartAndAttachOptions) WithInputStream(value bufio.Reader) *ExecStartAndAttachOptions { - v := &value - o.InputStream = v + o.InputStream = &value return o } -// GetInputStream +// GetInputStream returns value of field InputStream func (o *ExecStartAndAttachOptions) GetInputStream() bufio.Reader { - var inputStream bufio.Reader if o.InputStream == nil { - return inputStream + var z bufio.Reader + return z } return *o.InputStream } -// WithAttachOutput +// WithAttachOutput set field AttachOutput to given value func (o *ExecStartAndAttachOptions) WithAttachOutput(value bool) *ExecStartAndAttachOptions { - v := &value - o.AttachOutput = v + o.AttachOutput = &value return o } -// GetAttachOutput +// GetAttachOutput returns value of field AttachOutput func (o *ExecStartAndAttachOptions) GetAttachOutput() bool { - var attachOutput bool if o.AttachOutput == nil { - return attachOutput + var z bool + return z } return *o.AttachOutput } -// WithAttachError +// WithAttachError set field AttachError to given value func (o *ExecStartAndAttachOptions) WithAttachError(value bool) *ExecStartAndAttachOptions { - v := &value - o.AttachError = v + o.AttachError = &value return o } -// GetAttachError +// GetAttachError returns value of field AttachError func (o *ExecStartAndAttachOptions) GetAttachError() bool { - var attachError bool if o.AttachError == nil { - return attachError + var z bool + return z } return *o.AttachError } -// WithAttachInput +// WithAttachInput set field AttachInput to given value func (o *ExecStartAndAttachOptions) WithAttachInput(value bool) *ExecStartAndAttachOptions { - v := &value - o.AttachInput = v + o.AttachInput = &value return o } -// GetAttachInput +// GetAttachInput returns value of field AttachInput func (o *ExecStartAndAttachOptions) GetAttachInput() bool { - var attachInput bool if o.AttachInput == nil { - return attachInput + var z bool + return z } return *o.AttachInput } diff --git a/pkg/bindings/containers/types_exists_options.go b/pkg/bindings/containers/types_exists_options.go index a3eefcebf..9d354a07c 100644 --- a/pkg/bindings/containers/types_exists_options.go +++ b/pkg/bindings/containers/types_exists_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ExistsOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ExistsOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithExternal +// WithExternal set field External to given value func (o *ExistsOptions) WithExternal(value bool) *ExistsOptions { - v := &value - o.External = v + o.External = &value return o } -// GetExternal +// GetExternal returns value of field External func (o *ExistsOptions) GetExternal() bool { - var external bool if o.External == nil { - return external + var z bool + return z } return *o.External } diff --git a/pkg/bindings/containers/types_export_options.go b/pkg/bindings/containers/types_export_options.go index d15904bc1..79ff04f29 100644 --- a/pkg/bindings/containers/types_export_options.go +++ b/pkg/bindings/containers/types_export_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ExportOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ExportOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_healthcheck_options.go b/pkg/bindings/containers/types_healthcheck_options.go index edad13fee..f51993ba5 100644 --- a/pkg/bindings/containers/types_healthcheck_options.go +++ b/pkg/bindings/containers/types_healthcheck_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *HealthCheckOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *HealthCheckOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_init_options.go b/pkg/bindings/containers/types_init_options.go index 602608133..2b73c24fd 100644 --- a/pkg/bindings/containers/types_init_options.go +++ b/pkg/bindings/containers/types_init_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *InitOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *InitOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_inspect_options.go b/pkg/bindings/containers/types_inspect_options.go index d1f64ea9a..6a5f6bfca 100644 --- a/pkg/bindings/containers/types_inspect_options.go +++ b/pkg/bindings/containers/types_inspect_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *InspectOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *InspectOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithSize +// WithSize set field Size to given value func (o *InspectOptions) WithSize(value bool) *InspectOptions { - v := &value - o.Size = v + o.Size = &value return o } -// GetSize +// GetSize returns value of field Size func (o *InspectOptions) GetSize() bool { - var size bool if o.Size == nil { - return size + var z bool + return z } return *o.Size } diff --git a/pkg/bindings/containers/types_kill_options.go b/pkg/bindings/containers/types_kill_options.go index 60cb4ae2c..c755d3be2 100644 --- a/pkg/bindings/containers/types_kill_options.go +++ b/pkg/bindings/containers/types_kill_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *KillOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *KillOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithSignal +// WithSignal set field Signal to given value func (o *KillOptions) WithSignal(value string) *KillOptions { - v := &value - o.Signal = v + o.Signal = &value return o } -// GetSignal +// GetSignal returns value of field Signal func (o *KillOptions) GetSignal() string { - var signal string if o.Signal == nil { - return signal + var z string + return z } return *o.Signal } diff --git a/pkg/bindings/containers/types_list_options.go b/pkg/bindings/containers/types_list_options.go index c96b7d880..37f95e0ce 100644 --- a/pkg/bindings/containers/types_list_options.go +++ b/pkg/bindings/containers/types_list_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,128 +7,117 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ListOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ListOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAll +// WithAll set field All to given value func (o *ListOptions) WithAll(value bool) *ListOptions { - v := &value - o.All = v + o.All = &value return o } -// GetAll +// GetAll returns value of field All func (o *ListOptions) GetAll() bool { - var all bool if o.All == nil { - return all + var z bool + return z } return *o.All } -// WithExternal +// WithExternal set field External to given value func (o *ListOptions) WithExternal(value bool) *ListOptions { - v := &value - o.External = v + o.External = &value return o } -// GetExternal +// GetExternal returns value of field External func (o *ListOptions) GetExternal() bool { - var external bool if o.External == nil { - return external + var z bool + return z } return *o.External } -// WithFilters +// WithFilters set field Filters to given value func (o *ListOptions) WithFilters(value map[string][]string) *ListOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *ListOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } -// WithLast +// WithLast set field Last to given value func (o *ListOptions) WithLast(value int) *ListOptions { - v := &value - o.Last = v + o.Last = &value return o } -// GetLast +// GetLast returns value of field Last func (o *ListOptions) GetLast() int { - var last int if o.Last == nil { - return last + var z int + return z } return *o.Last } -// WithNamespace +// WithNamespace set field Namespace to given value func (o *ListOptions) WithNamespace(value bool) *ListOptions { - v := &value - o.Namespace = v + o.Namespace = &value return o } -// GetNamespace +// GetNamespace returns value of field Namespace func (o *ListOptions) GetNamespace() bool { - var namespace bool if o.Namespace == nil { - return namespace + var z bool + return z } return *o.Namespace } -// WithSize +// WithSize set field Size to given value func (o *ListOptions) WithSize(value bool) *ListOptions { - v := &value - o.Size = v + o.Size = &value return o } -// GetSize +// GetSize returns value of field Size func (o *ListOptions) GetSize() bool { - var size bool if o.Size == nil { - return size + var z bool + return z } return *o.Size } -// WithSync +// WithSync set field Sync to given value func (o *ListOptions) WithSync(value bool) *ListOptions { - v := &value - o.Sync = v + o.Sync = &value return o } -// GetSync +// GetSync returns value of field Sync func (o *ListOptions) GetSync() bool { - var sync bool if o.Sync == nil { - return sync + var z bool + return z } return *o.Sync } diff --git a/pkg/bindings/containers/types_log_options.go b/pkg/bindings/containers/types_log_options.go index 63f323089..d8160d4f7 100644 --- a/pkg/bindings/containers/types_log_options.go +++ b/pkg/bindings/containers/types_log_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,128 +7,117 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *LogOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *LogOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithFollow +// WithFollow set field Follow to given value func (o *LogOptions) WithFollow(value bool) *LogOptions { - v := &value - o.Follow = v + o.Follow = &value return o } -// GetFollow +// GetFollow returns value of field Follow func (o *LogOptions) GetFollow() bool { - var follow bool if o.Follow == nil { - return follow + var z bool + return z } return *o.Follow } -// WithSince +// WithSince set field Since to given value func (o *LogOptions) WithSince(value string) *LogOptions { - v := &value - o.Since = v + o.Since = &value return o } -// GetSince +// GetSince returns value of field Since func (o *LogOptions) GetSince() string { - var since string if o.Since == nil { - return since + var z string + return z } return *o.Since } -// WithStderr +// WithStderr set field Stderr to given value func (o *LogOptions) WithStderr(value bool) *LogOptions { - v := &value - o.Stderr = v + o.Stderr = &value return o } -// GetStderr +// GetStderr returns value of field Stderr func (o *LogOptions) GetStderr() bool { - var stderr bool if o.Stderr == nil { - return stderr + var z bool + return z } return *o.Stderr } -// WithStdout +// WithStdout set field Stdout to given value func (o *LogOptions) WithStdout(value bool) *LogOptions { - v := &value - o.Stdout = v + o.Stdout = &value return o } -// GetStdout +// GetStdout returns value of field Stdout func (o *LogOptions) GetStdout() bool { - var stdout bool if o.Stdout == nil { - return stdout + var z bool + return z } return *o.Stdout } -// WithTail +// WithTail set field Tail to given value func (o *LogOptions) WithTail(value string) *LogOptions { - v := &value - o.Tail = v + o.Tail = &value return o } -// GetTail +// GetTail returns value of field Tail func (o *LogOptions) GetTail() string { - var tail string if o.Tail == nil { - return tail + var z string + return z } return *o.Tail } -// WithTimestamps +// WithTimestamps set field Timestamps to given value func (o *LogOptions) WithTimestamps(value bool) *LogOptions { - v := &value - o.Timestamps = v + o.Timestamps = &value return o } -// GetTimestamps +// GetTimestamps returns value of field Timestamps func (o *LogOptions) GetTimestamps() bool { - var timestamps bool if o.Timestamps == nil { - return timestamps + var z bool + return z } return *o.Timestamps } -// WithUntil +// WithUntil set field Until to given value func (o *LogOptions) WithUntil(value string) *LogOptions { - v := &value - o.Until = v + o.Until = &value return o } -// GetUntil +// GetUntil returns value of field Until func (o *LogOptions) GetUntil() string { - var until string if o.Until == nil { - return until + var z string + return z } return *o.Until } diff --git a/pkg/bindings/containers/types_mount_options.go b/pkg/bindings/containers/types_mount_options.go index a1d8aef62..eccc7bb73 100644 --- a/pkg/bindings/containers/types_mount_options.go +++ b/pkg/bindings/containers/types_mount_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *MountOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *MountOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_mountedcontainerpaths_options.go b/pkg/bindings/containers/types_mountedcontainerpaths_options.go index c4562f43a..7d053aba2 100644 --- a/pkg/bindings/containers/types_mountedcontainerpaths_options.go +++ b/pkg/bindings/containers/types_mountedcontainerpaths_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *MountedContainerPathsOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *MountedContainerPathsOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_pause_options.go b/pkg/bindings/containers/types_pause_options.go index fa2ad4995..bd1740b25 100644 --- a/pkg/bindings/containers/types_pause_options.go +++ b/pkg/bindings/containers/types_pause_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *PauseOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *PauseOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_prune_options.go b/pkg/bindings/containers/types_prune_options.go index adba0a4ef..016a43b66 100644 --- a/pkg/bindings/containers/types_prune_options.go +++ b/pkg/bindings/containers/types_prune_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *PruneOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *PruneOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithFilters +// WithFilters set field Filters to given value func (o *PruneOptions) WithFilters(value map[string][]string) *PruneOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *PruneOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } diff --git a/pkg/bindings/containers/types_remove_options.go b/pkg/bindings/containers/types_remove_options.go index cd4b76ac2..8eaa13c2a 100644 --- a/pkg/bindings/containers/types_remove_options.go +++ b/pkg/bindings/containers/types_remove_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,64 +7,57 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *RemoveOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *RemoveOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithIgnore +// WithIgnore set field Ignore to given value func (o *RemoveOptions) WithIgnore(value bool) *RemoveOptions { - v := &value - o.Ignore = v + o.Ignore = &value return o } -// GetIgnore +// GetIgnore returns value of field Ignore func (o *RemoveOptions) GetIgnore() bool { - var ignore bool if o.Ignore == nil { - return ignore + var z bool + return z } return *o.Ignore } -// WithForce +// WithForce set field Force to given value func (o *RemoveOptions) WithForce(value bool) *RemoveOptions { - v := &value - o.Force = v + o.Force = &value return o } -// GetForce +// GetForce returns value of field Force func (o *RemoveOptions) GetForce() bool { - var force bool if o.Force == nil { - return force + var z bool + return z } return *o.Force } -// WithVolumes +// WithVolumes set field Volumes to given value func (o *RemoveOptions) WithVolumes(value bool) *RemoveOptions { - v := &value - o.Volumes = v + o.Volumes = &value return o } -// GetVolumes +// GetVolumes returns value of field Volumes func (o *RemoveOptions) GetVolumes() bool { - var volumes bool if o.Volumes == nil { - return volumes + var z bool + return z } return *o.Volumes } diff --git a/pkg/bindings/containers/types_rename_options.go b/pkg/bindings/containers/types_rename_options.go index 96d9aaab5..f55f7f5f0 100644 --- a/pkg/bindings/containers/types_rename_options.go +++ b/pkg/bindings/containers/types_rename_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *RenameOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *RenameOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithName +// WithName set field Name to given value func (o *RenameOptions) WithName(value string) *RenameOptions { - v := &value - o.Name = v + o.Name = &value return o } -// GetName +// GetName returns value of field Name func (o *RenameOptions) GetName() string { - var name string if o.Name == nil { - return name + var z string + return z } return *o.Name } diff --git a/pkg/bindings/containers/types_resizeexectty_options.go b/pkg/bindings/containers/types_resizeexectty_options.go index d74459822..fb4a1d36a 100644 --- a/pkg/bindings/containers/types_resizeexectty_options.go +++ b/pkg/bindings/containers/types_resizeexectty_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,48 +7,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ResizeExecTTYOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ResizeExecTTYOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithHeight +// WithHeight set field Height to given value func (o *ResizeExecTTYOptions) WithHeight(value int) *ResizeExecTTYOptions { - v := &value - o.Height = v + o.Height = &value return o } -// GetHeight +// GetHeight returns value of field Height func (o *ResizeExecTTYOptions) GetHeight() int { - var height int if o.Height == nil { - return height + var z int + return z } return *o.Height } -// WithWidth +// WithWidth set field Width to given value func (o *ResizeExecTTYOptions) WithWidth(value int) *ResizeExecTTYOptions { - v := &value - o.Width = v + o.Width = &value return o } -// GetWidth +// GetWidth returns value of field Width func (o *ResizeExecTTYOptions) GetWidth() int { - var width int if o.Width == nil { - return width + var z int + return z } return *o.Width } diff --git a/pkg/bindings/containers/types_resizetty_options.go b/pkg/bindings/containers/types_resizetty_options.go index 94946692f..1115478e9 100644 --- a/pkg/bindings/containers/types_resizetty_options.go +++ b/pkg/bindings/containers/types_resizetty_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,64 +7,57 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ResizeTTYOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ResizeTTYOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithHeight +// WithHeight set field Height to given value func (o *ResizeTTYOptions) WithHeight(value int) *ResizeTTYOptions { - v := &value - o.Height = v + o.Height = &value return o } -// GetHeight +// GetHeight returns value of field Height func (o *ResizeTTYOptions) GetHeight() int { - var height int if o.Height == nil { - return height + var z int + return z } return *o.Height } -// WithWidth +// WithWidth set field Width to given value func (o *ResizeTTYOptions) WithWidth(value int) *ResizeTTYOptions { - v := &value - o.Width = v + o.Width = &value return o } -// GetWidth +// GetWidth returns value of field Width func (o *ResizeTTYOptions) GetWidth() int { - var width int if o.Width == nil { - return width + var z int + return z } return *o.Width } -// WithRunning +// WithRunning set field Running to given value func (o *ResizeTTYOptions) WithRunning(value bool) *ResizeTTYOptions { - v := &value - o.Running = v + o.Running = &value return o } -// GetRunning +// GetRunning returns value of field Running func (o *ResizeTTYOptions) GetRunning() bool { - var running bool if o.Running == nil { - return running + var z bool + return z } return *o.Running } diff --git a/pkg/bindings/containers/types_restart_options.go b/pkg/bindings/containers/types_restart_options.go index 18a47fcb6..eb4538ea9 100644 --- a/pkg/bindings/containers/types_restart_options.go +++ b/pkg/bindings/containers/types_restart_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *RestartOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *RestartOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithTimeout +// WithTimeout set field Timeout to given value func (o *RestartOptions) WithTimeout(value int) *RestartOptions { - v := &value - o.Timeout = v + o.Timeout = &value return o } -// GetTimeout +// GetTimeout returns value of field Timeout func (o *RestartOptions) GetTimeout() int { - var timeout int if o.Timeout == nil { - return timeout + var z int + return z } return *o.Timeout } diff --git a/pkg/bindings/containers/types_restore_options.go b/pkg/bindings/containers/types_restore_options.go index 820a7696f..6eea108f4 100644 --- a/pkg/bindings/containers/types_restore_options.go +++ b/pkg/bindings/containers/types_restore_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,144 +7,132 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *RestoreOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *RestoreOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithIgnoreRootfs +// WithIgnoreRootfs set field IgnoreRootfs to given value func (o *RestoreOptions) WithIgnoreRootfs(value bool) *RestoreOptions { - v := &value - o.IgnoreRootfs = v + o.IgnoreRootfs = &value return o } -// GetIgnoreRootfs +// GetIgnoreRootfs returns value of field IgnoreRootfs func (o *RestoreOptions) GetIgnoreRootfs() bool { - var ignoreRootfs bool if o.IgnoreRootfs == nil { - return ignoreRootfs + var z bool + return z } return *o.IgnoreRootfs } -// WithIgnoreStaticIP +// WithIgnoreStaticIP set field IgnoreStaticIP to given value func (o *RestoreOptions) WithIgnoreStaticIP(value bool) *RestoreOptions { - v := &value - o.IgnoreStaticIP = v + o.IgnoreStaticIP = &value return o } -// GetIgnoreStaticIP +// GetIgnoreStaticIP returns value of field IgnoreStaticIP func (o *RestoreOptions) GetIgnoreStaticIP() bool { - var ignoreStaticIP bool if o.IgnoreStaticIP == nil { - return ignoreStaticIP + var z bool + return z } return *o.IgnoreStaticIP } -// WithIgnoreStaticMAC +// WithIgnoreStaticMAC set field IgnoreStaticMAC to given value func (o *RestoreOptions) WithIgnoreStaticMAC(value bool) *RestoreOptions { - v := &value - o.IgnoreStaticMAC = v + o.IgnoreStaticMAC = &value return o } -// GetIgnoreStaticMAC +// GetIgnoreStaticMAC returns value of field IgnoreStaticMAC func (o *RestoreOptions) GetIgnoreStaticMAC() bool { - var ignoreStaticMAC bool if o.IgnoreStaticMAC == nil { - return ignoreStaticMAC + var z bool + return z } return *o.IgnoreStaticMAC } -// WithImportAchive +// WithImportAchive set field ImportAchive to given value func (o *RestoreOptions) WithImportAchive(value string) *RestoreOptions { - v := &value - o.ImportAchive = v + o.ImportAchive = &value return o } -// GetImportAchive +// GetImportAchive returns value of field ImportAchive func (o *RestoreOptions) GetImportAchive() string { - var importAchive string if o.ImportAchive == nil { - return importAchive + var z string + return z } return *o.ImportAchive } -// WithKeep +// WithKeep set field Keep to given value func (o *RestoreOptions) WithKeep(value bool) *RestoreOptions { - v := &value - o.Keep = v + o.Keep = &value return o } -// GetKeep +// GetKeep returns value of field Keep func (o *RestoreOptions) GetKeep() bool { - var keep bool if o.Keep == nil { - return keep + var z bool + return z } return *o.Keep } -// WithName +// WithName set field Name to given value func (o *RestoreOptions) WithName(value string) *RestoreOptions { - v := &value - o.Name = v + o.Name = &value return o } -// GetName +// GetName returns value of field Name func (o *RestoreOptions) GetName() string { - var name string if o.Name == nil { - return name + var z string + return z } return *o.Name } -// WithTCPEstablished +// WithTCPEstablished set field TCPEstablished to given value func (o *RestoreOptions) WithTCPEstablished(value bool) *RestoreOptions { - v := &value - o.TCPEstablished = v + o.TCPEstablished = &value return o } -// GetTCPEstablished +// GetTCPEstablished returns value of field TCPEstablished func (o *RestoreOptions) GetTCPEstablished() bool { - var tCPEstablished bool if o.TCPEstablished == nil { - return tCPEstablished + var z bool + return z } return *o.TCPEstablished } -// WithPod +// WithPod set field Pod to given value func (o *RestoreOptions) WithPod(value string) *RestoreOptions { - v := &value - o.Pod = v + o.Pod = &value return o } -// GetPod +// GetPod returns value of field Pod func (o *RestoreOptions) GetPod() string { - var pod string if o.Pod == nil { - return pod + var z string + return z } return *o.Pod } diff --git a/pkg/bindings/containers/types_shouldrestart_options.go b/pkg/bindings/containers/types_shouldrestart_options.go index 28986d4f8..b43cf67e2 100644 --- a/pkg/bindings/containers/types_shouldrestart_options.go +++ b/pkg/bindings/containers/types_shouldrestart_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ShouldRestartOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ShouldRestartOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_start_options.go b/pkg/bindings/containers/types_start_options.go index d419c755c..30914d003 100644 --- a/pkg/bindings/containers/types_start_options.go +++ b/pkg/bindings/containers/types_start_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,48 +7,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *StartOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *StartOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithDetachKeys +// WithDetachKeys set field DetachKeys to given value func (o *StartOptions) WithDetachKeys(value string) *StartOptions { - v := &value - o.DetachKeys = v + o.DetachKeys = &value return o } -// GetDetachKeys +// GetDetachKeys returns value of field DetachKeys func (o *StartOptions) GetDetachKeys() string { - var detachKeys string if o.DetachKeys == nil { - return detachKeys + var z string + return z } return *o.DetachKeys } -// WithRecursive +// WithRecursive set field Recursive to given value func (o *StartOptions) WithRecursive(value bool) *StartOptions { - v := &value - o.Recursive = v + o.Recursive = &value return o } -// GetRecursive +// GetRecursive returns value of field Recursive func (o *StartOptions) GetRecursive() bool { - var recursive bool if o.Recursive == nil { - return recursive + var z bool + return z } return *o.Recursive } diff --git a/pkg/bindings/containers/types_stats_options.go b/pkg/bindings/containers/types_stats_options.go index 604004eb6..9306c806c 100644 --- a/pkg/bindings/containers/types_stats_options.go +++ b/pkg/bindings/containers/types_stats_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,48 +7,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *StatsOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *StatsOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithStream +// WithStream set field Stream to given value func (o *StatsOptions) WithStream(value bool) *StatsOptions { - v := &value - o.Stream = v + o.Stream = &value return o } -// GetStream +// GetStream returns value of field Stream func (o *StatsOptions) GetStream() bool { - var stream bool if o.Stream == nil { - return stream + var z bool + return z } return *o.Stream } -// WithInterval +// WithInterval set field Interval to given value func (o *StatsOptions) WithInterval(value int) *StatsOptions { - v := &value - o.Interval = v + o.Interval = &value return o } -// GetInterval +// GetInterval returns value of field Interval func (o *StatsOptions) GetInterval() int { - var interval int if o.Interval == nil { - return interval + var z int + return z } return *o.Interval } diff --git a/pkg/bindings/containers/types_stop_options.go b/pkg/bindings/containers/types_stop_options.go index d952f9c29..c6db8b909 100644 --- a/pkg/bindings/containers/types_stop_options.go +++ b/pkg/bindings/containers/types_stop_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,48 +7,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *StopOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *StopOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithIgnore +// WithIgnore set field Ignore to given value func (o *StopOptions) WithIgnore(value bool) *StopOptions { - v := &value - o.Ignore = v + o.Ignore = &value return o } -// GetIgnore +// GetIgnore returns value of field Ignore func (o *StopOptions) GetIgnore() bool { - var ignore bool if o.Ignore == nil { - return ignore + var z bool + return z } return *o.Ignore } -// WithTimeout +// WithTimeout set field Timeout to given value func (o *StopOptions) WithTimeout(value uint) *StopOptions { - v := &value - o.Timeout = v + o.Timeout = &value return o } -// GetTimeout +// GetTimeout returns value of field Timeout func (o *StopOptions) GetTimeout() uint { - var timeout uint if o.Timeout == nil { - return timeout + var z uint + return z } return *o.Timeout } diff --git a/pkg/bindings/containers/types_top_options.go b/pkg/bindings/containers/types_top_options.go index a80f2111a..7ff04a7b6 100644 --- a/pkg/bindings/containers/types_top_options.go +++ b/pkg/bindings/containers/types_top_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *TopOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *TopOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithDescriptors +// WithDescriptors set field Descriptors to given value func (o *TopOptions) WithDescriptors(value []string) *TopOptions { - v := &value - o.Descriptors = v + o.Descriptors = &value return o } -// GetDescriptors +// GetDescriptors returns value of field Descriptors func (o *TopOptions) GetDescriptors() []string { - var descriptors []string if o.Descriptors == nil { - return descriptors + var z []string + return z } return *o.Descriptors } diff --git a/pkg/bindings/containers/types_unmount_options.go b/pkg/bindings/containers/types_unmount_options.go index 6f624081b..4e5adb2a8 100644 --- a/pkg/bindings/containers/types_unmount_options.go +++ b/pkg/bindings/containers/types_unmount_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *UnmountOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *UnmountOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_unpause_options.go b/pkg/bindings/containers/types_unpause_options.go index d6694d4da..d0d806a58 100644 --- a/pkg/bindings/containers/types_unpause_options.go +++ b/pkg/bindings/containers/types_unpause_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *UnpauseOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *UnpauseOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/containers/types_wait_options.go b/pkg/bindings/containers/types_wait_options.go index ea724b619..4ca30f71b 100644 --- a/pkg/bindings/containers/types_wait_options.go +++ b/pkg/bindings/containers/types_wait_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package containers import ( @@ -7,48 +8,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *WaitOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *WaitOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithCondition +// WithCondition set field Condition to given value func (o *WaitOptions) WithCondition(value []define.ContainerStatus) *WaitOptions { - v := value - o.Condition = v + o.Condition = value return o } -// GetCondition +// GetCondition returns value of field Condition func (o *WaitOptions) GetCondition() []define.ContainerStatus { - var condition []define.ContainerStatus if o.Condition == nil { - return condition + var z []define.ContainerStatus + return z } return o.Condition } -// WithInterval +// WithInterval set field Interval to given value func (o *WaitOptions) WithInterval(value string) *WaitOptions { - v := &value - o.Interval = v + o.Interval = &value return o } -// GetInterval +// GetInterval returns value of field Interval func (o *WaitOptions) GetInterval() string { - var interval string if o.Interval == nil { - return interval + var z string + return z } return *o.Interval } diff --git a/pkg/bindings/doc.go b/pkg/bindings/doc.go new file mode 100644 index 000000000..20b4c42e9 --- /dev/null +++ b/pkg/bindings/doc.go @@ -0,0 +1,5 @@ +package bindings + +/* + See https://github.com/containers/podman/blob/main/pkg/bindings/README.md for details. +*/ diff --git a/pkg/bindings/generate/types_kube_options.go b/pkg/bindings/generate/types_kube_options.go index 785e55dd4..0dd23afb0 100644 --- a/pkg/bindings/generate/types_kube_options.go +++ b/pkg/bindings/generate/types_kube_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package generate import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *KubeOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *KubeOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithService +// WithService set field Service to given value func (o *KubeOptions) WithService(value bool) *KubeOptions { - v := &value - o.Service = v + o.Service = &value return o } -// GetService +// GetService returns value of field Service func (o *KubeOptions) GetService() bool { - var service bool if o.Service == nil { - return service + var z bool + return z } return *o.Service } diff --git a/pkg/bindings/generate/types_systemd_options.go b/pkg/bindings/generate/types_systemd_options.go index 1cee2e16a..7a778a52b 100644 --- a/pkg/bindings/generate/types_systemd_options.go +++ b/pkg/bindings/generate/types_systemd_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package generate import ( @@ -6,144 +7,132 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *SystemdOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *SystemdOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithUseName +// WithUseName set field UseName to given value func (o *SystemdOptions) WithUseName(value bool) *SystemdOptions { - v := &value - o.UseName = v + o.UseName = &value return o } -// GetUseName +// GetUseName returns value of field UseName func (o *SystemdOptions) GetUseName() bool { - var useName bool if o.UseName == nil { - return useName + var z bool + return z } return *o.UseName } -// WithNew +// WithNew set field New to given value func (o *SystemdOptions) WithNew(value bool) *SystemdOptions { - v := &value - o.New = v + o.New = &value return o } -// GetNew +// GetNew returns value of field New func (o *SystemdOptions) GetNew() bool { - var new bool if o.New == nil { - return new + var z bool + return z } return *o.New } -// WithNoHeader +// WithNoHeader set field NoHeader to given value func (o *SystemdOptions) WithNoHeader(value bool) *SystemdOptions { - v := &value - o.NoHeader = v + o.NoHeader = &value return o } -// GetNoHeader +// GetNoHeader returns value of field NoHeader func (o *SystemdOptions) GetNoHeader() bool { - var noHeader bool if o.NoHeader == nil { - return noHeader + var z bool + return z } return *o.NoHeader } -// WithRestartPolicy +// WithRestartPolicy set field RestartPolicy to given value func (o *SystemdOptions) WithRestartPolicy(value string) *SystemdOptions { - v := &value - o.RestartPolicy = v + o.RestartPolicy = &value return o } -// GetRestartPolicy +// GetRestartPolicy returns value of field RestartPolicy func (o *SystemdOptions) GetRestartPolicy() string { - var restartPolicy string if o.RestartPolicy == nil { - return restartPolicy + var z string + return z } return *o.RestartPolicy } -// WithStopTimeout +// WithStopTimeout set field StopTimeout to given value func (o *SystemdOptions) WithStopTimeout(value uint) *SystemdOptions { - v := &value - o.StopTimeout = v + o.StopTimeout = &value return o } -// GetStopTimeout +// GetStopTimeout returns value of field StopTimeout func (o *SystemdOptions) GetStopTimeout() uint { - var stopTimeout uint if o.StopTimeout == nil { - return stopTimeout + var z uint + return z } return *o.StopTimeout } -// WithContainerPrefix +// WithContainerPrefix set field ContainerPrefix to given value func (o *SystemdOptions) WithContainerPrefix(value string) *SystemdOptions { - v := &value - o.ContainerPrefix = v + o.ContainerPrefix = &value return o } -// GetContainerPrefix +// GetContainerPrefix returns value of field ContainerPrefix func (o *SystemdOptions) GetContainerPrefix() string { - var containerPrefix string if o.ContainerPrefix == nil { - return containerPrefix + var z string + return z } return *o.ContainerPrefix } -// WithPodPrefix +// WithPodPrefix set field PodPrefix to given value func (o *SystemdOptions) WithPodPrefix(value string) *SystemdOptions { - v := &value - o.PodPrefix = v + o.PodPrefix = &value return o } -// GetPodPrefix +// GetPodPrefix returns value of field PodPrefix func (o *SystemdOptions) GetPodPrefix() string { - var podPrefix string if o.PodPrefix == nil { - return podPrefix + var z string + return z } return *o.PodPrefix } -// WithSeparator +// WithSeparator set field Separator to given value func (o *SystemdOptions) WithSeparator(value string) *SystemdOptions { - v := &value - o.Separator = v + o.Separator = &value return o } -// GetSeparator +// GetSeparator returns value of field Separator func (o *SystemdOptions) GetSeparator() string { - var separator string if o.Separator == nil { - return separator + var z string + return z } return *o.Separator } diff --git a/pkg/bindings/generator/generator.go b/pkg/bindings/generator/generator.go index 90f0bfaf5..f7388ec6a 100644 --- a/pkg/bindings/generator/generator.go +++ b/pkg/bindings/generator/generator.go @@ -1,5 +1,10 @@ +// +build ignore + package main +// This program generates *_options_.go files to be used by the bindings calls to API service. +// It can be invoked by running go generate + import ( "errors" "fmt" @@ -11,56 +16,52 @@ import ( "os/exec" "strings" "text/template" - "time" + "unicode" + "unicode/utf8" ) -var bodyTmpl = `package {{.PackageName}} +var bodyTmpl = `// Code generated by go generate; DO NOT EDIT. +package {{.PackageName}} import ( {{range $import := .Imports}} {{$import}} {{end}} ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *{{.StructName}}) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *{{.StructName}}) ToParams() (url.Values, error) { return util.ToParams(o) } {{range $field := .Fields}} -// With{{.Name}} -func(o *{{$field.StructName}}) With{{$field.Name}}(value {{$field.Type}}) *{{$field.StructName}} { - v := {{$field.TypedValue}} - o.{{$field.Name}} = v +// With{{.Name}} set {{if .Comment}}{{.Comment}}{{else}}field {{.Name}} to given value{{end}} +func(o *{{.StructName}}) With{{.Name}}(value {{.Type}}) *{{.StructName}} { + o.{{.Name}} = {{if not .Composite}}&{{end}}value return o } -// Get{{.Name}} -func(o *{{$field.StructName}}) Get{{$field.Name}}() {{$field.Type}} { - var {{$field.ZeroName}} {{$field.Type}} - if o.{{$field.Name}} == nil { - return {{$field.ZeroName}} +// Get{{.Name}} returns value of {{if .Comment}}{{.Comment}}{{else}}field {{.Name}}{{end}} +func(o *{{.StructName}}) Get{{.Name}}() {{.Type}} { + if o.{{.Name}} == nil { + var z {{.Type}} + return z } - return {{$field.TypedName}} + return {{if not .Composite}}*{{end}}o.{{.Name}} } {{end}} ` type fieldStruct struct { + Comment string + Composite bool Name string StructName string Type string - TypedName string - TypedValue string - ZeroName string } func main() { @@ -69,7 +70,6 @@ func main() { fieldStructs []fieldStruct ) srcFile := os.Getenv("GOFILE") - pkg := os.Getenv("GOPACKAGE") inputStructName := os.Args[1] b, err := ioutil.ReadFile(srcFile) if err != nil { @@ -80,6 +80,7 @@ func main() { if err != nil { panic(err) } + // always add reflect imports := []string{"\"reflect\"", "\"github.com/containers/podman/v3/pkg/bindings/internal/util\""} for _, imp := range f.Imports { @@ -96,95 +97,94 @@ func main() { } }() + body := template.Must(template.New("body").Parse(bodyTmpl)) + ast.Inspect(f, func(n ast.Node) bool { ref, refOK := n.(*ast.TypeSpec) - if refOK { - if ref.Name.Name == inputStructName { - x := ref.Type.(*ast.StructType) - for _, field := range x.Fields.List { - var ( - name, zeroName, typedName, typedValue string - ) - if len(field.Names) > 0 { - name = field.Names[0].Name - if len(name) < 1 { - panic(errors.New("bad name")) - } - } - for k, v := range name { - zeroName = strings.ToLower(string(v)) + name[k+1:] - break - } - //sub := "*" - typeExpr := field.Type - switch field.Type.(type) { - case *ast.MapType, *ast.StructType, *ast.ArrayType: - typedName = "o." + name - typedValue = "value" - default: - typedName = "*o." + name - typedValue = "&value" - } - start := typeExpr.Pos() - 1 - end := typeExpr.End() - 1 - fieldType := strings.Replace(string(b[start:end]), "*", "", 1) - fStruct := fieldStruct{ - Name: name, - StructName: inputStructName, - Type: fieldType, - TypedName: typedName, - TypedValue: typedValue, - ZeroName: zeroName, - } - fieldStructs = append(fieldStructs, fStruct) - } // for - - bodyStruct := struct { - PackageName string - Imports []string - Date string - StructName string - Fields []fieldStruct - }{ - PackageName: pkg, - Imports: imports, - Date: time.Now().String(), - StructName: inputStructName, - Fields: fieldStructs, + if !(refOK && ref.Name.Name == inputStructName) { + return true + } + + x := ref.Type.(*ast.StructType) + for _, field := range x.Fields.List { + var name string + if len(field.Names) > 0 { + name = field.Names[0].Name + if len(name) < 1 { + panic(errors.New("bad name")) } + } - body := template.Must(template.New("body").Parse(bodyTmpl)) + var composite bool + switch field.Type.(type) { + case *ast.MapType, *ast.StructType, *ast.ArrayType: + composite = true + } - // create the body - if err := body.Execute(out, bodyStruct); err != nil { - fmt.Println(err) - os.Exit(1) - } + //sub := "*" + typeExpr := field.Type + start := typeExpr.Pos() - 1 + end := typeExpr.End() - 1 + fieldType := strings.Replace(string(b[start:end]), "*", "", 1) + + fieldStructs = append(fieldStructs, fieldStruct{ + Comment: fmtComment(field.Comment.Text()), + Composite: composite, + Name: name, + StructName: inputStructName, + Type: fieldType, + }) + } // for + + bodyStruct := struct { + PackageName string + Imports []string + StructName string + Fields []fieldStruct + }{ + PackageName: os.Getenv("GOPACKAGE"), + Imports: imports, + StructName: inputStructName, + Fields: fieldStructs, + } - // close out file - if err := out.Close(); err != nil { - fmt.Println(err) - os.Exit(1) - } - closed = true - - // go fmt file - gofmt := exec.Command("go", "fmt", out.Name()) - gofmt.Stderr = os.Stdout - if err := gofmt.Run(); err != nil { - fmt.Println(err) - os.Exit(1) - } + // create the body + if err := body.Execute(out, bodyStruct); err != nil { + fmt.Println(err) + os.Exit(1) + } - // go import file - goimport := exec.Command("goimports", "-w", out.Name()) - goimport.Stderr = os.Stdout - if err := goimport.Run(); err != nil { - fmt.Println(err) - os.Exit(1) - } - } + // close out file + if err := out.Close(); err != nil { + fmt.Println(err) + os.Exit(1) + } + closed = true + + // go fmt file + gofmt := exec.Command("go", "fmt", out.Name()) + gofmt.Stderr = os.Stdout + if err := gofmt.Run(); err != nil { + fmt.Println(err) + os.Exit(1) + } + + // go import file + goimport := exec.Command("goimports", "-w", out.Name()) + goimport.Stderr = os.Stdout + if err := goimport.Run(); err != nil { + fmt.Println(err) + os.Exit(1) } return true }) } + +func fmtComment(comment string) string { + r, n := utf8.DecodeRuneInString(comment) + if r != utf8.RuneError { + comment = string(unicode.ToLower(r)) + comment[n:] + } + comment = strings.TrimSpace(comment) + return comment +} diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go index 3beafa585..9d5aad23b 100644 --- a/pkg/bindings/images/build.go +++ b/pkg/bindings/images/build.go @@ -220,6 +220,16 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO if len(platform) > 0 { params.Set("platform", platform) } + if len(options.Platforms) > 0 { + params.Del("platform") + for _, platformSpec := range options.Platforms { + platform = platformSpec.OS + "/" + platformSpec.Arch + if platformSpec.Variant != "" { + platform += "/" + platformSpec.Variant + } + params.Add("platform", platform) + } + } params.Set("pullpolicy", options.PullPolicy.String()) diff --git a/pkg/bindings/images/types_diff_options.go b/pkg/bindings/images/types_diff_options.go index 5492323f6..658358e95 100644 --- a/pkg/bindings/images/types_diff_options.go +++ b/pkg/bindings/images/types_diff_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,48 +7,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *DiffOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *DiffOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithParent +// WithParent set field Parent to given value func (o *DiffOptions) WithParent(value string) *DiffOptions { - v := &value - o.Parent = v + o.Parent = &value return o } -// GetParent +// GetParent returns value of field Parent func (o *DiffOptions) GetParent() string { - var parent string if o.Parent == nil { - return parent + var z string + return z } return *o.Parent } -// WithDiffType +// WithDiffType set field DiffType to given value func (o *DiffOptions) WithDiffType(value string) *DiffOptions { - v := &value - o.DiffType = v + o.DiffType = &value return o } -// GetDiffType +// GetDiffType returns value of field DiffType func (o *DiffOptions) GetDiffType() string { - var diffType string if o.DiffType == nil { - return diffType + var z string + return z } return *o.DiffType } diff --git a/pkg/bindings/images/types_exists_options.go b/pkg/bindings/images/types_exists_options.go index 2326c398b..3158a1a54 100644 --- a/pkg/bindings/images/types_exists_options.go +++ b/pkg/bindings/images/types_exists_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ExistsOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ExistsOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/images/types_export_options.go b/pkg/bindings/images/types_export_options.go index 0c5a3390c..6229e435c 100644 --- a/pkg/bindings/images/types_export_options.go +++ b/pkg/bindings/images/types_export_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,48 +7,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ExportOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ExportOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithCompress +// WithCompress set field Compress to given value func (o *ExportOptions) WithCompress(value bool) *ExportOptions { - v := &value - o.Compress = v + o.Compress = &value return o } -// GetCompress +// GetCompress returns value of field Compress func (o *ExportOptions) GetCompress() bool { - var compress bool if o.Compress == nil { - return compress + var z bool + return z } return *o.Compress } -// WithFormat +// WithFormat set field Format to given value func (o *ExportOptions) WithFormat(value string) *ExportOptions { - v := &value - o.Format = v + o.Format = &value return o } -// GetFormat +// GetFormat returns value of field Format func (o *ExportOptions) GetFormat() string { - var format string if o.Format == nil { - return format + var z string + return z } return *o.Format } diff --git a/pkg/bindings/images/types_get_options.go b/pkg/bindings/images/types_get_options.go index 33da7b0be..9c10b9f54 100644 --- a/pkg/bindings/images/types_get_options.go +++ b/pkg/bindings/images/types_get_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *GetOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *GetOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithSize +// WithSize set field Size to given value func (o *GetOptions) WithSize(value bool) *GetOptions { - v := &value - o.Size = v + o.Size = &value return o } -// GetSize +// GetSize returns value of field Size func (o *GetOptions) GetSize() bool { - var size bool if o.Size == nil { - return size + var z bool + return z } return *o.Size } diff --git a/pkg/bindings/images/types_history_options.go b/pkg/bindings/images/types_history_options.go index 191375390..0175b49e6 100644 --- a/pkg/bindings/images/types_history_options.go +++ b/pkg/bindings/images/types_history_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *HistoryOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *HistoryOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/images/types_import_options.go b/pkg/bindings/images/types_import_options.go index 333e841e6..aed567934 100644 --- a/pkg/bindings/images/types_import_options.go +++ b/pkg/bindings/images/types_import_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,80 +7,72 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ImportOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ImportOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithChanges +// WithChanges set field Changes to given value func (o *ImportOptions) WithChanges(value []string) *ImportOptions { - v := &value - o.Changes = v + o.Changes = &value return o } -// GetChanges +// GetChanges returns value of field Changes func (o *ImportOptions) GetChanges() []string { - var changes []string if o.Changes == nil { - return changes + var z []string + return z } return *o.Changes } -// WithMessage +// WithMessage set field Message to given value func (o *ImportOptions) WithMessage(value string) *ImportOptions { - v := &value - o.Message = v + o.Message = &value return o } -// GetMessage +// GetMessage returns value of field Message func (o *ImportOptions) GetMessage() string { - var message string if o.Message == nil { - return message + var z string + return z } return *o.Message } -// WithReference +// WithReference set field Reference to given value func (o *ImportOptions) WithReference(value string) *ImportOptions { - v := &value - o.Reference = v + o.Reference = &value return o } -// GetReference +// GetReference returns value of field Reference func (o *ImportOptions) GetReference() string { - var reference string if o.Reference == nil { - return reference + var z string + return z } return *o.Reference } -// WithURL +// WithURL set field URL to given value func (o *ImportOptions) WithURL(value string) *ImportOptions { - v := &value - o.URL = v + o.URL = &value return o } -// GetURL +// GetURL returns value of field URL func (o *ImportOptions) GetURL() string { - var uRL string if o.URL == nil { - return uRL + var z string + return z } return *o.URL } diff --git a/pkg/bindings/images/types_list_options.go b/pkg/bindings/images/types_list_options.go index e86157f59..d810e0588 100644 --- a/pkg/bindings/images/types_list_options.go +++ b/pkg/bindings/images/types_list_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,48 +7,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ListOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ListOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAll +// WithAll set field All to given value func (o *ListOptions) WithAll(value bool) *ListOptions { - v := &value - o.All = v + o.All = &value return o } -// GetAll +// GetAll returns value of field All func (o *ListOptions) GetAll() bool { - var all bool if o.All == nil { - return all + var z bool + return z } return *o.All } -// WithFilters +// WithFilters set field Filters to given value func (o *ListOptions) WithFilters(value map[string][]string) *ListOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *ListOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } diff --git a/pkg/bindings/images/types_load_options.go b/pkg/bindings/images/types_load_options.go index 7b2e504d9..b139a96f4 100644 --- a/pkg/bindings/images/types_load_options.go +++ b/pkg/bindings/images/types_load_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *LoadOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *LoadOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithReference +// WithReference set field Reference to given value func (o *LoadOptions) WithReference(value string) *LoadOptions { - v := &value - o.Reference = v + o.Reference = &value return o } -// GetReference +// GetReference returns value of field Reference func (o *LoadOptions) GetReference() string { - var reference string if o.Reference == nil { - return reference + var z string + return z } return *o.Reference } diff --git a/pkg/bindings/images/types_prune_options.go b/pkg/bindings/images/types_prune_options.go index 6bd0c0f6f..77bef32e3 100644 --- a/pkg/bindings/images/types_prune_options.go +++ b/pkg/bindings/images/types_prune_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,48 +7,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *PruneOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *PruneOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAll +// WithAll set field All to given value func (o *PruneOptions) WithAll(value bool) *PruneOptions { - v := &value - o.All = v + o.All = &value return o } -// GetAll +// GetAll returns value of field All func (o *PruneOptions) GetAll() bool { - var all bool if o.All == nil { - return all + var z bool + return z } return *o.All } -// WithFilters +// WithFilters set field Filters to given value func (o *PruneOptions) WithFilters(value map[string][]string) *PruneOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *PruneOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } diff --git a/pkg/bindings/images/types_pull_options.go b/pkg/bindings/images/types_pull_options.go index 8fcf499eb..630235aec 100644 --- a/pkg/bindings/images/types_pull_options.go +++ b/pkg/bindings/images/types_pull_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,176 +7,162 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *PullOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *PullOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAllTags +// WithAllTags set field AllTags to given value func (o *PullOptions) WithAllTags(value bool) *PullOptions { - v := &value - o.AllTags = v + o.AllTags = &value return o } -// GetAllTags +// GetAllTags returns value of field AllTags func (o *PullOptions) GetAllTags() bool { - var allTags bool if o.AllTags == nil { - return allTags + var z bool + return z } return *o.AllTags } -// WithArch +// WithArch set field Arch to given value func (o *PullOptions) WithArch(value string) *PullOptions { - v := &value - o.Arch = v + o.Arch = &value return o } -// GetArch +// GetArch returns value of field Arch func (o *PullOptions) GetArch() string { - var arch string if o.Arch == nil { - return arch + var z string + return z } return *o.Arch } -// WithAuthfile +// WithAuthfile set field Authfile to given value func (o *PullOptions) WithAuthfile(value string) *PullOptions { - v := &value - o.Authfile = v + o.Authfile = &value return o } -// GetAuthfile +// GetAuthfile returns value of field Authfile func (o *PullOptions) GetAuthfile() string { - var authfile string if o.Authfile == nil { - return authfile + var z string + return z } return *o.Authfile } -// WithOS +// WithOS set field OS to given value func (o *PullOptions) WithOS(value string) *PullOptions { - v := &value - o.OS = v + o.OS = &value return o } -// GetOS +// GetOS returns value of field OS func (o *PullOptions) GetOS() string { - var oS string if o.OS == nil { - return oS + var z string + return z } return *o.OS } -// WithPolicy +// WithPolicy set field Policy to given value func (o *PullOptions) WithPolicy(value string) *PullOptions { - v := &value - o.Policy = v + o.Policy = &value return o } -// GetPolicy +// GetPolicy returns value of field Policy func (o *PullOptions) GetPolicy() string { - var policy string if o.Policy == nil { - return policy + var z string + return z } return *o.Policy } -// WithPassword +// WithPassword set field Password to given value func (o *PullOptions) WithPassword(value string) *PullOptions { - v := &value - o.Password = v + o.Password = &value return o } -// GetPassword +// GetPassword returns value of field Password func (o *PullOptions) GetPassword() string { - var password string if o.Password == nil { - return password + var z string + return z } return *o.Password } -// WithQuiet +// WithQuiet set field Quiet to given value func (o *PullOptions) WithQuiet(value bool) *PullOptions { - v := &value - o.Quiet = v + o.Quiet = &value return o } -// GetQuiet +// GetQuiet returns value of field Quiet func (o *PullOptions) GetQuiet() bool { - var quiet bool if o.Quiet == nil { - return quiet + var z bool + return z } return *o.Quiet } -// WithSkipTLSVerify +// WithSkipTLSVerify set field SkipTLSVerify to given value func (o *PullOptions) WithSkipTLSVerify(value bool) *PullOptions { - v := &value - o.SkipTLSVerify = v + o.SkipTLSVerify = &value return o } -// GetSkipTLSVerify +// GetSkipTLSVerify returns value of field SkipTLSVerify func (o *PullOptions) GetSkipTLSVerify() bool { - var skipTLSVerify bool if o.SkipTLSVerify == nil { - return skipTLSVerify + var z bool + return z } return *o.SkipTLSVerify } -// WithUsername +// WithUsername set field Username to given value func (o *PullOptions) WithUsername(value string) *PullOptions { - v := &value - o.Username = v + o.Username = &value return o } -// GetUsername +// GetUsername returns value of field Username func (o *PullOptions) GetUsername() string { - var username string if o.Username == nil { - return username + var z string + return z } return *o.Username } -// WithVariant +// WithVariant set field Variant to given value func (o *PullOptions) WithVariant(value string) *PullOptions { - v := &value - o.Variant = v + o.Variant = &value return o } -// GetVariant +// GetVariant returns value of field Variant func (o *PullOptions) GetVariant() string { - var variant string if o.Variant == nil { - return variant + var z string + return z } return *o.Variant } diff --git a/pkg/bindings/images/types_push_options.go b/pkg/bindings/images/types_push_options.go index 2593c2fe0..183db47aa 100644 --- a/pkg/bindings/images/types_push_options.go +++ b/pkg/bindings/images/types_push_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,128 +7,117 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *PushOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *PushOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAll +// WithAll set field All to given value func (o *PushOptions) WithAll(value bool) *PushOptions { - v := &value - o.All = v + o.All = &value return o } -// GetAll +// GetAll returns value of field All func (o *PushOptions) GetAll() bool { - var all bool if o.All == nil { - return all + var z bool + return z } return *o.All } -// WithAuthfile +// WithAuthfile set field Authfile to given value func (o *PushOptions) WithAuthfile(value string) *PushOptions { - v := &value - o.Authfile = v + o.Authfile = &value return o } -// GetAuthfile +// GetAuthfile returns value of field Authfile func (o *PushOptions) GetAuthfile() string { - var authfile string if o.Authfile == nil { - return authfile + var z string + return z } return *o.Authfile } -// WithCompress +// WithCompress set field Compress to given value func (o *PushOptions) WithCompress(value bool) *PushOptions { - v := &value - o.Compress = v + o.Compress = &value return o } -// GetCompress +// GetCompress returns value of field Compress func (o *PushOptions) GetCompress() bool { - var compress bool if o.Compress == nil { - return compress + var z bool + return z } return *o.Compress } -// WithFormat +// WithFormat set field Format to given value func (o *PushOptions) WithFormat(value string) *PushOptions { - v := &value - o.Format = v + o.Format = &value return o } -// GetFormat +// GetFormat returns value of field Format func (o *PushOptions) GetFormat() string { - var format string if o.Format == nil { - return format + var z string + return z } return *o.Format } -// WithPassword +// WithPassword set field Password to given value func (o *PushOptions) WithPassword(value string) *PushOptions { - v := &value - o.Password = v + o.Password = &value return o } -// GetPassword +// GetPassword returns value of field Password func (o *PushOptions) GetPassword() string { - var password string if o.Password == nil { - return password + var z string + return z } return *o.Password } -// WithSkipTLSVerify +// WithSkipTLSVerify set field SkipTLSVerify to given value func (o *PushOptions) WithSkipTLSVerify(value bool) *PushOptions { - v := &value - o.SkipTLSVerify = v + o.SkipTLSVerify = &value return o } -// GetSkipTLSVerify +// GetSkipTLSVerify returns value of field SkipTLSVerify func (o *PushOptions) GetSkipTLSVerify() bool { - var skipTLSVerify bool if o.SkipTLSVerify == nil { - return skipTLSVerify + var z bool + return z } return *o.SkipTLSVerify } -// WithUsername +// WithUsername set field Username to given value func (o *PushOptions) WithUsername(value string) *PushOptions { - v := &value - o.Username = v + o.Username = &value return o } -// GetUsername +// GetUsername returns value of field Username func (o *PushOptions) GetUsername() string { - var username string if o.Username == nil { - return username + var z string + return z } return *o.Username } diff --git a/pkg/bindings/images/types_remove_options.go b/pkg/bindings/images/types_remove_options.go index d591aae88..30321db25 100644 --- a/pkg/bindings/images/types_remove_options.go +++ b/pkg/bindings/images/types_remove_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,48 +7,42 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *RemoveOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *RemoveOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAll +// WithAll set field All to given value func (o *RemoveOptions) WithAll(value bool) *RemoveOptions { - v := &value - o.All = v + o.All = &value return o } -// GetAll +// GetAll returns value of field All func (o *RemoveOptions) GetAll() bool { - var all bool if o.All == nil { - return all + var z bool + return z } return *o.All } -// WithForce +// WithForce set field Force to given value func (o *RemoveOptions) WithForce(value bool) *RemoveOptions { - v := &value - o.Force = v + o.Force = &value return o } -// GetForce +// GetForce returns value of field Force func (o *RemoveOptions) GetForce() bool { - var force bool if o.Force == nil { - return force + var z bool + return z } return *o.Force } diff --git a/pkg/bindings/images/types_search_options.go b/pkg/bindings/images/types_search_options.go index a437a0934..e38ef9fb1 100644 --- a/pkg/bindings/images/types_search_options.go +++ b/pkg/bindings/images/types_search_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,112 +7,102 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *SearchOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *SearchOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAuthfile +// WithAuthfile set field Authfile to given value func (o *SearchOptions) WithAuthfile(value string) *SearchOptions { - v := &value - o.Authfile = v + o.Authfile = &value return o } -// GetAuthfile +// GetAuthfile returns value of field Authfile func (o *SearchOptions) GetAuthfile() string { - var authfile string if o.Authfile == nil { - return authfile + var z string + return z } return *o.Authfile } -// WithFilters +// WithFilters set field Filters to given value func (o *SearchOptions) WithFilters(value map[string][]string) *SearchOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *SearchOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } -// WithLimit +// WithLimit set field Limit to given value func (o *SearchOptions) WithLimit(value int) *SearchOptions { - v := &value - o.Limit = v + o.Limit = &value return o } -// GetLimit +// GetLimit returns value of field Limit func (o *SearchOptions) GetLimit() int { - var limit int if o.Limit == nil { - return limit + var z int + return z } return *o.Limit } -// WithNoTrunc +// WithNoTrunc set field NoTrunc to given value func (o *SearchOptions) WithNoTrunc(value bool) *SearchOptions { - v := &value - o.NoTrunc = v + o.NoTrunc = &value return o } -// GetNoTrunc +// GetNoTrunc returns value of field NoTrunc func (o *SearchOptions) GetNoTrunc() bool { - var noTrunc bool if o.NoTrunc == nil { - return noTrunc + var z bool + return z } return *o.NoTrunc } -// WithSkipTLSVerify +// WithSkipTLSVerify set field SkipTLSVerify to given value func (o *SearchOptions) WithSkipTLSVerify(value bool) *SearchOptions { - v := &value - o.SkipTLSVerify = v + o.SkipTLSVerify = &value return o } -// GetSkipTLSVerify +// GetSkipTLSVerify returns value of field SkipTLSVerify func (o *SearchOptions) GetSkipTLSVerify() bool { - var skipTLSVerify bool if o.SkipTLSVerify == nil { - return skipTLSVerify + var z bool + return z } return *o.SkipTLSVerify } -// WithListTags +// WithListTags set field ListTags to given value func (o *SearchOptions) WithListTags(value bool) *SearchOptions { - v := &value - o.ListTags = v + o.ListTags = &value return o } -// GetListTags +// GetListTags returns value of field ListTags func (o *SearchOptions) GetListTags() bool { - var listTags bool if o.ListTags == nil { - return listTags + var z bool + return z } return *o.ListTags } diff --git a/pkg/bindings/images/types_tag_options.go b/pkg/bindings/images/types_tag_options.go index 25cb8f68b..0d5772417 100644 --- a/pkg/bindings/images/types_tag_options.go +++ b/pkg/bindings/images/types_tag_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *TagOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *TagOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/images/types_tree_options.go b/pkg/bindings/images/types_tree_options.go index 43178113d..d70a81b06 100644 --- a/pkg/bindings/images/types_tree_options.go +++ b/pkg/bindings/images/types_tree_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *TreeOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *TreeOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithWhatRequires +// WithWhatRequires set field WhatRequires to given value func (o *TreeOptions) WithWhatRequires(value bool) *TreeOptions { - v := &value - o.WhatRequires = v + o.WhatRequires = &value return o } -// GetWhatRequires +// GetWhatRequires returns value of field WhatRequires func (o *TreeOptions) GetWhatRequires() bool { - var whatRequires bool if o.WhatRequires == nil { - return whatRequires + var z bool + return z } return *o.WhatRequires } diff --git a/pkg/bindings/images/types_untag_options.go b/pkg/bindings/images/types_untag_options.go index 520cf7a49..5d6cda000 100644 --- a/pkg/bindings/images/types_untag_options.go +++ b/pkg/bindings/images/types_untag_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package images import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *UntagOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *UntagOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/manifests/types_add_options.go b/pkg/bindings/manifests/types_add_options.go index 09105c590..c2e7b5e89 100644 --- a/pkg/bindings/manifests/types_add_options.go +++ b/pkg/bindings/manifests/types_add_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package manifests import ( @@ -6,144 +7,132 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *AddOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *AddOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAll +// WithAll set field All to given value func (o *AddOptions) WithAll(value bool) *AddOptions { - v := &value - o.All = v + o.All = &value return o } -// GetAll +// GetAll returns value of field All func (o *AddOptions) GetAll() bool { - var all bool if o.All == nil { - return all + var z bool + return z } return *o.All } -// WithAnnotation +// WithAnnotation set field Annotation to given value func (o *AddOptions) WithAnnotation(value map[string]string) *AddOptions { - v := value - o.Annotation = v + o.Annotation = value return o } -// GetAnnotation +// GetAnnotation returns value of field Annotation func (o *AddOptions) GetAnnotation() map[string]string { - var annotation map[string]string if o.Annotation == nil { - return annotation + var z map[string]string + return z } return o.Annotation } -// WithArch +// WithArch set field Arch to given value func (o *AddOptions) WithArch(value string) *AddOptions { - v := &value - o.Arch = v + o.Arch = &value return o } -// GetArch +// GetArch returns value of field Arch func (o *AddOptions) GetArch() string { - var arch string if o.Arch == nil { - return arch + var z string + return z } return *o.Arch } -// WithFeatures +// WithFeatures set field Features to given value func (o *AddOptions) WithFeatures(value []string) *AddOptions { - v := value - o.Features = v + o.Features = value return o } -// GetFeatures +// GetFeatures returns value of field Features func (o *AddOptions) GetFeatures() []string { - var features []string if o.Features == nil { - return features + var z []string + return z } return o.Features } -// WithImages +// WithImages set field Images to given value func (o *AddOptions) WithImages(value []string) *AddOptions { - v := value - o.Images = v + o.Images = value return o } -// GetImages +// GetImages returns value of field Images func (o *AddOptions) GetImages() []string { - var images []string if o.Images == nil { - return images + var z []string + return z } return o.Images } -// WithOS +// WithOS set field OS to given value func (o *AddOptions) WithOS(value string) *AddOptions { - v := &value - o.OS = v + o.OS = &value return o } -// GetOS +// GetOS returns value of field OS func (o *AddOptions) GetOS() string { - var oS string if o.OS == nil { - return oS + var z string + return z } return *o.OS } -// WithOSVersion +// WithOSVersion set field OSVersion to given value func (o *AddOptions) WithOSVersion(value string) *AddOptions { - v := &value - o.OSVersion = v + o.OSVersion = &value return o } -// GetOSVersion +// GetOSVersion returns value of field OSVersion func (o *AddOptions) GetOSVersion() string { - var oSVersion string if o.OSVersion == nil { - return oSVersion + var z string + return z } return *o.OSVersion } -// WithVariant +// WithVariant set field Variant to given value func (o *AddOptions) WithVariant(value string) *AddOptions { - v := &value - o.Variant = v + o.Variant = &value return o } -// GetVariant +// GetVariant returns value of field Variant func (o *AddOptions) GetVariant() string { - var variant string if o.Variant == nil { - return variant + var z string + return z } return *o.Variant } diff --git a/pkg/bindings/manifests/types_create_options.go b/pkg/bindings/manifests/types_create_options.go index 5f022c672..a04b7f4dd 100644 --- a/pkg/bindings/manifests/types_create_options.go +++ b/pkg/bindings/manifests/types_create_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package manifests import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *CreateOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *CreateOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAll +// WithAll set field All to given value func (o *CreateOptions) WithAll(value bool) *CreateOptions { - v := &value - o.All = v + o.All = &value return o } -// GetAll +// GetAll returns value of field All func (o *CreateOptions) GetAll() bool { - var all bool if o.All == nil { - return all + var z bool + return z } return *o.All } diff --git a/pkg/bindings/manifests/types_exists_options.go b/pkg/bindings/manifests/types_exists_options.go index 6f33c2cd5..0531b92c1 100644 --- a/pkg/bindings/manifests/types_exists_options.go +++ b/pkg/bindings/manifests/types_exists_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package manifests import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ExistsOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ExistsOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/manifests/types_inspect_options.go b/pkg/bindings/manifests/types_inspect_options.go index 7dfa11cb4..686d7171d 100644 --- a/pkg/bindings/manifests/types_inspect_options.go +++ b/pkg/bindings/manifests/types_inspect_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package manifests import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *InspectOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *InspectOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/manifests/types_remove_options.go b/pkg/bindings/manifests/types_remove_options.go index 7a507cf1a..90edd2b82 100644 --- a/pkg/bindings/manifests/types_remove_options.go +++ b/pkg/bindings/manifests/types_remove_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package manifests import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *RemoveOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *RemoveOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/network/types_connect_options.go b/pkg/bindings/network/types_connect_options.go index c0e7a6f50..b7a465999 100644 --- a/pkg/bindings/network/types_connect_options.go +++ b/pkg/bindings/network/types_connect_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package network import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ConnectOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ConnectOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAliases +// WithAliases set field Aliases to given value func (o *ConnectOptions) WithAliases(value []string) *ConnectOptions { - v := &value - o.Aliases = v + o.Aliases = &value return o } -// GetAliases +// GetAliases returns value of field Aliases func (o *ConnectOptions) GetAliases() []string { - var aliases []string if o.Aliases == nil { - return aliases + var z []string + return z } return *o.Aliases } diff --git a/pkg/bindings/network/types_create_options.go b/pkg/bindings/network/types_create_options.go index 5746a5b1f..1b1afebc1 100644 --- a/pkg/bindings/network/types_create_options.go +++ b/pkg/bindings/network/types_create_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package network import ( @@ -7,192 +8,177 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *CreateOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *CreateOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithDisableDNS +// WithDisableDNS set field DisableDNS to given value func (o *CreateOptions) WithDisableDNS(value bool) *CreateOptions { - v := &value - o.DisableDNS = v + o.DisableDNS = &value return o } -// GetDisableDNS +// GetDisableDNS returns value of field DisableDNS func (o *CreateOptions) GetDisableDNS() bool { - var disableDNS bool if o.DisableDNS == nil { - return disableDNS + var z bool + return z } return *o.DisableDNS } -// WithDriver +// WithDriver set field Driver to given value func (o *CreateOptions) WithDriver(value string) *CreateOptions { - v := &value - o.Driver = v + o.Driver = &value return o } -// GetDriver +// GetDriver returns value of field Driver func (o *CreateOptions) GetDriver() string { - var driver string if o.Driver == nil { - return driver + var z string + return z } return *o.Driver } -// WithGateway +// WithGateway set field Gateway to given value func (o *CreateOptions) WithGateway(value net.IP) *CreateOptions { - v := &value - o.Gateway = v + o.Gateway = &value return o } -// GetGateway +// GetGateway returns value of field Gateway func (o *CreateOptions) GetGateway() net.IP { - var gateway net.IP if o.Gateway == nil { - return gateway + var z net.IP + return z } return *o.Gateway } -// WithInternal +// WithInternal set field Internal to given value func (o *CreateOptions) WithInternal(value bool) *CreateOptions { - v := &value - o.Internal = v + o.Internal = &value return o } -// GetInternal +// GetInternal returns value of field Internal func (o *CreateOptions) GetInternal() bool { - var internal bool if o.Internal == nil { - return internal + var z bool + return z } return *o.Internal } -// WithLabels +// WithLabels set field Labels to given value func (o *CreateOptions) WithLabels(value map[string]string) *CreateOptions { - v := value - o.Labels = v + o.Labels = value return o } -// GetLabels +// GetLabels returns value of field Labels func (o *CreateOptions) GetLabels() map[string]string { - var labels map[string]string if o.Labels == nil { - return labels + var z map[string]string + return z } return o.Labels } -// WithMacVLAN +// WithMacVLAN set field MacVLAN to given value func (o *CreateOptions) WithMacVLAN(value string) *CreateOptions { - v := &value - o.MacVLAN = v + o.MacVLAN = &value return o } -// GetMacVLAN +// GetMacVLAN returns value of field MacVLAN func (o *CreateOptions) GetMacVLAN() string { - var macVLAN string if o.MacVLAN == nil { - return macVLAN + var z string + return z } return *o.MacVLAN } -// WithIPRange +// WithIPRange set field IPRange to given value func (o *CreateOptions) WithIPRange(value net.IPNet) *CreateOptions { - v := &value - o.IPRange = v + o.IPRange = &value return o } -// GetIPRange +// GetIPRange returns value of field IPRange func (o *CreateOptions) GetIPRange() net.IPNet { - var iPRange net.IPNet if o.IPRange == nil { - return iPRange + var z net.IPNet + return z } return *o.IPRange } -// WithSubnet +// WithSubnet set field Subnet to given value func (o *CreateOptions) WithSubnet(value net.IPNet) *CreateOptions { - v := &value - o.Subnet = v + o.Subnet = &value return o } -// GetSubnet +// GetSubnet returns value of field Subnet func (o *CreateOptions) GetSubnet() net.IPNet { - var subnet net.IPNet if o.Subnet == nil { - return subnet + var z net.IPNet + return z } return *o.Subnet } -// WithIPv6 +// WithIPv6 set field IPv6 to given value func (o *CreateOptions) WithIPv6(value bool) *CreateOptions { - v := &value - o.IPv6 = v + o.IPv6 = &value return o } -// GetIPv6 +// GetIPv6 returns value of field IPv6 func (o *CreateOptions) GetIPv6() bool { - var iPv6 bool if o.IPv6 == nil { - return iPv6 + var z bool + return z } return *o.IPv6 } -// WithOptions +// WithOptions set field Options to given value func (o *CreateOptions) WithOptions(value map[string]string) *CreateOptions { - v := value - o.Options = v + o.Options = value return o } -// GetOptions +// GetOptions returns value of field Options func (o *CreateOptions) GetOptions() map[string]string { - var options map[string]string if o.Options == nil { - return options + var z map[string]string + return z } return o.Options } -// WithName +// WithName set field Name to given value func (o *CreateOptions) WithName(value string) *CreateOptions { - v := &value - o.Name = v + o.Name = &value return o } -// GetName +// GetName returns value of field Name func (o *CreateOptions) GetName() string { - var name string if o.Name == nil { - return name + var z string + return z } return *o.Name } diff --git a/pkg/bindings/network/types_disconnect_options.go b/pkg/bindings/network/types_disconnect_options.go index a73675d4f..c95204447 100644 --- a/pkg/bindings/network/types_disconnect_options.go +++ b/pkg/bindings/network/types_disconnect_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package network import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *DisconnectOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *DisconnectOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithForce +// WithForce set field Force to given value func (o *DisconnectOptions) WithForce(value bool) *DisconnectOptions { - v := &value - o.Force = v + o.Force = &value return o } -// GetForce +// GetForce returns value of field Force func (o *DisconnectOptions) GetForce() bool { - var force bool if o.Force == nil { - return force + var z bool + return z } return *o.Force } diff --git a/pkg/bindings/network/types_exists_options.go b/pkg/bindings/network/types_exists_options.go index 4f33cdfbb..10430f9f5 100644 --- a/pkg/bindings/network/types_exists_options.go +++ b/pkg/bindings/network/types_exists_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package network import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ExistsOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ExistsOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/network/types_inspect_options.go b/pkg/bindings/network/types_inspect_options.go index 9f7497ed5..47426a605 100644 --- a/pkg/bindings/network/types_inspect_options.go +++ b/pkg/bindings/network/types_inspect_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package network import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *InspectOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *InspectOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/network/types_list_options.go b/pkg/bindings/network/types_list_options.go index fcbe23bd6..60281f2ba 100644 --- a/pkg/bindings/network/types_list_options.go +++ b/pkg/bindings/network/types_list_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package network import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ListOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ListOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithFilters +// WithFilters set field Filters to given value func (o *ListOptions) WithFilters(value map[string][]string) *ListOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *ListOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } diff --git a/pkg/bindings/network/types_prune_options.go b/pkg/bindings/network/types_prune_options.go index f17e09d69..06e4eb19c 100644 --- a/pkg/bindings/network/types_prune_options.go +++ b/pkg/bindings/network/types_prune_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package network import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *PruneOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *PruneOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithFilters +// WithFilters set field Filters to given value func (o *PruneOptions) WithFilters(value map[string][]string) *PruneOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *PruneOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } diff --git a/pkg/bindings/network/types_remove_options.go b/pkg/bindings/network/types_remove_options.go index f715c94c9..57fc4fa3a 100644 --- a/pkg/bindings/network/types_remove_options.go +++ b/pkg/bindings/network/types_remove_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package network import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *RemoveOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *RemoveOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithForce +// WithForce set field Force to given value func (o *RemoveOptions) WithForce(value bool) *RemoveOptions { - v := &value - o.Force = v + o.Force = &value return o } -// GetForce +// GetForce returns value of field Force func (o *RemoveOptions) GetForce() bool { - var force bool if o.Force == nil { - return force + var z bool + return z } return *o.Force } diff --git a/pkg/bindings/play/types_kube_options.go b/pkg/bindings/play/types_kube_options.go index 4cc7d6f21..65757cc5e 100644 --- a/pkg/bindings/play/types_kube_options.go +++ b/pkg/bindings/play/types_kube_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package play import ( @@ -7,240 +8,222 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *KubeOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *KubeOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAuthfile +// WithAuthfile set field Authfile to given value func (o *KubeOptions) WithAuthfile(value string) *KubeOptions { - v := &value - o.Authfile = v + o.Authfile = &value return o } -// GetAuthfile +// GetAuthfile returns value of field Authfile func (o *KubeOptions) GetAuthfile() string { - var authfile string if o.Authfile == nil { - return authfile + var z string + return z } return *o.Authfile } -// WithCertDir +// WithCertDir set field CertDir to given value func (o *KubeOptions) WithCertDir(value string) *KubeOptions { - v := &value - o.CertDir = v + o.CertDir = &value return o } -// GetCertDir +// GetCertDir returns value of field CertDir func (o *KubeOptions) GetCertDir() string { - var certDir string if o.CertDir == nil { - return certDir + var z string + return z } return *o.CertDir } -// WithUsername +// WithUsername set field Username to given value func (o *KubeOptions) WithUsername(value string) *KubeOptions { - v := &value - o.Username = v + o.Username = &value return o } -// GetUsername +// GetUsername returns value of field Username func (o *KubeOptions) GetUsername() string { - var username string if o.Username == nil { - return username + var z string + return z } return *o.Username } -// WithPassword +// WithPassword set field Password to given value func (o *KubeOptions) WithPassword(value string) *KubeOptions { - v := &value - o.Password = v + o.Password = &value return o } -// GetPassword +// GetPassword returns value of field Password func (o *KubeOptions) GetPassword() string { - var password string if o.Password == nil { - return password + var z string + return z } return *o.Password } -// WithNetwork +// WithNetwork set field Network to given value func (o *KubeOptions) WithNetwork(value string) *KubeOptions { - v := &value - o.Network = v + o.Network = &value return o } -// GetNetwork +// GetNetwork returns value of field Network func (o *KubeOptions) GetNetwork() string { - var network string if o.Network == nil { - return network + var z string + return z } return *o.Network } -// WithQuiet +// WithQuiet set field Quiet to given value func (o *KubeOptions) WithQuiet(value bool) *KubeOptions { - v := &value - o.Quiet = v + o.Quiet = &value return o } -// GetQuiet +// GetQuiet returns value of field Quiet func (o *KubeOptions) GetQuiet() bool { - var quiet bool if o.Quiet == nil { - return quiet + var z bool + return z } return *o.Quiet } -// WithSignaturePolicy +// WithSignaturePolicy set field SignaturePolicy to given value func (o *KubeOptions) WithSignaturePolicy(value string) *KubeOptions { - v := &value - o.SignaturePolicy = v + o.SignaturePolicy = &value return o } -// GetSignaturePolicy +// GetSignaturePolicy returns value of field SignaturePolicy func (o *KubeOptions) GetSignaturePolicy() string { - var signaturePolicy string if o.SignaturePolicy == nil { - return signaturePolicy + var z string + return z } return *o.SignaturePolicy } -// WithSkipTLSVerify +// WithSkipTLSVerify set field SkipTLSVerify to given value func (o *KubeOptions) WithSkipTLSVerify(value bool) *KubeOptions { - v := &value - o.SkipTLSVerify = v + o.SkipTLSVerify = &value return o } -// GetSkipTLSVerify +// GetSkipTLSVerify returns value of field SkipTLSVerify func (o *KubeOptions) GetSkipTLSVerify() bool { - var skipTLSVerify bool if o.SkipTLSVerify == nil { - return skipTLSVerify + var z bool + return z } return *o.SkipTLSVerify } -// WithSeccompProfileRoot +// WithSeccompProfileRoot set field SeccompProfileRoot to given value func (o *KubeOptions) WithSeccompProfileRoot(value string) *KubeOptions { - v := &value - o.SeccompProfileRoot = v + o.SeccompProfileRoot = &value return o } -// GetSeccompProfileRoot +// GetSeccompProfileRoot returns value of field SeccompProfileRoot func (o *KubeOptions) GetSeccompProfileRoot() string { - var seccompProfileRoot string if o.SeccompProfileRoot == nil { - return seccompProfileRoot + var z string + return z } return *o.SeccompProfileRoot } -// WithStaticIPs +// WithStaticIPs set field StaticIPs to given value func (o *KubeOptions) WithStaticIPs(value []net.IP) *KubeOptions { - v := &value - o.StaticIPs = v + o.StaticIPs = &value return o } -// GetStaticIPs +// GetStaticIPs returns value of field StaticIPs func (o *KubeOptions) GetStaticIPs() []net.IP { - var staticIPs []net.IP if o.StaticIPs == nil { - return staticIPs + var z []net.IP + return z } return *o.StaticIPs } -// WithStaticMACs +// WithStaticMACs set field StaticMACs to given value func (o *KubeOptions) WithStaticMACs(value []net.HardwareAddr) *KubeOptions { - v := &value - o.StaticMACs = v + o.StaticMACs = &value return o } -// GetStaticMACs +// GetStaticMACs returns value of field StaticMACs func (o *KubeOptions) GetStaticMACs() []net.HardwareAddr { - var staticMACs []net.HardwareAddr if o.StaticMACs == nil { - return staticMACs + var z []net.HardwareAddr + return z } return *o.StaticMACs } -// WithConfigMaps +// WithConfigMaps set field ConfigMaps to given value func (o *KubeOptions) WithConfigMaps(value []string) *KubeOptions { - v := &value - o.ConfigMaps = v + o.ConfigMaps = &value return o } -// GetConfigMaps +// GetConfigMaps returns value of field ConfigMaps func (o *KubeOptions) GetConfigMaps() []string { - var configMaps []string if o.ConfigMaps == nil { - return configMaps + var z []string + return z } return *o.ConfigMaps } -// WithLogDriver +// WithLogDriver set field LogDriver to given value func (o *KubeOptions) WithLogDriver(value string) *KubeOptions { - v := &value - o.LogDriver = v + o.LogDriver = &value return o } -// GetLogDriver +// GetLogDriver returns value of field LogDriver func (o *KubeOptions) GetLogDriver() string { - var logDriver string if o.LogDriver == nil { - return logDriver + var z string + return z } return *o.LogDriver } -// WithStart +// WithStart set field Start to given value func (o *KubeOptions) WithStart(value bool) *KubeOptions { - v := &value - o.Start = v + o.Start = &value return o } -// GetStart +// GetStart returns value of field Start func (o *KubeOptions) GetStart() bool { - var start bool if o.Start == nil { - return start + var z bool + return z } return *o.Start } diff --git a/pkg/bindings/pods/types_create_options.go b/pkg/bindings/pods/types_create_options.go index 891ef2e84..ce7649e96 100644 --- a/pkg/bindings/pods/types_create_options.go +++ b/pkg/bindings/pods/types_create_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *CreateOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *CreateOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/pods/types_exists_options.go b/pkg/bindings/pods/types_exists_options.go index 02423e7ed..096f5a3f1 100644 --- a/pkg/bindings/pods/types_exists_options.go +++ b/pkg/bindings/pods/types_exists_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ExistsOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ExistsOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/pods/types_inspect_options.go b/pkg/bindings/pods/types_inspect_options.go index 20ec3a726..7a2c25058 100644 --- a/pkg/bindings/pods/types_inspect_options.go +++ b/pkg/bindings/pods/types_inspect_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *InspectOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *InspectOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/pods/types_kill_options.go b/pkg/bindings/pods/types_kill_options.go index fabd45c67..ce521d3c0 100644 --- a/pkg/bindings/pods/types_kill_options.go +++ b/pkg/bindings/pods/types_kill_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *KillOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *KillOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithSignal +// WithSignal set field Signal to given value func (o *KillOptions) WithSignal(value string) *KillOptions { - v := &value - o.Signal = v + o.Signal = &value return o } -// GetSignal +// GetSignal returns value of field Signal func (o *KillOptions) GetSignal() string { - var signal string if o.Signal == nil { - return signal + var z string + return z } return *o.Signal } diff --git a/pkg/bindings/pods/types_list_options.go b/pkg/bindings/pods/types_list_options.go index 7221c7ff8..f786aa38c 100644 --- a/pkg/bindings/pods/types_list_options.go +++ b/pkg/bindings/pods/types_list_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ListOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ListOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithFilters +// WithFilters set field Filters to given value func (o *ListOptions) WithFilters(value map[string][]string) *ListOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *ListOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } diff --git a/pkg/bindings/pods/types_pause_options.go b/pkg/bindings/pods/types_pause_options.go index 0bbc9c293..34792602c 100644 --- a/pkg/bindings/pods/types_pause_options.go +++ b/pkg/bindings/pods/types_pause_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *PauseOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *PauseOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/pods/types_prune_options.go b/pkg/bindings/pods/types_prune_options.go index 0e788f471..ad2d1b983 100644 --- a/pkg/bindings/pods/types_prune_options.go +++ b/pkg/bindings/pods/types_prune_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *PruneOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *PruneOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/pods/types_remove_options.go b/pkg/bindings/pods/types_remove_options.go index 3d3c7ad2a..ce142ee74 100644 --- a/pkg/bindings/pods/types_remove_options.go +++ b/pkg/bindings/pods/types_remove_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *RemoveOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *RemoveOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithForce +// WithForce set field Force to given value func (o *RemoveOptions) WithForce(value bool) *RemoveOptions { - v := &value - o.Force = v + o.Force = &value return o } -// GetForce +// GetForce returns value of field Force func (o *RemoveOptions) GetForce() bool { - var force bool if o.Force == nil { - return force + var z bool + return z } return *o.Force } diff --git a/pkg/bindings/pods/types_restart_options.go b/pkg/bindings/pods/types_restart_options.go index 9278b7b46..1018ce9ea 100644 --- a/pkg/bindings/pods/types_restart_options.go +++ b/pkg/bindings/pods/types_restart_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *RestartOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *RestartOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/pods/types_start_options.go b/pkg/bindings/pods/types_start_options.go index d0cb50969..0dbe27bc1 100644 --- a/pkg/bindings/pods/types_start_options.go +++ b/pkg/bindings/pods/types_start_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *StartOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *StartOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/pods/types_stats_options.go b/pkg/bindings/pods/types_stats_options.go index 2fb3529ad..3c9592946 100644 --- a/pkg/bindings/pods/types_stats_options.go +++ b/pkg/bindings/pods/types_stats_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *StatsOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *StatsOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAll +// WithAll set field All to given value func (o *StatsOptions) WithAll(value bool) *StatsOptions { - v := &value - o.All = v + o.All = &value return o } -// GetAll +// GetAll returns value of field All func (o *StatsOptions) GetAll() bool { - var all bool if o.All == nil { - return all + var z bool + return z } return *o.All } diff --git a/pkg/bindings/pods/types_stop_options.go b/pkg/bindings/pods/types_stop_options.go index 443c9120f..a96f41d1d 100644 --- a/pkg/bindings/pods/types_stop_options.go +++ b/pkg/bindings/pods/types_stop_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *StopOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *StopOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithTimeout +// WithTimeout set field Timeout to given value func (o *StopOptions) WithTimeout(value int) *StopOptions { - v := &value - o.Timeout = v + o.Timeout = &value return o } -// GetTimeout +// GetTimeout returns value of field Timeout func (o *StopOptions) GetTimeout() int { - var timeout int if o.Timeout == nil { - return timeout + var z int + return z } return *o.Timeout } diff --git a/pkg/bindings/pods/types_top_options.go b/pkg/bindings/pods/types_top_options.go index ab6501704..2e319afb2 100644 --- a/pkg/bindings/pods/types_top_options.go +++ b/pkg/bindings/pods/types_top_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *TopOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *TopOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithDescriptors +// WithDescriptors set field Descriptors to given value func (o *TopOptions) WithDescriptors(value []string) *TopOptions { - v := value - o.Descriptors = v + o.Descriptors = value return o } -// GetDescriptors +// GetDescriptors returns value of field Descriptors func (o *TopOptions) GetDescriptors() []string { - var descriptors []string if o.Descriptors == nil { - return descriptors + var z []string + return z } return o.Descriptors } diff --git a/pkg/bindings/pods/types_unpause_options.go b/pkg/bindings/pods/types_unpause_options.go index f9ea972e6..88e9f60df 100644 --- a/pkg/bindings/pods/types_unpause_options.go +++ b/pkg/bindings/pods/types_unpause_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package pods import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *UnpauseOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *UnpauseOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/secrets/types_create_options.go b/pkg/bindings/secrets/types_create_options.go index 28d0c4e83..2c0633682 100644 --- a/pkg/bindings/secrets/types_create_options.go +++ b/pkg/bindings/secrets/types_create_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package secrets import ( @@ -6,64 +7,57 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *CreateOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *CreateOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithName +// WithName set field Name to given value func (o *CreateOptions) WithName(value string) *CreateOptions { - v := &value - o.Name = v + o.Name = &value return o } -// GetName +// GetName returns value of field Name func (o *CreateOptions) GetName() string { - var name string if o.Name == nil { - return name + var z string + return z } return *o.Name } -// WithDriver +// WithDriver set field Driver to given value func (o *CreateOptions) WithDriver(value string) *CreateOptions { - v := &value - o.Driver = v + o.Driver = &value return o } -// GetDriver +// GetDriver returns value of field Driver func (o *CreateOptions) GetDriver() string { - var driver string if o.Driver == nil { - return driver + var z string + return z } return *o.Driver } -// WithDriverOpts +// WithDriverOpts set field DriverOpts to given value func (o *CreateOptions) WithDriverOpts(value map[string]string) *CreateOptions { - v := value - o.DriverOpts = v + o.DriverOpts = value return o } -// GetDriverOpts +// GetDriverOpts returns value of field DriverOpts func (o *CreateOptions) GetDriverOpts() map[string]string { - var driverOpts map[string]string if o.DriverOpts == nil { - return driverOpts + var z map[string]string + return z } return o.DriverOpts } diff --git a/pkg/bindings/secrets/types_inspect_options.go b/pkg/bindings/secrets/types_inspect_options.go index 48c2737d0..79ea97293 100644 --- a/pkg/bindings/secrets/types_inspect_options.go +++ b/pkg/bindings/secrets/types_inspect_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package secrets import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *InspectOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *InspectOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/secrets/types_list_options.go b/pkg/bindings/secrets/types_list_options.go index e4501dde8..87b657ff9 100644 --- a/pkg/bindings/secrets/types_list_options.go +++ b/pkg/bindings/secrets/types_list_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package secrets import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ListOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ListOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithFilters +// WithFilters set field Filters to given value func (o *ListOptions) WithFilters(value map[string][]string) *ListOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *ListOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } diff --git a/pkg/bindings/secrets/types_remove_options.go b/pkg/bindings/secrets/types_remove_options.go index dd5ac530a..424a0c2e1 100644 --- a/pkg/bindings/secrets/types_remove_options.go +++ b/pkg/bindings/secrets/types_remove_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package secrets import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *RemoveOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *RemoveOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/system/types_disk_options.go b/pkg/bindings/system/types_disk_options.go index d55139b68..d057a2361 100644 --- a/pkg/bindings/system/types_disk_options.go +++ b/pkg/bindings/system/types_disk_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package system import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *DiskOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *DiskOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/system/types_events_options.go b/pkg/bindings/system/types_events_options.go index 8b4cff42c..6bb13b8a6 100644 --- a/pkg/bindings/system/types_events_options.go +++ b/pkg/bindings/system/types_events_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package system import ( @@ -6,80 +7,72 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *EventsOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *EventsOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithFilters +// WithFilters set field Filters to given value func (o *EventsOptions) WithFilters(value map[string][]string) *EventsOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *EventsOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } -// WithSince +// WithSince set field Since to given value func (o *EventsOptions) WithSince(value string) *EventsOptions { - v := &value - o.Since = v + o.Since = &value return o } -// GetSince +// GetSince returns value of field Since func (o *EventsOptions) GetSince() string { - var since string if o.Since == nil { - return since + var z string + return z } return *o.Since } -// WithStream +// WithStream set field Stream to given value func (o *EventsOptions) WithStream(value bool) *EventsOptions { - v := &value - o.Stream = v + o.Stream = &value return o } -// GetStream +// GetStream returns value of field Stream func (o *EventsOptions) GetStream() bool { - var stream bool if o.Stream == nil { - return stream + var z bool + return z } return *o.Stream } -// WithUntil +// WithUntil set field Until to given value func (o *EventsOptions) WithUntil(value string) *EventsOptions { - v := &value - o.Until = v + o.Until = &value return o } -// GetUntil +// GetUntil returns value of field Until func (o *EventsOptions) GetUntil() string { - var until string if o.Until == nil { - return until + var z string + return z } return *o.Until } diff --git a/pkg/bindings/system/types_info_options.go b/pkg/bindings/system/types_info_options.go index 2bbb95a2e..0a12d7db6 100644 --- a/pkg/bindings/system/types_info_options.go +++ b/pkg/bindings/system/types_info_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package system import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *InfoOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *InfoOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/system/types_prune_options.go b/pkg/bindings/system/types_prune_options.go index f4daa830a..4feb359ef 100644 --- a/pkg/bindings/system/types_prune_options.go +++ b/pkg/bindings/system/types_prune_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package system import ( @@ -6,64 +7,57 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *PruneOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *PruneOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithAll +// WithAll set field All to given value func (o *PruneOptions) WithAll(value bool) *PruneOptions { - v := &value - o.All = v + o.All = &value return o } -// GetAll +// GetAll returns value of field All func (o *PruneOptions) GetAll() bool { - var all bool if o.All == nil { - return all + var z bool + return z } return *o.All } -// WithFilters +// WithFilters set field Filters to given value func (o *PruneOptions) WithFilters(value map[string][]string) *PruneOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *PruneOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } -// WithVolumes +// WithVolumes set field Volumes to given value func (o *PruneOptions) WithVolumes(value bool) *PruneOptions { - v := &value - o.Volumes = v + o.Volumes = &value return o } -// GetVolumes +// GetVolumes returns value of field Volumes func (o *PruneOptions) GetVolumes() bool { - var volumes bool if o.Volumes == nil { - return volumes + var z bool + return z } return *o.Volumes } diff --git a/pkg/bindings/system/types_version_options.go b/pkg/bindings/system/types_version_options.go index 5e01da583..840777ca6 100644 --- a/pkg/bindings/system/types_version_options.go +++ b/pkg/bindings/system/types_version_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package system import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *VersionOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *VersionOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/test/generator_test.go b/pkg/bindings/test/generator_test.go new file mode 100644 index 000000000..d04cc10f9 --- /dev/null +++ b/pkg/bindings/test/generator_test.go @@ -0,0 +1,51 @@ +package test_bindings + +import ( + "github.com/containers/podman/v3/pkg/bindings/containers" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gstruct" +) + +var _ = Describe("Podman API Bindings", func() { + boxedTrue, boxedFalse := new(bool), new(bool) + *boxedTrue = true + *boxedFalse = false + + It("verify simple setters", func() { + boxedString := new(string) + *boxedString = "Test" + + actual := new(containers.AttachOptions). + WithDetachKeys("Test").WithLogs(true).WithStream(false) + + Expect(*actual).To(MatchAllFields(Fields{ + "DetachKeys": Equal(boxedString), + "Logs": Equal(boxedTrue), + "Stream": Equal(boxedFalse), + })) + + Expect(actual.GetDetachKeys()).To(Equal("Test")) + Expect(actual.GetLogs()).To(Equal(true)) + Expect(actual.GetStream()).To(Equal(false)) + }) + + It("verify composite setters", func() { + boxedInt := new(int) + *boxedInt = 50 + + actual := new(containers.ListOptions). + WithFilters(map[string][]string{"Test": {"Test Filter"}}). + WithLast(50) + + Expect(*actual).To(MatchAllFields(Fields{ + "All": BeNil(), + "External": BeNil(), + "Filters": HaveKeyWithValue("Test", []string{"Test Filter"}), + "Last": Equal(boxedInt), + "Namespace": BeNil(), + "Size": BeNil(), + "Sync": BeNil(), + })) + }) +}) diff --git a/pkg/bindings/volumes/types_create_options.go b/pkg/bindings/volumes/types_create_options.go index 0e8274d25..416c6aa26 100644 --- a/pkg/bindings/volumes/types_create_options.go +++ b/pkg/bindings/volumes/types_create_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package volumes import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *CreateOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *CreateOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/volumes/types_exists_options.go b/pkg/bindings/volumes/types_exists_options.go index b58b93f38..5c9cc9295 100644 --- a/pkg/bindings/volumes/types_exists_options.go +++ b/pkg/bindings/volumes/types_exists_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package volumes import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ExistsOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ExistsOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/volumes/types_inspect_options.go b/pkg/bindings/volumes/types_inspect_options.go index 81bed1363..4358748c2 100644 --- a/pkg/bindings/volumes/types_inspect_options.go +++ b/pkg/bindings/volumes/types_inspect_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package volumes import ( @@ -6,16 +7,12 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *InspectOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *InspectOptions) ToParams() (url.Values, error) { return util.ToParams(o) } diff --git a/pkg/bindings/volumes/types_list_options.go b/pkg/bindings/volumes/types_list_options.go index 9b2c6a3ad..e4896649c 100644 --- a/pkg/bindings/volumes/types_list_options.go +++ b/pkg/bindings/volumes/types_list_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package volumes import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *ListOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *ListOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithFilters +// WithFilters set field Filters to given value func (o *ListOptions) WithFilters(value map[string][]string) *ListOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *ListOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } diff --git a/pkg/bindings/volumes/types_prune_options.go b/pkg/bindings/volumes/types_prune_options.go index 5d52752f2..2e2964981 100644 --- a/pkg/bindings/volumes/types_prune_options.go +++ b/pkg/bindings/volumes/types_prune_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package volumes import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *PruneOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *PruneOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithFilters +// WithFilters set field Filters to given value func (o *PruneOptions) WithFilters(value map[string][]string) *PruneOptions { - v := value - o.Filters = v + o.Filters = value return o } -// GetFilters +// GetFilters returns value of field Filters func (o *PruneOptions) GetFilters() map[string][]string { - var filters map[string][]string if o.Filters == nil { - return filters + var z map[string][]string + return z } return o.Filters } diff --git a/pkg/bindings/volumes/types_remove_options.go b/pkg/bindings/volumes/types_remove_options.go index 5e3fde58a..0e0a3c804 100644 --- a/pkg/bindings/volumes/types_remove_options.go +++ b/pkg/bindings/volumes/types_remove_options.go @@ -1,3 +1,4 @@ +// Code generated by go generate; DO NOT EDIT. package volumes import ( @@ -6,32 +7,27 @@ import ( "github.com/containers/podman/v3/pkg/bindings/internal/util" ) -/* -This file is generated automatically by go generate. Do not edit. -*/ - -// Changed +// Changed returns true if named field has been set func (o *RemoveOptions) Changed(fieldName string) bool { return util.Changed(o, fieldName) } -// ToParams +// ToParams formats struct fields to be passed to API service func (o *RemoveOptions) ToParams() (url.Values, error) { return util.ToParams(o) } -// WithForce +// WithForce set field Force to given value func (o *RemoveOptions) WithForce(value bool) *RemoveOptions { - v := &value - o.Force = v + o.Force = &value return o } -// GetForce +// GetForce returns value of field Force func (o *RemoveOptions) GetForce() bool { - var force bool if o.Force == nil { - return force + var z bool + return z } return *o.Force } diff --git a/pkg/domain/entities/pods.go b/pkg/domain/entities/pods.go index d9dd0c532..a74725c63 100644 --- a/pkg/domain/entities/pods.go +++ b/pkg/domain/entities/pods.go @@ -131,6 +131,7 @@ type PodCreateOptions struct { Cpus float64 CpusetCpus string Userns specgen.Namespace + Volume []string } // PodLogsOptions describes the options to extract pod logs. diff --git a/pkg/machine/fcos.go b/pkg/machine/fcos.go index 4ea965b7f..cfcadeb02 100644 --- a/pkg/machine/fcos.go +++ b/pkg/machine/fcos.go @@ -3,12 +3,20 @@ package machine import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" url2 "net/url" "os" "path/filepath" "runtime" "strings" + "github.com/coreos/stream-metadata-go/fedoracoreos" + "github.com/coreos/stream-metadata-go/stream" + "github.com/pkg/errors" + digest "github.com/opencontainers/go-digest" "github.com/sirupsen/logrus" ) @@ -121,3 +129,68 @@ func getFcosArch() string { } return arch } + +// This should get Exported and stay put as it will apply to all fcos downloads +// getFCOS parses fedoraCoreOS's stream and returns the image download URL and the release version +func getFCOSDownload(imageStream string) (*fcosDownloadInfo, error) { + var ( + fcosstable stream.Stream + streamType string + ) + switch imageStream { + case "testing", "": + streamType = fedoracoreos.StreamNext + case "stable": + streamType = fedoracoreos.StreamStable + default: + return nil, errors.Errorf("invalid stream %s: valid streams are `testing` and `stable`", imageStream) + } + streamurl := fedoracoreos.GetStreamURL(streamType) + resp, err := http.Get(streamurl.String()) + if err != nil { + return nil, err + } + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + defer func() { + if err := resp.Body.Close(); err != nil { + logrus.Error(err) + } + }() + + if err := json.Unmarshal(body, &fcosstable); err != nil { + return nil, err + } + arch, ok := fcosstable.Architectures[getFcosArch()] + if !ok { + return nil, fmt.Errorf("unable to pull VM image: no targetArch in stream") + } + artifacts := arch.Artifacts + if artifacts == nil { + return nil, fmt.Errorf("unable to pull VM image: no artifact in stream") + } + qemu, ok := artifacts[artifact] + if !ok { + return nil, fmt.Errorf("unable to pull VM image: no qemu artifact in stream") + } + formats := qemu.Formats + if formats == nil { + return nil, fmt.Errorf("unable to pull VM image: no formats in stream") + } + qcow, ok := formats[Format] + if !ok { + return nil, fmt.Errorf("unable to pull VM image: no qcow2.xz format in stream") + } + disk := qcow.Disk + if disk == nil { + return nil, fmt.Errorf("unable to pull VM image: no disk in stream") + } + return &fcosDownloadInfo{ + Location: disk.Location, + Release: qemu.Release, + Sha256Sum: disk.Sha256, + CompressionType: "xz", + }, nil +} diff --git a/pkg/machine/fcos_amd64.go b/pkg/machine/fcos_amd64.go deleted file mode 100644 index 4e2e86d3e..000000000 --- a/pkg/machine/fcos_amd64.go +++ /dev/null @@ -1,78 +0,0 @@ -package machine - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - - "github.com/coreos/stream-metadata-go/fedoracoreos" - "github.com/coreos/stream-metadata-go/stream" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" -) - -// This should get Exported and stay put as it will apply to all fcos downloads -// getFCOS parses fedoraCoreOS's stream and returns the image download URL and the release version -func getFCOSDownload(imageStream string) (*fcosDownloadInfo, error) { - var ( - fcosstable stream.Stream - streamType string - ) - switch imageStream { - case "testing", "": - streamType = fedoracoreos.StreamNext - case "stable": - streamType = fedoracoreos.StreamStable - default: - return nil, errors.Errorf("invalid stream %s: valid streams are `testing` and `stable`", imageStream) - } - streamurl := fedoracoreos.GetStreamURL(streamType) - resp, err := http.Get(streamurl.String()) - if err != nil { - return nil, err - } - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - defer func() { - if err := resp.Body.Close(); err != nil { - logrus.Error(err) - } - }() - - if err := json.Unmarshal(body, &fcosstable); err != nil { - return nil, err - } - arch, ok := fcosstable.Architectures[getFcosArch()] - if !ok { - return nil, fmt.Errorf("unable to pull VM image: no targetArch in stream") - } - artifacts := arch.Artifacts - if artifacts == nil { - return nil, fmt.Errorf("unable to pull VM image: no artifact in stream") - } - qemu, ok := artifacts[artifact] - if !ok { - return nil, fmt.Errorf("unable to pull VM image: no qemu artifact in stream") - } - formats := qemu.Formats - if formats == nil { - return nil, fmt.Errorf("unable to pull VM image: no formats in stream") - } - qcow, ok := formats[Format] - if !ok { - return nil, fmt.Errorf("unable to pull VM image: no qcow2.xz format in stream") - } - disk := qcow.Disk - if disk == nil { - return nil, fmt.Errorf("unable to pull VM image: no disk in stream") - } - return &fcosDownloadInfo{ - Location: disk.Location, - Release: qemu.Release, - Sha256Sum: disk.Sha256, - CompressionType: "xz", - }, nil -} diff --git a/pkg/machine/fcos_arm64.go b/pkg/machine/fcos_arm64.go deleted file mode 100644 index f45522be0..000000000 --- a/pkg/machine/fcos_arm64.go +++ /dev/null @@ -1,177 +0,0 @@ -package machine - -import ( - "encoding/json" - "io/ioutil" - "net/http" - url2 "net/url" - - "github.com/sirupsen/logrus" -) - -const aarchBaseURL = "https://fedorapeople.org/groups/fcos-images/builds/latest/aarch64/" - -// Total hack until automation is possible. -// We need a proper json file at least to automate -func getFCOSDownload(imageStream string) (*fcosDownloadInfo, error) { - meta := Build{} - resp, err := http.Get(aarchBaseURL + "meta.json") - if err != nil { - return nil, err - } - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - defer func() { - if err := resp.Body.Close(); err != nil { - logrus.Error(err) - } - }() - if err := json.Unmarshal(body, &meta); err != nil { - return nil, err - } - pathURL, err := url2.Parse(meta.BuildArtifacts.Qemu.Path) - if err != nil { - return nil, err - } - - baseURL, err := url2.Parse(aarchBaseURL) - if err != nil { - return nil, err - } - pullURL := baseURL.ResolveReference(pathURL) - return &fcosDownloadInfo{ - Location: pullURL.String(), - Release: "", - Sha256Sum: meta.BuildArtifacts.Qemu.Sha256, - }, nil -} - -/* - All of this can be nuked when fcos upstream generates a proper meta data file for aarch. -*/ -type AliyunImage struct { - ImageID string `json:"id"` - Region string `json:"name"` -} - -type Amis struct { - Hvm string `json:"hvm"` - Region string `json:"name"` - Snapshot string `json:"snapshot"` -} - -type Artifact struct { - Path string `json:"path"` - Sha256 string `json:"sha256"` - SizeInBytes float64 `json:"size,omitempty"` - UncompressedSha256 string `json:"uncompressed-sha256,omitempty"` - UncompressedSize int `json:"uncompressed-size,omitempty"` -} - -type Build struct { - AlibabaAliyunUploads []AliyunImage `json:"aliyun,omitempty"` - Amis []Amis `json:"amis,omitempty"` - Architecture string `json:"coreos-assembler.basearch,omitempty"` - Azure *Cloudartifact `json:"azure,omitempty"` - BuildArtifacts *BuildArtifacts `json:"images,omitempty"` - BuildID string `json:"buildid"` - BuildRef string `json:"ref,omitempty"` - BuildSummary string `json:"summary"` - BuildTimeStamp string `json:"coreos-assembler.build-timestamp,omitempty"` - BuildURL string `json:"build-url,omitempty"` - ConfigGitRev string `json:"coreos-assembler.config-gitrev,omitempty"` - ContainerConfigGit *Git `json:"coreos-assembler.container-config-git,omitempty"` - CoreOsSource string `json:"coreos-assembler.code-source,omitempty"` - CosaContainerImageGit *Git `json:"coreos-assembler.container-image-git,omitempty"` - CosaDelayedMetaMerge bool `json:"coreos-assembler.delayed-meta-merge,omitempty"` - CosaImageChecksum string `json:"coreos-assembler.image-config-checksum,omitempty"` - CosaImageVersion int `json:"coreos-assembler.image-genver,omitempty"` - Extensions *Extensions `json:"extensions,omitempty"` - FedoraCoreOsParentCommit string `json:"fedora-coreos.parent-commit,omitempty"` - FedoraCoreOsParentVersion string `json:"fedora-coreos.parent-version,omitempty"` - Gcp *Gcp `json:"gcp,omitempty"` - GitDirty string `json:"coreos-assembler.config-dirty,omitempty"` - ImageInputChecksum string `json:"coreos-assembler.image-input-checksum,omitempty"` - InputHasOfTheRpmOstree string `json:"rpm-ostree-inputhash"` - MetaStamp float64 `json:"coreos-assembler.meta-stamp,omitempty"` - Name string `json:"name"` - Oscontainer *Image `json:"oscontainer,omitempty"` - OstreeCommit string `json:"ostree-commit"` - OstreeContentBytesWritten int `json:"ostree-content-bytes-written,omitempty"` - OstreeContentChecksum string `json:"ostree-content-checksum"` - OstreeNCacheHits int `json:"ostree-n-cache-hits,omitempty"` - OstreeNContentTotal int `json:"ostree-n-content-total,omitempty"` - OstreeNContentWritten int `json:"ostree-n-content-written,omitempty"` - OstreeNMetadataTotal int `json:"ostree-n-metadata-total,omitempty"` - OstreeNMetadataWritten int `json:"ostree-n-metadata-written,omitempty"` - OstreeTimestamp string `json:"ostree-timestamp"` - OstreeVersion string `json:"ostree-version"` - OverridesActive bool `json:"coreos-assembler.overrides-active,omitempty"` - PkgdiffAgainstParent PackageSetDifferences `json:"parent-pkgdiff,omitempty"` - PkgdiffBetweenBuilds PackageSetDifferences `json:"pkgdiff,omitempty"` - ReleasePayload *Image `json:"release-payload,omitempty"` -} - -type BuildArtifacts struct { - Aliyun *Artifact `json:"aliyun,omitempty"` - Aws *Artifact `json:"aws,omitempty"` - Azure *Artifact `json:"azure,omitempty"` - AzureStack *Artifact `json:"azurestack,omitempty"` - Dasd *Artifact `json:"dasd,omitempty"` - DigitalOcean *Artifact `json:"digitalocean,omitempty"` - Exoscale *Artifact `json:"exoscale,omitempty"` - Gcp *Artifact `json:"gcp,omitempty"` - IbmCloud *Artifact `json:"ibmcloud,omitempty"` - Initramfs *Artifact `json:"initramfs,omitempty"` - Iso *Artifact `json:"iso,omitempty"` - Kernel *Artifact `json:"kernel,omitempty"` - LiveInitramfs *Artifact `json:"live-initramfs,omitempty"` - LiveIso *Artifact `json:"live-iso,omitempty"` - LiveKernel *Artifact `json:"live-kernel,omitempty"` - LiveRootfs *Artifact `json:"live-rootfs,omitempty"` - Metal *Artifact `json:"metal,omitempty"` - Metal4KNative *Artifact `json:"metal4k,omitempty"` - OpenStack *Artifact `json:"openstack,omitempty"` - Ostree Artifact `json:"ostree"` - Qemu *Artifact `json:"qemu,omitempty"` - Vmware *Artifact `json:"vmware,omitempty"` - Vultr *Artifact `json:"vultr,omitempty"` -} - -type Cloudartifact struct { - Image string `json:"image"` - URL string `json:"url"` -} - -type Extensions struct { - Manifest map[string]interface{} `json:"manifest"` - Path string `json:"path"` - RpmOstreeState string `json:"rpm-ostree-state"` - Sha256 string `json:"sha256"` -} - -type Gcp struct { - ImageFamily string `json:"family,omitempty"` - ImageName string `json:"image"` - ImageProject string `json:"project,omitempty"` - URL string `json:"url"` -} - -type Git struct { - Branch string `json:"branch,omitempty"` - Commit string `json:"commit"` - Dirty string `json:"dirty,omitempty"` - Origin string `json:"origin"` -} - -type Image struct { - Comment string `json:"comment,omitempty"` - Digest string `json:"digest"` - Image string `json:"image"` -} - -type Items interface{} - -type PackageSetDifferences []Items diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index 5d8c6e6ce..d5f538594 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -15,6 +15,7 @@ import ( "strings" "time" + "github.com/containers/common/pkg/config" "github.com/containers/podman/v3/pkg/machine" "github.com/containers/podman/v3/pkg/rootless" "github.com/containers/podman/v3/utils" @@ -627,9 +628,12 @@ func CheckActiveVM() (bool, string, error) { // startHostNetworking runs a binary on the host system that allows users // to setup port forwarding to the podman virtual machine func (v *MachineVM) startHostNetworking() error { - // TODO we may wish to configure the directory in containers common - binary := filepath.Join("/usr/libexec/podman/", machine.ForwarderBinaryName) - if _, err := os.Stat(binary); err != nil { + cfg, err := config.Default() + if err != nil { + return err + } + binary, err := cfg.FindHelperBinary(machine.ForwarderBinaryName, false) + if err != nil { return err } diff --git a/pkg/rootlessport/rootlessport_linux.go b/pkg/rootlessport/rootlessport_linux.go index 730d91aa2..10d135e0b 100644 --- a/pkg/rootlessport/rootlessport_linux.go +++ b/pkg/rootlessport/rootlessport_linux.go @@ -218,6 +218,9 @@ outer: // we only need to have a socket to reload ports when we run under rootless cni if cfg.RootlessCNI { + socketfile := filepath.Join(socketDir, cfg.ContainerID) + // make sure to remove the file if it exists to prevent EADDRINUSE + _ = os.Remove(socketfile) // workaround to bypass the 108 char socket path limit // open the fd and use the path to the fd as bind argument fd, err := unix.Open(socketDir, unix.O_PATH, 0) @@ -229,6 +232,8 @@ outer: return err } err = unix.Close(fd) + // remove the socket file on exit + defer os.Remove(socketfile) if err != nil { logrus.Warnf("failed to close the socketDir fd: %v", err) } diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index f82b2a3c6..91230338e 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -28,15 +28,27 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener return nil, nil, nil, err } - // If joining a pod, retrieve the pod for use. + // If joining a pod, retrieve the pod for use, and its infra container var pod *libpod.Pod + var cont *libpod.Container + var config *libpod.ContainerConfig if s.Pod != "" { pod, err = rt.LookupPod(s.Pod) if err != nil { return nil, nil, nil, errors.Wrapf(err, "error retrieving pod %s", s.Pod) } + if pod.HasInfraContainer() { + cont, err = pod.InfraContainer() + if err != nil { + return nil, nil, nil, err + } + config = cont.Config() + } } + if config != nil && (len(config.NamedVolumes) > 0 || len(config.UserVolumes) > 0 || len(config.ImageVolumes) > 0 || len(config.OverlayVolumes) > 0) { + s.VolumesFrom = append(s.VolumesFrom, config.ID) + } // Set defaults for unset namespaces if s.PidNS.IsDefault() { defaultNS, err := GetDefaultNamespaceMode("pid", rtc, pod) @@ -90,7 +102,7 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener var newImage *libimage.Image var imageData *libimage.ImageData if s.Rootfs != "" { - options = append(options, libpod.WithRootFS(s.Rootfs)) + options = append(options, libpod.WithRootFS(s.Rootfs, s.RootfsOverlay)) } else { var resolvedImageName string newImage, resolvedImageName, err = rt.LibimageRuntime().LookupImage(s.Image, nil) @@ -394,7 +406,7 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen. options = append(options, libpod.WithShmSize(*s.ShmSize)) } if s.Rootfs != "" { - options = append(options, libpod.WithRootFS(s.Rootfs)) + options = append(options, libpod.WithRootFS(s.Rootfs, s.RootfsOverlay)) } // Default used if not overridden on command line diff --git a/pkg/specgen/podspecgen.go b/pkg/specgen/podspecgen.go index 8872a1321..5f72fc47d 100644 --- a/pkg/specgen/podspecgen.go +++ b/pkg/specgen/podspecgen.go @@ -72,6 +72,22 @@ type PodBasicConfig struct { // Any containers created within the pod will inherit the pod's userns settings. // Optional Userns Namespace `json:"userns,omitempty"` + // Mounts are mounts that will be added to the pod. + // These will supersede Image Volumes and VolumesFrom (WIP) volumes where + // there are conflicts. + // Optional. + Mounts []spec.Mount `json:"mounts,omitempty"` + // Volumes are named volumes that will be added to the pod. + // These will supersede Image Volumes and VolumesFrom (WIP) volumes where + // there are conflicts. + // Optional. + Volumes []*NamedVolume `json:"volumes,omitempty"` + // Overlay volumes are named volumes that will be added to the pod. + // Optional. + OverlayVolumes []*OverlayVolume `json:"overlay_volumes,omitempty"` + // Image volumes bind-mount a container-image mount into the pod's infra container. + // Optional. + ImageVolumes []*ImageVolume `json:"image_volumes,omitempty"` } // PodNetworkConfig contains networking configuration for a pod. diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index 0c30c498a..e0609c5bc 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -2,6 +2,7 @@ package specgen import ( "net" + "strings" "syscall" "github.com/containers/image/v5/manifest" @@ -209,6 +210,8 @@ type ContainerStorageConfig struct { // Conflicts with Image. // At least one of Image or Rootfs must be specified. Rootfs string `json:"rootfs,omitempty"` + // RootfsOverlay tells if rootfs is actuall an overlay on top of base path + RootfsOverlay bool `json:"rootfs_overlay,omitempty"` // ImageVolumeMode indicates how image volumes will be created. // Supported modes are "ignore" (do not create), "tmpfs" (create as // tmpfs), and "anonymous" (create as anonymous volumes). @@ -528,6 +531,12 @@ func NewSpecGenerator(arg string, rootfs bool) *SpecGenerator { csc := ContainerStorageConfig{} if rootfs { csc.Rootfs = arg + // check if rootfs is actually overlayed + parts := strings.SplitN(csc.Rootfs, ":", 2) + if len(parts) > 1 && parts[1] == "O" { + csc.RootfsOverlay = true + csc.Rootfs = parts[0] + } } else { csc.Image = arg } |