diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-14 13:04:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 13:04:11 -0400 |
commit | bb8b2ed7deb71431521d24486b0856845e7a7867 (patch) | |
tree | 3afa51a80166d3033bd1c793f1812bb7c9953155 | |
parent | 20daae1de93c1a73f454f3f3ba04bba03a348f81 (diff) | |
parent | d7256be807890892c988cc7d270e3d1bf951397c (diff) | |
download | podman-bb8b2ed7deb71431521d24486b0856845e7a7867.tar.gz podman-bb8b2ed7deb71431521d24486b0856845e7a7867.tar.bz2 podman-bb8b2ed7deb71431521d24486b0856845e7a7867.zip |
Merge pull request #11559 from jwhonce/wip/generator
Enhance bindings for IDE hints
110 files changed, 2058 insertions, 1757 deletions
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/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/test/apiv2/python/rest_api/test_v2_0_0_system.py b/test/apiv2/python/rest_api/test_v2_0_0_system.py index 8171abb84..1140d09cf 100644 --- a/test/apiv2/python/rest_api/test_v2_0_0_system.py +++ b/test/apiv2/python/rest_api/test_v2_0_0_system.py @@ -30,13 +30,12 @@ class SystemTestCase(APITestCase): # Actor.ID is uppercase for compatibility self.assertIn("ID", obj["Actor"]) # Verify 1.22+ deprecated variants are present if current originals are - if (obj["Actor"]["ID"]): - self.assertEqual(obj["Actor"]["ID"], obj["id"]) - if (obj["Action"]): - self.assertEqual(obj["Action"], obj["status"]) - if (obj["Actor"].get("Attributes") and obj["Actor"]["Attributes"].get("image")): - self.assertEqual(obj["Actor"]["Attributes"]["image"], obj["from"]) - + if obj["Actor"]["ID"]: + self.assertEqual(obj["Actor"]["ID"], obj["id"]) + if obj["Action"]: + self.assertEqual(obj["Action"], obj["status"]) + if obj["Actor"].get("Attributes") and obj["Actor"]["Attributes"].get("image"): + self.assertEqual(obj["Actor"]["Attributes"]["image"], obj["from"]) def test_ping(self): required_headers = ( diff --git a/vendor/github.com/onsi/gomega/gstruct/elements.go b/vendor/github.com/onsi/gomega/gstruct/elements.go new file mode 100644 index 000000000..b5e5ef2e4 --- /dev/null +++ b/vendor/github.com/onsi/gomega/gstruct/elements.go @@ -0,0 +1,231 @@ +// untested sections: 6 + +package gstruct + +import ( + "errors" + "fmt" + "reflect" + "runtime/debug" + "strconv" + + "github.com/onsi/gomega/format" + errorsutil "github.com/onsi/gomega/gstruct/errors" + "github.com/onsi/gomega/types" +) + +//MatchAllElements succeeds if every element of a slice matches the element matcher it maps to +//through the id function, and every element matcher is matched. +// idFn := func(element interface{}) string { +// return fmt.Sprintf("%v", element) +// } +// +// Expect([]string{"a", "b"}).To(MatchAllElements(idFn, Elements{ +// "a": Equal("a"), +// "b": Equal("b"), +// })) +func MatchAllElements(identifier Identifier, elements Elements) types.GomegaMatcher { + return &ElementsMatcher{ + Identifier: identifier, + Elements: elements, + } +} + +//MatchAllElementsWithIndex succeeds if every element of a slice matches the element matcher it maps to +//through the id with index function, and every element matcher is matched. +// idFn := func(index int, element interface{}) string { +// return strconv.Itoa(index) +// } +// +// Expect([]string{"a", "b"}).To(MatchAllElements(idFn, Elements{ +// "0": Equal("a"), +// "1": Equal("b"), +// })) +func MatchAllElementsWithIndex(identifier IdentifierWithIndex, elements Elements) types.GomegaMatcher { + return &ElementsMatcher{ + Identifier: identifier, + Elements: elements, + } +} + +//MatchElements succeeds if each element of a slice matches the element matcher it maps to +//through the id function. It can ignore extra elements and/or missing elements. +// idFn := func(element interface{}) string { +// return fmt.Sprintf("%v", element) +// } +// +// Expect([]string{"a", "b", "c"}).To(MatchElements(idFn, IgnoreExtras, Elements{ +// "a": Equal("a"), +// "b": Equal("b"), +// })) +// Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing, Elements{ +// "a": Equal("a"), +// "b": Equal("b"), +// "c": Equal("c"), +// "d": Equal("d"), +// })) +func MatchElements(identifier Identifier, options Options, elements Elements) types.GomegaMatcher { + return &ElementsMatcher{ + Identifier: identifier, + Elements: elements, + IgnoreExtras: options&IgnoreExtras != 0, + IgnoreMissing: options&IgnoreMissing != 0, + AllowDuplicates: options&AllowDuplicates != 0, + } +} + +//MatchElementsWithIndex succeeds if each element of a slice matches the element matcher it maps to +//through the id with index function. It can ignore extra elements and/or missing elements. +// idFn := func(index int, element interface{}) string { +// return strconv.Itoa(index) +// } +// +// Expect([]string{"a", "b", "c"}).To(MatchElements(idFn, IgnoreExtras, Elements{ +// "0": Equal("a"), +// "1": Equal("b"), +// })) +// Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing, Elements{ +// "0": Equal("a"), +// "1": Equal("b"), +// "2": Equal("c"), +// "3": Equal("d"), +// })) +func MatchElementsWithIndex(identifier IdentifierWithIndex, options Options, elements Elements) types.GomegaMatcher { + return &ElementsMatcher{ + Identifier: identifier, + Elements: elements, + IgnoreExtras: options&IgnoreExtras != 0, + IgnoreMissing: options&IgnoreMissing != 0, + AllowDuplicates: options&AllowDuplicates != 0, + } +} + +// ElementsMatcher is a NestingMatcher that applies custom matchers to each element of a slice mapped +// by the Identifier function. +// TODO: Extend this to work with arrays & maps (map the key) as well. +type ElementsMatcher struct { + // Matchers for each element. + Elements Elements + // Function mapping an element to the string key identifying its matcher. + Identifier Identify + + // Whether to ignore extra elements or consider it an error. + IgnoreExtras bool + // Whether to ignore missing elements or consider it an error. + IgnoreMissing bool + // Whether to key duplicates when matching IDs. + AllowDuplicates bool + + // State. + failures []error +} + +// Element ID to matcher. +type Elements map[string]types.GomegaMatcher + +// Function for identifying (mapping) elements. +type Identifier func(element interface{}) string + +// Calls the underlying fucntion with the provided params. +// Identifier drops the index. +func (i Identifier) WithIndexAndElement(index int, element interface{}) string { + return i(element) +} + +// Uses the index and element to generate an element name +type IdentifierWithIndex func(index int, element interface{}) string + +// Calls the underlying fucntion with the provided params. +// IdentifierWithIndex uses the index. +func (i IdentifierWithIndex) WithIndexAndElement(index int, element interface{}) string { + return i(index, element) +} + +// Interface for identifing the element +type Identify interface { + WithIndexAndElement(i int, element interface{}) string +} + +// IndexIdentity is a helper function for using an index as +// the key in the element map +func IndexIdentity(index int, _ interface{}) string { + return strconv.Itoa(index) +} + +func (m *ElementsMatcher) Match(actual interface{}) (success bool, err error) { + if reflect.TypeOf(actual).Kind() != reflect.Slice { + return false, fmt.Errorf("%v is type %T, expected slice", actual, actual) + } + + m.failures = m.matchElements(actual) + if len(m.failures) > 0 { + return false, nil + } + return true, nil +} + +func (m *ElementsMatcher) matchElements(actual interface{}) (errs []error) { + // Provide more useful error messages in the case of a panic. + defer func() { + if err := recover(); err != nil { + errs = append(errs, fmt.Errorf("panic checking %+v: %v\n%s", actual, err, debug.Stack())) + } + }() + + val := reflect.ValueOf(actual) + elements := map[string]bool{} + for i := 0; i < val.Len(); i++ { + element := val.Index(i).Interface() + id := m.Identifier.WithIndexAndElement(i, element) + if elements[id] { + if !m.AllowDuplicates { + errs = append(errs, fmt.Errorf("found duplicate element ID %s", id)) + continue + } + } + elements[id] = true + + matcher, expected := m.Elements[id] + if !expected { + if !m.IgnoreExtras { + errs = append(errs, fmt.Errorf("unexpected element %s", id)) + } + continue + } + + match, err := matcher.Match(element) + if match { + continue + } + + if err == nil { + if nesting, ok := matcher.(errorsutil.NestingMatcher); ok { + err = errorsutil.AggregateError(nesting.Failures()) + } else { + err = errors.New(matcher.FailureMessage(element)) + } + } + errs = append(errs, errorsutil.Nest(fmt.Sprintf("[%s]", id), err)) + } + + for id := range m.Elements { + if !elements[id] && !m.IgnoreMissing { + errs = append(errs, fmt.Errorf("missing expected element %s", id)) + } + } + + return errs +} + +func (m *ElementsMatcher) FailureMessage(actual interface{}) (message string) { + failure := errorsutil.AggregateError(m.failures) + return format.Message(actual, fmt.Sprintf("to match elements: %v", failure)) +} + +func (m *ElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to match elements") +} + +func (m *ElementsMatcher) Failures() []error { + return m.failures +} diff --git a/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go b/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go new file mode 100644 index 000000000..188492b21 --- /dev/null +++ b/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go @@ -0,0 +1,72 @@ +package errors + +import ( + "fmt" + "strings" + + "github.com/onsi/gomega/types" +) + +// A stateful matcher that nests other matchers within it and preserves the error types of the +// nested matcher failures. +type NestingMatcher interface { + types.GomegaMatcher + + // Returns the failures of nested matchers. + Failures() []error +} + +// An error type for labeling errors on deeply nested matchers. +type NestedError struct { + Path string + Err error +} + +func (e *NestedError) Error() string { + // Indent Errors. + indented := strings.Replace(e.Err.Error(), "\n", "\n\t", -1) + return fmt.Sprintf("%s:\n\t%v", e.Path, indented) +} + +// Create a NestedError with the given path. +// If err is a NestedError, prepend the path to it. +// If err is an AggregateError, recursively Nest each error. +func Nest(path string, err error) error { + if ag, ok := err.(AggregateError); ok { + var errs AggregateError + for _, e := range ag { + errs = append(errs, Nest(path, e)) + } + return errs + } + if ne, ok := err.(*NestedError); ok { + return &NestedError{ + Path: path + ne.Path, + Err: ne.Err, + } + } + return &NestedError{ + Path: path, + Err: err, + } +} + +// An error type for treating multiple errors as a single error. +type AggregateError []error + +// Error is part of the error interface. +func (err AggregateError) Error() string { + if len(err) == 0 { + // This should never happen, really. + return "" + } + if len(err) == 1 { + return err[0].Error() + } + result := fmt.Sprintf("[%s", err[0].Error()) + for i := 1; i < len(err); i++ { + result += fmt.Sprintf(", %s", err[i].Error()) + } + result += "]" + return result +} diff --git a/vendor/github.com/onsi/gomega/gstruct/fields.go b/vendor/github.com/onsi/gomega/gstruct/fields.go new file mode 100644 index 000000000..faf07b1a2 --- /dev/null +++ b/vendor/github.com/onsi/gomega/gstruct/fields.go @@ -0,0 +1,165 @@ +// untested sections: 6 + +package gstruct + +import ( + "errors" + "fmt" + "reflect" + "runtime/debug" + "strings" + + "github.com/onsi/gomega/format" + errorsutil "github.com/onsi/gomega/gstruct/errors" + "github.com/onsi/gomega/types" +) + +//MatchAllFields succeeds if every field of a struct matches the field matcher associated with +//it, and every element matcher is matched. +// actual := struct{ +// A int +// B []bool +// C string +// }{ +// A: 5, +// B: []bool{true, false}, +// C: "foo", +// } +// +// Expect(actual).To(MatchAllFields(Fields{ +// "A": Equal(5), +// "B": ConsistOf(true, false), +// "C": Equal("foo"), +// })) +func MatchAllFields(fields Fields) types.GomegaMatcher { + return &FieldsMatcher{ + Fields: fields, + } +} + +//MatchFields succeeds if each element of a struct matches the field matcher associated with +//it. It can ignore extra fields and/or missing fields. +// actual := struct{ +// A int +// B []bool +// C string +// }{ +// A: 5, +// B: []bool{true, false}, +// C: "foo", +// } +// +// Expect(actual).To(MatchFields(IgnoreExtras, Fields{ +// "A": Equal(5), +// "B": ConsistOf(true, false), +// })) +// Expect(actual).To(MatchFields(IgnoreMissing, Fields{ +// "A": Equal(5), +// "B": ConsistOf(true, false), +// "C": Equal("foo"), +// "D": Equal("extra"), +// })) +func MatchFields(options Options, fields Fields) types.GomegaMatcher { + return &FieldsMatcher{ + Fields: fields, + IgnoreExtras: options&IgnoreExtras != 0, + IgnoreMissing: options&IgnoreMissing != 0, + } +} + +type FieldsMatcher struct { + // Matchers for each field. + Fields Fields + + // Whether to ignore extra elements or consider it an error. + IgnoreExtras bool + // Whether to ignore missing elements or consider it an error. + IgnoreMissing bool + + // State. + failures []error +} + +// Field name to matcher. +type Fields map[string]types.GomegaMatcher + +func (m *FieldsMatcher) Match(actual interface{}) (success bool, err error) { + if reflect.TypeOf(actual).Kind() != reflect.Struct { + return false, fmt.Errorf("%v is type %T, expected struct", actual, actual) + } + + m.failures = m.matchFields(actual) + if len(m.failures) > 0 { + return false, nil + } + return true, nil +} + +func (m *FieldsMatcher) matchFields(actual interface{}) (errs []error) { + val := reflect.ValueOf(actual) + typ := val.Type() + fields := map[string]bool{} + for i := 0; i < val.NumField(); i++ { + fieldName := typ.Field(i).Name + fields[fieldName] = true + + err := func() (err error) { + // This test relies heavily on reflect, which tends to panic. + // Recover here to provide more useful error messages in that case. + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("panic checking %+v: %v\n%s", actual, r, debug.Stack()) + } + }() + + matcher, expected := m.Fields[fieldName] + if !expected { + if !m.IgnoreExtras { + return fmt.Errorf("unexpected field %s: %+v", fieldName, actual) + } + return nil + } + + field := val.Field(i).Interface() + + match, err := matcher.Match(field) + if err != nil { + return err + } else if !match { + if nesting, ok := matcher.(errorsutil.NestingMatcher); ok { + return errorsutil.AggregateError(nesting.Failures()) + } + return errors.New(matcher.FailureMessage(field)) + } + return nil + }() + if err != nil { + errs = append(errs, errorsutil.Nest("."+fieldName, err)) + } + } + + for field := range m.Fields { + if !fields[field] && !m.IgnoreMissing { + errs = append(errs, fmt.Errorf("missing expected field %s", field)) + } + } + + return errs +} + +func (m *FieldsMatcher) FailureMessage(actual interface{}) (message string) { + failures := make([]string, len(m.failures)) + for i := range m.failures { + failures[i] = m.failures[i].Error() + } + return format.Message(reflect.TypeOf(actual).Name(), + fmt.Sprintf("to match fields: {\n%v\n}\n", strings.Join(failures, "\n"))) +} + +func (m *FieldsMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to match fields") +} + +func (m *FieldsMatcher) Failures() []error { + return m.failures +} diff --git a/vendor/github.com/onsi/gomega/gstruct/ignore.go b/vendor/github.com/onsi/gomega/gstruct/ignore.go new file mode 100644 index 000000000..4396573e4 --- /dev/null +++ b/vendor/github.com/onsi/gomega/gstruct/ignore.go @@ -0,0 +1,39 @@ +// untested sections: 2 + +package gstruct + +import ( + "github.com/onsi/gomega/types" +) + +//Ignore ignores the actual value and always succeeds. +// Expect(nil).To(Ignore()) +// Expect(true).To(Ignore()) +func Ignore() types.GomegaMatcher { + return &IgnoreMatcher{true} +} + +//Reject ignores the actual value and always fails. It can be used in conjunction with IgnoreMissing +//to catch problematic elements, or to verify tests are running. +// Expect(nil).NotTo(Reject()) +// Expect(true).NotTo(Reject()) +func Reject() types.GomegaMatcher { + return &IgnoreMatcher{false} +} + +// A matcher that either always succeeds or always fails. +type IgnoreMatcher struct { + Succeed bool +} + +func (m *IgnoreMatcher) Match(actual interface{}) (bool, error) { + return m.Succeed, nil +} + +func (m *IgnoreMatcher) FailureMessage(_ interface{}) (message string) { + return "Unconditional failure" +} + +func (m *IgnoreMatcher) NegatedFailureMessage(_ interface{}) (message string) { + return "Unconditional success" +} diff --git a/vendor/github.com/onsi/gomega/gstruct/keys.go b/vendor/github.com/onsi/gomega/gstruct/keys.go new file mode 100644 index 000000000..56aed4bab --- /dev/null +++ b/vendor/github.com/onsi/gomega/gstruct/keys.go @@ -0,0 +1,126 @@ +// untested sections: 6 + +package gstruct + +import ( + "errors" + "fmt" + "reflect" + "runtime/debug" + "strings" + + "github.com/onsi/gomega/format" + errorsutil "github.com/onsi/gomega/gstruct/errors" + "github.com/onsi/gomega/types" +) + +func MatchAllKeys(keys Keys) types.GomegaMatcher { + return &KeysMatcher{ + Keys: keys, + } +} + +func MatchKeys(options Options, keys Keys) types.GomegaMatcher { + return &KeysMatcher{ + Keys: keys, + IgnoreExtras: options&IgnoreExtras != 0, + IgnoreMissing: options&IgnoreMissing != 0, + } +} + +type KeysMatcher struct { + // Matchers for each key. + Keys Keys + + // Whether to ignore extra keys or consider it an error. + IgnoreExtras bool + // Whether to ignore missing keys or consider it an error. + IgnoreMissing bool + + // State. + failures []error +} + +type Keys map[interface{}]types.GomegaMatcher + +func (m *KeysMatcher) Match(actual interface{}) (success bool, err error) { + if reflect.TypeOf(actual).Kind() != reflect.Map { + return false, fmt.Errorf("%v is type %T, expected map", actual, actual) + } + + m.failures = m.matchKeys(actual) + if len(m.failures) > 0 { + return false, nil + } + return true, nil +} + +func (m *KeysMatcher) matchKeys(actual interface{}) (errs []error) { + actualValue := reflect.ValueOf(actual) + keys := map[interface{}]bool{} + for _, keyValue := range actualValue.MapKeys() { + key := keyValue.Interface() + keys[key] = true + + err := func() (err error) { + // This test relies heavily on reflect, which tends to panic. + // Recover here to provide more useful error messages in that case. + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("panic checking %+v: %v\n%s", actual, r, debug.Stack()) + } + }() + + matcher, ok := m.Keys[key] + if !ok { + if !m.IgnoreExtras { + return fmt.Errorf("unexpected key %s: %+v", key, actual) + } + return nil + } + + valInterface := actualValue.MapIndex(keyValue).Interface() + + match, err := matcher.Match(valInterface) + if err != nil { + return err + } + + if !match { + if nesting, ok := matcher.(errorsutil.NestingMatcher); ok { + return errorsutil.AggregateError(nesting.Failures()) + } + return errors.New(matcher.FailureMessage(valInterface)) + } + return nil + }() + if err != nil { + errs = append(errs, errorsutil.Nest(fmt.Sprintf(".%#v", key), err)) + } + } + + for key := range m.Keys { + if !keys[key] && !m.IgnoreMissing { + errs = append(errs, fmt.Errorf("missing expected key %s", key)) + } + } + + return errs +} + +func (m *KeysMatcher) FailureMessage(actual interface{}) (message string) { + failures := make([]string, len(m.failures)) + for i := range m.failures { + failures[i] = m.failures[i].Error() + } + return format.Message(reflect.TypeOf(actual).Name(), + fmt.Sprintf("to match keys: {\n%v\n}\n", strings.Join(failures, "\n"))) +} + +func (m *KeysMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to match keys") +} + +func (m *KeysMatcher) Failures() []error { + return m.failures +} diff --git a/vendor/github.com/onsi/gomega/gstruct/pointer.go b/vendor/github.com/onsi/gomega/gstruct/pointer.go new file mode 100644 index 000000000..cc828a325 --- /dev/null +++ b/vendor/github.com/onsi/gomega/gstruct/pointer.go @@ -0,0 +1,58 @@ +// untested sections: 3 + +package gstruct + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" + "github.com/onsi/gomega/types" +) + +//PointTo applies the given matcher to the value pointed to by actual. It fails if the pointer is +//nil. +// actual := 5 +// Expect(&actual).To(PointTo(Equal(5))) +func PointTo(matcher types.GomegaMatcher) types.GomegaMatcher { + return &PointerMatcher{ + Matcher: matcher, + } +} + +type PointerMatcher struct { + Matcher types.GomegaMatcher + + // Failure message. + failure string +} + +func (m *PointerMatcher) Match(actual interface{}) (bool, error) { + val := reflect.ValueOf(actual) + + // return error if actual type is not a pointer + if val.Kind() != reflect.Ptr { + return false, fmt.Errorf("PointerMatcher expects a pointer but we have '%s'", val.Kind()) + } + + if !val.IsValid() || val.IsNil() { + m.failure = format.Message(actual, "not to be <nil>") + return false, nil + } + + // Forward the value. + elem := val.Elem().Interface() + match, err := m.Matcher.Match(elem) + if !match { + m.failure = m.Matcher.FailureMessage(elem) + } + return match, err +} + +func (m *PointerMatcher) FailureMessage(_ interface{}) (message string) { + return m.failure +} + +func (m *PointerMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return m.Matcher.NegatedFailureMessage(actual) +} diff --git a/vendor/github.com/onsi/gomega/gstruct/types.go b/vendor/github.com/onsi/gomega/gstruct/types.go new file mode 100644 index 000000000..48cbbe8f6 --- /dev/null +++ b/vendor/github.com/onsi/gomega/gstruct/types.go @@ -0,0 +1,15 @@ +package gstruct + +//Options is the type for options passed to some matchers. +type Options int + +const ( + //IgnoreExtras tells the matcher to ignore extra elements or fields, rather than triggering a failure. + IgnoreExtras Options = 1 << iota + //IgnoreMissing tells the matcher to ignore missing elements or fields, rather than triggering a failure. + IgnoreMissing + //AllowDuplicates tells the matcher to permit multiple members of the slice to produce the same ID when + //considered by the indentifier function. All members that map to a given key must still match successfully + //with the matcher that is provided for that key. + AllowDuplicates +) diff --git a/vendor/modules.txt b/vendor/modules.txt index db01e184e..a9e3b5cff 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -499,6 +499,8 @@ github.com/onsi/gomega github.com/onsi/gomega/format github.com/onsi/gomega/gbytes github.com/onsi/gomega/gexec +github.com/onsi/gomega/gstruct +github.com/onsi/gomega/gstruct/errors github.com/onsi/gomega/internal github.com/onsi/gomega/matchers github.com/onsi/gomega/matchers/support/goraph/bipartitegraph |