From eeb5c43ae3a044ce34a21d7a52a01cab3b6edb96 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 20 Jul 2020 15:33:04 -0400 Subject: [PATCH 01/31] podman http api client initial commit --- apiclient/apiclient.go | 56 +++++++++++++++++++++++++++++++++++++ apiclient/container_stop.go | 26 +++++++++++++++++ client.go | 13 --------- driver.go | 9 ++++-- 4 files changed, 88 insertions(+), 16 deletions(-) create mode 100644 apiclient/apiclient.go create mode 100644 apiclient/container_stop.go diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go new file mode 100644 index 0000000..095dc20 --- /dev/null +++ b/apiclient/apiclient.go @@ -0,0 +1,56 @@ +package apiclient + +import ( + "context" + "net" + "net/http" + "strings" + "time" +) + +type APIClient struct { + baseUrl string + httpClient *http.Client +} + +func NewClient(baseUrl string) *APIClient { + httpClient := http.Client{ + Timeout: 5 * time.Second, + } + if strings.HasPrefix(baseUrl, "unix:") { + path := strings.TrimPrefix(baseUrl, "unix:") + baseUrl = "http://localhost" + httpClient.Transport = &http.Transport{ + DialContext: func(_ context.Context, _, _ string) (net.Conn, error) { + return net.Dial("unix", path) + }, + } + } + return &APIClient{ + baseUrl: baseUrl, + httpClient: &httpClient, + } +} + +func (c *APIClient) Do(req *http.Request) (*http.Response, error) { + res, err := c.httpClient.Do(req) + return res, err +} + +func (c *APIClient) Get(ctx context.Context, path string) (*http.Response, error) { + req, err := http.NewRequest("GET", c.baseUrl+path, nil) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + return c.Do(req) +} + +func (c *APIClient) Post(ctx context.Context, path string) (*http.Response, error) { + req, err := http.NewRequest("POST", c.baseUrl+path, nil) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + return c.Do(req) +} diff --git a/apiclient/container_stop.go b/apiclient/container_stop.go new file mode 100644 index 0000000..a9678b7 --- /dev/null +++ b/apiclient/container_stop.go @@ -0,0 +1,26 @@ +package apiclient + +import ( + "context" + "fmt" + "net/http" +) + +// ContainerStop stops a container given a timeout. It takes the name or ID of a container as well as a +// timeout value. The timeout value the time before a forcible stop to the container is applied. +// If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) +// error will be returned instead. +func (c *APIClient) ContainerStop(ctx context.Context, name string, timeout int) error { + + res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/stop?timeout=%d", name, timeout)) + if err != nil { + return err + } + + defer res.Body.Close() + + if res.StatusCode != http.StatusNoContent { + return nil + } + return fmt.Errorf("unknown error, status code: %d", res.StatusCode) +} diff --git a/client.go b/client.go index f1c91e4..c098f67 100644 --- a/client.go +++ b/client.go @@ -96,19 +96,6 @@ func (c *PodmanClient) GetContainerStats(containerID string) (*iopodman.Containe return containerStats, err } -// StopContainer stops a container given a timeout. It takes the name or ID of a container as well as a -// timeout value. The timeout value the time before a forcible stop to the container is applied. -// If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -// error will be returned instead. -func (c *PodmanClient) StopContainer(containerID string, timeoutSeconds int64) error { - c.logger.Debug("Stopping container", "container", containerID, "timeout", timeoutSeconds) - err := c.withVarlink(func(varlinkConnection *varlink.Connection) error { - _, err := iopodman.StopContainer().Call(c.ctx, varlinkConnection, containerID, timeoutSeconds) - return err - }) - return err -} - // ForceRemoveContainer requires the name or ID of a container and will stop and remove a container and it's volumes. // iI container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned. func (c *PodmanClient) ForceRemoveContainer(containerID string) error { diff --git a/driver.go b/driver.go index dc390a1..32bf1d5 100644 --- a/driver.go +++ b/driver.go @@ -27,6 +27,7 @@ import ( "github.com/hashicorp/nomad/nomad/structs" "github.com/hashicorp/go-hclog" + "github.com/hashicorp/nomad-driver-podman/apiclient" "github.com/hashicorp/nomad-driver-podman/iopodman" "github.com/hashicorp/nomad-driver-podman/version" "github.com/hashicorp/nomad/client/stats" @@ -104,7 +105,8 @@ type Driver struct { logger hclog.Logger // podmanClient encapsulates podman remote calls - podmanClient *PodmanClient + podmanClient *PodmanClient + podmanClient2 *apiclient.APIClient } // TaskState is the state which is encoded in the handle returned in @@ -131,6 +133,7 @@ func NewPodmanDriver(logger hclog.Logger) drivers.DriverPlugin { ctx: ctx, logger: logger.Named("podmanClient"), }, + podmanClient2: apiclient.NewClient("unix:/run/podman/podman.sock"), } } @@ -594,7 +597,7 @@ func (d *Driver) StopTask(taskID string, timeout time.Duration, signal string) e return drivers.ErrTaskNotFound } // fixme send proper signal to container - err := d.podmanClient.StopContainer(handle.containerID, int64(timeout.Seconds())) + err := d.podmanClient2.ContainerStop(d.ctx, handle.containerID, int(timeout.Seconds())) if err != nil { d.logger.Error("Could not stop/kill container", "containerID", handle.containerID, "err", err) return err @@ -617,7 +620,7 @@ func (d *Driver) DestroyTask(taskID string, force bool) error { if handle.isRunning() { d.logger.Info("Have to destroyTask but container is still running", "containerID", handle.containerID) // we can not do anything, so catching the error is useless - err := d.podmanClient.StopContainer(handle.containerID, int64(60)) + err := d.podmanClient2.ContainerStop(d.ctx, handle.containerID, 60) if err != nil { d.logger.Warn("failed to stop/kill container during destroy", "error", err) } From 951c53abacfda0e68766bdede028bb232e2912ab Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Fri, 31 Jul 2020 15:06:26 -0400 Subject: [PATCH 02/31] Implement ContainerStart http api call --- apiclient/container_start.go | 23 +++++++++++++++++++++++ apiclient/container_stop.go | 2 +- client.go | 12 ------------ driver.go | 6 +++--- 4 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 apiclient/container_start.go diff --git a/apiclient/container_start.go b/apiclient/container_start.go new file mode 100644 index 0000000..bd63ac6 --- /dev/null +++ b/apiclient/container_start.go @@ -0,0 +1,23 @@ +package apiclient + +import ( + "context" + "fmt" + "net/http" +) + +// ContainerStart starts a container via id or name +func (c *APIClient) ContainerStart(ctx context.Context, name string) error { + + res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/start", name)) + if err != nil { + return err + } + + defer res.Body.Close() + + if res.StatusCode == http.StatusNoContent { + return nil + } + return fmt.Errorf("unknown error, status code: %d", res.StatusCode) +} diff --git a/apiclient/container_stop.go b/apiclient/container_stop.go index a9678b7..74a3d82 100644 --- a/apiclient/container_stop.go +++ b/apiclient/container_stop.go @@ -19,7 +19,7 @@ func (c *APIClient) ContainerStop(ctx context.Context, name string, timeout int) defer res.Body.Close() - if res.StatusCode != http.StatusNoContent { + if res.StatusCode == http.StatusNoContent { return nil } return fmt.Errorf("unknown error, status code: %d", res.StatusCode) diff --git a/client.go b/client.go index c098f67..40548fa 100644 --- a/client.go +++ b/client.go @@ -182,18 +182,6 @@ func (c *PodmanClient) CreateContainer(createOpts iopodman.Create) (string, erro return ret, err } -// StartContainer starts a created or stopped container. It takes the name or ID of container. It returns -// the container ID once started. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -// error will be returned. -func (c *PodmanClient) StartContainer(containerID string) error { - c.logger.Debug("Starting container", "container", containerID) - err := c.withVarlink(func(varlinkConnection *varlink.Connection) error { - _, err := iopodman.StartContainer().Call(c.ctx, varlinkConnection, containerID) - return err - }) - return err -} - // InspectContainer data takes a name or ID of a container returns the inspection // data as iopodman.InspectContainerData. func (c *PodmanClient) InspectContainer(containerID string) (iopodman.InspectContainerData, error) { diff --git a/driver.go b/driver.go index df839fd..78f7de1 100644 --- a/driver.go +++ b/driver.go @@ -308,7 +308,7 @@ func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error { // are we allowed to restart a stopped container? if d.config.RecoverStopped { d.logger.Debug("Found a stopped container, try to start it", "container", psInfo.Id) - if err = d.podmanClient.StartContainer(psInfo.Id); err != nil { + if err = d.podmanClient2.ContainerStart(d.ctx, psInfo.Id); err != nil { d.logger.Warn("Recovery restart failed", "task", handle.Config.ID, "container", taskState.ContainerID, "err", err) } else { d.logger.Info("Restarted a container during recovery", "container", psInfo.Id) @@ -317,7 +317,7 @@ func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error { } else { // no, let's cleanup here to prepare for a StartTask() d.logger.Debug("Found a stopped container, removing it", "container", psInfo.Id) - if err = d.podmanClient.ForceRemoveContainer(psInfo.Id); err != nil { + if err = d.podmanClient2.ContainerStart(d.ctx, psInfo.Id); err != nil { d.logger.Warn("Recovery cleanup failed", "task", handle.Config.ID, "container", psInfo.Id, "err", err) } h.procState = drivers.TaskStateExited @@ -515,7 +515,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } if !recoverRunningContainer { - if err = d.podmanClient.StartContainer(containerID); err != nil { + if err = d.podmanClient2.ContainerStart(d.ctx, containerID); err != nil { cleanup() return nil, nil, fmt.Errorf("failed to start task, could not start container: %v", err) } From e9d30e1aa8add1a47e92fe033f8b07a6e3412085 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sun, 2 Aug 2020 10:29:18 -0400 Subject: [PATCH 03/31] Implement ContailerDelete http api call --- apiclient/apiclient.go | 9 +++++++++ apiclient/container_delete.go | 24 ++++++++++++++++++++++++ client.go | 11 ----------- driver.go | 6 +++--- 4 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 apiclient/container_delete.go diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index 095dc20..f97fd36 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -54,3 +54,12 @@ func (c *APIClient) Post(ctx context.Context, path string) (*http.Response, erro req = req.WithContext(ctx) return c.Do(req) } + +func (c *APIClient) Delete(ctx context.Context, path string) (*http.Response, error) { + req, err := http.NewRequest("DELETE", c.baseUrl+path, nil) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + return c.Do(req) +} diff --git a/apiclient/container_delete.go b/apiclient/container_delete.go new file mode 100644 index 0000000..d591f59 --- /dev/null +++ b/apiclient/container_delete.go @@ -0,0 +1,24 @@ +package apiclient + +import ( + "context" + "fmt" + "net/http" +) + +// ContainerDelete deletes a container. +// It takes the name or ID of a container. +func (c *APIClient) ContainerDelete(ctx context.Context, name string, force bool, deleteVolumes bool) error { + + res, err := c.Delete(ctx, fmt.Sprintf("/containers/%s?force=%t&v=%t", name, force, deleteVolumes)) + if err != nil { + return err + } + + defer res.Body.Close() + + if res.StatusCode == http.StatusNoContent { + return nil + } + return fmt.Errorf("unknown error, status code: %d", res.StatusCode) +} diff --git a/client.go b/client.go index 40548fa..2c6c893 100644 --- a/client.go +++ b/client.go @@ -96,17 +96,6 @@ func (c *PodmanClient) GetContainerStats(containerID string) (*iopodman.Containe return containerStats, err } -// ForceRemoveContainer requires the name or ID of a container and will stop and remove a container and it's volumes. -// iI container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned. -func (c *PodmanClient) ForceRemoveContainer(containerID string) error { - c.logger.Debug("Removing container", "container", containerID) - err := c.withVarlink(func(varlinkConnection *varlink.Connection) error { - _, err := iopodman.RemoveContainer().Call(c.ctx, varlinkConnection, containerID, true, true) - return err - }) - return err -} - // GetInfo returns a [PodmanInfo](#PodmanInfo) struct that describes podman and its host such as storage stats, // build information of Podman, and system-wide registries func (c *PodmanClient) GetInfo() (*iopodman.PodmanInfo, error) { diff --git a/driver.go b/driver.go index 78f7de1..10ba37a 100644 --- a/driver.go +++ b/driver.go @@ -494,7 +494,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } else { // let's remove the old, dead container d.logger.Info("Detect stopped container with same name, removing it", "task", cfg.ID, "container", otherContainerPs.Id) - if err = d.podmanClient.ForceRemoveContainer(otherContainerPs.Id); err != nil { + if err = d.podmanClient2.ContainerDelete(d.ctx, otherContainerPs.Id, true, true); err != nil { return nil, nil, nstructs.WrapRecoverable(fmt.Sprintf("failed to remove dead container: %v", err), err) } } @@ -509,7 +509,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive cleanup := func() { d.logger.Debug("Cleaning up", "container", containerID) - if err := d.podmanClient.ForceRemoveContainer(containerID); err != nil { + if err := d.podmanClient2.ContainerDelete(d.ctx, containerID, true, true); err != nil { d.logger.Error("failed to clean up from an error in Start", "error", err) } } @@ -628,7 +628,7 @@ func (d *Driver) DestroyTask(taskID string, force bool) error { } if handle.removeContainerOnExit { - err := d.podmanClient.ForceRemoveContainer(handle.containerID) + err := d.podmanClient2.ContainerDelete(d.ctx, handle.containerID, true, true) if err != nil { d.logger.Warn("Could not remove container", "container", handle.containerID, "error", err) } From d0591f2064c5443a89ba5182efa129b71eb6bd6a Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sun, 2 Aug 2020 10:30:13 -0400 Subject: [PATCH 04/31] Switch podman repo to opensuse Start http api service unit --- .github/machinesetup.sh | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/machinesetup.sh b/.github/machinesetup.sh index b2f58a7..03d55d0 100755 --- a/.github/machinesetup.sh +++ b/.github/machinesetup.sh @@ -1,8 +1,8 @@ #!/bin/bash -e -# add podman repository -echo "deb http://ppa.launchpad.net/projectatomic/ppa/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/podman.list -apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 018BA5AD9DF57A4448F0E6CF8BECF1637AD8C79D +# add podman 2.x repository +echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_18.04/ /" | tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_18.04/Release.key | apt-key add - # Ignore apt-get update errors to avoid failing due to misbehaving repo; # true errors would fail in the apt-get install phase @@ -25,37 +25,39 @@ podman info echo "====== Podman version:" podman version -# enable varlink socket (not included in ubuntu package) -cat > /etc/systemd/system/io.podman.service << EOF +# enable http socket (not included in ubuntu package) +cat > /etc/systemd/system/podman.service << EOF [Unit] -Description=Podman Remote API Service -Requires=io.podman.socket -After=io.podman.socket -Documentation=man:podman-varlink(1) +Description=Podman API Service +Requires=podman.socket +After=podman.socket +Documentation=man:podman-system-service(1) +StartLimitIntervalSec=0 [Service] Type=simple -ExecStart=/usr/bin/podman varlink unix:%t/podman/io.podman --timeout=60000 -TimeoutStopSec=30 -KillMode=process +ExecStart=/usr/bin/podman system service [Install] WantedBy=multi-user.target -Also=io.podman.socket +Also=podman.socket EOF -cat > /etc/systemd/system/io.podman.socket << EOF +cat > /etc/systemd/system/podman.socket << EOF [Unit] -Description=Podman Remote API Socket -Documentation=man:podman-varlink(1) +Description=Podman API Socket +Documentation=man:podman-system-service(1) [Socket] -ListenStream=%t/podman/io.podman -SocketMode=0600 +ListenStream=%t/podman/podman.sock +SocketMode=0660 [Install] -WantedBy=sockets.targett +WantedBy=sockets.target EOF systemctl daemon-reload +# enable varlink (until it's fully removed...) systemctl start io.podman +# enable http api +systemctl start podman From de69df037031912445ce52e1f7efefc31c5a3d80 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Tue, 4 Aug 2020 19:38:42 +0200 Subject: [PATCH 05/31] Implement ContainerInspect and SystemInfo http api calls --- apiclient/container_inspect.go | 732 +++++++++++++++++++++++++++++++++ apiclient/system_info.go | 45 ++ client.go | 81 ---- driver.go | 40 +- handle.go | 5 +- 5 files changed, 800 insertions(+), 103 deletions(-) create mode 100644 apiclient/container_inspect.go create mode 100644 apiclient/system_info.go diff --git a/apiclient/container_inspect.go b/apiclient/container_inspect.go new file mode 100644 index 0000000..ca0d70e --- /dev/null +++ b/apiclient/container_inspect.go @@ -0,0 +1,732 @@ +package apiclient + +import ( + "context" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "time" +) + +// ContainerInspect data takes a name or ID of a container returns the inspection data +func (c *APIClient) ContainerInspect(ctx context.Context, name string) (InspectContainerData, error) { + + var inspectData InspectContainerData + + res, err := c.Get(ctx, fmt.Sprintf("/containers/%s/json", name)) + if err != nil { + return inspectData, err + } + + defer res.Body.Close() + + if res.StatusCode != http.StatusOK { + return inspectData, fmt.Errorf("unknown error, status code: %d", res.StatusCode) + } + body, err := ioutil.ReadAll(res.Body) + if err != nil { + return inspectData, err + } + err = json.Unmarshal(body, &inspectData) + if err != nil { + return inspectData, err + } + + return inspectData, nil +} + +// ------------------------------------------------------------------------------------------------------- +// structs copied from https://github.com/containers/podman/blob/master/libpod/define/container_inspect.go +// +// some unused parts are modified/commented out to not pull +// more dependencies and also to overcome some json unmarshall/version problems +// ------------------------------------------------------------------------------------------------------- + +// InspectContainerConfig holds further data about how a container was initially +// configured. +type InspectContainerConfig struct { + // Container hostname + Hostname string `json:"Hostname"` + // Container domain name - unused at present + DomainName string `json:"Domainname"` + // User the container was launched with + User string `json:"User"` + // Unused, at present + AttachStdin bool `json:"AttachStdin"` + // Unused, at present + AttachStdout bool `json:"AttachStdout"` + // Unused, at present + AttachStderr bool `json:"AttachStderr"` + // Whether the container creates a TTY + Tty bool `json:"Tty"` + // Whether the container leaves STDIN open + OpenStdin bool `json:"OpenStdin"` + // Whether STDIN is only left open once. + // Presently not supported by Podman, unused. + StdinOnce bool `json:"StdinOnce"` + // Container environment variables + Env []string `json:"Env"` + // Container command + Cmd []string `json:"Cmd"` + // Container image + Image string `json:"Image"` + // Unused, at present. I've never seen this field populated. + Volumes map[string]struct{} `json:"Volumes"` + // Container working directory + WorkingDir string `json:"WorkingDir"` + // Container entrypoint + // FIXME: was string instead of []string ?? + Entrypoint []string `json:"Entrypoint"` + // On-build arguments - presently unused. More of Buildah's domain. + OnBuild *string `json:"OnBuild"` + // Container labels + Labels map[string]string `json:"Labels"` + // Container annotations + Annotations map[string]string `json:"Annotations"` + // Container stop signal + // FIXME: can not unmarshal, got string "StopSignal": "\u000f", ??? + // StopSignal uint `json:"StopSignal"` + // Configured healthcheck for the container + // Healthcheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"` + // CreateCommand is the full command plus arguments of the process the + // container has been created with. + CreateCommand []string `json:"CreateCommand,omitempty"` + // Timezone is the timezone inside the container. + // Local means it has the same timezone as the host machine + Timezone string `json:"Timezone,omitempty"` + // SystemdMode is whether the container is running in systemd mode. In + // systemd mode, the container configuration is customized to optimize + // running systemd in the container. + SystemdMode bool `json:"SystemdMode,omitempty"` + // Umask is the umask inside the container. + Umask string `json:"Umask,omitempty"` +} + +// InspectRestartPolicy holds information about the container's restart policy. +type InspectRestartPolicy struct { + // Name contains the container's restart policy. + // Allowable values are "no" or "" (take no action), + // "on-failure" (restart on non-zero exit code, with an optional max + // retry count), and "always" (always restart on container stop, unless + // explicitly requested by API). + // Note that this is NOT actually a name of any sort - the poor naming + // is for Docker compatibility. + Name string `json:"Name"` + // MaximumRetryCount is the maximum number of retries allowed if the + // "on-failure" restart policy is in use. Not used if "on-failure" is + // not set. + MaximumRetryCount uint `json:"MaximumRetryCount"` +} + +// InspectLogConfig holds information about a container's configured log driver +// and is presently unused. It is retained for Docker compatibility. +type InspectLogConfig struct { + Type string `json:"Type"` + Config map[string]string `json:"Config"` //idk type, TODO +} + +// InspectBlkioWeightDevice holds information about the relative weight +// of an individual device node. Weights are used in the I/O scheduler to give +// relative priority to some accesses. +type InspectBlkioWeightDevice struct { + // Path is the path to the device this applies to. + Path string `json:"Path"` + // Weight is the relative weight the scheduler will use when scheduling + // I/O. + Weight uint16 `json:"Weight"` +} + +// InspectBlkioThrottleDevice holds information about a speed cap for a device +// node. This cap applies to a specific operation (read, write, etc) on the given +// node. +type InspectBlkioThrottleDevice struct { + // Path is the path to the device this applies to. + Path string `json:"Path"` + // Rate is the maximum rate. It is in either bytes per second or iops + // per second, determined by where it is used - documentation will + // indicate which is appropriate. + Rate uint64 `json:"Rate"` +} + +// InspectUlimit is a ulimit that will be applied to the container. +type InspectUlimit struct { + // Name is the name (type) of the ulimit. + Name string `json:"Name"` + // Soft is the soft limit that will be applied. + Soft uint64 `json:"Soft"` + // Hard is the hard limit that will be applied. + Hard uint64 `json:"Hard"` +} + +// InspectDevice is a single device that will be mounted into the container. +type InspectDevice struct { + // PathOnHost is the path of the device on the host. + PathOnHost string `json:"PathOnHost"` + // PathInContainer is the path of the device within the container. + PathInContainer string `json:"PathInContainer"` + // CgroupPermissions is the permissions of the mounted device. + // Presently not populated. + // TODO. + CgroupPermissions string `json:"CgroupPermissions"` +} + +// InspectHostPort provides information on a port on the host that a container's +// port is bound to. +type InspectHostPort struct { + // IP on the host we are bound to. "" if not specified (binding to all + // IPs). + HostIP string `json:"HostIp"` + // Port on the host we are bound to. No special formatting - just an + // integer stuffed into a string. + HostPort string `json:"HostPort"` +} + +// InspectMount provides a record of a single mount in a container. It contains +// fields for both named and normal volumes. Only user-specified volumes will be +// included, and tmpfs volumes are not included even if the user specified them. +type InspectMount struct { + // Whether the mount is a volume or bind mount. Allowed values are + // "volume" and "bind". + Type string `json:"Type"` + // The name of the volume. Empty for bind mounts. + Name string `json:"Name,omptempty"` + // The source directory for the volume. + Source string `json:"Source"` + // The destination directory for the volume. Specified as a path within + // the container, as it would be passed into the OCI runtime. + Destination string `json:"Destination"` + // The driver used for the named volume. Empty for bind mounts. + Driver string `json:"Driver"` + // Contains SELinux :z/:Z mount options. Unclear what, if anything, else + // goes in here. + Mode string `json:"Mode"` + // All remaining mount options. Additional data, not present in the + // original output. + Options []string `json:"Options"` + // Whether the volume is read-write + RW bool `json:"RW"` + // Mount propagation for the mount. Can be empty if not specified, but + // is always printed - no omitempty. + Propagation string `json:"Propagation"` +} + +// InspectContainerState provides a detailed record of a container's current +// state. It is returned as part of InspectContainerData. +// As with InspectContainerData, many portions of this struct are matched to +// Docker, but here we see more fields that are unused (nonsensical in the +// context of Libpod). +type InspectContainerState struct { + OciVersion string `json:"OciVersion"` + Status string `json:"Status"` + Running bool `json:"Running"` + Paused bool `json:"Paused"` + Restarting bool `json:"Restarting"` // TODO + OOMKilled bool `json:"OOMKilled"` + Dead bool `json:"Dead"` + Pid int `json:"Pid"` + ConmonPid int `json:"ConmonPid,omitempty"` + ExitCode int32 `json:"ExitCode"` + Error string `json:"Error"` // TODO + StartedAt time.Time `json:"StartedAt"` + FinishedAt time.Time `json:"FinishedAt"` + Healthcheck HealthCheckResults `json:"Healthcheck,omitempty"` +} + +// HealthCheckResults describes the results/logs from a healthcheck +type HealthCheckResults struct { + // Status healthy or unhealthy + Status string `json:"Status"` + // FailingStreak is the number of consecutive failed healthchecks + FailingStreak int `json:"FailingStreak"` + // Log describes healthcheck attempts and results + Log []HealthCheckLog `json:"Log"` +} + +// HealthCheckLog describes the results of a single healthcheck +type HealthCheckLog struct { + // Start time as string + Start string `json:"Start"` + // End time as a string + End string `json:"End"` + // Exitcode is 0 or 1 + ExitCode int `json:"ExitCode"` + // Output is the stdout/stderr from the healthcheck command + Output string `json:"Output"` +} + +// InspectContainerHostConfig holds information used when the container was +// created. +// It's very much a Docker-specific struct, retained (mostly) as-is for +// compatibility. We fill individual fields as best as we can, inferring as much +// as possible from the spec and container config. +// Some things cannot be inferred. These will be populated by spec annotations +// (if available). +// Field names are fixed for compatibility and cannot be changed. +// As such, silence lint warnings about them. +//nolint +type InspectContainerHostConfig struct { + // Binds contains an array of user-added mounts. + // Both volume mounts and named volumes are included. + // Tmpfs mounts are NOT included. + // In 'docker inspect' this is separated into 'Binds' and 'Mounts' based + // on how a mount was added. We do not make this distinction and do not + // include a Mounts field in inspect. + // Format: :[:] + Binds []string `json:"Binds"` + // CgroupMode is the configuration of the container's cgroup namespace. + // Populated as follows: + // private - a cgroup namespace has been created + // host - No cgroup namespace created + // container: - Using another container's cgroup namespace + // ns: - A path to a cgroup namespace has been specified + CgroupMode string `json:"CgroupMode"` + // ContainerIDFile is a file created during container creation to hold + // the ID of the created container. + // This is not handled within libpod and is stored in an annotation. + ContainerIDFile string `json:"ContainerIDFile"` + // LogConfig contains information on the container's logging backend + LogConfig *InspectLogConfig `json:"LogConfig"` + // NetworkMode is the configuration of the container's network + // namespace. + // Populated as follows: + // default - A network namespace is being created and configured via CNI + // none - A network namespace is being created, not configured via CNI + // host - No network namespace created + // container: - Using another container's network namespace + // ns: - A path to a network namespace has been specified + NetworkMode string `json:"NetworkMode"` + // PortBindings contains the container's port bindings. + // It is formatted as map[string][]InspectHostPort. + // The string key here is formatted as / + // and represents the container port. A single container port may be + // bound to multiple host ports (on different IPs). + PortBindings map[string][]InspectHostPort `json:"PortBindings"` + // RestartPolicy contains the container's restart policy. + RestartPolicy *InspectRestartPolicy `json:"RestartPolicy"` + // AutoRemove is whether the container will be automatically removed on + // exiting. + // It is not handled directly within libpod and is stored in an + // annotation. + AutoRemove bool `json:"AutoRemove"` + // VolumeDriver is presently unused and is retained for Docker + // compatibility. + VolumeDriver string `json:"VolumeDriver"` + // VolumesFrom is a list of containers which this container uses volumes + // from. This is not handled directly within libpod and is stored in an + // annotation. + // It is formatted as an array of container names and IDs. + VolumesFrom []string `json:"VolumesFrom"` + // CapAdd is a list of capabilities added to the container. + // It is not directly stored by Libpod, and instead computed from the + // capabilities listed in the container's spec, compared against a set + // of default capabilities. + CapAdd []string `json:"CapAdd"` + // CapDrop is a list of capabilities removed from the container. + // It is not directly stored by libpod, and instead computed from the + // capabilities listed in the container's spec, compared against a set + // of default capabilities. + CapDrop []string `json:"CapDrop"` + // Dns is a list of DNS nameservers that will be added to the + // container's resolv.conf + Dns []string `json:"Dns"` + // DnsOptions is a list of DNS options that will be set in the + // container's resolv.conf + DnsOptions []string `json:"DnsOptions"` + // DnsSearch is a list of DNS search domains that will be set in the + // container's resolv.conf + DnsSearch []string `json:"DnsSearch"` + // ExtraHosts contains hosts that will be aded to the container's + // /etc/hosts. + ExtraHosts []string `json:"ExtraHosts"` + // GroupAdd contains groups that the user inside the container will be + // added to. + GroupAdd []string `json:"GroupAdd"` + // IpcMode represents the configuration of the container's IPC + // namespace. + // Populated as follows: + // "" (empty string) - Default, an IPC namespace will be created + // host - No IPC namespace created + // container: - Using another container's IPC namespace + // ns: - A path to an IPC namespace has been specified + IpcMode string `json:"IpcMode"` + // Cgroup contains the container's cgroup. It is presently not + // populated. + // TODO. + Cgroup string `json:"Cgroup"` + // Cgroups contains the container's CGroup mode. + // Allowed values are "default" (container is creating CGroups) and + // "disabled" (container is not creating CGroups). + // This is Libpod-specific and not included in `docker inspect`. + Cgroups string `json:"Cgroups"` + // Links is unused, and provided purely for Docker compatibility. + Links []string `json:"Links"` + // OOMScoreAdj is an adjustment that will be made to the container's OOM + // score. + OomScoreAdj int `json:"OomScoreAdj"` + // PidMode represents the configuration of the container's PID + // namespace. + // Populated as follows: + // "" (empty string) - Default, a PID namespace will be created + // host - No PID namespace created + // container: - Using another container's PID namespace + // ns: - A path to a PID namespace has been specified + PidMode string `json:"PidMode"` + // Privileged indicates whether the container is running with elevated + // privileges. + // This has a very specific meaning in the Docker sense, so it's very + // difficult to decode from the spec and config, and so is stored as an + // annotation. + Privileged bool `json:"Privileged"` + // PublishAllPorts indicates whether image ports are being published. + // This is not directly stored in libpod and is saved as an annotation. + PublishAllPorts bool `json:"PublishAllPorts"` + // ReadonlyRootfs is whether the container will be mounted read-only. + ReadonlyRootfs bool `json:"ReadonlyRootfs"` + // SecurityOpt is a list of security-related options that are set in the + // container. + SecurityOpt []string `json:"SecurityOpt"` + // Tmpfs is a list of tmpfs filesystems that will be mounted into the + // container. + // It is a map of destination path to options for the mount. + Tmpfs map[string]string `json:"Tmpfs"` + // UTSMode represents the configuration of the container's UID + // namespace. + // Populated as follows: + // "" (empty string) - Default, a UTS namespace will be created + // host - no UTS namespace created + // container: - Using another container's UTS namespace + // ns: - A path to a UTS namespace has been specified + UTSMode string `json:"UTSMode"` + // UsernsMode represents the configuration of the container's user + // namespace. + // When running rootless, a user namespace is created outside of libpod + // to allow some privileged operations. This will not be reflected here. + // Populated as follows: + // "" (empty string) - No user namespace will be created + // private - The container will be run in a user namespace + // container: - Using another container's user namespace + // ns: - A path to a user namespace has been specified + // TODO Rootless has an additional 'keep-id' option, presently not + // reflected here. + UsernsMode string `json:"UsernsMode"` + // ShmSize is the size of the container's SHM device. + ShmSize int64 `json:"ShmSize"` + // Runtime is provided purely for Docker compatibility. + // It is set unconditionally to "oci" as Podman does not presently + // support non-OCI runtimes. + Runtime string `json:"Runtime"` + // ConsoleSize is an array of 2 integers showing the size of the + // container's console. + // It is only set if the container is creating a terminal. + // TODO. + ConsoleSize []uint `json:"ConsoleSize"` + // Isolation is presently unused and provided solely for Docker + // compatibility. + Isolation string `json:"Isolation"` + // CpuShares indicates the CPU resources allocated to the container. + // It is a relative weight in the scheduler for assigning CPU time + // versus other CGroups. + CpuShares uint64 `json:"CpuShares"` + // Memory indicates the memory resources allocated to the container. + // This is the limit (in bytes) of RAM the container may use. + Memory int64 `json:"Memory"` + // NanoCpus indicates number of CPUs allocated to the container. + // It is an integer where one full CPU is indicated by 1000000000 (one + // billion). + // Thus, 2.5 CPUs (fractional portions of CPUs are allowed) would be + // 2500000000 (2.5 billion). + // In 'docker inspect' this is set exclusively of two further options in + // the output (CpuPeriod and CpuQuota) which are both used to implement + // this functionality. + // We can't distinguish here, so if CpuQuota is set to the default of + // 100000, we will set both CpuQuota, CpuPeriod, and NanoCpus. If + // CpuQuota is not the default, we will not set NanoCpus. + NanoCpus int64 `json:"NanoCpus"` + // CgroupParent is the CGroup parent of the container. + // Only set if not default. + CgroupParent string `json:"CgroupParent"` + // BlkioWeight indicates the I/O resources allocated to the container. + // It is a relative weight in the scheduler for assigning I/O time + // versus other CGroups. + BlkioWeight uint16 `json:"BlkioWeight"` + // BlkioWeightDevice is an array of I/O resource priorities for + // individual device nodes. + // Unfortunately, the spec only stores the device's Major/Minor numbers + // and not the path, which is used here. + // Fortunately, the kernel provides an interface for retrieving the path + // of a given node by major:minor at /sys/dev/. However, the exact path + // in use may not be what was used in the original CLI invocation - + // though it is guaranteed that the device node will be the same, and + // using the given path will be functionally identical. + BlkioWeightDevice []InspectBlkioWeightDevice `json:"BlkioWeightDevice"` + // BlkioDeviceReadBps is an array of I/O throttle parameters for + // individual device nodes. + // This specifically sets read rate cap in bytes per second for device + // nodes. + // As with BlkioWeightDevice, we pull the path from /sys/dev, and we + // don't guarantee the path will be identical to the original (though + // the node will be). + BlkioDeviceReadBps []InspectBlkioThrottleDevice `json:"BlkioDeviceReadBps"` + // BlkioDeviceWriteBps is an array of I/O throttle parameters for + // individual device nodes. + // this specifically sets write rate cap in bytes per second for device + // nodes. + // as with BlkioWeightDevice, we pull the path from /sys/dev, and we + // don't guarantee the path will be identical to the original (though + // the node will be). + BlkioDeviceWriteBps []InspectBlkioThrottleDevice `json:"BlkioDeviceWriteBps"` + // BlkioDeviceReadIOps is an array of I/O throttle parameters for + // individual device nodes. + // This specifically sets the read rate cap in iops per second for + // device nodes. + // As with BlkioWeightDevice, we pull the path from /sys/dev, and we + // don't guarantee the path will be identical to the original (though + // the node will be). + BlkioDeviceReadIOps []InspectBlkioThrottleDevice `json:"BlkioDeviceReadIOps"` + // BlkioDeviceWriteIOps is an array of I/O throttle parameters for + // individual device nodes. + // This specifically sets the write rate cap in iops per second for + // device nodes. + // As with BlkioWeightDevice, we pull the path from /sys/dev, and we + // don't guarantee the path will be identical to the original (though + // the node will be). + BlkioDeviceWriteIOps []InspectBlkioThrottleDevice `json:"BlkioDeviceWriteIOps"` + // CpuPeriod is the length of a CPU period in microseconds. + // It relates directly to CpuQuota. + CpuPeriod uint64 `json:"CpuPeriod"` + // CpuPeriod is the amount of time (in microseconds) that a container + // can use the CPU in every CpuPeriod. + CpuQuota int64 `json:"CpuQuota"` + // CpuRealtimePeriod is the length of time (in microseconds) of the CPU + // realtime period. If set to 0, no time will be allocated to realtime + // tasks. + CpuRealtimePeriod uint64 `json:"CpuRealtimePeriod"` + // CpuRealtimeRuntime is the length of time (in microseconds) allocated + // for realtime tasks within every CpuRealtimePeriod. + CpuRealtimeRuntime int64 `json:"CpuRealtimeRuntime"` + // CpusetCpus is the is the set of CPUs that the container will execute + // on. Formatted as `0-3` or `0,2`. Default (if unset) is all CPUs. + CpusetCpus string `json:"CpusetCpus"` + // CpusetMems is the set of memory nodes the container will use. + // Formatted as `0-3` or `0,2`. Default (if unset) is all memory nodes. + CpusetMems string `json:"CpusetMems"` + // Devices is a list of device nodes that will be added to the + // container. + // These are stored in the OCI spec only as type, major, minor while we + // display the host path. We convert this with /sys/dev, but we cannot + // guarantee that the host path will be identical - only that the actual + // device will be. + Devices []InspectDevice `json:"Devices"` + // DiskQuota is the maximum amount of disk space the container may use + // (in bytes). + // Presently not populated. + // TODO. + DiskQuota uint64 `json:"DiskQuota"` + // KernelMemory is the maximum amount of memory the kernel will devote + // to the container. + KernelMemory int64 `json:"KernelMemory"` + // MemoryReservation is the reservation (soft limit) of memory available + // to the container. Soft limits are warnings only and can be exceeded. + MemoryReservation int64 `json:"MemoryReservation"` + // MemorySwap is the total limit for all memory available to the + // container, including swap. 0 indicates that there is no limit to the + // amount of memory available. + MemorySwap int64 `json:"MemorySwap"` + // MemorySwappiness is the willingness of the kernel to page container + // memory to swap. It is an integer from 0 to 100, with low numbers + // being more likely to be put into swap. + // -1, the default, will not set swappiness and use the system defaults. + MemorySwappiness int64 `json:"MemorySwappiness"` + // OomKillDisable indicates whether the kernel OOM killer is disabled + // for the container. + OomKillDisable bool `json:"OomKillDisable"` + // Init indicates whether the container has an init mounted into it. + Init bool `json:"Init,omitempty"` + // PidsLimit is the maximum number of PIDs what may be created within + // the container. 0, the default, indicates no limit. + PidsLimit int64 `json:"PidsLimit"` + // Ulimits is a set of ulimits that will be set within the container. + Ulimits []InspectUlimit `json:"Ulimits"` + // CpuCount is Windows-only and not presently implemented. + CpuCount uint64 `json:"CpuCount"` + // CpuPercent is Windows-only and not presently implemented. + CpuPercent uint64 `json:"CpuPercent"` + // IOMaximumIOps is Windows-only and not presently implemented. + IOMaximumIOps uint64 `json:"IOMaximumIOps"` + // IOMaximumBandwidth is Windows-only and not presently implemented. + IOMaximumBandwidth uint64 `json:"IOMaximumBandwidth"` +} + +// InspectBasicNetworkConfig holds basic configuration information (e.g. IP +// addresses, MAC address, subnet masks, etc) that are common for all networks +// (both additional and main). +type InspectBasicNetworkConfig struct { + // EndpointID is unused, maintained exclusively for compatibility. + EndpointID string `json:"EndpointID"` + // Gateway is the IP address of the gateway this network will use. + Gateway string `json:"Gateway"` + // IPAddress is the IP address for this network. + IPAddress string `json:"IPAddress"` + // IPPrefixLen is the length of the subnet mask of this network. + IPPrefixLen int `json:"IPPrefixLen"` + // SecondaryIPAddresses is a list of extra IP Addresses that the + // container has been assigned in this network. + SecondaryIPAddresses []string `json:"SecondaryIPAddresses,omitempty"` + // IPv6Gateway is the IPv6 gateway this network will use. + IPv6Gateway string `json:"IPv6Gateway"` + // GlobalIPv6Address is the global-scope IPv6 Address for this network. + GlobalIPv6Address string `json:"GlobalIPv6Address"` + // GlobalIPv6PrefixLen is the length of the subnet mask of this network. + GlobalIPv6PrefixLen int `json:"GlobalIPv6PrefixLen"` + // SecondaryIPv6Addresses is a list of extra IPv6 Addresses that the + // container has been assigned in this networ. + SecondaryIPv6Addresses []string `json:"SecondaryIPv6Addresses,omitempty"` + // MacAddress is the MAC address for the interface in this network. + MacAddress string `json:"MacAddress"` + // AdditionalMacAddresses is a set of additional MAC Addresses beyond + // the first. CNI may configure more than one interface for a single + // network, which can cause this. + AdditionalMacAddresses []string `json:"AdditionalMACAddresses,omitempty"` +} + +// InspectAdditionalNetwork holds information about non-default CNI networks the +// container has been connected to. +// As with InspectNetworkSettings, many fields are unused and maintained only +// for compatibility with Docker. +type InspectAdditionalNetwork struct { + InspectBasicNetworkConfig + + // Name of the network we're connecting to. + NetworkID string `json:"NetworkID,omitempty"` + // DriverOpts is presently unused and maintained exclusively for + // compatibility. + DriverOpts map[string]string `json:"DriverOpts"` + // IPAMConfig is presently unused and maintained exclusively for + // compatibility. + IPAMConfig map[string]string `json:"IPAMConfig"` + // Links is presently unused and maintained exclusively for + // compatibility. + Links []string `json:"Links"` +} + +// InspectNetworkSettings holds information about the network settings of the +// container. +// Many fields are maintained only for compatibility with `docker inspect` and +// are unused within Libpod. +type InspectNetworkSettings struct { + InspectBasicNetworkConfig + + Bridge string `json:"Bridge"` + SandboxID string `json:"SandboxID"` + HairpinMode bool `json:"HairpinMode"` + LinkLocalIPv6Address string `json:"LinkLocalIPv6Address"` + LinkLocalIPv6PrefixLen int `json:"LinkLocalIPv6PrefixLen"` + Ports map[string][]InspectHostPort `json:"Ports"` + SandboxKey string `json:"SandboxKey"` + // Networks contains information on non-default CNI networks this + // container has joined. + // It is a map of network name to network information. + Networks map[string]*InspectAdditionalNetwork `json:"Networks,omitempty"` +} + +// InspectContainerData provides a detailed record of a container's configuration +// and state as viewed by Libpod. +// Large portions of this structure are defined such that the output is +// compatible with `docker inspect` JSON, but additional fields have been added +// as required to share information not in the original output. +type InspectContainerData struct { + ID string `json:"Id"` + // FIXME can not parse date/time: "Created": "2020-07-05 11:32:38.541987006 -0400 -0400", + //Created time.Time `json:"Created"` + Path string `json:"Path"` + Args []string `json:"Args"` + State *InspectContainerState `json:"State"` + Image string `json:"Image"` + ImageName string `json:"ImageName"` + Rootfs string `json:"Rootfs"` + Pod string `json:"Pod"` + ResolvConfPath string `json:"ResolvConfPath"` + HostnamePath string `json:"HostnamePath"` + HostsPath string `json:"HostsPath"` + StaticDir string `json:"StaticDir"` + OCIConfigPath string `json:"OCIConfigPath,omitempty"` + OCIRuntime string `json:"OCIRuntime,omitempty"` + LogPath string `json:"LogPath"` + LogTag string `json:"LogTag"` + ConmonPidFile string `json:"ConmonPidFile"` + Name string `json:"Name"` + RestartCount int32 `json:"RestartCount"` + Driver string `json:"Driver"` + MountLabel string `json:"MountLabel"` + ProcessLabel string `json:"ProcessLabel"` + AppArmorProfile string `json:"AppArmorProfile"` + EffectiveCaps []string `json:"EffectiveCaps"` + BoundingCaps []string `json:"BoundingCaps"` + ExecIDs []string `json:"ExecIDs"` + //GraphDriver *driver.Data `json:"GraphDriver"` + SizeRw *int64 `json:"SizeRw,omitempty"` + SizeRootFs int64 `json:"SizeRootFs,omitempty"` + Mounts []InspectMount `json:"Mounts"` + Dependencies []string `json:"Dependencies"` + NetworkSettings *InspectNetworkSettings `json:"NetworkSettings"` //TODO + ExitCommand []string `json:"ExitCommand"` + Namespace string `json:"Namespace"` + IsInfra bool `json:"IsInfra"` + Config *InspectContainerConfig `json:"Config"` + HostConfig *InspectContainerHostConfig `json:"HostConfig"` +} + +// InspectExecSession contains information about a given exec session. +type InspectExecSession struct { + // CanRemove is legacy and used purely for compatibility reasons. + // Will always be set to true, unless the exec session is running. + CanRemove bool `json:"CanRemove"` + // ContainerID is the ID of the container this exec session is attached + // to. + ContainerID string `json:"ContainerID"` + // DetachKeys are the detach keys used by the exec session. + // If set to "" the default keys are being used. + // Will show "" if no detach keys are set. + DetachKeys string `json:"DetachKeys"` + // ExitCode is the exit code of the exec session. Will be set to 0 if + // the exec session has not yet exited. + ExitCode int `json:"ExitCode"` + // ID is the ID of the exec session. + ID string `json:"ID"` + // OpenStderr is whether the container's STDERR stream will be attached. + // Always set to true if the exec session created a TTY. + OpenStderr bool `json:"OpenStderr"` + // OpenStdin is whether the container's STDIN stream will be attached + // to. + OpenStdin bool `json:"OpenStdin"` + // OpenStdout is whether the container's STDOUT stream will be attached. + // Always set to true if the exec session created a TTY. + OpenStdout bool `json:"OpenStdout"` + // Running is whether the exec session is running. + Running bool `json:"Running"` + // Pid is the PID of the exec session's process. + // Will be set to 0 if the exec session is not running. + Pid int `json:"Pid"` + // ProcessConfig contains information about the exec session's process. + ProcessConfig *InspectExecProcess `json:"ProcessConfig"` +} + +// InspectExecProcess contains information about the process in a given exec +// session. +type InspectExecProcess struct { + // Arguments are the arguments to the entrypoint command of the exec + // session. + Arguments []string `json:"arguments"` + // Entrypoint is the entrypoint for the exec session (the command that + // will be executed in the container). + // FIXME: was string instead of []string ?? + Entrypoint []string `json:"entrypoint"` + // Privileged is whether the exec session will be started with elevated + // privileges. + Privileged bool `json:"privileged"` + // Tty is whether the exec session created a terminal. + Tty bool `json:"tty"` + // User is the user the exec session was started as. + User string `json:"user"` +} diff --git a/apiclient/system_info.go b/apiclient/system_info.go new file mode 100644 index 0000000..8c99d88 --- /dev/null +++ b/apiclient/system_info.go @@ -0,0 +1,45 @@ +package apiclient + +import ( + "context" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" +) + +// SystemInfo returns information on the system and libpod configuration +func (c *APIClient) SystemInfo(ctx context.Context) (Info, error) { + + var infoData Info + + // the libpod/info endpoint seems to have some trouble + // using "compat" endpoint and minimal struct + // until podman returns proper data. + res, err := c.Get(ctx, fmt.Sprintf("/info")) + if err != nil { + return infoData, err + } + + defer res.Body.Close() + + if res.StatusCode != http.StatusOK { + return infoData, fmt.Errorf("unknown error, status code: %d", res.StatusCode) + } + body, err := ioutil.ReadAll(res.Body) + if err != nil { + return infoData, err + } + err = json.Unmarshal(body, &infoData) + if err != nil { + return infoData, err + } + + return infoData, nil +} + +// for now, we only use the podman version, so it's enough to +// declare this tiny struct +type Info struct { + Version string `json:"ServerVersion"` +} diff --git a/client.go b/client.go index 2c6c893..2e71532 100644 --- a/client.go +++ b/client.go @@ -96,67 +96,6 @@ func (c *PodmanClient) GetContainerStats(containerID string) (*iopodman.Containe return containerStats, err } -// GetInfo returns a [PodmanInfo](#PodmanInfo) struct that describes podman and its host such as storage stats, -// build information of Podman, and system-wide registries -func (c *PodmanClient) GetInfo() (*iopodman.PodmanInfo, error) { - var ret *iopodman.PodmanInfo - c.logger.Debug("Get podman info") - err := c.withVarlink(func(varlinkConnection *varlink.Connection) error { - result, err := iopodman.GetInfo().Call(c.ctx, varlinkConnection) - ret = &result - return err - }) - return ret, err -} - -// PsID returns a PsContainer struct that describes the process state of exactly -// one container. -func (c *PodmanClient) PsID(containerID string) (*iopodman.PsContainer, error) { - filters := []string{"id=" + containerID} - psInfo, err := c.Ps(filters) - if err == nil { - if len(psInfo) == 1 { - return &psInfo[0], nil - } else { - return nil, fmt.Errorf("No such container: %s", containerID) - } - } - return nil, err -} - -// PsByName returns a PsContainer struct that describes the process state of exactly -// one container. -func (c *PodmanClient) PsByName(containerName string) (*iopodman.PsContainer, error) { - filters := []string{"name=" + containerName} - psInfo, err := c.Ps(filters) - if err == nil { - if len(psInfo) == 1 { - return &psInfo[0], nil - } else { - return nil, fmt.Errorf("No such container: %s", containerName) - } - } - return nil, err -} - -// Ps finds process info for one or more containers by applying a filter -func (c *PodmanClient) Ps(filters []string) ([]iopodman.PsContainer, error) { - var ret []iopodman.PsContainer - c.logger.Debug("Get container list", "filters", filters) - psOpts := iopodman.PsOpts{ - Filters: &filters, - All: true, - } - err := c.withVarlink(func(varlinkConnection *varlink.Connection) error { - result, err := iopodman.Ps().Call(c.ctx, varlinkConnection, psOpts) - if err == nil { - ret = result - } - return err - }) - return ret, err -} - // CreateContainer creates a new container from an image. It uses a [Create](#Create) type for input. func (c *PodmanClient) CreateContainer(createOpts iopodman.Create) (string, error) { ret := "" @@ -171,26 +110,6 @@ func (c *PodmanClient) CreateContainer(createOpts iopodman.Create) (string, erro return ret, err } -// InspectContainer data takes a name or ID of a container returns the inspection -// data as iopodman.InspectContainerData. -func (c *PodmanClient) InspectContainer(containerID string) (iopodman.InspectContainerData, error) { - var ret iopodman.InspectContainerData - c.logger.Debug("Inspect container", "container", containerID) - err := c.withVarlink(func(varlinkConnection *varlink.Connection) error { - inspectJSON, err := iopodman.InspectContainer().Call(c.ctx, varlinkConnection, containerID) - if err == nil { - err = json.Unmarshal([]byte(inspectJSON), &ret) - if err != nil { - c.logger.Error("failed to unmarshal inspect container", "err", err) - return err - } - - } - return err - }) - return ret, err -} - // PullImage takes a name or ID of an image and pulls it to local storage // returning the name of the image pulled func (c *PodmanClient) PullImage(imageID string) (string, error) { diff --git a/driver.go b/driver.go index 10ba37a..f6d3dc5 100644 --- a/driver.go +++ b/driver.go @@ -240,7 +240,7 @@ func (d *Driver) buildFingerprint() *drivers.Fingerprint { desc = "disabled" // try to connect and get version info - info, err := d.podmanClient.GetInfo() + info, err := d.podmanClient2.SystemInfo(d.ctx) if err != nil { d.logger.Error("Could not get podman info", "err", err) } else { @@ -249,7 +249,7 @@ func (d *Driver) buildFingerprint() *drivers.Fingerprint { desc = "ready" // TODO: we would have more data here... maybe we can return more details to nomad attrs["driver.podman"] = pstructs.NewBoolAttribute(true) - attrs["driver.podman.version"] = pstructs.NewStringAttribute(info.Podman.Podman_version) + attrs["driver.podman.version"] = pstructs.NewStringAttribute(info.Version) } return &drivers.Fingerprint{ @@ -279,7 +279,7 @@ func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error { } d.logger.Debug("Checking for recoverable task", "task", handle.Config.Name, "taskid", handle.Config.ID, "container", taskState.ContainerID) - psInfo, err := d.podmanClient.PsID(taskState.ContainerID) + inspectData, err := d.podmanClient2.ContainerInspect(d.ctx, taskState.ContainerID) if err != nil { d.logger.Warn("Recovery lookup failed", "task", handle.Config.ID, "container", taskState.ContainerID, "err", err) return nil @@ -301,29 +301,29 @@ func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error { removeContainerOnExit: d.config.GC.Container, } - if psInfo.State == "running" { - d.logger.Info("Recovered a still running container", "container", psInfo.Id) + if inspectData.State.Running { + d.logger.Info("Recovered a still running container", "container", inspectData.State.Pid) h.procState = drivers.TaskStateRunning - } else if psInfo.State == "exited" { + } else if inspectData.State.Status == "exited" { // are we allowed to restart a stopped container? if d.config.RecoverStopped { - d.logger.Debug("Found a stopped container, try to start it", "container", psInfo.Id) - if err = d.podmanClient2.ContainerStart(d.ctx, psInfo.Id); err != nil { + d.logger.Debug("Found a stopped container, try to start it", "container", inspectData.State.Pid) + if err = d.podmanClient2.ContainerStart(d.ctx, inspectData.ID); err != nil { d.logger.Warn("Recovery restart failed", "task", handle.Config.ID, "container", taskState.ContainerID, "err", err) } else { - d.logger.Info("Restarted a container during recovery", "container", psInfo.Id) + d.logger.Info("Restarted a container during recovery", "container", inspectData.ID) h.procState = drivers.TaskStateRunning } } else { // no, let's cleanup here to prepare for a StartTask() - d.logger.Debug("Found a stopped container, removing it", "container", psInfo.Id) - if err = d.podmanClient2.ContainerStart(d.ctx, psInfo.Id); err != nil { - d.logger.Warn("Recovery cleanup failed", "task", handle.Config.ID, "container", psInfo.Id, "err", err) + d.logger.Debug("Found a stopped container, removing it", "container", inspectData.ID) + if err = d.podmanClient2.ContainerStart(d.ctx, inspectData.ID); err != nil { + d.logger.Warn("Recovery cleanup failed", "task", handle.Config.ID, "container", inspectData.ID) } h.procState = drivers.TaskStateExited } } else { - d.logger.Warn("Recovery restart failed, unknown container state", "state", psInfo.State, "container", taskState.ContainerID) + d.logger.Warn("Recovery restart failed, unknown container state", "state", inspectData.State.Status, "container", taskState.ContainerID) h.procState = drivers.TaskStateUnknown } @@ -483,18 +483,18 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive containerID := "" recoverRunningContainer := false // check if there is a container with same name - otherContainerPs, err := d.podmanClient.PsByName(containerName) + otherContainerInspect, err := d.podmanClient2.ContainerInspect(d.ctx, containerName) if err == nil { // ok, seems we found a container with similar name - if otherContainerPs.State == "running" { + if otherContainerInspect.State.Running { // it's still running. So let's use it instead of creating a new one - d.logger.Info("Detect running container with same name, we reuse it", "task", cfg.ID, "container", otherContainerPs.Id) - containerID = otherContainerPs.Id + d.logger.Info("Detect running container with same name, we reuse it", "task", cfg.ID, "container", otherContainerInspect.ID) + containerID = otherContainerInspect.ID recoverRunningContainer = true } else { // let's remove the old, dead container - d.logger.Info("Detect stopped container with same name, removing it", "task", cfg.ID, "container", otherContainerPs.Id) - if err = d.podmanClient2.ContainerDelete(d.ctx, otherContainerPs.Id, true, true); err != nil { + d.logger.Info("Detect stopped container with same name, removing it", "task", cfg.ID, "container", otherContainerInspect.ID) + if err = d.podmanClient2.ContainerDelete(d.ctx, otherContainerInspect.ID, true, true); err != nil { return nil, nil, nstructs.WrapRecoverable(fmt.Sprintf("failed to remove dead container: %v", err), err) } } @@ -521,7 +521,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } } - inspectData, err := d.podmanClient.InspectContainer(containerID) + inspectData, err := d.podmanClient2.ContainerInspect(d.ctx, containerID) if err != nil { d.logger.Error("failed to inspect container", "err", err) cleanup() diff --git a/handle.go b/handle.go index 0d4f52e..685410d 100644 --- a/handle.go +++ b/handle.go @@ -177,12 +177,11 @@ func (h *TaskHandle) runContainerMonitor() { } containerStats, err := h.driver.podmanClient.GetContainerStats(h.containerID) - h.logger.Trace("Container stats", "container", h.containerID, "stats", containerStats) if err != nil { if _, ok := err.(*iopodman.NoContainerRunning); ok { h.logger.Debug("Container is not running anymore", "container", h.containerID) // container was stopped, get exit code and other post mortem infos - inspectData, err := h.driver.podmanClient.InspectContainer(h.containerID) + inspectData, err := h.driver.podmanClient2.ContainerInspect(h.driver.ctx, h.containerID) h.stateLock.Lock() if err != nil { h.exitResult.Err = fmt.Errorf("Driver was unable to get the exit code. %s: %v", h.containerID, err) @@ -211,6 +210,8 @@ func (h *TaskHandle) runContainerMonitor() { // fall into the "TaskStateExited" case h.logger.Debug("Could not get container stats, unknown error", "err", fmt.Sprintf("%#v", err)) continue + } else { + h.logger.Trace("Container stats", "container", h.containerID, "stats", containerStats) } h.stateLock.Lock() From ab0bcba2b891928d490b5b837681817e5423b1ad Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Wed, 5 Aug 2020 08:04:56 +0200 Subject: [PATCH 06/31] Linter --- apiclient/container_inspect.go | 124 +++++++++++++++++---------------- apiclient/system_info.go | 2 +- 2 files changed, 64 insertions(+), 62 deletions(-) diff --git a/apiclient/container_inspect.go b/apiclient/container_inspect.go index ca0d70e..2a96418 100644 --- a/apiclient/container_inspect.go +++ b/apiclient/container_inspect.go @@ -41,6 +41,8 @@ func (c *APIClient) ContainerInspect(ctx context.Context, name string) (InspectC // // some unused parts are modified/commented out to not pull // more dependencies and also to overcome some json unmarshall/version problems +// +// some fields are reordert to make the linter happy (bytes maligned complains) // ------------------------------------------------------------------------------------------------------- // InspectContainerConfig holds further data about how a container was initially @@ -52,19 +54,6 @@ type InspectContainerConfig struct { DomainName string `json:"Domainname"` // User the container was launched with User string `json:"User"` - // Unused, at present - AttachStdin bool `json:"AttachStdin"` - // Unused, at present - AttachStdout bool `json:"AttachStdout"` - // Unused, at present - AttachStderr bool `json:"AttachStderr"` - // Whether the container creates a TTY - Tty bool `json:"Tty"` - // Whether the container leaves STDIN open - OpenStdin bool `json:"OpenStdin"` - // Whether STDIN is only left open once. - // Presently not supported by Podman, unused. - StdinOnce bool `json:"StdinOnce"` // Container environment variables Env []string `json:"Env"` // Container command @@ -95,12 +84,25 @@ type InspectContainerConfig struct { // Timezone is the timezone inside the container. // Local means it has the same timezone as the host machine Timezone string `json:"Timezone,omitempty"` + // Umask is the umask inside the container. + Umask string `json:"Umask,omitempty"` // SystemdMode is whether the container is running in systemd mode. In // systemd mode, the container configuration is customized to optimize // running systemd in the container. SystemdMode bool `json:"SystemdMode,omitempty"` - // Umask is the umask inside the container. - Umask string `json:"Umask,omitempty"` + // Unused, at present + AttachStdin bool `json:"AttachStdin"` + // Unused, at present + AttachStdout bool `json:"AttachStdout"` + // Unused, at present + AttachStderr bool `json:"AttachStderr"` + // Whether the container creates a TTY + Tty bool `json:"Tty"` + // Whether the container leaves STDIN open + OpenStdin bool `json:"OpenStdin"` + // Whether STDIN is only left open once. + // Presently not supported by Podman, unused. + StdinOnce bool `json:"StdinOnce"` } // InspectRestartPolicy holds information about the container's restart policy. @@ -190,7 +192,7 @@ type InspectMount struct { // "volume" and "bind". Type string `json:"Type"` // The name of the volume. Empty for bind mounts. - Name string `json:"Name,omptempty"` + Name string `json:"Name,omitempty"` // The source directory for the volume. Source string `json:"Source"` // The destination directory for the volume. Specified as a path within @@ -636,52 +638,51 @@ type InspectNetworkSettings struct { // compatible with `docker inspect` JSON, but additional fields have been added // as required to share information not in the original output. type InspectContainerData struct { - ID string `json:"Id"` - // FIXME can not parse date/time: "Created": "2020-07-05 11:32:38.541987006 -0400 -0400", - //Created time.Time `json:"Created"` - Path string `json:"Path"` - Args []string `json:"Args"` - State *InspectContainerState `json:"State"` - Image string `json:"Image"` - ImageName string `json:"ImageName"` - Rootfs string `json:"Rootfs"` - Pod string `json:"Pod"` - ResolvConfPath string `json:"ResolvConfPath"` - HostnamePath string `json:"HostnamePath"` - HostsPath string `json:"HostsPath"` - StaticDir string `json:"StaticDir"` - OCIConfigPath string `json:"OCIConfigPath,omitempty"` - OCIRuntime string `json:"OCIRuntime,omitempty"` - LogPath string `json:"LogPath"` - LogTag string `json:"LogTag"` - ConmonPidFile string `json:"ConmonPidFile"` - Name string `json:"Name"` - RestartCount int32 `json:"RestartCount"` - Driver string `json:"Driver"` - MountLabel string `json:"MountLabel"` - ProcessLabel string `json:"ProcessLabel"` - AppArmorProfile string `json:"AppArmorProfile"` - EffectiveCaps []string `json:"EffectiveCaps"` - BoundingCaps []string `json:"BoundingCaps"` - ExecIDs []string `json:"ExecIDs"` - //GraphDriver *driver.Data `json:"GraphDriver"` - SizeRw *int64 `json:"SizeRw,omitempty"` - SizeRootFs int64 `json:"SizeRootFs,omitempty"` + State *InspectContainerState `json:"State"` Mounts []InspectMount `json:"Mounts"` - Dependencies []string `json:"Dependencies"` NetworkSettings *InspectNetworkSettings `json:"NetworkSettings"` //TODO - ExitCommand []string `json:"ExitCommand"` - Namespace string `json:"Namespace"` - IsInfra bool `json:"IsInfra"` Config *InspectContainerConfig `json:"Config"` HostConfig *InspectContainerHostConfig `json:"HostConfig"` + ID string `json:"Id"` + // FIXME can not parse date/time: "Created": "2020-07-05 11:32:38.541987006 -0400 -0400", + //Created time.Time `json:"Created"` + Path string `json:"Path"` + Args []string `json:"Args"` + Image string `json:"Image"` + ImageName string `json:"ImageName"` + Rootfs string `json:"Rootfs"` + Pod string `json:"Pod"` + ResolvConfPath string `json:"ResolvConfPath"` + HostnamePath string `json:"HostnamePath"` + HostsPath string `json:"HostsPath"` + StaticDir string `json:"StaticDir"` + OCIConfigPath string `json:"OCIConfigPath,omitempty"` + OCIRuntime string `json:"OCIRuntime,omitempty"` + LogPath string `json:"LogPath"` + LogTag string `json:"LogTag"` + ConmonPidFile string `json:"ConmonPidFile"` + Name string `json:"Name"` + Driver string `json:"Driver"` + MountLabel string `json:"MountLabel"` + ProcessLabel string `json:"ProcessLabel"` + AppArmorProfile string `json:"AppArmorProfile"` + EffectiveCaps []string `json:"EffectiveCaps"` + BoundingCaps []string `json:"BoundingCaps"` + ExecIDs []string `json:"ExecIDs"` + Dependencies []string `json:"Dependencies"` + ExitCommand []string `json:"ExitCommand"` + Namespace string `json:"Namespace"` + //GraphDriver *driver.Data `json:"GraphDriver"` + SizeRw *int64 `json:"SizeRw,omitempty"` + SizeRootFs int64 `json:"SizeRootFs,omitempty"` + RestartCount int32 `json:"RestartCount"` + IsInfra bool `json:"IsInfra"` } // InspectExecSession contains information about a given exec session. type InspectExecSession struct { - // CanRemove is legacy and used purely for compatibility reasons. - // Will always be set to true, unless the exec session is running. - CanRemove bool `json:"CanRemove"` + // ProcessConfig contains information about the exec session's process. + ProcessConfig *InspectExecProcess `json:"ProcessConfig"` // ContainerID is the ID of the container this exec session is attached // to. ContainerID string `json:"ContainerID"` @@ -689,11 +690,17 @@ type InspectExecSession struct { // If set to "" the default keys are being used. // Will show "" if no detach keys are set. DetachKeys string `json:"DetachKeys"` + // ID is the ID of the exec session. + ID string `json:"ID"` // ExitCode is the exit code of the exec session. Will be set to 0 if // the exec session has not yet exited. ExitCode int `json:"ExitCode"` - // ID is the ID of the exec session. - ID string `json:"ID"` + // Pid is the PID of the exec session's process. + // Will be set to 0 if the exec session is not running. + Pid int `json:"Pid"` + // CanRemove is legacy and used purely for compatibility reasons. + // Will always be set to true, unless the exec session is running. + CanRemove bool `json:"CanRemove"` // OpenStderr is whether the container's STDERR stream will be attached. // Always set to true if the exec session created a TTY. OpenStderr bool `json:"OpenStderr"` @@ -705,11 +712,6 @@ type InspectExecSession struct { OpenStdout bool `json:"OpenStdout"` // Running is whether the exec session is running. Running bool `json:"Running"` - // Pid is the PID of the exec session's process. - // Will be set to 0 if the exec session is not running. - Pid int `json:"Pid"` - // ProcessConfig contains information about the exec session's process. - ProcessConfig *InspectExecProcess `json:"ProcessConfig"` } // InspectExecProcess contains information about the process in a given exec diff --git a/apiclient/system_info.go b/apiclient/system_info.go index 8c99d88..d088d29 100644 --- a/apiclient/system_info.go +++ b/apiclient/system_info.go @@ -16,7 +16,7 @@ func (c *APIClient) SystemInfo(ctx context.Context) (Info, error) { // the libpod/info endpoint seems to have some trouble // using "compat" endpoint and minimal struct // until podman returns proper data. - res, err := c.Get(ctx, fmt.Sprintf("/info")) + res, err := c.Get(ctx, "/info") if err != nil { return infoData, err } From 5d363e6f1675250ae3cdfb0cd73634b2559e1ebc Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Thu, 6 Aug 2020 08:16:44 +0200 Subject: [PATCH 07/31] License headers --- apiclient/apiclient.go | 16 ++++++++++++++++ apiclient/container_delete.go | 16 ++++++++++++++++ apiclient/container_inspect.go | 16 ++++++++++++++++ apiclient/container_start.go | 16 ++++++++++++++++ apiclient/container_stop.go | 16 ++++++++++++++++ apiclient/system_info.go | 16 ++++++++++++++++ 6 files changed, 96 insertions(+) diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index f97fd36..564fff4 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -1,3 +1,19 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package apiclient import ( diff --git a/apiclient/container_delete.go b/apiclient/container_delete.go index d591f59..46d90ea 100644 --- a/apiclient/container_delete.go +++ b/apiclient/container_delete.go @@ -1,3 +1,19 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package apiclient import ( diff --git a/apiclient/container_inspect.go b/apiclient/container_inspect.go index 2a96418..4f8bba0 100644 --- a/apiclient/container_inspect.go +++ b/apiclient/container_inspect.go @@ -1,3 +1,19 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package apiclient import ( diff --git a/apiclient/container_start.go b/apiclient/container_start.go index bd63ac6..9df67d2 100644 --- a/apiclient/container_start.go +++ b/apiclient/container_start.go @@ -1,3 +1,19 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package apiclient import ( diff --git a/apiclient/container_stop.go b/apiclient/container_stop.go index 74a3d82..03d079b 100644 --- a/apiclient/container_stop.go +++ b/apiclient/container_stop.go @@ -1,3 +1,19 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package apiclient import ( diff --git a/apiclient/system_info.go b/apiclient/system_info.go index d088d29..6904edd 100644 --- a/apiclient/system_info.go +++ b/apiclient/system_info.go @@ -1,3 +1,19 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package apiclient import ( From 4ac65cfc710fcc4cb3a68fe4b060ff3953eb51f0 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Fri, 28 Aug 2020 10:15:42 +0200 Subject: [PATCH 08/31] linter, fmt --- client_test.go | 12 ++++++------ driver.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client_test.go b/client_test.go index 6f4898a..fbd7aac 100644 --- a/client_test.go +++ b/client_test.go @@ -17,13 +17,13 @@ limitations under the License. package main import ( + "github.com/stretchr/testify/require" "os/user" "testing" - "github.com/stretchr/testify/require" ) func TestClient_GuessSocketPathForRootCgroupV1(t *testing.T) { - u := user.User { Uid: "0" } + u := user.User{Uid: "0"} fs := []string{"nodev cgroup"} p := guessSocketPath(&u, fs) @@ -31,7 +31,7 @@ func TestClient_GuessSocketPathForRootCgroupV1(t *testing.T) { } func TestClient_GuessSocketPathForRootCgroupV2(t *testing.T) { - u := user.User { Uid: "0" } + u := user.User{Uid: "0"} fs := []string{"nodev cgroup2"} p := guessSocketPath(&u, fs) @@ -39,7 +39,7 @@ func TestClient_GuessSocketPathForRootCgroupV2(t *testing.T) { } func TestClient_GuessSocketPathForUserCgroupV1(t *testing.T) { - u := user.User { Uid: "1000" } + u := user.User{Uid: "1000"} fs := []string{"nodev cgroup"} p := guessSocketPath(&u, fs) @@ -47,7 +47,7 @@ func TestClient_GuessSocketPathForUserCgroupV1(t *testing.T) { } func TestClient_GuessSocketPathForUserCgroupV2_1(t *testing.T) { - u := user.User { Uid: "1000" } + u := user.User{Uid: "1000"} fs := []string{"nodev cgroup2"} p := guessSocketPath(&u, fs) @@ -55,7 +55,7 @@ func TestClient_GuessSocketPathForUserCgroupV2_1(t *testing.T) { } func TestClient_GuessSocketPathForUserCgroupV2_2(t *testing.T) { - u := user.User { Uid: "1337" } + u := user.User{Uid: "1337"} fs := []string{"nodev cgroup2"} p := guessSocketPath(&u, fs) diff --git a/driver.go b/driver.go index 9c4c738..2ccb028 100644 --- a/driver.go +++ b/driver.go @@ -19,7 +19,6 @@ package main import ( "context" "fmt" - "github.com/hashicorp/consul-template/signals" "os/user" "path/filepath" "strings" @@ -27,6 +26,7 @@ import ( "github.com/hashicorp/nomad/nomad/structs" + "github.com/hashicorp/consul-template/signals" "github.com/hashicorp/go-hclog" "github.com/hashicorp/nomad-driver-podman/iopodman" "github.com/hashicorp/nomad-driver-podman/version" From 6f05360d0e9b8a334a21ffd6a63949522260c6eb Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Fri, 28 Aug 2020 19:43:24 +0200 Subject: [PATCH 09/31] Remove separate go setup, rely on base image --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7d125b2..93e28df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,9 +9,9 @@ jobs: steps: - uses: actions/checkout@v1 - - uses: actions/setup-go@v2 - with: - go-version: '^1.14.1' + + - name: Show go version + run: go version - name: Lint Deps run: make lint-deps From b2c8e240eaf3d2550d6b9fc8731e8b351a8bf615 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sat, 29 Aug 2020 17:58:04 +0200 Subject: [PATCH 10/31] Makefile improvements --- GNUmakefile | 10 +- go.mod | 6 +- go.sum | 289 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 290 insertions(+), 15 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 9bee5d0..6b9f836 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -7,14 +7,14 @@ changelogfmt: .PHONY: check check: ## Lint the source code @echo "==> Linting source code..." - @golangci-lint run + @$(CURDIR)/build/bin/golangci-lint run $(CURDIR) @echo "==> vetting hc-log statements" - @hclogvet . + @$(CURDIR)/build/bin/hclogvet $(CURDIR) .PHONY: lint-deps lint-deps: ## Install linter dependencies ## Keep versions in sync with tools/go.mod (see https://github.com/golang/go/issues/30515) @echo "==> Updating linter dependencies..." - GO111MODULE=on cd tools && go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0 - GO111MODULE=on cd tools && go get github.com/client9/misspell/cmd/misspell@v0.3.4 - GO111MODULE=on cd tools && go get github.com/hashicorp/go-hclog/hclogvet@master + cd tools && GOBIN=$(CURDIR)/build/bin go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0 + cd tools && GOBIN=$(CURDIR)/build/bin go get github.com/client9/misspell/cmd/misspell@v0.3.4 + cd tools && GOBIN=$(CURDIR)/build/bin go get github.com/hashicorp/go-hclog/hclogvet@master diff --git a/go.mod b/go.mod index 8ed6728..0e80a6c 100644 --- a/go.mod +++ b/go.mod @@ -18,17 +18,17 @@ require ( github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect github.com/docker/go-metrics v0.0.1 // indirect github.com/go-ole/go-ole v1.2.4 // indirect + github.com/golangci/golangci-lint v1.30.0 // indirect github.com/hashicorp/consul v1.7.3 // indirect github.com/hashicorp/consul-template v0.24.1 github.com/hashicorp/go-hclog v0.14.1 + github.com/hashicorp/go-hclog/hclogvet v0.1.3 // indirect github.com/hashicorp/nomad v0.11.3-0.20200630133459-42c2ee4448c8 github.com/hashicorp/nomad/api v0.0.0-20200630133459-42c2ee4448c8 - github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mrunalp/fileutils v0.0.0-20200504145649-7be891c94fd3 // indirect github.com/opencontainers/selinux v1.5.1 // indirect - github.com/stretchr/testify v1.5.1 + github.com/stretchr/testify v1.6.1 github.com/varlink/go v0.3.0 google.golang.org/grpc v1.29.1 // indirect - gotest.tools/gotestsum v0.5.2 // indirect ) diff --git a/go.sum b/go.sum index 9450dd0..8368089 100644 --- a/go.sum +++ b/go.sum @@ -14,6 +14,7 @@ cloud.google.com/go/bigquery v1.0.1 h1:hL+ycaJpVE9M7nLoiXb/Pn10ENE2u+oddxbD8uu0Z cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/datastore v1.0.0 h1:Kt+gOPPp2LEPWp8CSfxhsM8ik9CcyE/gYu+0r+RnZvM= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1 h1:W9tAK3E57P75u0XLLR82LZyw8VpAnhmyTOxW9qzmyj8= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/storage v1.0.0 h1:VV2nUM3wwLLGh9lSABFgZMjInyUbJeaRSE64WuAIQ+4= @@ -44,8 +45,12 @@ github.com/DataDog/datadog-go v2.2.0+incompatible h1:V5BKkxACZLjzHjSgBbr2gvLA2Ae github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/Djarvur/go-err113 v0.0.0-20200511133814-5174e21577d5 h1:XTrzB+F8+SpRmbhAH8HLxhiiG6nYNwaBZjrFps1oWEk= +github.com/Djarvur/go-err113 v0.0.0-20200511133814-5174e21577d5/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5 h1:U7q69tqXiCf6m097GRlNQB0/6SI1qWIOHYHhCEvDxF4= github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5/go.mod h1:nxQPcNPR/34g+HcK2hEsF99O+GJgIkW/OmPl8wtzhmk= +github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= +github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Microsoft/go-winio v0.4.3/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= @@ -60,6 +65,9 @@ github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20180829222009-86f2a9fac6c5 h1:WLy github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20180829222009-86f2a9fac6c5/go.mod h1:nMOvShGpWaf0bXwXmeu4k+O4uziuaEI8pWzIj3BUrOA= github.com/NYTimes/gziphandler v1.0.1 h1:iLrQrdwjDd52kHDA5op2UBJFjmOb9g+7scBan4RN8F0= github.com/NYTimes/gziphandler v1.0.1/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= +github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= @@ -84,6 +92,7 @@ github.com/apparentlymart/go-textseg/v12 v12.0.0 h1:bNEQyAGak9tojivJNkoqWErVCQbj github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 h1:EFSB7Zo9Eg91v7MJPVsifUysc/wPdN+NOnVe6bWbdBM= github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg= @@ -108,10 +117,13 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= +github.com/bombsimon/wsl/v3 v3.1.0 h1:E5SRssoBgtVFPcYWUOFJEcgaySgdtTNYzsSKDOY7ss8= +github.com/bombsimon/wsl/v3 v3.1.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= @@ -121,6 +133,7 @@ github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3k github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1 h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b h1:T4nWG1TXIxeor8mAu5bFguPJgSIGhZqv/f0z55KCrJM= @@ -164,9 +177,13 @@ github.com/containernetworking/plugins v0.7.3-0.20190501191748-2d6d46d308b2/go.m github.com/containernetworking/plugins v0.8.5 h1:pCvEMrFf7yzJI8+/D/7jkvE96KD52b7/Eu+jpahihy8= github.com/containernetworking/plugins v0.8.5/go.mod h1:UZ2539umj8djuRQmBxuazHeJbYrLV8BSBejkk+she6o= github.com/coredns/coredns v1.1.2/go.mod h1:zASH/MVDgR6XZTbxvOnsZfffS+31vg6Ackf/wo1+AM0= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-iptables v0.4.3-0.20190724151750-969b135e941d/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= github.com/coreos/go-iptables v0.4.5 h1:DpHb9vJrZQEFMcVLFKAAGMUVX0XoRC0ptCthinRYm38= github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= @@ -175,6 +192,8 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyphar/filepath-securejoin v0.2.3-0.20190205144030-7efe413b52e1 h1:dCqRswe3ZAwkQWdvFLwRqmJCpGP3DWb7bFogdqY3+QU= github.com/cyphar/filepath-securejoin v0.2.3-0.20190205144030-7efe413b52e1/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= @@ -182,15 +201,20 @@ github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1S github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s= github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8= github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I= +github.com/daixiang0/gci v0.0.0-20200727065011-66f1df783cb2 h1:3Lhhps85OdA8ezsEKu+IA1hE+DBTjt/fjd7xNCrHbVA= +github.com/daixiang0/gci v0.0.0-20200727065011-66f1df783cb2/go.mod h1:+AV8KmHTGxxwp/pY84TLQfFKp2vuKXXJVzF3kD/hfR4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/denis-tingajkin/go-header v0.3.1 h1:ymEpSiFjeItCy1FOP+x0M2KdCELdEAHUsNa8F+hHc6w= +github.com/denis-tingajkin/go-header v0.3.1/go.mod h1:sq/2IxMhaZX+RRcgHfCRx/m0M5na0fBt4/CRe7Lrji0= github.com/denverdino/aliyungo v0.0.0-20170926055100-d3308649c661/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba h1:p6poVbjHDkKa+wtC8frBMwQtT3BmqGYBjzMwJ63tuR4= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/digitalocean/godo v1.1.1/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= github.com/digitalocean/godo v1.10.0 h1:uW1/FcvZE/hoixnJcnlmIUvTVNdZCLjRLzmDtRi1xXY= github.com/digitalocean/godo v1.10.0/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= @@ -253,23 +277,54 @@ github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYis github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-check/check v0.0.0-20140225173054-eb6ee6f84d0a/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= +github.com/go-critic/go-critic v0.5.0 h1:Ic2p5UCl5fX/2WX2w8nroPpPhxRNsNTMlJzsu/uqwnM= +github.com/go-critic/go-critic v0.5.0/go.mod h1:4jeRh3ZAVnRYhuWdOEvwzVqLUpxMSoAT0xZ74JsTPlo= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= +github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g= +github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= +github.com/go-toolsmith/astcopy v1.0.0 h1:OMgl1b1MEpjFQ1m5ztEO06rz5CUd3oBv9RF7+DyvdG8= +github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= +github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= +github.com/go-toolsmith/astequal v1.0.0 h1:4zxD8j3JRFNyLN46lodQuqz3xdKSrur7U/sr0SDS/gQ= +github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= +github.com/go-toolsmith/astfmt v0.0.0-20180903215011-8f8ee99c3086/go.mod h1:mP93XdblcopXwlyN4X4uodxXQhldPGZbcEJIimQHrkg= +github.com/go-toolsmith/astfmt v1.0.0 h1:A0vDDXt+vsvLEdbMFJAUBI/uTbRw1ffOPnxsILnFL6k= +github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= +github.com/go-toolsmith/astinfo v0.0.0-20180906194353-9809ff7efb21/go.mod h1:dDStQCHtmZpYOmjRP/8gHHnCCch3Zz3oEgCdZVdtweU= +github.com/go-toolsmith/astp v0.0.0-20180903215135-0af7e3c24f30/go.mod h1:SV2ur98SGypH1UjcPpCatrV5hPazG6+IfNHbkDXBRrk= +github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg= +github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= +github.com/go-toolsmith/pkgload v0.0.0-20181119091011-e9e65178eee8/go.mod h1:WoMrjiy4zvdS+Bg6z9jZH82QXwkcgCBX6nOfnmdaHks= +github.com/go-toolsmith/pkgload v1.0.0/go.mod h1:5eFArkbO80v7Z0kdngIxsRXRMTaX4Ilcwuh3clNrQJc= +github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4= +github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= +github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= +github.com/go-toolsmith/typep v1.0.2 h1:8xdsa1+FSIH/RhEkgnD1j2CJOy5mNllW1Q9tRiYwvlk= +github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= +github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4/FHQWkvVRmgijNXRfzkIDHh23ggEo= +github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/godbus/dbus v5.0.1+incompatible h1:fsDsnr/6MFSIm3kl6JJpq5pH+vO/rA5jUunalLnzSc8= github.com/godbus/dbus v5.0.1+incompatible/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/gofrs/flock v0.7.1 h1:DP+LD/t0njgoPBvT5MJLeliUIVQR03hiKR6vezdwHlc= +github.com/gofrs/flock v0.7.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -280,6 +335,7 @@ github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5 github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -292,9 +348,46 @@ github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= +github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= +github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= +github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= +github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 h1:YYWNAGTKWhKpcLLt7aSj/odlKrSrelQwlovBpDuf19w= +github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0= +github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZBf8NjltjWihK2QfBBBZuv91cMFfDHw= +github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= +github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 h1:pe9JHs3cHHDQgOFXJJdYkK6fLz2PWyYtP4hthoCMvs8= +github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3/go.mod h1:JXrF4TWy4tXYn62/9x8Wm/K/dm06p8tCKwFRDPZG/1o= +github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d h1:pXTK/gkVNs7Zyy7WKgLXmpQ5bHTrq5GDsp8R9Qs67g0= +github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d/go.mod h1:ozx7R9SIwqmqf5pRP90DhR2Oay2UIjGuKheCBCNwAYU= +github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= +github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= +github.com/golangci/golangci-lint v1.30.0 h1:UhdK5WbO0GBd7W+k2lOD7BEJH4Wsa7zKfw8m3/aEJGQ= +github.com/golangci/golangci-lint v1.30.0/go.mod h1:5t0i3wHlqQc9deBBvZsP+a/4xz7cfjV+zhp5U0Mzp14= +github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc h1:gLLhTLMk2/SutryVJ6D4VZCU3CUqr8YloG7FPIBWFpI= +github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU= +github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= +github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= +github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= +github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= +github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770 h1:EL/O5HGrF7Jaq0yNhBLucz9hTuRzj2LdwGBOaENgxIk= +github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= +github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 h1:leSNB7iYzLYSSx3J/s5sVf4Drkc68W2wm4Ixh/mr0us= +github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bzsHdTM0bsB7+8mt0GUMvjCgwLpTapNZHU8AajI= +github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 h1:HVfrLniijszjS1aiNg8JbBMO2+E1WIQ+j/gL4SQqGPg= +github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= +github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= +github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= @@ -305,6 +398,8 @@ github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= @@ -316,8 +411,7 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= @@ -325,6 +419,7 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/gookit/color v1.2.5/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg= github.com/gophercloud/gophercloud v0.0.0-20180828235145-f29afc2cceca h1:wobTb8SE189AuxzEKClyYxiI4nUGWlpVtl13eLiFlOE= github.com/gophercloud/gophercloud v0.0.0-20180828235145-f29afc2cceca/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -335,13 +430,19 @@ github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= +github.com/gostaticanalysis/analysisutil v0.0.3 h1:iwp+5/UAyzQSFgQ4uR2sni99sJ8Eo9DEacKWM5pekIg= +github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39 h1:MqvH60+R2JhSdvVgGxmExOndrkRQtGW7w4+gcrymN64= github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0 h1:bM6ZAFZmc/wPFaRDi0d5L7hGEZEx/2u+Tmr2evNHDiI= @@ -351,9 +452,11 @@ github.com/hashicorp/consul v1.7.3 h1:b33lARUsnuz0I5VapThpf7TMIirD4Co2X0UtZIax/+ github.com/hashicorp/consul v1.7.3/go.mod h1:ULIn4NmujdEvr3u3ckVYKPm6usKMuiIiL9zOu4H1nUE= github.com/hashicorp/consul-template v0.24.1 h1:96zTJ5YOq4HMTgtehXRvzGoQNEG2Z4jBYY5ofhq8/Cc= github.com/hashicorp/consul-template v0.24.1/go.mod h1:KcTEopo2kCp7kww0d4oG7d3oX2Uou4hzb1Rs/wY9TVI= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.2.0/go.mod h1:1SIkFYi2ZTXUE5Kgt179+4hH33djo11+0Eo2XgTAtkw= github.com/hashicorp/consul/api v1.4.0 h1:jfESivXnO5uLdH650JU/6AnjRoHrLhULq0FnC3Kp9EY= github.com/hashicorp/consul/api v1.4.0/go.mod h1:xc8u05kyMa3Wjr9eEAsIAo3dg8+LywT5E/Cl7cNS5nU= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.2.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.4.0 h1:zBtCfKJZcJDBvSCkQJch4ulp59m1rATFLKwNo/LYY30= github.com/hashicorp/consul/sdk v0.4.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= @@ -386,6 +489,8 @@ github.com/hashicorp/go-hclog v0.12.0 h1:d4QkX8FRTYaKaCZBoXYY8zJX2BXjWxurN/GA2tk github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v0.14.1 h1:nQcJDQwIAGnmoUWp8ubocEX40cCml/17YkF6csQLReU= github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog/hclogvet v0.1.3 h1:3m9Fxgh3Gct7cyAKPo3rIGR4n4anAZT7knHTZjYwKEo= +github.com/hashicorp/go-hclog/hclogvet v0.1.3/go.mod h1:f0uAs1kAopX4JXFgR4kMixWftM8qLha6edaFVawdNtg= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.1.0 h1:vN9wG1D6KG6YHRTWr8512cxGOVgTMEfgEdSj/hr8MPc= github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -497,11 +602,16 @@ github.com/ishidawataru/sctp v0.0.0-20191218070446-00ab2ac2db07/go.mod h1:co9pwD github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da/go.mod h1:ks+b9deReOc7jgqp+e7LuFiCBH6Rm5hL32cLcEAArb4= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= +github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a h1:GmsqmapfzSJkm28dhRoHz2tLRbJmqhU86IPgBtN3mmk= +github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a/go.mod h1:xRskid8CManxVta/ALEhJha/pweKBaVG6fWgc0yH25s= +github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3 h1:jNYPNLe3d8smommaoQlK7LOA5ESyUJJ+Wf79ZtA7Vp4= +github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= +github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= +github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/joyent/triton-go v0.0.0-20180628001255-830d2b111e62/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= github.com/joyent/triton-go v0.0.0-20190112182421-51ffac552869 h1:BvV6PYcRz0yGnWXNZrd5wginNT1GfFfPvvWpPbjfFL8= @@ -520,7 +630,10 @@ github.com/juju/testing v0.0.0-20190613124551-e81189438503/go.mod h1:63prj8cnj0t github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.10.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.10.5/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= @@ -540,6 +653,9 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/kyoh86/exportloopref v0.1.7 h1:u+iHuTbkbTS2D/JP7fCuZDo/t3rBVGo3Hf58Rc+lQVY= +github.com/kyoh86/exportloopref v0.1.7/go.mod h1:h1rDl2Kdj97+Kwh4gdz3ujE7XHmH51Q0lUiZ1z4NLj8= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/likexian/gokit v0.0.0-20190309162924-0a377eecf7aa/go.mod h1:QdfYv6y6qPA9pbBA2qXtoT8BMKha6UyNbxWGWl/9Jfk= github.com/likexian/gokit v0.0.0-20190418170008-ace88ad0983b/go.mod h1:KKqSnk/VVSW8kEyO2vVCXoanzEutKdlBAPohmGXkxCk= github.com/likexian/gokit v0.0.0-20190501133040-e77ea8b19cdc/go.mod h1:3kvONayqCaj+UgrRZGpgfXzHdMYCAO0KAt4/8n0L57Y= @@ -549,11 +665,21 @@ github.com/likexian/simplejson-go v0.0.0-20190419151922-c1f9f0b4f084/go.mod h1:U github.com/likexian/simplejson-go v0.0.0-20190502021454-d8787b4bfa0b/go.mod h1:3BWwtmKP9cXWwYCr5bkoVDEfLywacOv0s06OBEDpyt8= github.com/linode/linodego v0.7.1 h1:4WZmMpSA2NRwlPZcc0+4Gyn7rr99Evk9bnr0B3gXRKE= github.com/linode/linodego v0.7.1/go.mod h1:ga11n3ivecUrPCHN0rANxKmfWBJVkOXfLMZinAbj2sY= +github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/maratori/testpackage v1.0.1 h1:QtJ5ZjqapShm0w5DosRjg0PRlSdAdlx+W6cCKoALdbQ= +github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= +github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb h1:RHba4YImhrUVQDHUCe2BNSOz4tVy2yGyXhvYDvxGgeE= +github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw= +github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= @@ -566,6 +692,8 @@ github.com/mattn/go-shellwords v1.0.3 h1:K/VxK7SZ+cvuPgFSLKi5QPI9Vr/ipOf4C1gN+nt github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-shellwords v1.0.5 h1:JhhFTIOslh5ZsPrpa3Wdg8bF0WI3b44EMblmU9wIsXc= github.com/mattn/go-shellwords v1.0.5/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= @@ -614,10 +742,15 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mozilla/tls-observatory v0.0.0-20200317151703-4fa42e1c2dee/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0= github.com/mrunalp/fileutils v0.0.0-20200504145649-7be891c94fd3 h1:eK+kqTSbinmtz6ynzliXWjYAW/3DqVMXHgpQv5fPhPw= github.com/mrunalp/fileutils v0.0.0-20200504145649-7be891c94fd3/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nakabonne/nestif v0.3.0 h1:+yOViDGhg8ygGrmII72nV9B/zGxY188TYpfolntsaPw= +github.com/nakabonne/nestif v0.3.0/go.mod h1:dI314BppzXjJ4HsCnbo7XzrJHPszZsjnk5wEBSYHI2c= +github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E= +github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= @@ -625,16 +758,24 @@ github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2 h1:BQ1HW github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2/go.mod h1:TLb2Sg7HQcgGdloNxkrmtgDNR9uVYF3lfdFIN4Ro6Sk= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nishanths/exhaustive v0.0.0-20200708172631-8866003e3856 h1:W3KBC2LFyfgd+wNudlfgCCsTo4q97MeNWrfz8/wSdSc= +github.com/nishanths/exhaustive v0.0.0-20200708172631-8866003e3856/go.mod h1:wBEpHwM2OdmeNpdCvRPUlkEbBuaFmcK4Wv8Q7FuGW3c= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28 h1:R9vmquWCeGmxTHUVnTQJrU4oPlgEn9+x48nwXSqkIKg= github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.13.0 h1:M76yO2HkZASFjXL0HSoZJ1AYEmQxNJmY41Jx1zNUq1Y= +github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= @@ -645,6 +786,8 @@ github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= @@ -672,7 +815,12 @@ github.com/packethost/packngo v0.1.1-0.20180711074735-b9cb5096f54c/go.mod h1:otz github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= +github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.2.5+incompatible h1:xOYu2+sKj87pJz7V+I7260354UlcRyAZUGhMCToTzVw= @@ -694,6 +842,7 @@ github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= @@ -709,8 +858,10 @@ github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2 github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= @@ -721,21 +872,34 @@ github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE= github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= +github.com/quasilyte/go-ruleguard v0.1.2-0.20200318202121-b00d7a75d3d8 h1:DvnesvLtRPQOvaUbfXfh0tpMHg29by0H7F2U+QIkSu8= +github.com/quasilyte/go-ruleguard v0.1.2-0.20200318202121-b00d7a75d3d8/go.mod h1:CGFX09Ci3pq9QZdj86B+VGIdNj4VyCo2iPOGS9esB/k= +github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY= +github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/rboyer/safeio v0.2.1/go.mod h1:Cq/cEPK+YXFn622lsQ0K4KsPZSPtaptHHEldsy7Fmig= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03 h1:Wdi9nwnhFNAlseAOekn6B5G/+GMtks9UKbvRU/CMM/o= github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03/go.mod h1:gRAiPF5C5Nd0eyyRdqIu9qTiFSoZzpTq727b5B8fkkU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rs/cors v0.0.0-20170801073201-eabcc6af4bbe h1:fPLXIFSIvTs99QtPSCsRITbv01v7MsPN7wpuYtD8ebI= github.com/rs/cors v0.0.0-20170801073201-eabcc6af4bbe/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryancurrah/gomodguard v1.1.0 h1:DWbye9KyMgytn8uYpuHkwf0RHqAYO6Ay/D0TbCpPtVU= +github.com/ryancurrah/gomodguard v1.1.0/go.mod h1:4O8tr7hBODaGE6VIhfJDHcwzh5GUccKSJBU0UMXJFVM= +github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw= +github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.1-0.20170703205827-abc90934186a+incompatible h1:ZVvb3R06BXNcQ3nXT2eANJAwGeRu4tbUzLI7sIyFZ2s= @@ -744,13 +908,19 @@ github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkB github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/seccomp/libseccomp-golang v0.9.2-0.20200314001724-bdab42bd5128 h1:vWI7jlfJVWN//T8jrt5JduYkSid+Sl/fRz33J1jQ83k= github.com/seccomp/libseccomp-golang v0.9.2-0.20200314001724-bdab42bd5128/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= +github.com/securego/gosec/v2 v2.4.0 h1:ivAoWcY5DMs9n04Abc1VkqZBO0FL0h4ShTcVsC53lCE= +github.com/securego/gosec/v2 v2.4.0/go.mod h1:0/Q4cjmlFDfDUj1+Fib61sc+U5IQb2w+Iv9/C3wPVko= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= +github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= github.com/shirou/gopsutil v0.0.0-20181107111621-48177ef5f880/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= github.com/shirou/gopsutil v2.20.2+incompatible h1:ucK79BhBpgqQxPASyS2cu9HX8cfDVljBN1WWFvbNvgY= github.com/shirou/gopsutil v2.20.2+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= @@ -775,6 +945,7 @@ github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= @@ -791,16 +962,38 @@ github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d h1:bVQRCxQvfjNUeRqaY/uT0tFuvuFY0ulgnczuR684Xic= github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d/go.mod h1:Cw4GTlQccdRGSEf6KiMju767x0NEHE0YIVPJSaXjlsw= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= +github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= +github.com/sourcegraph/go-diff v0.5.3 h1:lhIKJ2nXLZZ+AfbHpYxTn0pXpNTTui0DX7DO3xeb1Zs= +github.com/sourcegraph/go-diff v0.5.3/go.mod h1:v9JDtjCE4HHHCZGId75rg8gkKKa98RVjBcBGsVmMmak= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/ssgreg/nlreturn/v2 v2.0.1 h1:+lm6xFjVuNw/9t/Fh5sIwfNWefiD5bddzc6vwJ1TvRI= +github.com/ssgreg/nlreturn/v2 v2.0.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -812,18 +1005,42 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 h1:b6uOv7YOFK0TYG7HtkIgExQo+2RdLuwRft63jn2HWj8= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= +github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2 h1:Xr9gkxfOP0KQWXKNqmwe8vEeSUiUj4Rlee9CMVX2ZUQ= +github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= github.com/tencentcloud/tencentcloud-sdk-go v3.0.83+incompatible h1:8uRvJleFpqLsO77WaAh2UrasMOzd8MxXrNj20e7El+Q= github.com/tencentcloud/tencentcloud-sdk-go v3.0.83+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= github.com/tent/http-link-go v0.0.0-20130702225549-ac974c61c2f9/go.mod h1:RHkNRtSLfOK7qBTHaeSX1D6BNpI3qw7NTxsmNr4RvN8= +github.com/tetafro/godot v0.4.8 h1:h61+hQraWhdI6WYqMwAwZYCE5yxL6a9/Orw4REbabSU= +github.com/tetafro/godot v0.4.8/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0= +github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q= +github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa h1:RC4maTWLKKwb7p1cnoygsbKIgNlJqSYBeAFON3Ar8As= +github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/ultraware/funlen v0.0.2 h1:Av96YVBwwNSe4MLR7iI/BIa3VyI7/djnto/pK3Uxbdo= +github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= +github.com/ultraware/whitespace v0.0.4 h1:If7Va4cM03mpgrNH9k49/VOicWpGoG70XPBFFODYDsg= +github.com/ultraware/whitespace v0.0.4/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/uudashr/gocognit v1.0.1 h1:MoG2fZ0b/Eo7NXoIwCVFLG5JED3qgQz5/NEE+rOsjPs= +github.com/uudashr/gocognit v1.0.1/go.mod h1:j44Ayx2KW4+oB6SWMv8KsmHzZrOInQav7D3cQMJ5JUM= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.12.0/go.mod h1:229t1eWu9UXTPmoUkbpN/fctKPBY4IJoFXQnxHGXy6E= +github.com/valyala/quicktemplate v1.5.1/go.mod h1:v7yYWpBEiutDyNfVaph6oC/yKwejzVyTX/2cwwHxyok= +github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/varlink/go v0.3.0 h1:7IDKK8X3W9qqgw7oisE2RgtdTOxBxDwX5RDm2qVoKT8= github.com/varlink/go v0.3.0/go.mod h1:DKg9Y2ctoNkesREGAEak58l+jOC6JU2aqZvUYs5DynU= github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= @@ -839,13 +1056,18 @@ github.com/vmware/govmomi v0.18.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59b github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= github.com/zclconf/go-cty v1.4.1 h1:Xzr4m4utRDhHDifag1onwwUSq32HLoLBsp+w6tD0880= github.com/zclconf/go-cty v1.4.1/go.mod h1:nHzOclRkoj++EU9ZjSrZvRG0BXIWt8c7loYc0qXAFGQ= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -877,6 +1099,8 @@ golang.org/x/crypto v0.0.0-20191106202628-ed6320f186d4/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -892,12 +1116,14 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNTEKDvWeuc1yieZ8qUzUE= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -919,6 +1145,7 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -930,6 +1157,9 @@ golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20170807180024-9a379c6b3e95/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -950,6 +1180,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4 golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -981,6 +1213,7 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190730183949-1393eb018365/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -995,7 +1228,7 @@ golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1012,33 +1245,56 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190221204921-83362c3779f5/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190424220101-1e8e1cfdf96b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190719005602-e377ae9d6386/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200117220505-0cba7a3a9ee9/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200211205636-11eff242d136/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200321224714-0d839f3cf2ed/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200422022333-3d57cf2e726e/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200519015757-0d0afa43d58a/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375 h1:SjQ2+AKWgZLc1xej6WSzL+Dfs5Uyd5xcZH1mGC411IA= golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200625211823-6506e20df31f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200701041122-1837592efa10/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305 h1:yaM5S0KcY0lIoZo7Fl+oi91b/DdlU2zuWpfHrpWbCS0= +golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -1078,6 +1334,7 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200302123026-7795fca6ccb1 h1:RYJIKMPLUCjLP+fEg9ygjxF3KjfSHN4BSZw91aecq6U= google.golang.org/genproto v0.0.0-20200302123026-7795fca6ccb1/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= @@ -1087,6 +1344,7 @@ google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= @@ -1096,6 +1354,13 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= @@ -1112,6 +1377,8 @@ gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -1132,11 +1399,10 @@ gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools v1.4.0 h1:BjtEgfuw8Qyd+jPvQz8CfoxiO/UjFEidWinwEXZiWv0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/gotestsum v0.5.2 h1:sSKWtEFqorHhuBCHU6MeUl50cq9U2J3d1m5NlQTVrbY= -gotest.tools/gotestsum v0.5.2/go.mod h1:hC9TQserDVTWcJuARh76Ydp3ZwuE+pIIWpt2BzDLD6M= gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= @@ -1156,6 +1422,15 @@ k8s.io/apimachinery v0.0.0-20190223001710-c182ff3b9841/go.mod h1:ccL7Eh7zubPUSh9 k8s.io/client-go v8.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= +mvdan.cc/gofumpt v0.0.0-20200709182408-4fd085cb6d5f h1:gi7cb8HTDZ6q8VqsUpkdoFi3vxwHMneQ6+Q5Ap5hjPE= +mvdan.cc/gofumpt v0.0.0-20200709182408-4fd085cb6d5f/go.mod h1:9VQ397fNXEnF84t90W4r4TRCQK+pg9f8ugVfyj+S26w= +mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= +mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= +mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= +mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= +mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f h1:Cq7MalBHYACRd6EesksG1Q8EoIAKOsiZviGKbOLIej4= +mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= +sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4 h1:JPJh2pk3+X4lXAkZIk2RuE/7/FoK9maXw+TNPJhVS/c= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= From 4ca9b04e0a209651951c5feccea1a7d718b560c9 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 31 Aug 2020 19:50:45 +0200 Subject: [PATCH 11/31] implemented api v2 create container Improved container startup and stats Disabled oom test because of podman problems --- apiclient/apiclient.go | 8 +- apiclient/container_create.go | 639 ++++++++++++++++++++++++++++++++++ apiclient/container_start.go | 15 +- apiclient/container_stop.go | 2 +- apiclient/container_wait.go | 39 +++ client.go | 14 - driver.go | 241 +++++++++---- driver_test.go | 41 ++- go.mod | 1 + handle.go | 10 +- 10 files changed, 899 insertions(+), 111 deletions(-) create mode 100644 apiclient/container_create.go create mode 100644 apiclient/container_wait.go diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index 564fff4..7dd080f 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -18,6 +18,7 @@ package apiclient import ( "context" + "io" "net" "net/http" "strings" @@ -31,7 +32,7 @@ type APIClient struct { func NewClient(baseUrl string) *APIClient { httpClient := http.Client{ - Timeout: 5 * time.Second, + Timeout: 60 * time.Second, } if strings.HasPrefix(baseUrl, "unix:") { path := strings.TrimPrefix(baseUrl, "unix:") @@ -62,12 +63,13 @@ func (c *APIClient) Get(ctx context.Context, path string) (*http.Response, error return c.Do(req) } -func (c *APIClient) Post(ctx context.Context, path string) (*http.Response, error) { - req, err := http.NewRequest("POST", c.baseUrl+path, nil) +func (c *APIClient) Post(ctx context.Context, path string, body io.Reader) (*http.Response, error) { + req, err := http.NewRequest("POST", c.baseUrl+path, body) if err != nil { return nil, err } req = req.WithContext(ctx) + req.Header.Set("Content-Type", "application/json") return c.Do(req) } diff --git a/apiclient/container_create.go b/apiclient/container_create.go new file mode 100644 index 0000000..503fad9 --- /dev/null +++ b/apiclient/container_create.go @@ -0,0 +1,639 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apiclient + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io/ioutil" + "net" + "net/http" + "syscall" + + spec "github.com/opencontainers/runtime-spec/specs-go" +) + +// ContainerCreate creates a new container +func (c *APIClient) ContainerCreate(ctx context.Context, create SpecGenerator) (ContainerCreateResponse, error) { + + response := ContainerCreateResponse{} + + jsonString, err := json.Marshal(create) + if err != nil { + return response, err + } + // fmt.Println(string(jsonString)) + + res, err := c.Post(ctx, "/v1.24/libpod/containers/create", bytes.NewBuffer(jsonString)) + if err != nil { + return response, err + } + + defer res.Body.Close() + + if res.StatusCode != http.StatusCreated { + body, _ := ioutil.ReadAll(res.Body) + return response, fmt.Errorf("unknown error, status code: %d: %s", res.StatusCode, body) + } + + body, err := ioutil.ReadAll(res.Body) + if err != nil { + return response, err + } + err = json.Unmarshal(body, &response) + if err != nil { + return response, err + } + + return response, err +} + +type ContainerCreateRequest struct { + // Name is the name the container will be given. + // If no name is provided, one will be randomly generated. + // Optional. + Name string `json:"name,omitempty"` + + // Command is the container's command. + // If not given and Image is specified, this will be populated by the + // image's configuration. + // Optional. + Command []string `json:"command,omitempty"` + + // Entrypoint is the container's entrypoint. + // If not given and Image is specified, this will be populated by the + // image's configuration. + // Optional. + Entrypoint []string `json:"entrypoint,omitempty"` + + // WorkDir is the container's working directory. + // If unset, the default, /, will be used. + // Optional. + WorkDir string `json:"work_dir,omitempty"` + // Env is a set of environment variables that will be set in the + // container. + // Optional. + Env map[string]string `json:"env,omitempty"` +} + +type ContainerCreateResponse struct { + Id string + Warnings []string +} + +// ------------------------------------------------------------------------------------------------------- +// structs copied from https://github.com/containers/podman/blob/master/pkg/specgen/specgen.go +// +// some unused parts are modified/commented out to not pull +// more dependencies and also to overcome some json unmarshall/version problems +// +// some fields are reordert to make the linter happy (bytes maligned complains) +// ------------------------------------------------------------------------------------------------------- + +// LogConfig describes the logging characteristics for a container +type LogConfig struct { + // LogDriver is the container's log driver. + // Optional. + Driver string `json:"driver,omitempty"` + // LogPath is the path the container's logs will be stored at. + // Only available if LogDriver is set to "json-file" or "k8s-file". + // Optional. + Path string `json:"path,omitempty"` + // A set of options to accompany the log driver. + // Optional. + Options map[string]string `json:"options,omitempty"` +} + +// ContainerBasicConfig contains the basic parts of a container. +type ContainerBasicConfig struct { + // Name is the name the container will be given. + // If no name is provided, one will be randomly generated. + // Optional. + Name string `json:"name,omitempty"` + // Pod is the ID of the pod the container will join. + // Optional. + Pod string `json:"pod,omitempty"` + // Entrypoint is the container's entrypoint. + // If not given and Image is specified, this will be populated by the + // image's configuration. + // Optional. + Entrypoint []string `json:"entrypoint,omitempty"` + // Command is the container's command. + // If not given and Image is specified, this will be populated by the + // image's configuration. + // Optional. + Command []string `json:"command,omitempty"` + // Env is a set of environment variables that will be set in the + // container. + // Optional. + Env map[string]string `json:"env,omitempty"` + // Terminal is whether the container will create a PTY. + // Optional. + Terminal bool `json:"terminal,omitempty"` + // Stdin is whether the container will keep its STDIN open. + Stdin bool `json:"stdin,omitempty"` + // Labels are key-value pairs that are used to add metadata to + // containers. + // Optional. + Labels map[string]string `json:"labels,omitempty"` + // Annotations are key-value options passed into the container runtime + // that can be used to trigger special behavior. + // Optional. + Annotations map[string]string `json:"annotations,omitempty"` + // StopSignal is the signal that will be used to stop the container. + // Must be a non-zero integer below SIGRTMAX. + // If not provided, the default, SIGTERM, will be used. + // Will conflict with Systemd if Systemd is set to "true" or "always". + // Optional. + StopSignal *syscall.Signal `json:"stop_signal,omitempty"` + // StopTimeout is a timeout between the container's stop signal being + // sent and SIGKILL being sent. + // If not provided, the default will be used. + // If 0 is used, stop signal will not be sent, and SIGKILL will be sent + // instead. + // Optional. + StopTimeout *uint `json:"stop_timeout,omitempty"` + // LogConfiguration describes the logging for a container including + // driver, path, and options. + // Optional + LogConfiguration *LogConfig `json:"log_configuration,omitempty"` + // ConmonPidFile is a path at which a PID file for Conmon will be + // placed. + // If not given, a default location will be used. + // Optional. + ConmonPidFile string `json:"conmon_pid_file,omitempty"` + // RestartPolicy is the container's restart policy - an action which + // will be taken when the container exits. + // If not given, the default policy, which does nothing, will be used. + // Optional. + RestartPolicy string `json:"restart_policy,omitempty"` + // RestartRetries is the number of attempts that will be made to restart + // the container. + // Only available when RestartPolicy is set to "on-failure". + // Optional. + RestartRetries *uint `json:"restart_tries,omitempty"` + // OCIRuntime is the name of the OCI runtime that will be used to create + // the container. + // If not specified, the default will be used. + // Optional. + OCIRuntime string `json:"oci_runtime,omitempty"` + // Systemd is whether the container will be started in systemd mode. + // Valid options are "true", "false", and "always". + // "true" enables this mode only if the binary run in the container is + // /sbin/init or systemd. "always" unconditionally enables systemd mode. + // "false" unconditionally disables systemd mode. + // If enabled, mounts and stop signal will be modified. + // If set to "always" or set to "true" and conditionally triggered, + // conflicts with StopSignal. + // If not specified, "false" will be assumed. + // Optional. + Systemd string `json:"systemd,omitempty"` + // Determine how to handle the NOTIFY_SOCKET - do we participate or pass it through + // "container" - let the OCI runtime deal with it, advertise conmon's MAINPID + // "conmon-only" - advertise conmon's MAINPID, send READY when started, don't pass to OCI + // "ignore" - unset NOTIFY_SOCKET + SdNotifyMode string `json:"sdnotifyMode,omitempty"` + // Namespace is the libpod namespace the container will be placed in. + // Optional. + Namespace string `json:"namespace,omitempty"` + + // PidNS is the container's PID namespace. + // It defaults to private. + // Mandatory. + PidNS Namespace `json:"pidns,omitempty"` + + // UtsNS is the container's UTS namespace. + // It defaults to private. + // Must be set to Private to set Hostname. + // Mandatory. + UtsNS Namespace `json:"utsns,omitempty"` + + // Hostname is the container's hostname. If not set, the hostname will + // not be modified (if UtsNS is not private) or will be set to the + // container ID (if UtsNS is private). + // Conflicts with UtsNS if UtsNS is not set to private. + // Optional. + Hostname string `json:"hostname,omitempty"` + // Sysctl sets kernel parameters for the container + Sysctl map[string]string `json:"sysctl,omitempty"` + // Remove indicates if the container should be removed once it has been started + // and exits + Remove bool `json:"remove,omitempty"` + // ContainerCreateCommand is the command that was used to create this + // container. + // This will be shown in the output of Inspect() on the container, and + // may also be used by some tools that wish to recreate the container + // (e.g. `podman generate systemd --new`). + // Optional. + ContainerCreateCommand []string `json:"containerCreateCommand,omitempty"` + // PreserveFDs is a number of additional file descriptors (in addition + // to 0, 1, 2) that will be passed to the executed process. The total FDs + // passed will be 3 + PreserveFDs. + // set tags as `json:"-"` for not supported remote + PreserveFDs uint `json:"-"` + // Timezone is the timezone inside the container. + // Local means it has the same timezone as the host machine + Timezone string `json:"timezone,omitempty"` +} + +// ContainerStorageConfig contains information on the storage configuration of a +// container. +type ContainerStorageConfig struct { + // Image is the image the container will be based on. The image will be + // used as the container's root filesystem, and its environment vars, + // volumes, and other configuration will be applied to the container. + // Conflicts with Rootfs. + // At least one of Image or Rootfs must be specified. + Image string `json:"image"` + // Rootfs is the path to a directory that will be used as the + // container's root filesystem. No modification will be made to the + // directory, it will be directly mounted into the container as root. + // Conflicts with Image. + // At least one of Image or Rootfs must be specified. + Rootfs string `json:"rootfs,omitempty"` + // ImageVolumeMode indicates how image volumes will be created. + // Supported modes are "ignore" (do not create), "tmpfs" (create as + // tmpfs), and "anonymous" (create as anonymous volumes). + // The default if unset is anonymous. + // Optional. + ImageVolumeMode string `json:"image_volume_mode,omitempty"` + // VolumesFrom is a set of containers whose volumes will be added to + // this container. The name or ID of the container must be provided, and + // may optionally be followed by a : and then one or more + // comma-separated options. Valid options are 'ro', 'rw', and 'z'. + // Options will be used for all volumes sourced from the container. + VolumesFrom []string `json:"volumes_from,omitempty"` + // Init specifies that an init binary will be mounted into the + // container, and will be used as PID1. + Init bool `json:"init,omitempty"` + // InitPath specifies the path to the init binary that will be added if + // Init is specified above. If not specified, the default set in the + // Libpod config will be used. Ignored if Init above is not set. + // Optional. + InitPath string `json:"init_path,omitempty"` + // Mounts are mounts that will be added to the container. + // These will supersede Image Volumes and VolumesFrom volumes where + // there are conflicts. + // Optional. + Mounts []spec.Mount `json:"mounts,omitempty"` + // Volumes are named volumes that will be added to the container. + // These will supersede Image Volumes and VolumesFrom volumes where + // there are conflicts. + // Optional. + Volumes []*NamedVolume `json:"volumes,omitempty"` + // Overlay volumes are named volumes that will be added to the container. + // Optional. + OverlayVolumes []*OverlayVolume `json:"overlay_volumes,omitempty"` + // Devices are devices that will be added to the container. + // Optional. + Devices []spec.LinuxDevice `json:"devices,omitempty"` + // IpcNS is the container's IPC namespace. + // Default is private. + // Conflicts with ShmSize if not set to private. + // Mandatory. + IpcNS Namespace `json:"ipcns,omitempty"` + + // ShmSize is the size of the tmpfs to mount in at /dev/shm, in bytes. + // Conflicts with ShmSize if IpcNS is not private. + // Optional. + ShmSize *int64 `json:"shm_size,omitempty"` + // WorkDir is the container's working directory. + // If unset, the default, /, will be used. + // Optional. + WorkDir string `json:"work_dir,omitempty"` + // RootfsPropagation is the rootfs propagation mode for the container. + // If not set, the default of rslave will be used. + // Optional. + RootfsPropagation string `json:"rootfs_propagation,omitempty"` +} + +// ContainerSecurityConfig is a container's security features, including +// SELinux, Apparmor, and Seccomp. +type ContainerSecurityConfig struct { + // Privileged is whether the container is privileged. + // Privileged does the following: + // - Adds all devices on the system to the container. + // - Adds all capabilities to the container. + // - Disables Seccomp, SELinux, and Apparmor confinement. + // (Though SELinux can be manually re-enabled). + // TODO: this conflicts with things. + // TODO: this does more. + Privileged bool `json:"privileged,omitempty"` + // User is the user the container will be run as. + // Can be given as a UID or a username; if a username, it will be + // resolved within the container, using the container's /etc/passwd. + // If unset, the container will be run as root. + // Optional. + User string `json:"user,omitempty"` + // Groups are a list of supplemental groups the container's user will + // be granted access to. + // Optional. + Groups []string `json:"groups,omitempty"` + // CapAdd are capabilities which will be added to the container. + // Conflicts with Privileged. + // Optional. + CapAdd []string `json:"cap_add,omitempty"` + // CapDrop are capabilities which will be removed from the container. + // Conflicts with Privileged. + // Optional. + CapDrop []string `json:"cap_drop,omitempty"` + // SelinuxProcessLabel is the process label the container will use. + // If SELinux is enabled and this is not specified, a label will be + // automatically generated if not specified. + // Optional. + SelinuxOpts []string `json:"selinux_opts,omitempty"` + // ApparmorProfile is the name of the Apparmor profile the container + // will use. + // Optional. + ApparmorProfile string `json:"apparmor_profile,omitempty"` + // SeccompPolicy determines which seccomp profile gets applied + // the container. valid values: empty,default,image + SeccompPolicy string `json:"seccomp_policy,omitempty"` + // SeccompProfilePath is the path to a JSON file containing the + // container's Seccomp profile. + // If not specified, no Seccomp profile will be used. + // Optional. + SeccompProfilePath string `json:"seccomp_profile_path,omitempty"` + // NoNewPrivileges is whether the container will set the no new + // privileges flag on create, which disables gaining additional + // privileges (e.g. via setuid) in the container. + NoNewPrivileges bool `json:"no_new_privileges,omitempty"` + // UserNS is the container's user namespace. + // It defaults to host, indicating that no user namespace will be + // created. + // If set to private, IDMappings must be set. + // Mandatory. + // UserNS Namespace `json:"userns,omitempty"` + + // IDMappings are UID and GID mappings that will be used by user + // namespaces. + // Required if UserNS is private. + // IDMappings *storage.IDMappingOptions `json:"idmappings,omitempty"` + // ReadOnlyFilesystem indicates that everything will be mounted + + // as read-only + ReadOnlyFilesystem bool `json:"read_only_filesystem,omittempty"` + // Umask is the umask the init process of the container will be run with. + Umask string `json:"umask,omitempty"` + // ProcOpts are the options used for the proc mount. + ProcOpts []string `json:"procfs_opts,omitempty"` +} + +// ContainerCgroupConfig contains configuration information about a container's +// cgroups. +type ContainerCgroupConfig struct { + // CgroupNS is the container's cgroup namespace. + // It defaults to private. + // Mandatory. + CgroupNS Namespace `json:"cgroupns,omitempty"` + + // CgroupsMode sets a policy for how cgroups will be created in the + // container, including the ability to disable creation entirely. + CgroupsMode string `json:"cgroups_mode,omitempty"` + // CgroupParent is the container's CGroup parent. + // If not set, the default for the current cgroup driver will be used. + // Optional. + CgroupParent string `json:"cgroup_parent,omitempty"` +} + +// ContainerNetworkConfig contains information on a container's network +// configuration. +type ContainerNetworkConfig struct { + // NetNS is the configuration to use for the container's network + // namespace. + // Mandatory. + NetNS Namespace `json:"netns,omitempty"` + + // StaticIP is the a IPv4 address of the container. + // Only available if NetNS is set to Bridge. + // Optional. + StaticIP *net.IP `json:"static_ip,omitempty"` + // StaticIPv6 is a static IPv6 address to set in the container. + // Only available if NetNS is set to Bridge. + // Optional. + StaticIPv6 *net.IP `json:"static_ipv6,omitempty"` + // StaticMAC is a static MAC address to set in the container. + // Only available if NetNS is set to bridge. + // Optional. + StaticMAC *net.HardwareAddr `json:"static_mac,omitempty"` + // PortBindings is a set of ports to map into the container. + // Only available if NetNS is set to bridge or slirp. + // Optional. + PortMappings []PortMapping `json:"portmappings,omitempty"` + // PublishExposedPorts will publish ports specified in the image to + // random unused ports (guaranteed to be above 1024) on the host. + // This is based on ports set in Expose below, and any ports specified + // by the Image (if one is given). + // Only available if NetNS is set to Bridge or Slirp. + PublishExposedPorts bool `json:"publish_image_ports,omitempty"` + // Expose is a number of ports that will be forwarded to the container + // if PublishExposedPorts is set. + // Expose is a map of uint16 (port number) to a string representing + // protocol. Allowed protocols are "tcp", "udp", and "sctp", or some + // combination of the three separated by commas. + // If protocol is set to "" we will assume TCP. + // Only available if NetNS is set to Bridge or Slirp, and + // PublishExposedPorts is set. + // Optional. + Expose map[uint16]string `json:"expose,omitempty"` + // CNINetworks is a list of CNI networks to join the container to. + // If this list is empty, the default CNI network will be joined + // instead. If at least one entry is present, we will not join the + // default network (unless it is part of this list). + // Only available if NetNS is set to bridge. + // Optional. + CNINetworks []string `json:"cni_networks,omitempty"` + // UseImageResolvConf indicates that resolv.conf should not be managed + // by Podman, but instead sourced from the image. + // Conflicts with DNSServer, DNSSearch, DNSOption. + UseImageResolvConf bool `json:"use_image_resolve_conf,omitempty"` + // DNSServers is a set of DNS servers that will be used in the + // container's resolv.conf, replacing the host's DNS Servers which are + // used by default. + // Conflicts with UseImageResolvConf. + // Optional. + DNSServers []net.IP `json:"dns_server,omitempty"` + // DNSSearch is a set of DNS search domains that will be used in the + // container's resolv.conf, replacing the host's DNS search domains + // which are used by default. + // Conflicts with UseImageResolvConf. + // Optional. + DNSSearch []string `json:"dns_search,omitempty"` + // DNSOptions is a set of DNS options that will be used in the + // container's resolv.conf, replacing the host's DNS options which are + // used by default. + // Conflicts with UseImageResolvConf. + // Optional. + DNSOptions []string `json:"dns_option,omitempty"` + // UseImageHosts indicates that /etc/hosts should not be managed by + // Podman, and instead sourced from the image. + // Conflicts with HostAdd. + UseImageHosts bool `json:"use_image_hosts,omitempty"` + // HostAdd is a set of hosts which will be added to the container's + // /etc/hosts file. + // Conflicts with UseImageHosts. + // Optional. + HostAdd []string `json:"hostadd,omitempty"` + // NetworkOptions are additional options for each network + // Optional. + NetworkOptions map[string][]string `json:"network_options,omitempty"` +} + +// ContainerResourceConfig contains information on container resource limits. +type ContainerResourceConfig struct { + // ResourceLimits are resource limits to apply to the container., + // Can only be set as root on cgroups v1 systems, but can be set as + // rootless as well for cgroups v2. + // Optional. + ResourceLimits *spec.LinuxResources `json:"resource_limits,omitempty"` + // Rlimits are POSIX rlimits to apply to the container. + // Optional. + Rlimits []spec.POSIXRlimit `json:"r_limits,omitempty"` + // OOMScoreAdj adjusts the score used by the OOM killer to determine + // processes to kill for the container's process. + // Optional. + OOMScoreAdj *int `json:"oom_score_adj,omitempty"` + // Weight per cgroup per device, can override BlkioWeight + WeightDevice map[string]spec.LinuxWeightDevice `json:"weightDevice,omitempty"` + // IO read rate limit per cgroup per device, bytes per second + ThrottleReadBpsDevice map[string]spec.LinuxThrottleDevice `json:"throttleReadBpsDevice,omitempty"` + // IO write rate limit per cgroup per device, bytes per second + ThrottleWriteBpsDevice map[string]spec.LinuxThrottleDevice `json:"throttleWriteBpsDevice,omitempty"` + // IO read rate limit per cgroup per device, IO per second + ThrottleReadIOPSDevice map[string]spec.LinuxThrottleDevice `json:"throttleReadIOPSDevice,omitempty"` + // IO write rate limit per cgroup per device, IO per second + ThrottleWriteIOPSDevice map[string]spec.LinuxThrottleDevice `json:"throttleWriteIOPSDevice,omitempty"` +} + +// ContainerHealthCheckConfig describes a container healthcheck with attributes +// like command, retries, interval, start period, and timeout. +type ContainerHealthCheckConfig struct { + // HealthConfig *manifest.Schema2HealthConfig `json:"healthconfig,omitempty"` +} + +// SpecGenerator creates an OCI spec and Libpod configuration options to create +// a container based on the given configuration. +// swagger:model SpecGenerator +type SpecGenerator struct { + ContainerBasicConfig + ContainerStorageConfig + ContainerSecurityConfig + ContainerCgroupConfig + ContainerNetworkConfig + ContainerResourceConfig + ContainerHealthCheckConfig +} + +// NamedVolume holds information about a named volume that will be mounted into +// the container. +type NamedVolume struct { + // Name is the name of the named volume to be mounted. May be empty. + // If empty, a new named volume with a pseudorandomly generated name + // will be mounted at the given destination. + Name string + // Destination to mount the named volume within the container. Must be + // an absolute path. Path will be created if it does not exist. + Dest string + // Options are options that the named volume will be mounted with. + Options []string +} + +// OverlayVolume holds information about a overlay volume that will be mounted into +// the container. +type OverlayVolume struct { + // Destination is the absolute path where the mount will be placed in the container. + Destination string `json:"destination"` + // Source specifies the source path of the mount. + Source string `json:"source,omitempty"` +} + +// PortMapping is one or more ports that will be mapped into the container. +type PortMapping struct { + // HostIP is the IP that we will bind to on the host. + // If unset, assumed to be 0.0.0.0 (all interfaces). + HostIP string `json:"host_ip,omitempty"` + // ContainerPort is the port number that will be exposed from the + // container. + // Mandatory. + ContainerPort uint16 `json:"container_port"` + // HostPort is the port number that will be forwarded from the host into + // the container. + // If omitted, a random port on the host (guaranteed to be over 1024) + // will be assigned. + HostPort uint16 `json:"host_port,omitempty"` + // Range is the number of ports that will be forwarded, starting at + // HostPort and ContainerPort and counting up. + // This is 1-indexed, so 1 is assumed to be a single port (only the + // Hostport:Containerport mapping will be added), 2 is two ports (both + // Hostport:Containerport and Hostport+1:Containerport+1), etc. + // If unset, assumed to be 1 (a single port). + // Both hostport + range and containerport + range must be less than + // 65536. + Range uint16 `json:"range,omitempty"` + // Protocol is the protocol forward. + // Must be either "tcp", "udp", and "sctp", or some combination of these + // separated by commas. + // If unset, assumed to be TCP. + Protocol string `json:"protocol,omitempty"` +} + +// taken from https://github.com/containers/podman/blob/master/pkg/specgen/namespaces.go + +type NamespaceMode string + +const ( + // Default indicates the spec generator should determine + // a sane default + Default NamespaceMode = "default" + // Host means the the namespace is derived from + // the host + Host NamespaceMode = "host" + // Path is the path to a namespace + Path NamespaceMode = "path" + // FromContainer means namespace is derived from a + // different container + FromContainer NamespaceMode = "container" + // FromPod indicates the namespace is derived from a pod + FromPod NamespaceMode = "pod" + // Private indicates the namespace is private + Private NamespaceMode = "private" + // NoNetwork indicates no network namespace should + // be joined. loopback should still exists + NoNetwork NamespaceMode = "none" + // Bridge indicates that a CNI network stack + // should be used + Bridge NamespaceMode = "bridge" + // Slirp indicates that a slirp4netns network stack should + // be used + Slirp NamespaceMode = "slirp4netns" + // KeepId indicates a user namespace to keep the owner uid inside + // of the namespace itself + KeepID NamespaceMode = "keep-id" + // KeepId indicates to automatically create a user namespace + Auto NamespaceMode = "auto" + // DefaultKernelNamespaces is a comma-separated list of default kernel + // namespaces. + DefaultKernelNamespaces = "cgroup,ipc,net,uts" +) + +// Namespace describes the namespace +type Namespace struct { + NSMode NamespaceMode `json:"nsmode,omitempty"` + Value string `json:"string,omitempty"` +} diff --git a/apiclient/container_start.go b/apiclient/container_start.go index 9df67d2..f02e962 100644 --- a/apiclient/container_start.go +++ b/apiclient/container_start.go @@ -20,20 +20,27 @@ import ( "context" "fmt" "net/http" + "time" ) // ContainerStart starts a container via id or name func (c *APIClient) ContainerStart(ctx context.Context, name string) error { - res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/start", name)) + res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/start", name), nil) if err != nil { return err } defer res.Body.Close() - if res.StatusCode == http.StatusNoContent { - return nil + if res.StatusCode != http.StatusNoContent { + return fmt.Errorf("unknown error, status code: %d", res.StatusCode) } - return fmt.Errorf("unknown error, status code: %d", res.StatusCode) + + // wait max 10 seconds for running state + timeout, cancel := context.WithTimeout(ctx, time.Second*10) + defer cancel() + + err = c.ContainerWait(timeout, name, "running") + return err } diff --git a/apiclient/container_stop.go b/apiclient/container_stop.go index 03d079b..6ced42e 100644 --- a/apiclient/container_stop.go +++ b/apiclient/container_stop.go @@ -28,7 +28,7 @@ import ( // error will be returned instead. func (c *APIClient) ContainerStop(ctx context.Context, name string, timeout int) error { - res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/stop?timeout=%d", name, timeout)) + res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/stop?timeout=%d", name, timeout), nil) if err != nil { return err } diff --git a/apiclient/container_wait.go b/apiclient/container_wait.go new file mode 100644 index 0000000..fd0a7b6 --- /dev/null +++ b/apiclient/container_wait.go @@ -0,0 +1,39 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apiclient + +import ( + "context" + "fmt" + "net/http" +) + +// ContainerWait waits on a container to met a given condition +func (c *APIClient) ContainerWait(ctx context.Context, name string, condition string) error { + + res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/wait?condition=%s", name, condition), nil) + if err != nil { + return err + } + + defer res.Body.Close() + + if res.StatusCode == http.StatusOK { + return nil + } + return fmt.Errorf("unknown error, status code: %d", res.StatusCode) +} diff --git a/client.go b/client.go index 2e71532..354e41b 100644 --- a/client.go +++ b/client.go @@ -96,20 +96,6 @@ func (c *PodmanClient) GetContainerStats(containerID string) (*iopodman.Containe return containerStats, err } -// CreateContainer creates a new container from an image. It uses a [Create](#Create) type for input. -func (c *PodmanClient) CreateContainer(createOpts iopodman.Create) (string, error) { - ret := "" - err := c.withVarlink(func(varlinkConnection *varlink.Connection) error { - result, err := iopodman.CreateContainer().Call(c.ctx, varlinkConnection, createOpts) - if err == nil { - ret = result - c.logger.Debug("Created container", "container", ret) - } - return err - }) - return ret, err -} - // PullImage takes a name or ID of an image and pulls it to local storage // returning the name of the image pulled func (c *PodmanClient) PullImage(imageID string) (string, error) { diff --git a/driver.go b/driver.go index f6d3dc5..9daef47 100644 --- a/driver.go +++ b/driver.go @@ -19,8 +19,10 @@ package main import ( "context" "fmt" + "net" "os/user" "path/filepath" + "strconv" "strings" "time" @@ -40,6 +42,7 @@ import ( pstructs "github.com/hashicorp/nomad/plugins/shared/structs" shelpers "github.com/hashicorp/nomad/helper/stats" + spec "github.com/opencontainers/runtime-spec/specs-go" ) const ( @@ -364,89 +367,123 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } d.logger.Debug("created/pulled image", "img_id", img.ID) - allArgs := []string{driverConfig.Image} + createOpts := apiclient.SpecGenerator{} + createOpts.ContainerBasicConfig.LogConfiguration = &apiclient.LogConfig{} + allArgs := []string{} if driverConfig.Command != "" { allArgs = append(allArgs, driverConfig.Command) } allArgs = append(allArgs, driverConfig.Args...) - var entryPoint *string // nil -> image default entryPoint if driverConfig.Entrypoint != "" { - *entryPoint = driverConfig.Entrypoint - } - - var workingDir *string // nil -> image default workingDir - if driverConfig.WorkingDir != "" { - *workingDir = driverConfig.WorkingDir + createOpts.ContainerBasicConfig.Entrypoint = append(createOpts.ContainerBasicConfig.Entrypoint, driverConfig.Entrypoint) } containerName := BuildContainerName(cfg) - memoryLimit := fmt.Sprintf("%dm", cfg.Resources.NomadResources.Memory.MemoryMB) - cpuShares := cfg.Resources.LinuxResources.CPUShares - logOpts := []string{ - fmt.Sprintf("path=%s", cfg.StdoutPath), - } + cpuShares := uint64(cfg.Resources.LinuxResources.CPUShares) // ensure to include port_map into tasks environment map cfg.Env = taskenv.SetPortMapEnvs(cfg.Env, driverConfig.PortMap) - // convert environment map into a k=v list - allEnv := cfg.EnvList() + procFilesystems, err := getProcFilesystems() - allVolumes, err := d.containerBinds(cfg, &driverConfig) + // ------------------------------------------------------------------------------------------- + // BASIC + // ------------------------------------------------------------------------------------------- + createOpts.ContainerBasicConfig.Name = containerName + createOpts.ContainerBasicConfig.Command = allArgs + createOpts.ContainerBasicConfig.Env = cfg.Env + createOpts.ContainerBasicConfig.Hostname = driverConfig.Hostname + + createOpts.ContainerBasicConfig.LogConfiguration.Path = cfg.StdoutPath + + // ------------------------------------------------------------------------------------------- + // STORAGE + // ------------------------------------------------------------------------------------------- + createOpts.ContainerStorageConfig.Init = driverConfig.Init + createOpts.ContainerStorageConfig.Image = driverConfig.Image + createOpts.ContainerStorageConfig.InitPath = driverConfig.InitPath + createOpts.ContainerStorageConfig.WorkDir = driverConfig.WorkingDir + allMounts, err := d.containerMounts(cfg, &driverConfig) if err != nil { return nil, nil, err } - d.logger.Debug("binding volumes", "volumes", allVolumes) + createOpts.ContainerStorageConfig.Mounts = allMounts - swap := memoryLimit - if driverConfig.MemorySwap != "" { - swap = driverConfig.MemorySwap + // ------------------------------------------------------------------------------------------- + // RESOURCES + // ------------------------------------------------------------------------------------------- + createOpts.ContainerResourceConfig.ResourceLimits = &spec.LinuxResources{ + Memory: &spec.LinuxMemory{}, + CPU: &spec.LinuxCPU{}, + } + if driverConfig.MemoryReservation != "" { + reservation, err := memoryInBytes(driverConfig.MemoryReservation) + if err != nil { + return nil, nil, err + } + createOpts.ContainerResourceConfig.ResourceLimits.Memory.Reservation = &reservation } - procFilesystems, err := getProcFilesystems() - swappiness := new(int64) + if cfg.Resources.NomadResources.Memory.MemoryMB > 0 { + limit := cfg.Resources.NomadResources.Memory.MemoryMB * 1024 * 1024 + createOpts.ContainerResourceConfig.ResourceLimits.Memory.Limit = &limit + } + if driverConfig.MemorySwap != "" { + swap, err := memoryInBytes(driverConfig.MemorySwap) + if err != nil { + return nil, nil, err + } + createOpts.ContainerResourceConfig.ResourceLimits.Memory.Swap = &swap + } if err == nil { cgroupv2 := false for _, l := range procFilesystems { cgroupv2 = cgroupv2 || strings.HasSuffix(l, "cgroup2") } if !cgroupv2 { - swappiness = &driverConfig.MemorySwappiness + swappiness := uint64(driverConfig.MemorySwappiness) + createOpts.ContainerResourceConfig.ResourceLimits.Memory.Swappiness = &swappiness } } - - // Generate network string - var network string - if cfg.NetworkIsolation != nil && - cfg.NetworkIsolation.Path != "" { - network = fmt.Sprintf("ns:%s", cfg.NetworkIsolation.Path) + createOpts.ContainerResourceConfig.ResourceLimits.CPU.Shares = &cpuShares + + // ------------------------------------------------------------------------------------------- + // SECURITY + // ------------------------------------------------------------------------------------------- + createOpts.ContainerSecurityConfig.CapAdd = driverConfig.CapAdd + createOpts.ContainerSecurityConfig.CapDrop = driverConfig.CapDrop + createOpts.ContainerSecurityConfig.User = cfg.User + + // ------------------------------------------------------------------------------------------- + // NETWORK + // ------------------------------------------------------------------------------------------- + for _, strdns := range driverConfig.Dns { + ipdns := net.ParseIP(strdns) + if ipdns == nil { + return nil, nil, fmt.Errorf("Invald dns server address") + } + createOpts.ContainerNetworkConfig.DNSServers = append(createOpts.ContainerNetworkConfig.DNSServers, ipdns) + } + // Configure network + if cfg.NetworkIsolation != nil && cfg.NetworkIsolation.Path != "" { + createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.Path + createOpts.ContainerNetworkConfig.NetNS.Value = cfg.NetworkIsolation.Path } else { - network = driverConfig.NetworkMode - } - - createOpts := iopodman.Create{ - Args: allArgs, - Entrypoint: entryPoint, - WorkDir: workingDir, - Env: &allEnv, - Name: &containerName, - Volume: &allVolumes, - Memory: &memoryLimit, - CpuShares: &cpuShares, - CapAdd: &driverConfig.CapAdd, - CapDrop: &driverConfig.CapDrop, - Dns: &driverConfig.Dns, - LogOpt: &logOpts, - Hostname: &driverConfig.Hostname, - Init: &driverConfig.Init, - InitPath: &driverConfig.InitPath, - User: &cfg.User, - MemoryReservation: &driverConfig.MemoryReservation, - MemorySwap: &swap, - MemorySwappiness: swappiness, - Network: &network, - Tmpfs: &driverConfig.Tmpfs, + if driverConfig.NetworkMode == "" { + createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.Bridge + } else if driverConfig.NetworkMode == "bridge" { + createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.Bridge + } else if driverConfig.NetworkMode == "host" { + createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.Host + } else if driverConfig.NetworkMode == "none" { + createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.NoNetwork + } else if driverConfig.NetworkMode == "slirp4netns" { + createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.Slirp + } else { + // FIXME: needs more work, parsing etc. + return nil, nil, fmt.Errorf("Unknown/Unsupported network mode: %s", driverConfig.NetworkMode) + } } // Setup port mapping and exposed ports @@ -456,29 +493,39 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive return nil, nil, fmt.Errorf("Trying to map ports but no network interface is available") } } else { - publishedPorts := []string{} + publishedPorts := []apiclient.PortMapping{} network := cfg.Resources.NomadResources.Networks[0] allPorts := []structs.Port{} allPorts = append(allPorts, network.ReservedPorts...) allPorts = append(allPorts, network.DynamicPorts...) for _, port := range allPorts { - hostPort := port.Value + hostPort := uint16(port.Value) // By default we will map the allocated port 1:1 to the container - containerPort := port.Value + containerPort := uint16(port.Value) // If the user has mapped a port using port_map we'll change it here if mapped, ok := driverConfig.PortMap[port.Label]; ok { - containerPort = mapped + containerPort = uint16(mapped) } // we map both udp and tcp ports - publishedPorts = append(publishedPorts, fmt.Sprintf("%s:%d:%d/tcp", network.IP, hostPort, containerPort)) - publishedPorts = append(publishedPorts, fmt.Sprintf("%s:%d:%d/udp", network.IP, hostPort, containerPort)) + publishedPorts = append(publishedPorts, apiclient.PortMapping{ + HostIP: network.IP, + HostPort: hostPort, + ContainerPort: containerPort, + Protocol: "tcp", + }) + publishedPorts = append(publishedPorts, apiclient.PortMapping{ + HostIP: network.IP, + HostPort: hostPort, + ContainerPort: containerPort, + Protocol: "udp", + }) } - - createOpts.Publish = &publishedPorts + createOpts.ContainerNetworkConfig.PortMappings = publishedPorts } + // ------------------------------------------------------------------------------------------- containerID := "" recoverRunningContainer := false @@ -501,10 +548,14 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } if !recoverRunningContainer { - containerID, err = d.podmanClient.CreateContainer(createOpts) + createResponse, err := d.podmanClient2.ContainerCreate(d.ctx, createOpts) + for _, w := range createResponse.Warnings { + d.logger.Warn("Create Warning", "warning", w) + } if err != nil { return nil, nil, fmt.Errorf("failed to start task, could not create container: %v", err) } + containerID = createResponse.Id } cleanup := func() { @@ -572,6 +623,30 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive return handle, net, nil } +func memoryInBytes(strmem string) (int64, error) { + l := len(strmem) + if l < 2 { + return 0, fmt.Errorf("Invalid memory string: %s", strmem) + } + ival, err := strconv.Atoi(strmem[0 : l-1]) + if err != nil { + return 0, err + } + + switch strmem[l-1] { + case 'b': + return int64(ival), nil + case 'k': + return int64(ival) * 1024, nil + case 'm': + return int64(ival) * 1024 * 1024, nil + case 'g': + return int64(ival) * 1024 * 1024 * 1024, nil + default: + return 0, fmt.Errorf("Invalid memory string: %s", strmem) + } +} + // WaitTask function is expected to return a channel that will send an *ExitResult when the task // exits or close the channel when the context is canceled. It is also expected that calling // WaitTask on an exited task will immediately send an *ExitResult on the returned channel. @@ -625,6 +700,16 @@ func (d *Driver) DestroyTask(taskID string, force bool) error { if err != nil { d.logger.Warn("failed to stop/kill container during destroy", "error", err) } + // wait a while for stats emitter to collect exit code etc. + for i := 0; i < 20; i++ { + if !handle.isRunning() { + break + } + time.Sleep(time.Millisecond * 250) + } + if handle.isRunning() { + d.logger.Warn("stats emitter did not exit while stop/kill container during destroy", "error", err) + } } if handle.removeContainerOnExit { @@ -727,15 +812,15 @@ func (d *Driver) createImage(cfg *drivers.TaskConfig, driverConfig *TaskConfig) return img, nil } -func (d *Driver) containerBinds(task *drivers.TaskConfig, driverConfig *TaskConfig) ([]string, error) { - allocDirBind := fmt.Sprintf("%s:%s", task.TaskDir().SharedAllocDir, task.Env[taskenv.AllocDir]) - taskLocalBind := fmt.Sprintf("%s:%s", task.TaskDir().LocalDir, task.Env[taskenv.TaskLocalDir]) - secretDirBind := fmt.Sprintf("%s:%s", task.TaskDir().SecretsDir, task.Env[taskenv.SecretsDir]) - binds := []string{allocDirBind, taskLocalBind, secretDirBind} +func (d *Driver) containerMounts(task *drivers.TaskConfig, driverConfig *TaskConfig) ([]spec.Mount, error) { + binds := []spec.Mount{} + binds = append(binds, spec.Mount{Source: task.TaskDir().SharedAllocDir, Destination: task.Env[taskenv.AllocDir], Type: "bind"}) + binds = append(binds, spec.Mount{Source: task.TaskDir().LocalDir, Destination: task.Env[taskenv.TaskLocalDir], Type: "bind"}) + binds = append(binds, spec.Mount{Source: task.TaskDir().SecretsDir, Destination: task.Env[taskenv.SecretsDir], Type: "bind"}) // TODO support volume drivers // https://github.com/containers/libpod/pull/4548 - taskLocalBindVolume := false + taskLocalBindVolume := true for _, userbind := range driverConfig.Volumes { src, dst, mode, err := parseVolumeSpec(userbind) @@ -759,10 +844,14 @@ func (d *Driver) containerBinds(task *drivers.TaskConfig, driverConfig *TaskConf if !d.config.Volumes.Enabled && !isParentPath(task.AllocDir, src) { return nil, fmt.Errorf("volumes are not enabled; cannot mount host paths: %+q", userbind) } + bind := spec.Mount{ + Source: src, + Destination: dst, + Type: "bind", + } - bind := src + ":" + dst if mode != "" { - bind += ":" + mode + bind.Options = append(bind.Options, mode) } binds = append(binds, bind) } @@ -770,10 +859,18 @@ func (d *Driver) containerBinds(task *drivers.TaskConfig, driverConfig *TaskConf if selinuxLabel := d.config.Volumes.SelinuxLabel; selinuxLabel != "" { // Apply SELinux Label to each volume for i := range binds { - binds[i] = fmt.Sprintf("%s:%s", binds[i], selinuxLabel) + binds[i].Options = append(binds[i].Options, selinuxLabel) } } + for _, dst := range driverConfig.Tmpfs { + bind := spec.Mount{ + Destination: dst, + Type: "tmpfs", + } + binds = append(binds, bind) + } + return binds, nil } diff --git a/driver_test.go b/driver_test.go index 1c96d0c..dfff75b 100644 --- a/driver_test.go +++ b/driver_test.go @@ -32,6 +32,7 @@ import ( "time" "github.com/hashicorp/go-hclog" + "github.com/hashicorp/nomad-driver-podman/apiclient" "github.com/hashicorp/nomad-driver-podman/iopodman" "github.com/hashicorp/nomad/client/taskenv" "github.com/hashicorp/nomad/helper/freeport" @@ -88,7 +89,14 @@ func createBasicResources() *drivers.Resources { // A driver plugin interface and cleanup function is returned func podmanDriverHarness(t *testing.T, cfg map[string]interface{}) *dtestutil.DriverHarness { - d := NewPodmanDriver(testlog.HCLogger(t)).(*Driver) + logger := testlog.HCLogger(t) + if testing.Verbose() { + logger.SetLevel(hclog.Trace) + } else { + logger.SetLevel(hclog.Info) + } + + d := NewPodmanDriver(logger).(*Driver) d.podmanClient = newPodmanClient() d.config.Volumes.Enabled = true if enforce, err := ioutil.ReadFile("/sys/fs/selinux/enforce"); err == nil { @@ -237,17 +245,15 @@ func TestPodmanDriver_Start_StoppedContainer(t *testing.T) { // the case of dockerd getting restarted and stopping containers while // Nomad is watching them. containerName := BuildContainerName(task) - createOpts := iopodman.Create{ - Args: []string{ - taskCfg.Image, - "sleep", - "5", - }, - Name: &containerName, + createOpts := apiclient.SpecGenerator{} + createOpts.ContainerBasicConfig.Name = containerName + createOpts.ContainerStorageConfig.Image = taskCfg.Image + createOpts.ContainerBasicConfig.Command = []string{ + "sleep", + "5", } - podman := newPodmanClient() - _, err := podman.CreateContainer(createOpts) + _, err := getPodmanDriver(t, d).podmanClient2.ContainerCreate(context.Background(), createOpts) require.NoError(t, err) _, _, err = d.StartTask(task) @@ -265,7 +271,6 @@ func TestPodmanDriver_Start_Wait_AllocDir(t *testing.T) { exp := []byte{'w', 'i', 'n'} file := "output.txt" - allocDir := "/mnt/alloc" taskCfg := newTaskConfig("", []string{ "sh", @@ -273,7 +278,6 @@ func TestPodmanDriver_Start_Wait_AllocDir(t *testing.T) { fmt.Sprintf(`echo -n %s > $%s/%s; sleep 1`, string(exp), taskenv.AllocDir, file), }) - taskCfg.Volumes = []string{fmt.Sprintf("alloc/:%s", allocDir)} task := &drivers.TaskConfig{ ID: uuid.Generate(), Name: "start_wait_allocDir", @@ -659,6 +663,9 @@ func TestPodmanDriver_Init(t *testing.T) { // test oom flag propagation func TestPodmanDriver_OOM(t *testing.T) { + + t.Skip("Skipping oom test because of podman cgroup v2 bugs") + if !tu.IsCI() { t.Parallel() } @@ -690,7 +697,7 @@ func TestPodmanDriver_OOM(t *testing.T) { AllocID: uuid.Generate(), Resources: createBasicResources(), } - // limit memory to 10MB to trigger oom soon enough + // limit memory to 5MB to trigger oom soon enough task.Resources.NomadResources.Memory.MemoryMB = 10 require.NoError(t, task.EncodeConcreteDriverConfig(&taskCfg)) @@ -712,7 +719,7 @@ func TestPodmanDriver_OOM(t *testing.T) { require.False(t, res.Successful(), "Should have failed because of oom but was successful") require.True(t, res.OOMKilled, "OOM Flag not set") require.Contains(t, res.Err.Error(), "OOM killer") - case <-time.After(time.Duration(tu.TestMultiplier()*2) * time.Second): + case <-time.After(time.Duration(tu.TestMultiplier()*3) * time.Second): t.Fatalf("Container did not exit in time") } } @@ -1095,9 +1102,13 @@ func getPodmanConnection(ctx context.Context) (*varlink.Connection, error) { } func newPodmanClient() *PodmanClient { + level := hclog.Info + if testing.Verbose() { + level = hclog.Trace + } testLogger := hclog.New(&hclog.LoggerOptions{ Name: "testClient", - Level: hclog.LevelFromString("DEBUG"), + Level: level, }) client := &PodmanClient{ ctx: context.Background(), diff --git a/go.mod b/go.mod index c02b78b..f04ec6c 100644 --- a/go.mod +++ b/go.mod @@ -24,6 +24,7 @@ require ( github.com/hashicorp/nomad/api v0.0.0-20200630133459-42c2ee4448c8 github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mrunalp/fileutils v0.0.0-20200504145649-7be891c94fd3 // indirect + github.com/opencontainers/runtime-spec v1.0.2-0.20200307132014-f49fed0d6290 github.com/opencontainers/selinux v1.5.1 // indirect github.com/stretchr/testify v1.5.1 github.com/varlink/go v0.3.0 diff --git a/handle.go b/handle.go index 685410d..e904e2c 100644 --- a/handle.go +++ b/handle.go @@ -178,8 +178,14 @@ func (h *TaskHandle) runContainerMonitor() { containerStats, err := h.driver.podmanClient.GetContainerStats(h.containerID) if err != nil { - if _, ok := err.(*iopodman.NoContainerRunning); ok { - h.logger.Debug("Container is not running anymore", "container", h.containerID) + gone := false + if _, ok := err.(*iopodman.ContainerNotFound); ok { + gone = true + } else if _, ok := err.(*iopodman.NoContainerRunning); ok { + gone = true + } + if gone { + h.logger.Debug("Container is not running anymore", "container", h.containerID, "err", err) // container was stopped, get exit code and other post mortem infos inspectData, err := h.driver.podmanClient2.ContainerInspect(h.driver.ctx, h.containerID) h.stateLock.Lock() From 84bb809ce0280dc19fc3b8d4a58dfd413dd795c2 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Tue, 1 Sep 2020 19:15:51 +0200 Subject: [PATCH 12/31] Improved tmpfs unittest --- driver_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/driver_test.go b/driver_test.go index dfff75b..470dd93 100644 --- a/driver_test.go +++ b/driver_test.go @@ -888,8 +888,8 @@ func TestPodmanDriver_Tmpfs(t *testing.T) { // see if stdout was populated with expected "mount" output tasklog := readLogfile(t, task) - require.Contains(t, tasklog, " tmpfs on /tmpdata1 type tmpfs ") - require.Contains(t, tasklog, " tmpfs on /tmpdata2 type tmpfs ") + require.Contains(t, tasklog, " on /tmpdata1 type tmpfs ") + require.Contains(t, tasklog, " on /tmpdata2 type tmpfs ") } // check default capabilities From f06c899e9d09ff4a5a2f9c714404cb0e2798ba14 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sun, 6 Sep 2020 11:38:10 +0200 Subject: [PATCH 13/31] Implement ContainerKill / SignalTask http api call --- apiclient/container_kill.go | 39 ++++++ client.go | 12 -- driver.go | 11 +- driver_test.go | 44 +++++++ go.mod | 8 +- go.sum | 239 ------------------------------------ 6 files changed, 89 insertions(+), 264 deletions(-) create mode 100644 apiclient/container_kill.go diff --git a/apiclient/container_kill.go b/apiclient/container_kill.go new file mode 100644 index 0000000..35d8b29 --- /dev/null +++ b/apiclient/container_kill.go @@ -0,0 +1,39 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apiclient + +import ( + "context" + "fmt" + "net/http" +) + +// ContainerKill sends a signal to a container +func (c *APIClient) ContainerKill(ctx context.Context, name string, signal string) error { + + res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/kill?signal=%s", name, signal), nil) + if err != nil { + return err + } + + defer res.Body.Close() + + if res.StatusCode == http.StatusNoContent { + return nil + } + return fmt.Errorf("unknown error, status code: %d", res.StatusCode) +} diff --git a/client.go b/client.go index 595b34f..354e41b 100644 --- a/client.go +++ b/client.go @@ -30,7 +30,6 @@ import ( "os" "os/user" "strings" - "syscall" "time" ) @@ -97,17 +96,6 @@ func (c *PodmanClient) GetContainerStats(containerID string) (*iopodman.Containe return containerStats, err } -// Forward signal to the container. -// This is an optional capability. -func (c *PodmanClient) SignalContainer(containerID string, sig os.Signal) error { - c.logger.Debug("Sending signal to the container", "container", containerID, "signal", sig) - err := c.withVarlink(func(varlinkConnection *varlink.Connection) error { - _, err := iopodman.KillContainer().Call(c.ctx, varlinkConnection, containerID, int64(sig.(syscall.Signal))) - return err - }) - return err -} - // PullImage takes a name or ID of an image and pulls it to local storage // returning the name of the image pulled func (c *PodmanClient) PullImage(imageID string) (string, error) { diff --git a/driver.go b/driver.go index f809383..1096deb 100644 --- a/driver.go +++ b/driver.go @@ -28,7 +28,6 @@ import ( "github.com/hashicorp/nomad/nomad/structs" - "github.com/hashicorp/consul-template/signals" "github.com/hashicorp/go-hclog" "github.com/hashicorp/nomad-driver-podman/apiclient" "github.com/hashicorp/nomad-driver-podman/iopodman" @@ -765,15 +764,7 @@ func (d *Driver) SignalTask(taskID string, signal string) error { return drivers.ErrTaskNotFound } - // The given signal will be forwarded to the target taskID. - // Please checkout https://github.com/hashicorp/consul-template/blob/master/signals/signals_unix.go - // for a list of supported signals. - sig, ok := signals.SignalLookup[signal] - if !ok { - return fmt.Errorf("Invalid signal: %s", signal) - } - - return d.podmanClient.SignalContainer(handle.containerID, sig) + return d.podmanClient2.ContainerKill(d.ctx, handle.containerID, signal) } // ExecTask function is used by the Nomad client to execute commands inside the task execution context. diff --git a/driver_test.go b/driver_test.go index 470dd93..b624903 100644 --- a/driver_test.go +++ b/driver_test.go @@ -1045,6 +1045,50 @@ func TestPodmanDriver_NetworkMode(t *testing.T) { } } +// test kill / signal support +func TestPodmanDriver_SignalTask(t *testing.T) { + if !tu.IsCI() { + t.Parallel() + } + + taskCfg := newTaskConfig("", busyboxLongRunningCmd) + task := &drivers.TaskConfig{ + ID: uuid.Generate(), + Name: "signal_task", + AllocID: uuid.Generate(), + Resources: createBasicResources(), + } + require.NoError(t, task.EncodeConcreteDriverConfig(&taskCfg)) + + d := podmanDriverHarness(t, nil) + cleanup := d.MkAllocDir(task, true) + defer cleanup() + + _, _, err := d.StartTask(task) + require.NoError(t, err) + + defer d.DestroyTask(task.ID, true) + + go func(t *testing.T) { + time.Sleep(300 * time.Millisecond) + // try to send non-existing singal, should yield an error + require.Error(t, d.SignalTask(task.ID, "FOO")) + time.Sleep(300 * time.Millisecond) + // SIGINT should stop busybox and hence the container will shutdown + require.NoError(t, d.SignalTask(task.ID, "SIGINT")) + }(t) + + // Attempt to wait + waitCh, err := d.WaitTask(context.Background(), task.ID) + require.NoError(t, err) + + select { + case <-waitCh: + t.Fatalf("wait channel should not have received an exit result") + case <-time.After(time.Duration(tu.TestMultiplier()*2) * time.Second): + } +} + // read a tasks logfile into a string, fail on error func readLogfile(t *testing.T, task *drivers.TaskConfig) string { logfile := filepath.Join(filepath.Dir(task.StdoutPath), fmt.Sprintf("%s.stdout.0", task.Name)) diff --git a/go.mod b/go.mod index cc6cb71..f967ec9 100644 --- a/go.mod +++ b/go.mod @@ -18,18 +18,20 @@ require ( github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect github.com/docker/go-metrics v0.0.1 // indirect github.com/go-ole/go-ole v1.2.4 // indirect - github.com/golangci/golangci-lint v1.30.0 // indirect + github.com/google/go-cmp v0.5.0 // indirect github.com/hashicorp/consul v1.7.3 // indirect - github.com/hashicorp/consul-template v0.24.1 github.com/hashicorp/go-hclog v0.14.1 - github.com/hashicorp/go-hclog/hclogvet v0.1.3 // indirect github.com/hashicorp/nomad v0.11.3-0.20200630133459-42c2ee4448c8 github.com/hashicorp/nomad/api v0.0.0-20200630133459-42c2ee4448c8 + github.com/mattn/go-colorable v0.1.7 // indirect + github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mrunalp/fileutils v0.0.0-20200504145649-7be891c94fd3 // indirect + github.com/onsi/ginkgo v1.13.0 // indirect github.com/opencontainers/runtime-spec v1.0.2-0.20200307132014-f49fed0d6290 github.com/opencontainers/selinux v1.5.1 // indirect github.com/stretchr/testify v1.6.1 github.com/varlink/go v0.3.0 + golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305 // indirect google.golang.org/grpc v1.29.1 // indirect ) diff --git a/go.sum b/go.sum index 8368089..92d614f 100644 --- a/go.sum +++ b/go.sum @@ -14,7 +14,6 @@ cloud.google.com/go/bigquery v1.0.1 h1:hL+ycaJpVE9M7nLoiXb/Pn10ENE2u+oddxbD8uu0Z cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/datastore v1.0.0 h1:Kt+gOPPp2LEPWp8CSfxhsM8ik9CcyE/gYu+0r+RnZvM= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1 h1:W9tAK3E57P75u0XLLR82LZyw8VpAnhmyTOxW9qzmyj8= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/storage v1.0.0 h1:VV2nUM3wwLLGh9lSABFgZMjInyUbJeaRSE64WuAIQ+4= @@ -45,12 +44,8 @@ github.com/DataDog/datadog-go v2.2.0+incompatible h1:V5BKkxACZLjzHjSgBbr2gvLA2Ae github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/Djarvur/go-err113 v0.0.0-20200511133814-5174e21577d5 h1:XTrzB+F8+SpRmbhAH8HLxhiiG6nYNwaBZjrFps1oWEk= -github.com/Djarvur/go-err113 v0.0.0-20200511133814-5174e21577d5/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5 h1:U7q69tqXiCf6m097GRlNQB0/6SI1qWIOHYHhCEvDxF4= github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5/go.mod h1:nxQPcNPR/34g+HcK2hEsF99O+GJgIkW/OmPl8wtzhmk= -github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Microsoft/go-winio v0.4.3/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= @@ -65,9 +60,6 @@ github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20180829222009-86f2a9fac6c5 h1:WLy github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20180829222009-86f2a9fac6c5/go.mod h1:nMOvShGpWaf0bXwXmeu4k+O4uziuaEI8pWzIj3BUrOA= github.com/NYTimes/gziphandler v1.0.1 h1:iLrQrdwjDd52kHDA5op2UBJFjmOb9g+7scBan4RN8F0= github.com/NYTimes/gziphandler v1.0.1/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= -github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= @@ -92,7 +84,6 @@ github.com/apparentlymart/go-textseg/v12 v12.0.0 h1:bNEQyAGak9tojivJNkoqWErVCQbj github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 h1:EFSB7Zo9Eg91v7MJPVsifUysc/wPdN+NOnVe6bWbdBM= github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg= @@ -117,13 +108,10 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/bombsimon/wsl/v3 v3.1.0 h1:E5SRssoBgtVFPcYWUOFJEcgaySgdtTNYzsSKDOY7ss8= -github.com/bombsimon/wsl/v3 v3.1.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= @@ -133,7 +121,6 @@ github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3k github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1 h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b h1:T4nWG1TXIxeor8mAu5bFguPJgSIGhZqv/f0z55KCrJM= @@ -177,13 +164,9 @@ github.com/containernetworking/plugins v0.7.3-0.20190501191748-2d6d46d308b2/go.m github.com/containernetworking/plugins v0.8.5 h1:pCvEMrFf7yzJI8+/D/7jkvE96KD52b7/Eu+jpahihy8= github.com/containernetworking/plugins v0.8.5/go.mod h1:UZ2539umj8djuRQmBxuazHeJbYrLV8BSBejkk+she6o= github.com/coredns/coredns v1.1.2/go.mod h1:zASH/MVDgR6XZTbxvOnsZfffS+31vg6Ackf/wo1+AM0= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-iptables v0.4.3-0.20190724151750-969b135e941d/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= github.com/coreos/go-iptables v0.4.5 h1:DpHb9vJrZQEFMcVLFKAAGMUVX0XoRC0ptCthinRYm38= github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= @@ -192,8 +175,6 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyphar/filepath-securejoin v0.2.3-0.20190205144030-7efe413b52e1 h1:dCqRswe3ZAwkQWdvFLwRqmJCpGP3DWb7bFogdqY3+QU= github.com/cyphar/filepath-securejoin v0.2.3-0.20190205144030-7efe413b52e1/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= @@ -201,20 +182,15 @@ github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1S github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s= github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8= github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I= -github.com/daixiang0/gci v0.0.0-20200727065011-66f1df783cb2 h1:3Lhhps85OdA8ezsEKu+IA1hE+DBTjt/fjd7xNCrHbVA= -github.com/daixiang0/gci v0.0.0-20200727065011-66f1df783cb2/go.mod h1:+AV8KmHTGxxwp/pY84TLQfFKp2vuKXXJVzF3kD/hfR4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denis-tingajkin/go-header v0.3.1 h1:ymEpSiFjeItCy1FOP+x0M2KdCELdEAHUsNa8F+hHc6w= -github.com/denis-tingajkin/go-header v0.3.1/go.mod h1:sq/2IxMhaZX+RRcgHfCRx/m0M5na0fBt4/CRe7Lrji0= github.com/denverdino/aliyungo v0.0.0-20170926055100-d3308649c661/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba h1:p6poVbjHDkKa+wtC8frBMwQtT3BmqGYBjzMwJ63tuR4= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/digitalocean/godo v1.1.1/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= github.com/digitalocean/godo v1.10.0 h1:uW1/FcvZE/hoixnJcnlmIUvTVNdZCLjRLzmDtRi1xXY= github.com/digitalocean/godo v1.10.0/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= @@ -277,54 +253,23 @@ github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYis github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-check/check v0.0.0-20140225173054-eb6ee6f84d0a/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/go-critic/go-critic v0.5.0 h1:Ic2p5UCl5fX/2WX2w8nroPpPhxRNsNTMlJzsu/uqwnM= -github.com/go-critic/go-critic v0.5.0/go.mod h1:4jeRh3ZAVnRYhuWdOEvwzVqLUpxMSoAT0xZ74JsTPlo= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= -github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g= -github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= -github.com/go-toolsmith/astcopy v1.0.0 h1:OMgl1b1MEpjFQ1m5ztEO06rz5CUd3oBv9RF7+DyvdG8= -github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= -github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= -github.com/go-toolsmith/astequal v1.0.0 h1:4zxD8j3JRFNyLN46lodQuqz3xdKSrur7U/sr0SDS/gQ= -github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= -github.com/go-toolsmith/astfmt v0.0.0-20180903215011-8f8ee99c3086/go.mod h1:mP93XdblcopXwlyN4X4uodxXQhldPGZbcEJIimQHrkg= -github.com/go-toolsmith/astfmt v1.0.0 h1:A0vDDXt+vsvLEdbMFJAUBI/uTbRw1ffOPnxsILnFL6k= -github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= -github.com/go-toolsmith/astinfo v0.0.0-20180906194353-9809ff7efb21/go.mod h1:dDStQCHtmZpYOmjRP/8gHHnCCch3Zz3oEgCdZVdtweU= -github.com/go-toolsmith/astp v0.0.0-20180903215135-0af7e3c24f30/go.mod h1:SV2ur98SGypH1UjcPpCatrV5hPazG6+IfNHbkDXBRrk= -github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg= -github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= -github.com/go-toolsmith/pkgload v0.0.0-20181119091011-e9e65178eee8/go.mod h1:WoMrjiy4zvdS+Bg6z9jZH82QXwkcgCBX6nOfnmdaHks= -github.com/go-toolsmith/pkgload v1.0.0/go.mod h1:5eFArkbO80v7Z0kdngIxsRXRMTaX4Ilcwuh3clNrQJc= -github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4= -github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= -github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= -github.com/go-toolsmith/typep v1.0.2 h1:8xdsa1+FSIH/RhEkgnD1j2CJOy5mNllW1Q9tRiYwvlk= -github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= -github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4/FHQWkvVRmgijNXRfzkIDHh23ggEo= -github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= -github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= -github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/godbus/dbus v5.0.1+incompatible h1:fsDsnr/6MFSIm3kl6JJpq5pH+vO/rA5jUunalLnzSc8= github.com/godbus/dbus v5.0.1+incompatible/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= -github.com/gofrs/flock v0.7.1 h1:DP+LD/t0njgoPBvT5MJLeliUIVQR03hiKR6vezdwHlc= -github.com/gofrs/flock v0.7.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -335,7 +280,6 @@ github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5 github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -358,36 +302,6 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= -github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= -github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= -github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= -github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 h1:YYWNAGTKWhKpcLLt7aSj/odlKrSrelQwlovBpDuf19w= -github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0= -github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZBf8NjltjWihK2QfBBBZuv91cMFfDHw= -github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= -github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 h1:pe9JHs3cHHDQgOFXJJdYkK6fLz2PWyYtP4hthoCMvs8= -github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3/go.mod h1:JXrF4TWy4tXYn62/9x8Wm/K/dm06p8tCKwFRDPZG/1o= -github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d h1:pXTK/gkVNs7Zyy7WKgLXmpQ5bHTrq5GDsp8R9Qs67g0= -github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d/go.mod h1:ozx7R9SIwqmqf5pRP90DhR2Oay2UIjGuKheCBCNwAYU= -github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= -github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.30.0 h1:UhdK5WbO0GBd7W+k2lOD7BEJH4Wsa7zKfw8m3/aEJGQ= -github.com/golangci/golangci-lint v1.30.0/go.mod h1:5t0i3wHlqQc9deBBvZsP+a/4xz7cfjV+zhp5U0Mzp14= -github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc h1:gLLhTLMk2/SutryVJ6D4VZCU3CUqr8YloG7FPIBWFpI= -github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU= -github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= -github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= -github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= -github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= -github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770 h1:EL/O5HGrF7Jaq0yNhBLucz9hTuRzj2LdwGBOaENgxIk= -github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= -github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 h1:leSNB7iYzLYSSx3J/s5sVf4Drkc68W2wm4Ixh/mr0us= -github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bzsHdTM0bsB7+8mt0GUMvjCgwLpTapNZHU8AajI= -github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 h1:HVfrLniijszjS1aiNg8JbBMO2+E1WIQ+j/gL4SQqGPg= -github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= -github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= -github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= @@ -411,7 +325,6 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= @@ -419,7 +332,6 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/gookit/color v1.2.5/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg= github.com/gophercloud/gophercloud v0.0.0-20180828235145-f29afc2cceca h1:wobTb8SE189AuxzEKClyYxiI4nUGWlpVtl13eLiFlOE= github.com/gophercloud/gophercloud v0.0.0-20180828235145-f29afc2cceca/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -430,19 +342,13 @@ github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= -github.com/gostaticanalysis/analysisutil v0.0.3 h1:iwp+5/UAyzQSFgQ4uR2sni99sJ8Eo9DEacKWM5pekIg= -github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39 h1:MqvH60+R2JhSdvVgGxmExOndrkRQtGW7w4+gcrymN64= github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0 h1:bM6ZAFZmc/wPFaRDi0d5L7hGEZEx/2u+Tmr2evNHDiI= @@ -452,11 +358,9 @@ github.com/hashicorp/consul v1.7.3 h1:b33lARUsnuz0I5VapThpf7TMIirD4Co2X0UtZIax/+ github.com/hashicorp/consul v1.7.3/go.mod h1:ULIn4NmujdEvr3u3ckVYKPm6usKMuiIiL9zOu4H1nUE= github.com/hashicorp/consul-template v0.24.1 h1:96zTJ5YOq4HMTgtehXRvzGoQNEG2Z4jBYY5ofhq8/Cc= github.com/hashicorp/consul-template v0.24.1/go.mod h1:KcTEopo2kCp7kww0d4oG7d3oX2Uou4hzb1Rs/wY9TVI= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.2.0/go.mod h1:1SIkFYi2ZTXUE5Kgt179+4hH33djo11+0Eo2XgTAtkw= github.com/hashicorp/consul/api v1.4.0 h1:jfESivXnO5uLdH650JU/6AnjRoHrLhULq0FnC3Kp9EY= github.com/hashicorp/consul/api v1.4.0/go.mod h1:xc8u05kyMa3Wjr9eEAsIAo3dg8+LywT5E/Cl7cNS5nU= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.2.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.4.0 h1:zBtCfKJZcJDBvSCkQJch4ulp59m1rATFLKwNo/LYY30= github.com/hashicorp/consul/sdk v0.4.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= @@ -489,8 +393,6 @@ github.com/hashicorp/go-hclog v0.12.0 h1:d4QkX8FRTYaKaCZBoXYY8zJX2BXjWxurN/GA2tk github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v0.14.1 h1:nQcJDQwIAGnmoUWp8ubocEX40cCml/17YkF6csQLReU= github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog/hclogvet v0.1.3 h1:3m9Fxgh3Gct7cyAKPo3rIGR4n4anAZT7knHTZjYwKEo= -github.com/hashicorp/go-hclog/hclogvet v0.1.3/go.mod h1:f0uAs1kAopX4JXFgR4kMixWftM8qLha6edaFVawdNtg= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.1.0 h1:vN9wG1D6KG6YHRTWr8512cxGOVgTMEfgEdSj/hr8MPc= github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -602,17 +504,10 @@ github.com/ishidawataru/sctp v0.0.0-20191218070446-00ab2ac2db07/go.mod h1:co9pwD github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da/go.mod h1:ks+b9deReOc7jgqp+e7LuFiCBH6Rm5hL32cLcEAArb4= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= -github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a h1:GmsqmapfzSJkm28dhRoHz2tLRbJmqhU86IPgBtN3mmk= -github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a/go.mod h1:xRskid8CManxVta/ALEhJha/pweKBaVG6fWgc0yH25s= -github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3 h1:jNYPNLe3d8smommaoQlK7LOA5ESyUJJ+Wf79ZtA7Vp4= -github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= -github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/joyent/triton-go v0.0.0-20180628001255-830d2b111e62/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= github.com/joyent/triton-go v0.0.0-20190112182421-51ffac552869 h1:BvV6PYcRz0yGnWXNZrd5wginNT1GfFfPvvWpPbjfFL8= github.com/joyent/triton-go v0.0.0-20190112182421-51ffac552869/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= @@ -632,8 +527,6 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.10.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.10.5/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= @@ -653,9 +546,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= -github.com/kyoh86/exportloopref v0.1.7 h1:u+iHuTbkbTS2D/JP7fCuZDo/t3rBVGo3Hf58Rc+lQVY= -github.com/kyoh86/exportloopref v0.1.7/go.mod h1:h1rDl2Kdj97+Kwh4gdz3ujE7XHmH51Q0lUiZ1z4NLj8= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/likexian/gokit v0.0.0-20190309162924-0a377eecf7aa/go.mod h1:QdfYv6y6qPA9pbBA2qXtoT8BMKha6UyNbxWGWl/9Jfk= github.com/likexian/gokit v0.0.0-20190418170008-ace88ad0983b/go.mod h1:KKqSnk/VVSW8kEyO2vVCXoanzEutKdlBAPohmGXkxCk= github.com/likexian/gokit v0.0.0-20190501133040-e77ea8b19cdc/go.mod h1:3kvONayqCaj+UgrRZGpgfXzHdMYCAO0KAt4/8n0L57Y= @@ -665,15 +555,7 @@ github.com/likexian/simplejson-go v0.0.0-20190419151922-c1f9f0b4f084/go.mod h1:U github.com/likexian/simplejson-go v0.0.0-20190502021454-d8787b4bfa0b/go.mod h1:3BWwtmKP9cXWwYCr5bkoVDEfLywacOv0s06OBEDpyt8= github.com/linode/linodego v0.7.1 h1:4WZmMpSA2NRwlPZcc0+4Gyn7rr99Evk9bnr0B3gXRKE= github.com/linode/linodego v0.7.1/go.mod h1:ga11n3ivecUrPCHN0rANxKmfWBJVkOXfLMZinAbj2sY= -github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/maratori/testpackage v1.0.1 h1:QtJ5ZjqapShm0w5DosRjg0PRlSdAdlx+W6cCKoALdbQ= -github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= -github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb h1:RHba4YImhrUVQDHUCe2BNSOz4tVy2yGyXhvYDvxGgeE= -github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= @@ -692,8 +574,6 @@ github.com/mattn/go-shellwords v1.0.3 h1:K/VxK7SZ+cvuPgFSLKi5QPI9Vr/ipOf4C1gN+nt github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-shellwords v1.0.5 h1:JhhFTIOslh5ZsPrpa3Wdg8bF0WI3b44EMblmU9wIsXc= github.com/mattn/go-shellwords v1.0.5/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= -github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= @@ -742,15 +622,10 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/mozilla/tls-observatory v0.0.0-20200317151703-4fa42e1c2dee/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0= github.com/mrunalp/fileutils v0.0.0-20200504145649-7be891c94fd3 h1:eK+kqTSbinmtz6ynzliXWjYAW/3DqVMXHgpQv5fPhPw= github.com/mrunalp/fileutils v0.0.0-20200504145649-7be891c94fd3/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nakabonne/nestif v0.3.0 h1:+yOViDGhg8ygGrmII72nV9B/zGxY188TYpfolntsaPw= -github.com/nakabonne/nestif v0.3.0/go.mod h1:dI314BppzXjJ4HsCnbo7XzrJHPszZsjnk5wEBSYHI2c= -github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E= -github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= @@ -758,15 +633,12 @@ github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2 h1:BQ1HW github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2/go.mod h1:TLb2Sg7HQcgGdloNxkrmtgDNR9uVYF3lfdFIN4Ro6Sk= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/exhaustive v0.0.0-20200708172631-8866003e3856 h1:W3KBC2LFyfgd+wNudlfgCCsTo4q97MeNWrfz8/wSdSc= -github.com/nishanths/exhaustive v0.0.0-20200708172631-8866003e3856/go.mod h1:wBEpHwM2OdmeNpdCvRPUlkEbBuaFmcK4Wv8Q7FuGW3c= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28 h1:R9vmquWCeGmxTHUVnTQJrU4oPlgEn9+x48nwXSqkIKg= github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -815,12 +687,7 @@ github.com/packethost/packngo v0.1.1-0.20180711074735-b9cb5096f54c/go.mod h1:otz github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= -github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.2.5+incompatible h1:xOYu2+sKj87pJz7V+I7260354UlcRyAZUGhMCToTzVw= @@ -842,7 +709,6 @@ github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= @@ -858,10 +724,8 @@ github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2 github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= @@ -872,34 +736,21 @@ github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE= github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= -github.com/quasilyte/go-ruleguard v0.1.2-0.20200318202121-b00d7a75d3d8 h1:DvnesvLtRPQOvaUbfXfh0tpMHg29by0H7F2U+QIkSu8= -github.com/quasilyte/go-ruleguard v0.1.2-0.20200318202121-b00d7a75d3d8/go.mod h1:CGFX09Ci3pq9QZdj86B+VGIdNj4VyCo2iPOGS9esB/k= -github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY= -github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/rboyer/safeio v0.2.1/go.mod h1:Cq/cEPK+YXFn622lsQ0K4KsPZSPtaptHHEldsy7Fmig= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03 h1:Wdi9nwnhFNAlseAOekn6B5G/+GMtks9UKbvRU/CMM/o= github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03/go.mod h1:gRAiPF5C5Nd0eyyRdqIu9qTiFSoZzpTq727b5B8fkkU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rs/cors v0.0.0-20170801073201-eabcc6af4bbe h1:fPLXIFSIvTs99QtPSCsRITbv01v7MsPN7wpuYtD8ebI= github.com/rs/cors v0.0.0-20170801073201-eabcc6af4bbe/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.1.0 h1:DWbye9KyMgytn8uYpuHkwf0RHqAYO6Ay/D0TbCpPtVU= -github.com/ryancurrah/gomodguard v1.1.0/go.mod h1:4O8tr7hBODaGE6VIhfJDHcwzh5GUccKSJBU0UMXJFVM= -github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw= -github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.1-0.20170703205827-abc90934186a+incompatible h1:ZVvb3R06BXNcQ3nXT2eANJAwGeRu4tbUzLI7sIyFZ2s= @@ -913,14 +764,9 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUt github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/seccomp/libseccomp-golang v0.9.2-0.20200314001724-bdab42bd5128 h1:vWI7jlfJVWN//T8jrt5JduYkSid+Sl/fRz33J1jQ83k= github.com/seccomp/libseccomp-golang v0.9.2-0.20200314001724-bdab42bd5128/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= -github.com/securego/gosec/v2 v2.4.0 h1:ivAoWcY5DMs9n04Abc1VkqZBO0FL0h4ShTcVsC53lCE= -github.com/securego/gosec/v2 v2.4.0/go.mod h1:0/Q4cjmlFDfDUj1+Fib61sc+U5IQb2w+Iv9/C3wPVko= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= -github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= github.com/shirou/gopsutil v0.0.0-20181107111621-48177ef5f880/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= github.com/shirou/gopsutil v2.20.2+incompatible h1:ucK79BhBpgqQxPASyS2cu9HX8cfDVljBN1WWFvbNvgY= github.com/shirou/gopsutil v2.20.2+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= @@ -945,7 +791,6 @@ github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= @@ -962,38 +807,16 @@ github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d h1:bVQRCxQvfjNUeRqaY/uT0tFuvuFY0ulgnczuR684Xic= github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d/go.mod h1:Cw4GTlQccdRGSEf6KiMju767x0NEHE0YIVPJSaXjlsw= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= -github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= -github.com/sourcegraph/go-diff v0.5.3 h1:lhIKJ2nXLZZ+AfbHpYxTn0pXpNTTui0DX7DO3xeb1Zs= -github.com/sourcegraph/go-diff v0.5.3/go.mod h1:v9JDtjCE4HHHCZGId75rg8gkKKa98RVjBcBGsVmMmak= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/ssgreg/nlreturn/v2 v2.0.1 h1:+lm6xFjVuNw/9t/Fh5sIwfNWefiD5bddzc6vwJ1TvRI= -github.com/ssgreg/nlreturn/v2 v2.0.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -1007,40 +830,18 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 h1:b6uOv7YOFK0TYG7HtkIgExQo+2RdLuwRft63jn2HWj8= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2 h1:Xr9gkxfOP0KQWXKNqmwe8vEeSUiUj4Rlee9CMVX2ZUQ= -github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= github.com/tencentcloud/tencentcloud-sdk-go v3.0.83+incompatible h1:8uRvJleFpqLsO77WaAh2UrasMOzd8MxXrNj20e7El+Q= github.com/tencentcloud/tencentcloud-sdk-go v3.0.83+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= github.com/tent/http-link-go v0.0.0-20130702225549-ac974c61c2f9/go.mod h1:RHkNRtSLfOK7qBTHaeSX1D6BNpI3qw7NTxsmNr4RvN8= -github.com/tetafro/godot v0.4.8 h1:h61+hQraWhdI6WYqMwAwZYCE5yxL6a9/Orw4REbabSU= -github.com/tetafro/godot v0.4.8/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0= -github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q= -github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa h1:RC4maTWLKKwb7p1cnoygsbKIgNlJqSYBeAFON3Ar8As= -github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= -github.com/ultraware/funlen v0.0.2 h1:Av96YVBwwNSe4MLR7iI/BIa3VyI7/djnto/pK3Uxbdo= -github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= -github.com/ultraware/whitespace v0.0.4 h1:If7Va4cM03mpgrNH9k49/VOicWpGoG70XPBFFODYDsg= -github.com/ultraware/whitespace v0.0.4/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/uudashr/gocognit v1.0.1 h1:MoG2fZ0b/Eo7NXoIwCVFLG5JED3qgQz5/NEE+rOsjPs= -github.com/uudashr/gocognit v1.0.1/go.mod h1:j44Ayx2KW4+oB6SWMv8KsmHzZrOInQav7D3cQMJ5JUM= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.12.0/go.mod h1:229t1eWu9UXTPmoUkbpN/fctKPBY4IJoFXQnxHGXy6E= -github.com/valyala/quicktemplate v1.5.1/go.mod h1:v7yYWpBEiutDyNfVaph6oC/yKwejzVyTX/2cwwHxyok= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/varlink/go v0.3.0 h1:7IDKK8X3W9qqgw7oisE2RgtdTOxBxDwX5RDm2qVoKT8= github.com/varlink/go v0.3.0/go.mod h1:DKg9Y2ctoNkesREGAEak58l+jOC6JU2aqZvUYs5DynU= github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= @@ -1056,9 +857,6 @@ github.com/vmware/govmomi v0.18.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59b github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= @@ -1067,7 +865,6 @@ github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= github.com/zclconf/go-cty v1.4.1 h1:Xzr4m4utRDhHDifag1onwwUSq32HLoLBsp+w6tD0880= github.com/zclconf/go-cty v1.4.1/go.mod h1:nHzOclRkoj++EU9ZjSrZvRG0BXIWt8c7loYc0qXAFGQ= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1116,14 +913,12 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNTEKDvWeuc1yieZ8qUzUE= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -1145,7 +940,6 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1245,54 +1039,33 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190221204921-83362c3779f5/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190424220101-1e8e1cfdf96b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190719005602-e377ae9d6386/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200117220505-0cba7a3a9ee9/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200211205636-11eff242d136/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200321224714-0d839f3cf2ed/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200422022333-3d57cf2e726e/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200519015757-0d0afa43d58a/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375 h1:SjQ2+AKWgZLc1xej6WSzL+Dfs5Uyd5xcZH1mGC411IA= golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200625211823-6506e20df31f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200701041122-1837592efa10/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305 h1:yaM5S0KcY0lIoZo7Fl+oi91b/DdlU2zuWpfHrpWbCS0= golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1334,7 +1107,6 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200302123026-7795fca6ccb1 h1:RYJIKMPLUCjLP+fEg9ygjxF3KjfSHN4BSZw91aecq6U= google.golang.org/genproto v0.0.0-20200302123026-7795fca6ccb1/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= @@ -1344,7 +1116,6 @@ google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= @@ -1377,8 +1148,6 @@ gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -1422,14 +1191,6 @@ k8s.io/apimachinery v0.0.0-20190223001710-c182ff3b9841/go.mod h1:ccL7Eh7zubPUSh9 k8s.io/client-go v8.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= -mvdan.cc/gofumpt v0.0.0-20200709182408-4fd085cb6d5f h1:gi7cb8HTDZ6q8VqsUpkdoFi3vxwHMneQ6+Q5Ap5hjPE= -mvdan.cc/gofumpt v0.0.0-20200709182408-4fd085cb6d5f/go.mod h1:9VQ397fNXEnF84t90W4r4TRCQK+pg9f8ugVfyj+S26w= -mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= -mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= -mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= -mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f h1:Cq7MalBHYACRd6EesksG1Q8EoIAKOsiZviGKbOLIej4= -mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4 h1:JPJh2pk3+X4lXAkZIk2RuE/7/FoK9maXw+TNPJhVS/c= From c9bb044795f61e1721916addcabd7b2cc327b746 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sun, 6 Sep 2020 11:55:39 +0200 Subject: [PATCH 14/31] Fix SignalTask unittest --- driver_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/driver_test.go b/driver_test.go index b624903..004de27 100644 --- a/driver_test.go +++ b/driver_test.go @@ -1074,7 +1074,7 @@ func TestPodmanDriver_SignalTask(t *testing.T) { // try to send non-existing singal, should yield an error require.Error(t, d.SignalTask(task.ID, "FOO")) time.Sleep(300 * time.Millisecond) - // SIGINT should stop busybox and hence the container will shutdown + // send a friendly CTRL+C to busybox to stop the container require.NoError(t, d.SignalTask(task.ID, "SIGINT")) }(t) @@ -1083,9 +1083,10 @@ func TestPodmanDriver_SignalTask(t *testing.T) { require.NoError(t, err) select { - case <-waitCh: - t.Fatalf("wait channel should not have received an exit result") - case <-time.After(time.Duration(tu.TestMultiplier()*2) * time.Second): + case res := <-waitCh: + require.Equal(t, 130, res.ExitCode, "Should have got exit code 130") + case <-time.After(time.Duration(tu.TestMultiplier()*5) * time.Second): + t.Fatalf("Container did not exit in time") } } From 34807fd4964402cd993b8b15882a317def44df21 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sat, 31 Oct 2020 17:51:19 +0100 Subject: [PATCH 15/31] Implement ContainerStats http api call --- apiclient/container_stats.go | 208 +++++++++++++++++++++++++++++++++++ client.go | 14 --- handle.go | 40 +++---- 3 files changed, 228 insertions(+), 34 deletions(-) create mode 100644 apiclient/container_stats.go diff --git a/apiclient/container_stats.go b/apiclient/container_stats.go new file mode 100644 index 0000000..03be794 --- /dev/null +++ b/apiclient/container_stats.go @@ -0,0 +1,208 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apiclient + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "net/http" + "time" +) + +var ContainerNotFound = errors.New("No such Container") +var ContainerWrongState = errors.New("Container has wrong state") + +// ContainerStats data takes a name or ID of a container returns stats data +func (c *APIClient) ContainerStats(ctx context.Context, name string) (Stats, error) { + + var stats Stats + res, err := c.Get(ctx, fmt.Sprintf("libpod/containers/%s/stats?stream=false", name)) + if err != nil { + return stats, err + } + + defer res.Body.Close() + + if res.StatusCode == http.StatusNotFound { + return stats, ContainerNotFound + } + + if res.StatusCode == http.StatusConflict { + return stats, ContainerWrongState + } + if res.StatusCode != http.StatusOK { + return stats, fmt.Errorf("unknown error, status code: %d", res.StatusCode) + } + + body, err := ioutil.ReadAll(res.Body) + if err != nil { + return stats, err + } + err = json.Unmarshal(body, &stats) + if err != nil { + return stats, err + } + + return stats, nil +} + +// ------------------------------------------------------------------------------------------------------- +// structs loosly copied from https://github.com/containers/podman/blob/master/pkg/api/handlers/compat/types.go +// and https://github.com/moby/moby/blob/master/api/types/stats.go +// some unused parts are modified/commented out to not pull +// more dependencies and also to overcome some json unmarshall/version problems +// +// some fields are reordert to make the linter happy (bytes maligned complains) +// ------------------------------------------------------------------------------------------------------- +// + +// CPUStats aggregates and wraps all CPU related info of container +type CPUStats struct { + // CPU Usage. Linux and Windows. + CPUUsage CPUUsage `json:"cpu_usage"` + + // System Usage. Linux only. + SystemUsage uint64 `json:"system_cpu_usage,omitempty"` + + // Online CPUs. Linux only. + OnlineCPUs uint32 `json:"online_cpus,omitempty"` + + // Usage of CPU in %. Linux only. + CPU float64 `json:"cpu"` + + // Throttling Data. Linux only. + ThrottlingData ThrottlingData `json:"throttling_data,omitempty"` +} + +// Stats is Ultimate struct aggregating all types of stats of one container +type Stats struct { + // Common stats + Read time.Time `json:"read"` + PreRead time.Time `json:"preread"` + + // Linux specific stats, not populated on Windows. + PidsStats PidsStats `json:"pids_stats,omitempty"` + BlkioStats BlkioStats `json:"blkio_stats,omitempty"` + + // Windows specific stats, not populated on Linux. + // NumProcs uint32 `json:"num_procs"` + // StorageStats docker.StorageStats `json:"storage_stats,omitempty"` + + // Shared stats + CPUStats CPUStats `json:"cpu_stats,omitempty"` + PreCPUStats CPUStats `json:"precpu_stats,omitempty"` // "Pre"="Previous" + MemoryStats MemoryStats `json:"memory_stats,omitempty"` +} + +// ThrottlingData stores CPU throttling stats of one running container. +// Not used on Windows. +type ThrottlingData struct { + // Number of periods with throttling active + Periods uint64 `json:"periods"` + // Number of periods when the container hits its throttling limit. + ThrottledPeriods uint64 `json:"throttled_periods"` + // Aggregate time the container was throttled for in nanoseconds. + ThrottledTime uint64 `json:"throttled_time"` +} + +// CPUUsage stores All CPU stats aggregated since container inception. +type CPUUsage struct { + // Total CPU time consumed. + // Units: nanoseconds (Linux) + // Units: 100's of nanoseconds (Windows) + TotalUsage uint64 `json:"total_usage"` + + // Total CPU time consumed per core (Linux). Not used on Windows. + // Units: nanoseconds. + PercpuUsage []uint64 `json:"percpu_usage,omitempty"` + + // Time spent by tasks of the cgroup in kernel mode (Linux). + // Time spent by all container processes in kernel mode (Windows). + // Units: nanoseconds (Linux). + // Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers. + UsageInKernelmode uint64 `json:"usage_in_kernelmode"` + + // Time spent by tasks of the cgroup in user mode (Linux). + // Time spent by all container processes in user mode (Windows). + // Units: nanoseconds (Linux). + // Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers + UsageInUsermode uint64 `json:"usage_in_usermode"` +} + +// PidsStats contains the stats of a container's pids +type PidsStats struct { + // Current is the number of pids in the cgroup + Current uint64 `json:"current,omitempty"` + // Limit is the hard limit on the number of pids in the cgroup. + // A "Limit" of 0 means that there is no limit. + Limit uint64 `json:"limit,omitempty"` +} + +// BlkioStatEntry is one small entity to store a piece of Blkio stats +// Not used on Windows. +type BlkioStatEntry struct { + Major uint64 `json:"major"` + Minor uint64 `json:"minor"` + Op string `json:"op"` + Value uint64 `json:"value"` +} + +// BlkioStats stores All IO service stats for data read and write. +// This is a Linux specific structure as the differences between expressing +// block I/O on Windows and Linux are sufficiently significant to make +// little sense attempting to morph into a combined structure. +type BlkioStats struct { + // number of bytes transferred to and from the block device + IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"` + IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive"` + IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive"` + IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive"` + IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive"` + IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive"` + IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive"` + SectorsRecursive []BlkioStatEntry `json:"sectors_recursive"` +} + +// MemoryStats aggregates all memory stats since container inception on Linux. +// Windows returns stats for commit and private working set only. +type MemoryStats struct { + // Linux Memory Stats + + // current res_counter usage for memory + Usage uint64 `json:"usage,omitempty"` + // maximum usage ever recorded. + MaxUsage uint64 `json:"max_usage,omitempty"` + // TODO(vishh): Export these as stronger types. + // all the stats exported via memory.stat. + Stats map[string]uint64 `json:"stats,omitempty"` + // number of times memory usage hits limits. + Failcnt uint64 `json:"failcnt,omitempty"` + Limit uint64 `json:"limit,omitempty"` + + // Windows Memory Stats + // See https://technet.microsoft.com/en-us/magazine/ff382715.aspx + + // committed bytes + Commit uint64 `json:"commitbytes,omitempty"` + // peak committed bytes + CommitPeak uint64 `json:"commitpeakbytes,omitempty"` + // private working set + PrivateWorkingSet uint64 `json:"privateworkingset,omitempty"` +} diff --git a/client.go b/client.go index 354e41b..dd63365 100644 --- a/client.go +++ b/client.go @@ -82,20 +82,6 @@ func (c *PodmanClient) withVarlink(cb func(*varlink.Connection) error) error { return err } -// GetContainerStats takes the name or ID of a container and returns a single ContainerStats structure which -// contains attributes like memory and cpu usage. If the container cannot be found, a -// [ContainerNotFound](#ContainerNotFound) error will be returned. If the container is not running, a [NoContainerRunning](#NoContainerRunning) -// error will be returned -func (c *PodmanClient) GetContainerStats(containerID string) (*iopodman.ContainerStats, error) { - var containerStats *iopodman.ContainerStats - err := c.withVarlink(func(varlinkConnection *varlink.Connection) error { - result, err := iopodman.GetContainerStats().Call(c.ctx, varlinkConnection, containerID) - containerStats = &result - return err - }) - return containerStats, err -} - // PullImage takes a name or ID of an image and pulls it to local storage // returning the name of the image pulled func (c *PodmanClient) PullImage(imageID string) (string, error) { diff --git a/handle.go b/handle.go index e904e2c..760d309 100644 --- a/handle.go +++ b/handle.go @@ -18,19 +18,20 @@ package main import ( "context" + "errors" "fmt" "sync" "time" hclog "github.com/hashicorp/go-hclog" - "github.com/hashicorp/nomad-driver-podman/iopodman" + "github.com/hashicorp/nomad-driver-podman/apiclient" "github.com/hashicorp/nomad/client/stats" "github.com/hashicorp/nomad/plugins/drivers" ) var ( measuredCPUStats = []string{"System Mode", "User Mode", "Percent"} - measuredMemStats = []string{"RSS"} + measuredMemStats = []string{"Usage", "Max Usage"} ) // TaskHandle is the podman specific handle for exactly one container @@ -54,7 +55,7 @@ type TaskHandle struct { removeContainerOnExit bool - containerStats iopodman.ContainerStats + containerStats apiclient.Stats } func (h *TaskHandle) taskStatus() *drivers.TaskStatus { @@ -123,13 +124,10 @@ func (h *TaskHandle) runStatsEmitter(ctx context.Context, statsChannel chan *dri t := time.Now() //FIXME implement cpu stats correctly - //available := shelpers.TotalTicksAvailable() - //cpus := shelpers.CPUNumCores() - - totalPercent := h.totalCPUStats.Percent(h.containerStats.Cpu * 10e16) + totalPercent := h.totalCPUStats.Percent(float64(h.containerStats.CPUStats.CPUUsage.TotalUsage)) cs := &drivers.CpuStats{ - SystemMode: h.systemCPUStats.Percent(float64(h.containerStats.System_nano)), - UserMode: h.userCPUStats.Percent(float64(h.containerStats.Cpu_nano)), + SystemMode: h.systemCPUStats.Percent(float64(h.containerStats.CPUStats.CPUUsage.UsageInKernelmode)), + UserMode: h.userCPUStats.Percent(float64(h.containerStats.CPUStats.CPUUsage.UsageInUsermode)), Percent: totalPercent, TotalTicks: h.systemCPUStats.TicksConsumed(totalPercent), Measured: measuredCPUStats, @@ -138,7 +136,9 @@ func (h *TaskHandle) runStatsEmitter(ctx context.Context, statsChannel chan *dri //h.driver.logger.Info("stats", "cpu", containerStats.Cpu, "system", containerStats.System_nano, "user", containerStats.Cpu_nano, "percent", totalPercent, "ticks", cs.TotalTicks, "cpus", cpus, "available", available) ms := &drivers.MemoryStats{ - RSS: uint64(h.containerStats.Mem_usage), + MaxUsage: h.containerStats.MemoryStats.MaxUsage, + Usage: h.containerStats.MemoryStats.Usage, + RSS: h.containerStats.MemoryStats.Usage, Measured: measuredMemStats, } h.stateLock.Unlock() @@ -176,24 +176,24 @@ func (h *TaskHandle) runContainerMonitor() { timer.Reset(interval) } - containerStats, err := h.driver.podmanClient.GetContainerStats(h.containerID) - if err != nil { + containerStats, statsErr := h.driver.podmanClient2.ContainerStats(h.driver.ctx, h.containerID) + if statsErr != nil { gone := false - if _, ok := err.(*iopodman.ContainerNotFound); ok { + if errors.Is(statsErr, apiclient.ContainerNotFound) { gone = true - } else if _, ok := err.(*iopodman.NoContainerRunning); ok { + } else if errors.Is(statsErr, apiclient.ContainerWrongState) { gone = true } if gone { - h.logger.Debug("Container is not running anymore", "container", h.containerID, "err", err) + h.logger.Debug("Container is not running anymore", "container", h.containerID, "err", statsErr) // container was stopped, get exit code and other post mortem infos inspectData, err := h.driver.podmanClient2.ContainerInspect(h.driver.ctx, h.containerID) h.stateLock.Lock() + h.completedAt = time.Now() if err != nil { h.exitResult.Err = fmt.Errorf("Driver was unable to get the exit code. %s: %v", h.containerID, err) h.logger.Error("Failed to inspect stopped container, can not get exit code", "container", h.containerID, "err", err) h.exitResult.Signal = 0 - h.completedAt = time.Now() } else { h.exitResult.ExitCode = int(inspectData.State.ExitCode) if len(inspectData.State.Error) > 0 { @@ -214,16 +214,16 @@ func (h *TaskHandle) runContainerMonitor() { } // continue and wait for next cycle, it should eventually // fall into the "TaskStateExited" case - h.logger.Debug("Could not get container stats, unknown error", "err", fmt.Sprintf("%#v", err)) + h.logger.Debug("Could not get container stats, unknown error", "err", fmt.Sprintf("%#v", statsErr)) continue - } else { - h.logger.Trace("Container stats", "container", h.containerID, "stats", containerStats) + // } else { + // h.logger.Trace("Container stats", "container", h.containerID, "stats", containerStats) } h.stateLock.Lock() // keep last known containerStats in handle to // have it available in the stats emitter - h.containerStats = *containerStats + h.containerStats = containerStats h.stateLock.Unlock() } } From 220228c1322fd6039a2b3fa29a00fc9526c8fc8e Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sun, 1 Nov 2020 14:56:00 +0100 Subject: [PATCH 16/31] Code cleanup --- apiclient/apiclient.go | 36 +++++++++++++---- apiclient/container_start.go | 4 +- client.go | 42 -------------------- client_test.go | 70 --------------------------------- driver.go | 75 +----------------------------------- 5 files changed, 34 insertions(+), 193 deletions(-) delete mode 100644 client_test.go diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index 7dd080f..25f2a59 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -18,9 +18,12 @@ package apiclient import ( "context" + "fmt" + "github.com/hashicorp/go-hclog" "io" "net" "net/http" + "os" "strings" "time" ) @@ -28,25 +31,44 @@ import ( type APIClient struct { baseUrl string httpClient *http.Client + logger hclog.Logger } -func NewClient(baseUrl string) *APIClient { - httpClient := http.Client{ +func NewClient(logger hclog.Logger) *APIClient { + ac := &APIClient{ + logger: logger, + } + ac.SetSocketPath(GuessSocketPath()) + return ac +} + +func (c *APIClient) SetSocketPath(baseUrl string) { + c.logger.Debug("http baseurl", "url", baseUrl) + c.httpClient = &http.Client{ Timeout: 60 * time.Second, } if strings.HasPrefix(baseUrl, "unix:") { + c.baseUrl = "http://u" path := strings.TrimPrefix(baseUrl, "unix:") - baseUrl = "http://localhost" - httpClient.Transport = &http.Transport{ + c.httpClient.Transport = &http.Transport{ DialContext: func(_ context.Context, _, _ string) (net.Conn, error) { return net.Dial("unix", path) }, } + } else { + c.baseUrl = baseUrl } - return &APIClient{ - baseUrl: baseUrl, - httpClient: &httpClient, +} + +// GuessSocketPath returns the default unix domain socket path for root or non-root users +func GuessSocketPath() string { + uid := os.Getuid() + // are we root? + if uid == 0 { + return "unix:/run/podman/podman.sock" } + // not? then let's try the default per-user socket location + return fmt.Sprintf("unix:/run/user/%d/podman/podman.sock", uid) } func (c *APIClient) Do(req *http.Request) (*http.Response, error) { diff --git a/apiclient/container_start.go b/apiclient/container_start.go index f02e962..31f70e3 100644 --- a/apiclient/container_start.go +++ b/apiclient/container_start.go @@ -19,6 +19,7 @@ package apiclient import ( "context" "fmt" + "io/ioutil" "net/http" "time" ) @@ -34,7 +35,8 @@ func (c *APIClient) ContainerStart(ctx context.Context, name string) error { defer res.Body.Close() if res.StatusCode != http.StatusNoContent { - return fmt.Errorf("unknown error, status code: %d", res.StatusCode) + body, _ := ioutil.ReadAll(res.Body) + return fmt.Errorf("unknown error, status code: %d: %s", res.StatusCode, body) } // wait max 10 seconds for running state diff --git a/client.go b/client.go index dd63365..681a74c 100644 --- a/client.go +++ b/client.go @@ -19,12 +19,10 @@ package main import ( "github.com/avast/retry-go" "github.com/hashicorp/go-hclog" - "github.com/hashicorp/nomad-driver-podman/iopodman" "github.com/varlink/go/varlink" "bufio" "context" - "encoding/json" "fmt" "net" "os" @@ -82,46 +80,6 @@ func (c *PodmanClient) withVarlink(cb func(*varlink.Connection) error) error { return err } -// PullImage takes a name or ID of an image and pulls it to local storage -// returning the name of the image pulled -func (c *PodmanClient) PullImage(imageID string) (string, error) { - var ret string - c.logger.Debug("Pull image", "image", imageID) - err := c.withVarlink(func(varlinkConnection *varlink.Connection) error { - moreResponse, err := iopodman.PullImage().Call(c.ctx, varlinkConnection, imageID) - if err == nil { - ret = moreResponse.Logs[len(moreResponse.Logs)-1] - if err != nil { - c.logger.Error("failed to unmarshal image pull logs", "err", err) - return err - } - - } - return err - }) - return ret, err -} - -// InspectImage data takes a name or ID of an image and returns the inspection -// data as iopodman.InspectImageData. -func (c *PodmanClient) InspectImage(imageID string) (iopodman.InspectImageData, error) { - var ret iopodman.InspectImageData - c.logger.Debug("Inspect image", "image", imageID) - err := c.withVarlink(func(varlinkConnection *varlink.Connection) error { - inspectJSON, err := iopodman.InspectImage().Call(c.ctx, varlinkConnection, imageID) - if err == nil { - err = json.Unmarshal([]byte(inspectJSON), &ret) - if err != nil { - c.logger.Error("failed to unmarshal inspect image", "err", err) - return err - } - - } - return err - }) - return ret, err -} - func guessSocketPath(user *user.User, procFilesystems []string) string { rootVarlinkPath := "unix://run/podman/io.podman" if user.Uid == "0" { diff --git a/client_test.go b/client_test.go deleted file mode 100644 index fbd7aac..0000000 --- a/client_test.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "github.com/stretchr/testify/require" - "os/user" - "testing" -) - -func TestClient_GuessSocketPathForRootCgroupV1(t *testing.T) { - u := user.User{Uid: "0"} - fs := []string{"nodev cgroup"} - p := guessSocketPath(&u, fs) - - require.Equal(t, p, "unix://run/podman/io.podman") -} - -func TestClient_GuessSocketPathForRootCgroupV2(t *testing.T) { - u := user.User{Uid: "0"} - fs := []string{"nodev cgroup2"} - p := guessSocketPath(&u, fs) - - require.Equal(t, p, "unix://run/podman/io.podman") -} - -func TestClient_GuessSocketPathForUserCgroupV1(t *testing.T) { - u := user.User{Uid: "1000"} - fs := []string{"nodev cgroup"} - p := guessSocketPath(&u, fs) - - require.Equal(t, p, "unix://run/podman/io.podman") -} - -func TestClient_GuessSocketPathForUserCgroupV2_1(t *testing.T) { - u := user.User{Uid: "1000"} - fs := []string{"nodev cgroup2"} - p := guessSocketPath(&u, fs) - - require.Equal(t, p, "unix://run/user/1000/podman/io.podman") -} - -func TestClient_GuessSocketPathForUserCgroupV2_2(t *testing.T) { - u := user.User{Uid: "1337"} - fs := []string{"nodev cgroup2"} - p := guessSocketPath(&u, fs) - - require.Equal(t, p, "unix://run/user/1337/podman/io.podman") -} - -func TestClient_GetProcFilesystems(t *testing.T) { - procFilesystems, err := getProcFilesystems() - - require.NoError(t, err) - require.Greater(t, len(procFilesystems), 0) -} diff --git a/driver.go b/driver.go index 1096deb..d5703f6 100644 --- a/driver.go +++ b/driver.go @@ -20,7 +20,6 @@ import ( "context" "fmt" "net" - "os/user" "path/filepath" "strconv" "strings" @@ -30,7 +29,6 @@ import ( "github.com/hashicorp/go-hclog" "github.com/hashicorp/nomad-driver-podman/apiclient" - "github.com/hashicorp/nomad-driver-podman/iopodman" "github.com/hashicorp/nomad-driver-podman/version" "github.com/hashicorp/nomad/client/stats" "github.com/hashicorp/nomad/client/taskenv" @@ -136,7 +134,7 @@ func NewPodmanDriver(logger hclog.Logger) drivers.DriverPlugin { ctx: ctx, logger: logger.Named("podmanClient"), }, - podmanClient2: apiclient.NewClient("unix:/run/podman/podman.sock"), + podmanClient2: apiclient.NewClient(logger), } } @@ -170,22 +168,7 @@ func (d *Driver) SetConfig(cfg *base.Config) error { } if config.SocketPath != "" { - d.podmanClient.varlinkSocketPath = config.SocketPath - } else { - user, _ := user.Current() - procFilesystems, err := getProcFilesystems() - - if err != nil { - return err - } - - socketPath := guessSocketPath(user, procFilesystems) - - if err != nil { - return err - } - - d.podmanClient.varlinkSocketPath = socketPath + d.podmanClient2.SetSocketPath(config.SocketPath) } return nil @@ -361,12 +344,6 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive return nil, nil, fmt.Errorf("image name required") } - img, err := d.createImage(cfg, &driverConfig) - if err != nil { - return nil, nil, fmt.Errorf("Couldn't create image: %v", err) - } - d.logger.Debug("created/pulled image", "img_id", img.ID) - createOpts := apiclient.SpecGenerator{} createOpts.ContainerBasicConfig.LogConfiguration = &apiclient.LogConfig{} allArgs := []string{} @@ -772,54 +749,6 @@ func (d *Driver) ExecTask(taskID string, cmd []string, timeout time.Duration) (* return nil, fmt.Errorf("Podman driver does not support exec") } -func (d *Driver) createImage(cfg *drivers.TaskConfig, driverConfig *TaskConfig) (iopodman.InspectImageData, error) { - img, err := d.podmanClient.InspectImage(driverConfig.Image) - if err != nil { - err = d.eventer.EmitEvent(&drivers.TaskEvent{ - TaskID: cfg.ID, - AllocID: cfg.AllocID, - TaskName: cfg.Name, - Timestamp: time.Now(), - Message: "Downloading image", - Annotations: map[string]string{ - "image": driverConfig.Image, - }, - }) - if err != nil { - d.logger.Warn("error emitting event", "error", err) - } - - pullLog, err := d.podmanClient.PullImage(driverConfig.Image) - if err != nil { - return iopodman.InspectImageData{}, fmt.Errorf("image %s couldn't be downloaded: %v", driverConfig.Image, err) - } - - img, err = d.podmanClient.InspectImage(driverConfig.Image) - if err != nil { - return iopodman.InspectImageData{}, fmt.Errorf("image %s couldn't be inspected: %v", driverConfig.Image, err) - } - - err = d.eventer.EmitEvent(&drivers.TaskEvent{ - TaskID: cfg.ID, - AllocID: cfg.AllocID, - TaskName: cfg.Name, - Timestamp: time.Now(), - Message: fmt.Sprintf("Image downloaded: %s", pullLog), - Annotations: map[string]string{ - "image": driverConfig.Image, - }, - }) - if err != nil { - d.logger.Warn("error emitting event", "error", err) - } - - } - - d.logger.Debug("Image created", "img_id", img.ID, "config", img.Config) - - return img, nil -} - func (d *Driver) containerMounts(task *drivers.TaskConfig, driverConfig *TaskConfig) ([]spec.Mount, error) { binds := []spec.Mount{} binds = append(binds, spec.Mount{Source: task.TaskDir().SharedAllocDir, Destination: task.Env[taskenv.AllocDir], Type: "bind"}) From 745fa54d9af1d63db6152174bf4904376e0d66d5 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sun, 1 Nov 2020 17:30:05 +0100 Subject: [PATCH 17/31] Removed varlink from tests --- driver_test.go | 128 +++++++++++++------------------------------------ 1 file changed, 34 insertions(+), 94 deletions(-) diff --git a/driver_test.go b/driver_test.go index 004de27..1c6e316 100644 --- a/driver_test.go +++ b/driver_test.go @@ -18,12 +18,10 @@ package main import ( "context" - "encoding/json" "fmt" "io/ioutil" "os" "os/exec" - "os/user" "path/filepath" "reflect" @@ -33,7 +31,6 @@ import ( "github.com/hashicorp/go-hclog" "github.com/hashicorp/nomad-driver-podman/apiclient" - "github.com/hashicorp/nomad-driver-podman/iopodman" "github.com/hashicorp/nomad/client/taskenv" "github.com/hashicorp/nomad/helper/freeport" "github.com/hashicorp/nomad/helper/testlog" @@ -43,30 +40,14 @@ import ( dtestutil "github.com/hashicorp/nomad/plugins/drivers/testutils" tu "github.com/hashicorp/nomad/testutil" "github.com/stretchr/testify/require" - "github.com/varlink/go/varlink" ) var ( // busyboxLongRunningCmd is a busybox command that runs indefinitely, and // ideally responds to SIGINT/SIGTERM. Sadly, busybox:1.29.3 /bin/sleep doesn't. busyboxLongRunningCmd = []string{"nc", "-l", "-p", "3000", "127.0.0.1"} - varlinkSocketPath = "" ) -func init() { - user, _ := user.Current() - procFilesystems, err := getProcFilesystems() - - if err != nil { - fmt.Fprintf(os.Stderr, "error: %v\n", err) - os.Exit(1) - } - - socketPath := guessSocketPath(user, procFilesystems) - - varlinkSocketPath = socketPath -} - func createBasicResources() *drivers.Resources { res := drivers.Resources{ NomadResources: &structs.AllocatedTaskResources{ @@ -358,16 +339,9 @@ func TestPodmanDriver_GC_Container_on(t *testing.T) { d.DestroyTask(task.ID, true) - ctx := context.Background() - varlinkConnection, err := getPodmanConnection(ctx) - require.NoError(t, err) - - defer varlinkConnection.Close() - - // ... 1 means container could not be found (is deleted) - exists, err := iopodman.ContainerExists().Call(ctx, varlinkConnection, containerName) - require.NoError(t, err) - require.Equal(t, 1, int(exists)) + // see if the container does not exist (404) + _, err = getPodmanDriver(t, d).podmanClient2.ContainerStats(context.Background(), containerName) + require.Error(t, err, apiclient.ContainerNotFound) } // check if container is destroyed if gc.container=false @@ -411,19 +385,13 @@ func TestPodmanDriver_GC_Container_off(t *testing.T) { d.DestroyTask(task.ID, true) - ctx := context.Background() - varlinkConnection, err := getPodmanConnection(ctx) - require.NoError(t, err) - - defer varlinkConnection.Close() - - // ... 0 means container could be found (still exists) - exists, err := iopodman.ContainerExists().Call(ctx, varlinkConnection, containerName) + // see if the stopped container can be inspected + _, err = getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) require.NoError(t, err) - require.Equal(t, 0, int(exists)) // and cleanup after ourself - iopodman.RemoveContainer().Call(ctx, varlinkConnection, containerName, true, true) + err = getPodmanDriver(t, d).podmanClient2.ContainerDelete(context.Background(), containerName, true, true) + require.NoError(t, err) } // Check stdout/stderr logging @@ -560,34 +528,35 @@ func TestPodmanDriver_PortMap(t *testing.T) { defer d.DestroyTask(task.ID, true) - inspectData := inspectContainer(t, containerName) + inspectData, err := getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) + require.NoError(t, err) // Verify that the port environment variables are set require.Contains(t, inspectData.Config.Env, "NOMAD_PORT_main=8888") require.Contains(t, inspectData.Config.Env, "NOMAD_PORT_REDIS=6379") // Verify that the correct ports are bound - expectedPortBindings := map[string][]iopodman.InspectHostPort{ - "8888/tcp": []iopodman.InspectHostPort{ - iopodman.InspectHostPort{ + expectedPortBindings := map[string][]apiclient.InspectHostPort{ + "8888/tcp": []apiclient.InspectHostPort{ + apiclient.InspectHostPort{ HostIP: "127.0.0.1", HostPort: strconv.Itoa(ports[0]), }, }, - "8888/udp": []iopodman.InspectHostPort{ - iopodman.InspectHostPort{ + "8888/udp": []apiclient.InspectHostPort{ + apiclient.InspectHostPort{ HostIP: "127.0.0.1", HostPort: strconv.Itoa(ports[0]), }, }, - "6379/tcp": []iopodman.InspectHostPort{ - iopodman.InspectHostPort{ + "6379/tcp": []apiclient.InspectHostPort{ + apiclient.InspectHostPort{ HostIP: "127.0.0.1", HostPort: strconv.Itoa(ports[1]), }, }, - "6379/udp": []iopodman.InspectHostPort{ - iopodman.InspectHostPort{ + "6379/udp": []apiclient.InspectHostPort{ + apiclient.InspectHostPort{ HostIP: "127.0.0.1", HostPort: strconv.Itoa(ports[1]), }, @@ -597,8 +566,6 @@ func TestPodmanDriver_PortMap(t *testing.T) { require.Exactly(t, expectedPortBindings, inspectData.HostConfig.PortBindings) - // fmt.Printf("Inspect %v",inspectData.HostConfig.PortBindings) - } // check --init with default path @@ -726,6 +693,9 @@ func TestPodmanDriver_OOM(t *testing.T) { // check setting a user for the task func TestPodmanDriver_User(t *testing.T) { + // if os.Getuid() != 0 { + // t.Skip("Skipping User test ") + // } if !tu.IsCI() { t.Parallel() } @@ -816,7 +786,8 @@ func TestPodmanDriver_Swap(t *testing.T) { case <-time.After(time.Duration(tu.TestMultiplier()*2) * time.Second): } // inspect container to learn about the actual podman limits - inspectData := inspectContainer(t, containerName) + inspectData, err := getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) + require.NoError(t, err) // see if the configured values are set correctly require.Equal(t, int64(52428800), inspectData.HostConfig.Memory) @@ -879,7 +850,9 @@ func TestPodmanDriver_Tmpfs(t *testing.T) { } // see if tmpfs was propagated to podman - inspectData := inspectContainer(t, containerName) + inspectData, err := getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) + require.NoError(t, err) + expectedFilesystem := map[string]string{ "/tmpdata1": "rw,rprivate,nosuid,nodev,tmpcopyup", "/tmpdata2": "rw,rprivate,nosuid,nodev,tmpcopyup", @@ -1036,7 +1009,8 @@ func TestPodmanDriver_NetworkMode(t *testing.T) { require.NoError(t, d.WaitUntilStarted(task.ID, time.Duration(tu.TestMultiplier()*3)*time.Second)) - inspectData := inspectContainer(t, containerName) + inspectData, err := getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) + require.NoError(t, err) if tc.mode == "host" { require.Equal(t, "host", inspectData.HostConfig.NetworkMode) } @@ -1112,40 +1086,6 @@ func newTaskConfig(variant string, command []string) TaskConfig { } } -func inspectContainer(t *testing.T, containerName string) iopodman.InspectContainerData { - ctx := context.Background() - varlinkConnection, err := getPodmanConnection(ctx) - require.NoError(t, err) - - defer varlinkConnection.Close() - - inspectJSON, err := iopodman.InspectContainer().Call(ctx, varlinkConnection, containerName) - require.NoError(t, err) - - var inspectData iopodman.InspectContainerData - require.NoError(t, json.Unmarshal([]byte(inspectJSON), &inspectData)) - - return inspectData -} - -func getContainer(t *testing.T, containerName string) iopodman.Container { - ctx := context.Background() - varlinkConnection, err := getPodmanConnection(ctx) - require.NoError(t, err) - - defer varlinkConnection.Close() - - container, err := iopodman.GetContainer().Call(ctx, varlinkConnection, containerName) - require.NoError(t, err) - - return container -} - -func getPodmanConnection(ctx context.Context) (*varlink.Connection, error) { - varlinkConnection, err := varlink.NewConnection(ctx, varlinkSocketPath) - return varlinkConnection, err -} - func newPodmanClient() *PodmanClient { level := hclog.Info if testing.Verbose() { @@ -1156,9 +1096,8 @@ func newPodmanClient() *PodmanClient { Level: level, }) client := &PodmanClient{ - ctx: context.Background(), - logger: testLogger, - varlinkSocketPath: varlinkSocketPath, + ctx: context.Background(), + logger: testLogger, } return client } @@ -1170,7 +1109,7 @@ func getPodmanDriver(t *testing.T, harness *dtestutil.DriverHarness) *Driver { } // helper to start, destroy and inspect a long running container -func startDestroyInspect(t *testing.T, taskCfg TaskConfig, taskName string) iopodman.InspectContainerData { +func startDestroyInspect(t *testing.T, taskCfg TaskConfig, taskName string) apiclient.InspectContainerData { if !tu.IsCI() { t.Parallel() } @@ -1203,7 +1142,8 @@ func startDestroyInspect(t *testing.T, taskCfg TaskConfig, taskName string) iopo t.Fatalf("wait channel should not have received an exit result") case <-time.After(time.Duration(tu.TestMultiplier()*2) * time.Second): } - // inspect container to learn about the actual podman limits - inspectData := inspectContainer(t, containerName) + inspectData, err := getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) + require.NoError(t, err) + return inspectData } From dac3c0de1a3a91cf09ee864f6f0d7eb566b8cf1b Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sun, 1 Nov 2020 17:59:56 +0100 Subject: [PATCH 18/31] Remove varlink code --- .github/machinesetup.sh | 2 - README.md | 32 +- build.sh | 2 - client.go | 129 - config.go | 2 +- driver.go | 57 +- go.mod | 2 - go.sum | 4 - iopodman/generate.go | 19 - iopodman/inspect.go | 255 - iopodman/io.podman.varlink | 1344 ----- iopodman/iopodman.go | 11148 ----------------------------------- 12 files changed, 51 insertions(+), 12945 deletions(-) delete mode 100644 client.go delete mode 100644 iopodman/generate.go delete mode 100644 iopodman/inspect.go delete mode 100644 iopodman/io.podman.varlink delete mode 100644 iopodman/iopodman.go diff --git a/.github/machinesetup.sh b/.github/machinesetup.sh index 03d55d0..f8bba82 100755 --- a/.github/machinesetup.sh +++ b/.github/machinesetup.sh @@ -57,7 +57,5 @@ WantedBy=sockets.target EOF systemctl daemon-reload -# enable varlink (until it's fully removed...) -systemctl start io.podman # enable http api systemctl start podman diff --git a/README.md b/README.md index e86b15f..2241980 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,11 @@ cd nomad-driver-podman - Linux host with `podman` installed - For rootless containers you need a system supporting cgroup V2 and a few other things, follow [this tutorial](https://github.com/containers/libpod/blob/master/docs/tutorials/rootless_tutorial.md) -You need a varlink enabled podman binary and a system socket activation unit, -see https://podman.io/blogs/2019/01/16/podman-varlink.html. +You need a 2.x podman binary and a system socket activation unit, +see https://www.redhat.com/sysadmin/podmans-new-rest-api nomad agent, nomad-driver-podman and podman will reside on the same host, so you -do not have to worry about the ssh aspects of podman varlink. +do not have to worry about the ssh aspects of the podman api. Ensure that nomad can find the plugin, see [plugin_dir](https://www.nomadproject.io/docs/configuration/index.html#plugin_dir) @@ -334,22 +334,16 @@ GRUB_CMDLINE_LINUX_DEFAULT="quiet cgroup_enable=memory swapaccount=1 systemd.uni `sudo update-grub` -ensure that podman varlink is running -``` -$ systemctl --user status io.podman -● io.podman.service - Podman Remote API Service - Loaded: loaded (/usr/lib/systemd/user/io.podman.service; disabled; vendor preset: enabled) - Active: active (running) since Wed 2020-07-01 16:01:41 EDT; 7s ago -TriggeredBy: ● io.podman.socket - Docs: man:podman-varlink(1) - Main PID: 25091 (podman) - Tasks: 29 (limit: 18808) - Memory: 17.5M - CPU: 184ms - CGroup: /user.slice/user-1000.slice/user@1000.service/io.podman.service - ├─25091 /usr/bin/podman varlink unix:/run/user/1000/podman/io.podman --timeout=60000 --cgroup-manager=systemd - ├─25121 /usr/bin/podman varlink unix:/run/user/1000/podman/io.podman --timeout=60000 --cgroup-manager=systemd - └─25125 /usr/bin/podman +ensure that podman socket is running +``` +$ systemctl --user status podman.socket +* podman.socket - Podman API Socket + Loaded: loaded (/usr/lib/systemd/user/podman.socket; disabled; vendor preset: disabled) + Active: active (listening) since Sat 2020-10-31 19:21:29 CET; 22h ago + Triggers: * podman.service + Docs: man:podman-system-service(1) + Listen: /run/user/1000/podman/podman.sock (Stream) + CGroup: /user.slice/user-1000.slice/user@1000.service/podman.socket ``` ensure that you have a recent version of [crun](https://github.com/containers/crun/) diff --git a/build.sh b/build.sh index 58ec11e..f98e358 100755 --- a/build.sh +++ b/build.sh @@ -10,8 +10,6 @@ mkdir -p build/test # ensure to build in a isolated GOPATH in order to get predictable dependencies export GOPATH=$project/build -go install github.com/varlink/go/cmd/varlink-go-interface-generator go install gotest.tools/gotestsum -go generate github.com/hashicorp/nomad-driver-podman/iopodman go build diff --git a/client.go b/client.go deleted file mode 100644 index 681a74c..0000000 --- a/client.go +++ /dev/null @@ -1,129 +0,0 @@ -/* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "github.com/avast/retry-go" - "github.com/hashicorp/go-hclog" - "github.com/varlink/go/varlink" - - "bufio" - "context" - "fmt" - "net" - "os" - "os/user" - "strings" - "time" -) - -const ( - // number of varlink op retries - varlinkRetries = 4 -) - -// PodmanClient encapsulates varlink operations -type PodmanClient struct { - - // ctx is the context for the driver. It is passed to other subsystems to - // coordinate shutdown - ctx context.Context - - // logger will log to the Nomad agent - logger hclog.Logger - - varlinkSocketPath string -} - -// withVarlink calls a podman varlink function and retries N times in case of network failures -func (c *PodmanClient) withVarlink(cb func(*varlink.Connection) error) error { - err := retry.Do( - // invoke the callback in a fresh varlink connection - func() error { - connection, err := c.getConnection() - if err != nil { - c.logger.Debug("Failed to open varlink connection", "err", err) - return err - } - defer connection.Close() - return cb(connection) - }, - // ... and retry up to N times - retry.Attempts(varlinkRetries), - // ... but only if it failed with net.OpError - retry.RetryIf(func(err error) bool { - if _, ok := err.(*net.OpError); ok { - c.logger.Debug("Failed to invoke varlink method, will retry", "err", err) - return true - } - return false - }), - // wait 1 sec between retries - retry.Delay(time.Second), - // and return last error directly (not wrapped) - retry.LastErrorOnly(true), - ) - return err -} - -func guessSocketPath(user *user.User, procFilesystems []string) string { - rootVarlinkPath := "unix://run/podman/io.podman" - if user.Uid == "0" { - return rootVarlinkPath - } - - cgroupv2 := isCGroupV2(procFilesystems) - - if cgroupv2 { - return fmt.Sprintf("unix://run/user/%s/podman/io.podman", user.Uid) - } - - return rootVarlinkPath -} - -func isCGroupV2(procFilesystems []string) bool { - cgroupv2 := false - for _, l := range procFilesystems { - if strings.HasSuffix(l, "cgroup2") { - cgroupv2 = true - } - } - - return cgroupv2 -} - -func getProcFilesystems() ([]string, error) { - file, err := os.Open("/proc/filesystems") - if err != nil { - return nil, err - } - defer file.Close() - - var lines []string - scanner := bufio.NewScanner(file) - for scanner.Scan() { - lines = append(lines, scanner.Text()) - } - - return lines, scanner.Err() -} - -// getConnection opens a new varlink connection -func (c *PodmanClient) getConnection() (*varlink.Connection, error) { - varlinkConnection, err := varlink.NewConnection(c.ctx, c.varlinkSocketPath) - return varlinkConnection, err -} diff --git a/config.go b/config.go index 1ab01c0..aa08bc1 100644 --- a/config.go +++ b/config.go @@ -48,7 +48,7 @@ var ( hclspec.NewAttr("recover_stopped", "bool", false), hclspec.NewLiteral("true"), ), - // the path to the VarLink socket + // the path to the podman api socket "socket_path": hclspec.NewAttr("socket_path", "string", false), }) diff --git a/driver.go b/driver.go index d5703f6..f0d73f6 100644 --- a/driver.go +++ b/driver.go @@ -17,9 +17,11 @@ limitations under the License. package main import ( + "bufio" "context" "fmt" "net" + "os" "path/filepath" "strconv" "strings" @@ -106,7 +108,6 @@ type Driver struct { logger hclog.Logger // podmanClient encapsulates podman remote calls - podmanClient *PodmanClient podmanClient2 *apiclient.APIClient } @@ -130,11 +131,7 @@ func NewPodmanDriver(logger hclog.Logger) drivers.DriverPlugin { ctx: ctx, signalShutdown: cancel, logger: logger.Named(pluginName), - podmanClient: &PodmanClient{ - ctx: ctx, - logger: logger.Named("podmanClient"), - }, - podmanClient2: apiclient.NewClient(logger), + podmanClient2: apiclient.NewClient(logger), } } @@ -362,11 +359,6 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive // ensure to include port_map into tasks environment map cfg.Env = taskenv.SetPortMapEnvs(cfg.Env, driverConfig.PortMap) - procFilesystems, err := getProcFilesystems() - if err != nil { - return nil, nil, fmt.Errorf("Couldn't get Proc info: %v", err) - } - // ------------------------------------------------------------------------------------------- // BASIC // ------------------------------------------------------------------------------------------- @@ -416,15 +408,14 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } createOpts.ContainerResourceConfig.ResourceLimits.Memory.Swap = &swap } - if err == nil { - cgroupv2 := false - for _, l := range procFilesystems { - cgroupv2 = cgroupv2 || strings.HasSuffix(l, "cgroup2") - } - if !cgroupv2 { - swappiness := uint64(driverConfig.MemorySwappiness) - createOpts.ContainerResourceConfig.ResourceLimits.Memory.Swappiness = &swappiness - } + + v2, err := isCGroupV2() + if err != nil { + return nil, nil, err + } + if !v2 { + swappiness := uint64(driverConfig.MemorySwappiness) + createOpts.ContainerResourceConfig.ResourceLimits.Memory.Swappiness = &swappiness } createOpts.ContainerResourceConfig.ResourceLimits.CPU.Shares = &cpuShares @@ -846,3 +837,29 @@ func isParentPath(parent, path string) bool { rel, err := filepath.Rel(parent, path) return err == nil && !strings.HasPrefix(rel, "..") } + +func isCGroupV2() (bool, error) { + file, err := os.Open("/proc/filesystems") + if err != nil { + return false, err + } + defer file.Close() + + var lines []string + scanner := bufio.NewScanner(file) + for scanner.Scan() { + lines = append(lines, scanner.Text()) + } + if scanner.Err() != nil { + return false, scanner.Err() + } + + cgroupv2 := false + for _, l := range lines { + if strings.HasSuffix(l, "cgroup2") { + cgroupv2 = true + } + } + + return cgroupv2, nil +} diff --git a/go.mod b/go.mod index f967ec9..eaaafeb 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,6 @@ replace ( require ( github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect - github.com/avast/retry-go v2.4.3+incompatible github.com/container-storage-interface/spec v1.2.0 // indirect github.com/containernetworking/plugins v0.8.5 // indirect github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect @@ -30,7 +29,6 @@ require ( github.com/opencontainers/runtime-spec v1.0.2-0.20200307132014-f49fed0d6290 github.com/opencontainers/selinux v1.5.1 // indirect github.com/stretchr/testify v1.6.1 - github.com/varlink/go v0.3.0 golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305 // indirect google.golang.org/grpc v1.29.1 // indirect diff --git a/go.sum b/go.sum index 92d614f..19512ac 100644 --- a/go.sum +++ b/go.sum @@ -92,8 +92,6 @@ github.com/armon/go-metrics v0.3.3/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4 github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/avast/retry-go v2.4.3+incompatible h1:c/FTk2POrEQyZfaHBMkMrXdu3/6IESJUHwu8r3k1JEU= -github.com/avast/retry-go v2.4.3+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.25.41 h1:/hj7nZ0586wFqpwjNpzWiUTwtaMgxAZNZKHay80MdXw= @@ -842,8 +840,6 @@ github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqri github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/varlink/go v0.3.0 h1:7IDKK8X3W9qqgw7oisE2RgtdTOxBxDwX5RDm2qVoKT8= -github.com/varlink/go v0.3.0/go.mod h1:DKg9Y2ctoNkesREGAEak58l+jOC6JU2aqZvUYs5DynU= github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0= github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= diff --git a/iopodman/generate.go b/iopodman/generate.go deleted file mode 100644 index d51ddf7..0000000 --- a/iopodman/generate.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package iopodman - -//go:generate ../build/bin/varlink-go-interface-generator io.podman.varlink diff --git a/iopodman/inspect.go b/iopodman/inspect.go deleted file mode 100644 index 1064feb..0000000 --- a/iopodman/inspect.go +++ /dev/null @@ -1,255 +0,0 @@ -/* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package iopodman - -import ( - "time" -) - -// this partly replicates https://github.com/containers/libpod/blob/master/libpod/container_inspect.go -// but we do not want to depend on (huge) libpod directly -// and varlink api lacks support for this structures -// so we resorted to unmarshal only some parts of the inspected container - -type InspectContainerData struct { - ID string `json:"Id"` - Created time.Time `json:"Created"` - Path string `json:"Path"` - Args []string `json:"Args"` - State *InspectContainerState `json:"State"` - ImageID string `json:"Image"` - ImageName string `json:"ImageName"` - Rootfs string `json:"Rootfs"` - ResolvConfPath string `json:"ResolvConfPath"` - HostnamePath string `json:"HostnamePath"` - HostsPath string `json:"HostsPath"` - StaticDir string `json:"StaticDir"` - OCIConfigPath string `json:"OCIConfigPath,omitempty"` - OCIRuntime string `json:"OCIRuntime,omitempty"` - LogPath string `json:"LogPath"` - ConmonPidFile string `json:"ConmonPidFile"` - Name string `json:"Name"` - RestartCount int32 `json:"RestartCount"` - Driver string `json:"Driver"` - MountLabel string `json:"MountLabel"` - ProcessLabel string `json:"ProcessLabel"` - AppArmorProfile string `json:"AppArmorProfile"` - EffectiveCaps []string `json:"EffectiveCaps"` - BoundingCaps []string `json:"BoundingCaps"` - ExecIDs []string `json:"ExecIDs"` - // GraphDriver *driver.Data `json:"GraphDriver"` - SizeRw int64 `json:"SizeRw,omitempty"` - SizeRootFs int64 `json:"SizeRootFs,omitempty"` - Mounts []InspectMount `json:"Mounts"` - Dependencies []string `json:"Dependencies"` - NetworkSettings *InspectNetworkSettings `json:"NetworkSettings"` //TODO - ExitCommand []string `json:"ExitCommand"` - Namespace string `json:"Namespace"` - IsInfra bool `json:"IsInfra"` - Config *InspectContainerConfig `json:"Config"` - HostConfig *InspectContainerHostConfig `json:"HostConfig"` -} - -// InspectContainerConfig holds further data about how a container was initially -// configured. -type InspectContainerConfig struct { - // Container hostname - Hostname string `json:"Hostname"` - // Container domain name - unused at present - DomainName string `json:"Domainname"` - // User the container was launched with - User string `json:"User"` - // Unused, at present - AttachStdin bool `json:"AttachStdin"` - // Unused, at present - AttachStdout bool `json:"AttachStdout"` - // Unused, at present - AttachStderr bool `json:"AttachStderr"` - // Whether the container creates a TTY - Tty bool `json:"Tty"` - // Whether the container leaves STDIN open - OpenStdin bool `json:"OpenStdin"` - // Whether STDIN is only left open once. - // Presently not supported by Podman, unused. - StdinOnce bool `json:"StdinOnce"` - // Container environment variables - Env []string `json:"Env"` - // Container command - Cmd []string `json:"Cmd"` - // Container image - Image string `json:"Image"` - // Unused, at present. I've never seen this field populated. - Volumes map[string]struct{} `json:"Volumes"` - // Container working directory - WorkingDir string `json:"WorkingDir"` - // Container entrypoint - Entrypoint string `json:"Entrypoint"` - // On-build arguments - presently unused. More of Buildah's domain. - OnBuild *string `json:"OnBuild"` - // Container labels - Labels map[string]string `json:"Labels"` - // Container annotations - Annotations map[string]string `json:"Annotations"` - // Container stop signal - StopSignal uint `json:"StopSignal"` - // Configured healthcheck for the container - // Healthcheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"` -} - -type InspectImageData struct { - ID string `json:"Id"` - Created time.Time `json:"Created"` - Config *InspectImageConfig `json:"Config"` -} - -type InspectImageConfig struct { - Env []string `json:"Env"` - Entrypoint []string `json:"Entrypoint"` - Cmd []string `json:"Cmd"` - WorkingDir string `json:"WorkingDir"` -} - -// InspectMount provides a record of a single mount in a container. It contains -// fields for both named and normal volumes. Only user-specified volumes will be -// included, and tmpfs volumes are not included even if the user specified them. -type InspectMount struct { - // Whether the mount is a volume or bind mount. Allowed values are - // "volume" and "bind". - Type string `json:"Type"` - // The name of the volume. Empty for bind mounts. - Name string `json:"Name,omptempty"` - // The source directory for the volume. - Source string `json:"Source"` - // The destination directory for the volume. Specified as a path within - // the container, as it would be passed into the OCI runtime. - Destination string `json:"Destination"` - // The driver used for the named volume. Empty for bind mounts. - Driver string `json:"Driver"` - // Contains SELinux :z/:Z mount options. Unclear what, if anything, else - // goes in here. - Mode string `json:"Mode"` - // All remaining mount options. Additional data, not present in the - // original output. - Options []string `json:"Options"` - // Whether the volume is read-write - RW bool `json:"RW"` - // Mount propagation for the mount. Can be empty if not specified, but - // is always printed - no omitempty. - Propagation string `json:"Propagation"` -} - -// InspectHostPort provides information on a port on the host that a container's -// port is bound to. -type InspectHostPort struct { - // IP on the host we are bound to. "" if not specified (binding to all - // IPs). - HostIP string `json:"HostIp"` - // Port on the host we are bound to. No special formatting - just an - // integer stuffed into a string. - HostPort string `json:"HostPort"` -} - -// InspectContainerState provides a detailed record of a container's current -// state. It is returned as part of InspectContainerData. -// As with InspectContainerData, many portions of this struct are matched to -// Docker, but here we see more fields that are unused (nonsensical in the -// context of Libpod). -type InspectContainerState struct { - OciVersion string `json:"OciVersion"` - Status string `json:"Status"` - Running bool `json:"Running"` - Paused bool `json:"Paused"` - Restarting bool `json:"Restarting"` // TODO - OOMKilled bool `json:"OOMKilled"` - Dead bool `json:"Dead"` - Pid int `json:"Pid"` - ExitCode int32 `json:"ExitCode"` - Error string `json:"Error"` - StartedAt time.Time `json:"StartedAt"` - FinishedAt time.Time `json:"FinishedAt"` - // Healthcheck HealthCheckResults `json:"Healthcheck,omitempty"` -} - -// InspectNetworkSettings holds information about the network settings of the -// container. -// Many fields are maintained only for compatibility with `docker inspect` and -// are unused within Libpod. -type InspectNetworkSettings struct { - Bridge string `json:"Bridge"` - SandboxID string `json:"SandboxID"` - HairpinMode bool `json:"HairpinMode"` - LinkLocalIPv6Address string `json:"LinkLocalIPv6Address"` - LinkLocalIPv6PrefixLen int `json:"LinkLocalIPv6PrefixLen"` - // Ports []ocicni.PortMapping `json:"Ports"` - SandboxKey string `json:"SandboxKey"` - SecondaryIPAddresses []string `json:"SecondaryIPAddresses"` - SecondaryIPv6Addresses []string `json:"SecondaryIPv6Addresses"` - EndpointID string `json:"EndpointID"` - Gateway string `json:"Gateway"` - GlobalIPv6Address string `json:"GlobalIPv6Address"` - GlobalIPv6PrefixLen int `json:"GlobalIPv6PrefixLen"` - IPAddress string `json:"IPAddress"` - IPPrefixLen int `json:"IPPrefixLen"` - IPv6Gateway string `json:"IPv6Gateway"` - MacAddress string `json:"MacAddress"` -} - -// InspectContainerHostConfig holds information used when the container was created. -type InspectContainerHostConfig struct { - // Binds contains an array of user-added mounts. - // Both volume mounts and named volumes are included. - // Tmpfs mounts are NOT included. - // In 'docker inspect' this is separated into 'Binds' and 'Mounts' based - // on how a mount was added. We do not make this distinction and do not - // include a Mounts field in inspect. - // Format: :[:] - Binds []string `json:"Binds"` - // NetworkMode is the configuration of the container's network - // namespace. - // Populated as follows: - // default - A network namespace is being created and configured via CNI - // none - A network namespace is being created, not configured via CNI - // host - No network namespace created - // container: - Using another container's network namespace - // ns: - A path to a network namespace has been specified - NetworkMode string `json:"NetworkMode"` - // PortBindings contains the container's port bindings. - // It is formatted as map[string][]InspectHostPort. - // The string key here is formatted as / - // and represents the container port. A single container port may be - // bound to multiple host ports (on different IPs). - PortBindings map[string][]InspectHostPort `json:"PortBindings"` - // Tmpfs is a list of tmpfs filesystems that will be mounted into the - // container. - // It is a map of destination path to options for the mount. - Tmpfs map[string]string `json:"Tmpfs"` - // Memory indicates the memory resources allocated to the container. - // This is the limit (in bytes) of RAM the container may use. - Memory int64 `json:"Memory"` - // MemoryReservation is the reservation (soft limit) of memory available - // to the container. Soft limits are warnings only and can be exceeded. - MemoryReservation int64 `json:"MemoryReservation"` - // MemorySwap is the total limit for all memory available to the - // container, including swap. 0 indicates that there is no limit to the - // amount of memory available. - MemorySwap int64 `json:"MemorySwap"` - // MemorySwappiness is the willingness of the kernel to page container - // memory to swap. It is an integer from 0 to 100, with low numbers - // being more likely to be put into swap. - // -1, the default, will not set swappiness and use the system defaults. - MemorySwappiness int64 `json:"MemorySwappiness"` -} diff --git a/iopodman/io.podman.varlink b/iopodman/io.podman.varlink deleted file mode 100644 index f9339fc..0000000 --- a/iopodman/io.podman.varlink +++ /dev/null @@ -1,1344 +0,0 @@ -# Podman Service Interface and API description. The master version of this document can be found -# in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in the upstream libpod repository. -interface io.podman - -type Volume ( - name: string, - labels: [string]string, - mountPoint: string, - driver: string, - options: [string]string -) - -type NotImplemented ( - comment: string -) - -type StringResponse ( - message: string -) - -type LogLine ( - device: string, - parseLogType : string, - time: string, - msg: string, - cid: string -) - -# ContainerChanges describes the return struct for ListContainerChanges -type ContainerChanges ( - changed: []string, - added: []string, - deleted: []string -) - -type ImageSaveOptions ( - name: string, - format: string, - output: string, - outputType: string, - moreTags: []string, - quiet: bool, - compress: bool -) - -type VolumeCreateOpts ( - volumeName: string, - driver: string, - labels: [string]string, - options: [string]string -) - -type VolumeRemoveOpts ( - volumes: []string, - all: bool, - force: bool -) - -type Image ( - id: string, - digest: string, - digests: []string, - parentId: string, - repoTags: []string, - repoDigests: []string, - created: string, # as RFC3339 - size: int, - virtualSize: int, - containers: int, - labels: [string]string, - isParent: bool, - topLayer: string, - readOnly: bool -) - -# ImageHistory describes the returned structure from ImageHistory. -type ImageHistory ( - id: string, - created: string, # as RFC3339 - createdBy: string, - tags: []string, - size: int, - comment: string -) - -# Represents a single search result from SearchImages -type ImageSearchResult ( - description: string, - is_official: bool, - is_automated: bool, - registry: string, - name: string, - star_count: int -) - -type ImageSearchFilter ( - is_official: ?bool, - is_automated: ?bool, - star_count: int -) - -type KubePodService ( - pod: string, - service: string -) - -type Container ( - id: string, - image: string, - imageid: string, - command: []string, - createdat: string, # as RFC3339 - runningfor: string, - status: string, - ports: []ContainerPortMappings, - rootfssize: int, - rwsize: int, - names: string, - labels: [string]string, - mounts: []ContainerMount, - containerrunning: bool, - namespaces: ContainerNameSpace -) - -# ContainerStats is the return struct for the stats of a container -type ContainerStats ( - id: string, - name: string, - cpu: float, - cpu_nano: int, - system_nano: int, - mem_usage: int, - mem_limit: int, - mem_perc: float, - net_input: int, - net_output: int, - block_output: int, - block_input: int, - pids: int -) - -type PsOpts ( - all: bool, - filters: ?[]string, - last: ?int, - latest: ?bool, - noTrunc: ?bool, - pod: ?bool, - quiet: ?bool, - size: ?bool, - sort: ?string, - sync: ?bool -) - -type PsContainer ( - id: string, - image: string, - command: string, - created: string, - ports: string, - names: string, - isInfra: bool, - status: string, - state: string, - pidNum: int, - rootFsSize: int, - rwSize: int, - pod: string, - createdAt: string, - exitedAt: string, - startedAt: string, - labels: [string]string, - nsPid: string, - cgroup: string, - ipc: string, - mnt: string, - net: string, - pidNs: string, - user: string, - uts: string, - mounts: string -) - -# ContainerMount describes the struct for mounts in a container -type ContainerMount ( - destination: string, - type: string, - source: string, - options: []string -) - -# ContainerPortMappings describes the struct for portmappings in an existing container -type ContainerPortMappings ( - host_port: string, - host_ip: string, - protocol: string, - container_port: string -) - -# ContainerNamespace describes the namespace structure for an existing container -type ContainerNameSpace ( - user: string, - uts: string, - pidns: string, - pid: string, - cgroup: string, - net: string, - mnt: string, - ipc: string -) - -# InfoDistribution describes the host's distribution -type InfoDistribution ( - distribution: string, - version: string -) - -# InfoHost describes the host stats portion of PodmanInfo -type InfoHost ( - buildah_version: string, - distribution: InfoDistribution, - mem_free: int, - mem_total: int, - swap_free: int, - swap_total: int, - arch: string, - cpus: int, - hostname: string, - kernel: string, - os: string, - uptime: string, - eventlogger: string -) - -# InfoGraphStatus describes the detailed status of the storage driver -type InfoGraphStatus ( - backing_filesystem: string, - native_overlay_diff: string, - supports_d_type: string -) - -# InfoStore describes the host's storage informatoin -type InfoStore ( - containers: int, - images: int, - graph_driver_name: string, - graph_driver_options: string, - graph_root: string, - graph_status: InfoGraphStatus, - run_root: string -) - -# InfoPodman provides details on the Podman binary -type InfoPodmanBinary ( - compiler: string, - go_version: string, - podman_version: string, - git_commit: string -) - -# PodmanInfo describes the Podman host and build -type PodmanInfo ( - host: InfoHost, - registries: []string, - insecure_registries: []string, - store: InfoStore, - podman: InfoPodmanBinary -) - -# Sockets describes sockets location for a container -type Sockets( - container_id: string, - io_socket: string, - control_socket: string -) - -# Create is an input structure for creating containers. -# args[0] is the image name or id -# args[1-] are the new commands if changed -type Create ( - args: []string, - addHost: ?[]string, - annotation: ?[]string, - attach: ?[]string, - blkioWeight: ?string, - blkioWeightDevice: ?[]string, - capAdd: ?[]string, - capDrop: ?[]string, - cgroupParent: ?string, - cidFile: ?string, - conmonPidfile: ?string, - command: ?[]string, - cpuPeriod: ?int, - cpuQuota: ?int, - cpuRtPeriod: ?int, - cpuRtRuntime: ?int, - cpuShares: ?int, - cpus: ?float, - cpuSetCpus: ?string, - cpuSetMems: ?string, - detach: ?bool, - detachKeys: ?string, - device: ?[]string, - deviceReadBps: ?[]string, - deviceReadIops: ?[]string, - deviceWriteBps: ?[]string, - deviceWriteIops: ?[]string, - dns: ?[]string, - dnsOpt: ?[]string, - dnsSearch: ?[]string, - dnsServers: ?[]string, - entrypoint: ?string, - env: ?[]string, - envFile: ?[]string, - expose: ?[]string, - gidmap: ?[]string, - groupadd: ?[]string, - healthcheckCommand: ?string, - healthcheckInterval: ?string, - healthcheckRetries: ?int, - healthcheckStartPeriod: ?string, - healthcheckTimeout:?string, - hostname: ?string, - imageVolume: ?string, - init: ?bool, - initPath: ?string, - interactive: ?bool, - ip: ?string, - ipc: ?string, - kernelMemory: ?string, - label: ?[]string, - labelFile: ?[]string, - logDriver: ?string, - logOpt: ?[]string, - macAddress: ?string, - memory: ?string, - memoryReservation: ?string, - memorySwap: ?string, - memorySwappiness: ?int, - name: ?string, - net: ?string, - network: ?string, - noHosts: ?bool, - oomKillDisable: ?bool, - oomScoreAdj: ?int, - overrideArch: ?string, - overrideOS: ?string, - pid: ?string, - pidsLimit: ?int, - pod: ?string, - privileged: ?bool, - publish: ?[]string, - publishAll: ?bool, - pull: ?string, - quiet: ?bool, - readonly: ?bool, - readonlytmpfs: ?bool, - restart: ?string, - rm: ?bool, - rootfs: ?bool, - securityOpt: ?[]string, - shmSize: ?string, - stopSignal: ?string, - stopTimeout: ?int, - storageOpt: ?[]string, - subuidname: ?string, - subgidname: ?string, - sysctl: ?[]string, - systemd: ?string, - tmpfs: ?[]string, - tty: ?bool, - uidmap: ?[]string, - ulimit: ?[]string, - user: ?string, - userns: ?string, - uts: ?string, - mount: ?[]string, - volume: ?[]string, - volumesFrom: ?[]string, - workDir: ?string -) - -# BuildOptions are are used to describe describe physical attributes of the build -type BuildOptions ( - addHosts: []string, - cgroupParent: string, - cpuPeriod: int, - cpuQuota: int, - cpuShares: int, - cpusetCpus: string, - cpusetMems: string, - memory: int, - memorySwap: int, - shmSize: string, - ulimit: []string, - volume: []string -) - -# BuildInfo is used to describe user input for building images -type BuildInfo ( - additionalTags: []string, - annotations: []string, - buildArgs: [string]string, - buildOptions: BuildOptions, - cniConfigDir: string, - cniPluginDir: string, - compression: string, - contextDir: string, - defaultsMountFilePath: string, - dockerfiles: []string, - err: string, - forceRmIntermediateCtrs: bool, - iidfile: string, - label: []string, - layers: bool, - nocache: bool, - out: string, - output: string, - outputFormat: string, - pullPolicy: string, - quiet: bool, - remoteIntermediateCtrs: bool, - reportWriter: string, - runtimeArgs: []string, - squash: bool -) - -# MoreResponse is a struct for when responses from varlink requires longer output -type MoreResponse ( - logs: []string, - id: string -) - -# ListPodContainerInfo is a returned struct for describing containers -# in a pod. -type ListPodContainerInfo ( - name: string, - id: string, - status: string -) - -# PodCreate is an input structure for creating pods. -# It emulates options to podman pod create. The infraCommand and -# infraImage options are currently NotSupported. -type PodCreate ( - name: string, - cgroupParent: string, - labels: [string]string, - share: []string, - infra: bool, - infraCommand: string, - infraImage: string, - publish: []string -) - -# ListPodData is the returned struct for an individual pod -type ListPodData ( - id: string, - name: string, - createdat: string, - cgroup: string, - status: string, - labels: [string]string, - numberofcontainers: string, - containersinfo: []ListPodContainerInfo -) - -type PodContainerErrorData ( - containerid: string, - reason: string -) - -# Runlabel describes the required input for container runlabel -type Runlabel( - image: string, - authfile: string, - display: bool, - name: string, - pull: bool, - label: string, - extraArgs: []string, - opts: [string]string -) - -# Event describes a libpod struct -type Event( - # TODO: make status and type a enum at some point? - # id is the container, volume, pod, image ID - id: string, - # image is the image name where applicable - image: string, - # name is the name of the pod, container, image - name: string, - # status describes the event that happened (i.e. create, remove, ...) - status: string, - # time the event happened - time: string, - # type describes object the event happened with (image, container...) - type: string -) - -type DiffInfo( - # path that is different - path: string, - # Add, Delete, Modify - changeType: string -) - -type ExecOpts( - # container name or id - name: string, - # Create pseudo tty - tty: bool, - # privileged access in container - privileged: bool, - # command to execute in container - cmd: []string, - # user to use in container - user: ?string, - # workdir to run command in container - workdir: ?string, - # slice of keyword=value environment variables - env: ?[]string, - # string of detach keys - detachKeys: ?string -) - -# GetVersion returns version and build information of the podman service -method GetVersion() -> ( - version: string, - go_version: string, - git_commit: string, - built: string, # as RFC3339 - os_arch: string, - remote_api_version: int -) - -# GetInfo returns a [PodmanInfo](#PodmanInfo) struct that describes podman and its host such as storage stats, -# build information of Podman, and system-wide registries. -method GetInfo() -> (info: PodmanInfo) - -# ListContainers returns information about all containers. -# See also [GetContainer](#GetContainer). -method ListContainers() -> (containers: []Container) - -method Ps(opts: PsOpts) -> (containers: []PsContainer) - -method GetContainersByStatus(status: []string) -> (containerS: []Container) - -method Top (nameOrID: string, descriptors: []string) -> (top: []string) - -# HealthCheckRun executes defined container's healthcheck command -# and returns the container's health status. -method HealthCheckRun (nameOrID: string) -> (healthCheckStatus: string) - -# GetContainer returns information about a single container. If a container -# with the given id doesn't exist, a [ContainerNotFound](#ContainerNotFound) -# error will be returned. See also [ListContainers](ListContainers) and -# [InspectContainer](#InspectContainer). -method GetContainer(id: string) -> (container: Container) - -# GetContainersByContext allows you to get a list of container ids depending on all, latest, or a list of -# container names. The definition of latest container means the latest by creation date. In a multi- -# user environment, results might differ from what you expect. -method GetContainersByContext(all: bool, latest: bool, args: []string) -> (containers: []string) - -# CreateContainer creates a new container from an image. It uses a [Create](#Create) type for input. -method CreateContainer(create: Create) -> (container: string) - -# InspectContainer data takes a name or ID of a container returns the inspection -# data in string format. You can then serialize the string into JSON. A [ContainerNotFound](#ContainerNotFound) -# error will be returned if the container cannot be found. See also [InspectImage](#InspectImage). -method InspectContainer(name: string) -> (container: string) - -# ListContainerProcesses takes a name or ID of a container and returns the processes -# running inside the container as array of strings. It will accept an array of string -# arguments that represent ps options. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -# error will be returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}' -# { -# "container": [ -# " UID PID PPID C STIME TTY TIME CMD", -# " 0 21220 21210 0 09:05 pts/0 00:00:00 /bin/sh", -# " 0 21232 21220 0 09:05 pts/0 00:00:00 top", -# " 0 21284 21220 0 09:05 pts/0 00:00:00 vi /etc/hosts" -# ] -# } -# ~~~ -method ListContainerProcesses(name: string, opts: []string) -> (container: []string) - -# GetContainerLogs takes a name or ID of a container and returns the logs of that container. -# If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) error will be returned. -# The container logs are returned as an array of strings. GetContainerLogs will honor the streaming -# capability of varlink if the client invokes it. -method GetContainerLogs(name: string) -> (container: []string) - -method GetContainersLogs(names: []string, follow: bool, latest: bool, since: string, tail: int, timestamps: bool) -> (log: LogLine) - -# ListContainerChanges takes a name or ID of a container and returns changes between the container and -# its base image. It returns a struct of changed, deleted, and added path names. -method ListContainerChanges(name: string) -> (container: ContainerChanges) - -# ExportContainer creates an image from a container. It takes the name or ID of a container and a -# path representing the target tarfile. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -# error will be returned. -# The return value is the written tarfile. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.ExportContainer '{"name": "flamboyant_payne", "path": "/tmp/payne.tar" }' -# { -# "tarfile": "/tmp/payne.tar" -# } -# ~~~ -method ExportContainer(name: string, path: string) -> (tarfile: string) - -# GetContainerStats takes the name or ID of a container and returns a single ContainerStats structure which -# contains attributes like memory and cpu usage. If the container cannot be found, a -# [ContainerNotFound](#ContainerNotFound) error will be returned. If the container is not running, a [NoContainerRunning](#NoContainerRunning) -# error will be returned -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.GetContainerStats '{"name": "c33e4164f384"}' -# { -# "container": { -# "block_input": 0, -# "block_output": 0, -# "cpu": 2.571123918839990154678e-08, -# "cpu_nano": 49037378, -# "id": "c33e4164f384aa9d979072a63319d66b74fd7a128be71fa68ede24f33ec6cfee", -# "mem_limit": 33080606720, -# "mem_perc": 2.166828456524753747370e-03, -# "mem_usage": 716800, -# "name": "competent_wozniak", -# "net_input": 768, -# "net_output": 5910, -# "pids": 1, -# "system_nano": 10000000 -# } -# } -# ~~~ -method GetContainerStats(name: string) -> (container: ContainerStats) - -# GetContainerStatsWithHistory takes a previous set of container statistics and uses libpod functions -# to calculate the containers statistics based on current and previous measurements. -method GetContainerStatsWithHistory(previousStats: ContainerStats) -> (container: ContainerStats) - -# This method has not be implemented yet. -# method ResizeContainerTty() -> (notimplemented: NotImplemented) - -# StartContainer starts a created or stopped container. It takes the name or ID of container. It returns -# the container ID once started. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -# error will be returned. See also [CreateContainer](#CreateContainer). -method StartContainer(name: string) -> (container: string) - -# StopContainer stops a container given a timeout. It takes the name or ID of a container as well as a -# timeout value. The timeout value the time before a forcible stop to the container is applied. It -# returns the container ID once stopped. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -# error will be returned instead. See also [KillContainer](KillContainer). -# #### Error -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}' -# { -# "container": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -# } -# ~~~ -method StopContainer(name: string, timeout: int) -> (container: string) - -# InitContainer initializes the given container. It accepts a container name or -# ID, and will initialize the container matching that ID if possible, and error -# if not. Containers can only be initialized when they are in the Created or -# Exited states. Initialization prepares a container to be started, but does not -# start the container. It is intended to be used to debug a container's state -# prior to starting it. -method InitContainer(name: string) -> (container: string) - -# RestartContainer will restart a running container given a container name or ID and timeout value. The timeout -# value is the time before a forcible stop is used to stop the container. If the container cannot be found by -# name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise, the ID of the -# container will be returned. -method RestartContainer(name: string, timeout: int) -> (container: string) - -# KillContainer takes the name or ID of a container as well as a signal to be applied to the container. Once the -# container has been killed, the container's ID is returned. If the container cannot be found, a -# [ContainerNotFound](#ContainerNotFound) error is returned. See also [StopContainer](StopContainer). -method KillContainer(name: string, signal: int) -> (container: string) - -# This method has not be implemented yet. -# method UpdateContainer() -> (notimplemented: NotImplemented) - -# This method has not be implemented yet. -# method RenameContainer() -> (notimplemented: NotImplemented) - -# PauseContainer takes the name or ID of container and pauses it. If the container cannot be found, -# a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. -# See also [UnpauseContainer](#UnpauseContainer). -method PauseContainer(name: string) -> (container: string) - -# UnpauseContainer takes the name or ID of container and unpauses a paused container. If the container cannot be -# found, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. -# See also [PauseContainer](#PauseContainer). -method UnpauseContainer(name: string) -> (container: string) - -# Attach takes the name or ID of a container and sets up the ability to remotely attach to its console. The start -# bool is whether you wish to start the container in question first. -method Attach(name: string, detachKeys: string, start: bool) -> () - -method AttachControl(name: string) -> () - -# GetAttachSockets takes the name or ID of an existing container. It returns file paths for two sockets needed -# to properly communicate with a container. The first is the actual I/O socket that the container uses. The -# second is a "control" socket where things like resizing the TTY events are sent. If the container cannot be -# found, a [ContainerNotFound](#ContainerNotFound) error will be returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/io.podman/io.podman.GetAttachSockets '{"name": "b7624e775431219161"}' -# { -# "sockets": { -# "container_id": "b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca", -# "control_socket": "/var/lib/containers/storage/overlay-containers/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/userdata/ctl", -# "io_socket": "/var/run/libpod/socket/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/attach" -# } -# } -# ~~~ -method GetAttachSockets(name: string) -> (sockets: Sockets) - -# WaitContainer takes the name or ID of a container and waits the given interval in milliseconds until the container -# stops. Upon stopping, the return code of the container is returned. If the container container cannot be found by ID -# or name, a [ContainerNotFound](#ContainerNotFound) error is returned. -method WaitContainer(name: string, interval: int) -> (exitcode: int) - -# RemoveContainer requires the name or ID of a container as well as a boolean that -# indicates whether a container should be forcefully removed (e.g., by stopping it), and a boolean -# indicating whether to remove builtin volumes. Upon successful removal of the -# container, its ID is returned. If the -# container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned. -# See also [EvictContainer](EvictContainer). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.RemoveContainer '{"name": "62f4fd98cb57"}' -# { -# "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -# } -# ~~~ -method RemoveContainer(name: string, force: bool, removeVolumes: bool) -> (container: string) - -# EvictContainer requires the name or ID of a container as well as a boolean that -# indicates to remove builtin volumes. Upon successful eviction of the container, -# its ID is returned. If the container cannot be found by name or ID, -# a [ContainerNotFound](#ContainerNotFound) error will be returned. -# See also [RemoveContainer](RemoveContainer). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.EvictContainer '{"name": "62f4fd98cb57"}' -# { -# "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -# } -# ~~~ -method EvictContainer(name: string, removeVolumes: bool) -> (container: string) - -# DeleteStoppedContainers will delete all containers that are not running. It will return a list the deleted -# container IDs. See also [RemoveContainer](RemoveContainer). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.DeleteStoppedContainers -# { -# "containers": [ -# "451410b931d00def8aa9b4f8084e4d4a39e5e04ea61f358cf53a5cf95afcdcee", -# "8b60f754a3e01389494a9581ade97d35c2765b6e2f19acd2d3040c82a32d1bc0", -# "cf2e99d4d3cad6073df199ed32bbe64b124f3e1aba6d78821aa8460e70d30084", -# "db901a329587312366e5ecff583d08f0875b4b79294322df67d90fc6eed08fc1" -# ] -# } -# ~~~ -method DeleteStoppedContainers() -> (containers: []string) - -# ListImages returns information about the images that are currently in storage. -# See also [InspectImage](#InspectImage). -method ListImages() -> (images: []Image) - -# GetImage returns information about a single image in storage. -# If the image caGetImage returns be found, [ImageNotFound](#ImageNotFound) will be returned. -method GetImage(id: string) -> (image: Image) - -# BuildImage takes a [BuildInfo](#BuildInfo) structure and builds an image. At a minimum, you must provide the -# contextDir tarball path, the 'dockerfiles' path, and 'output' option in the BuildInfo structure. The 'output' -# options is the name of the of the resulting build. It will return a [MoreResponse](#MoreResponse) structure -# that contains the build logs and resulting image ID. -# #### Example -# ~~~ -# $ sudo varlink call -m unix:///run/podman/io.podman/io.podman.BuildImage '{"build":{"contextDir":"/tmp/t/context.tar","dockerfiles":["Dockerfile"], "output":"foobar"}}' -# { -# "image": { -# "id": "", -# "logs": [ -# "STEP 1: FROM alpine\n" -# ] -# } -# } -# { -# "image": { -# "id": "", -# "logs": [ -# "STEP 2: COMMIT foobar\n" -# ] -# } -# } -# { -# "image": { -# "id": "", -# "logs": [ -# "b7b28af77ffec6054d13378df4fdf02725830086c7444d9c278af25312aa39b9\n" -# ] -# } -# } -# { -# "image": { -# "id": "b7b28af77ffec6054d13378df4fdf02725830086c7444d9c278af25312aa39b9", -# "logs": [] -# } -# } -# ~~~ -method BuildImage(build: BuildInfo) -> (image: MoreResponse) - -# This function is not implemented yet. -# method CreateImage() -> (notimplemented: NotImplemented) - -# InspectImage takes the name or ID of an image and returns a string representation of data associated with the -#image. You must serialize the string into JSON to use it further. An [ImageNotFound](#ImageNotFound) error will -# be returned if the image cannot be found. -method InspectImage(name: string) -> (image: string) - -# HistoryImage takes the name or ID of an image and returns information about its history and layers. The returned -# history is in the form of an array of ImageHistory structures. If the image cannot be found, an -# [ImageNotFound](#ImageNotFound) error is returned. -method HistoryImage(name: string) -> (history: []ImageHistory) - -# PushImage takes two input arguments: the name or ID of an image, the fully-qualified destination name of the image, -# It will return an [ImageNotFound](#ImageNotFound) error if -# the image cannot be found in local storage; otherwise it will return a [MoreResponse](#MoreResponse) -method PushImage(name: string, tag: string, compress: bool, format: string, removeSignatures: bool, signBy: string) -> (reply: MoreResponse) - -# TagImage takes the name or ID of an image in local storage as well as the desired tag name. If the image cannot -# be found, an [ImageNotFound](#ImageNotFound) error will be returned; otherwise, the ID of the image is returned on success. -method TagImage(name: string, tagged: string) -> (image: string) - -# RemoveImage takes the name or ID of an image as well as a boolean that determines if containers using that image -# should be deleted. If the image cannot be found, an [ImageNotFound](#ImageNotFound) error will be returned. The -# ID of the removed image is returned when complete. See also [DeleteUnusedImages](DeleteUnusedImages). -# #### Example -# ~~~ -# varlink call -m unix:/run/podman/io.podman/io.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}' -# { -# "image": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e" -# } -# ~~~ -method RemoveImage(name: string, force: bool) -> (image: string) - -# SearchImages searches available registries for images that contain the -# contents of "query" in their name. If "limit" is given, limits the amount of -# search results per registry. -method SearchImages(query: string, limit: ?int, filter: ImageSearchFilter) -> (results: []ImageSearchResult) - -# DeleteUnusedImages deletes any images not associated with a container. The IDs of the deleted images are returned -# in a string array. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.DeleteUnusedImages -# { -# "images": [ -# "166ea6588079559c724c15223f52927f514f73dd5c5cf2ae2d143e3b2e6e9b52", -# "da86e6ba6ca197bf6bc5e9d900febd906b133eaa4750e6bed647b0fbe50ed43e", -# "3ef70f7291f47dfe2b82931a993e16f5a44a0e7a68034c3e0e086d77f5829adc", -# "59788edf1f3e78cd0ebe6ce1446e9d10788225db3dedcfd1a59f764bad2b2690" -# ] -# } -# ~~~ -method DeleteUnusedImages() -> (images: []string) - -# Commit, creates an image from an existing container. It requires the name or -# ID of the container as well as the resulting image name. Optionally, you can define an author and message -# to be added to the resulting image. You can also define changes to the resulting image for the following -# attributes: _CMD, ENTRYPOINT, ENV, EXPOSE, LABEL, ONBUILD, STOPSIGNAL, USER, VOLUME, and WORKDIR_. To pause the -# container while it is being committed, pass a _true_ bool for the pause argument. If the container cannot -# be found by the ID or name provided, a (ContainerNotFound)[#ContainerNotFound] error will be returned; otherwise, -# the resulting image's ID will be returned as a string inside a MoreResponse. -method Commit(name: string, image_name: string, changes: []string, author: string, message: string, pause: bool, manifestType: string) -> (reply: MoreResponse) - -# ImportImage imports an image from a source (like tarball) into local storage. The image can have additional -# descriptions added to it using the message and changes options. See also [ExportImage](ExportImage). -method ImportImage(source: string, reference: string, message: string, changes: []string, delete: bool) -> (image: string) - -# ExportImage takes the name or ID of an image and exports it to a destination like a tarball. There is also -# a boolean option to force compression. It also takes in a string array of tags to be able to save multiple -# tags of the same image to a tarball (each tag should be of the form :). Upon completion, the ID -# of the image is returned. If the image cannot be found in local storage, an [ImageNotFound](#ImageNotFound) -# error will be returned. See also [ImportImage](ImportImage). -method ExportImage(name: string, destination: string, compress: bool, tags: []string) -> (image: string) - -# PullImage pulls an image from a repository to local storage. After a successful pull, the image id and logs -# are returned as a [MoreResponse](#MoreResponse). This connection also will handle a WantsMores request to send -# status as it occurs. -method PullImage(name: string) -> (reply: MoreResponse) - -# CreatePod creates a new empty pod. It uses a [PodCreate](#PodCreate) type for input. -# On success, the ID of the newly created pod will be returned. -# #### Example -# ~~~ -# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"name": "test"}}' -# { -# "pod": "b05dee7bd4ccfee688099fe1588a7a898d6ddd6897de9251d4671c9b0feacb2a" -# } -# -# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"infra": true, "share": ["ipc", "net", "uts"]}}' -# { -# "pod": "d7697449a8035f613c1a8891286502aca68fff7d5d49a85279b3bda229af3b28" -# } -# ~~~ -method CreatePod(create: PodCreate) -> (pod: string) - -# ListPods returns a list of pods in no particular order. They are -# returned as an array of ListPodData structs. See also [GetPod](#GetPod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.ListPods -# { -# "pods": [ -# { -# "cgroup": "machine.slice", -# "containersinfo": [ -# { -# "id": "00c130a45de0411f109f1a0cfea2e298df71db20fa939de5cab8b2160a36be45", -# "name": "1840835294cf-infra", -# "status": "running" -# }, -# { -# "id": "49a5cce72093a5ca47c6de86f10ad7bb36391e2d89cef765f807e460865a0ec6", -# "name": "upbeat_murdock", -# "status": "running" -# } -# ], -# "createdat": "2018-12-07 13:10:15.014139258 -0600 CST", -# "id": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f", -# "name": "foobar", -# "numberofcontainers": "2", -# "status": "Running" -# }, -# { -# "cgroup": "machine.slice", -# "containersinfo": [ -# { -# "id": "1ca4b7bbba14a75ba00072d4b705c77f3df87db0109afaa44d50cb37c04a477e", -# "name": "784306f655c6-infra", -# "status": "running" -# } -# ], -# "createdat": "2018-12-07 13:09:57.105112457 -0600 CST", -# "id": "784306f655c6200aea321dd430ba685e9b2cc1f7d7528a72f3ff74ffb29485a2", -# "name": "nostalgic_pike", -# "numberofcontainers": "1", -# "status": "Running" -# } -# ] -# } -# ~~~ -method ListPods() -> (pods: []ListPodData) - -# GetPod takes a name or ID of a pod and returns single [ListPodData](#ListPodData) -# structure. A [PodNotFound](#PodNotFound) error will be returned if the pod cannot be found. -# See also [ListPods](ListPods). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.GetPod '{"name": "foobar"}' -# { -# "pod": { -# "cgroup": "machine.slice", -# "containersinfo": [ -# { -# "id": "00c130a45de0411f109f1a0cfea2e298df71db20fa939de5cab8b2160a36be45", -# "name": "1840835294cf-infra", -# "status": "running" -# }, -# { -# "id": "49a5cce72093a5ca47c6de86f10ad7bb36391e2d89cef765f807e460865a0ec6", -# "name": "upbeat_murdock", -# "status": "running" -# } -# ], -# "createdat": "2018-12-07 13:10:15.014139258 -0600 CST", -# "id": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f", -# "name": "foobar", -# "numberofcontainers": "2", -# "status": "Running" -# } -# } -# ~~~ -method GetPod(name: string) -> (pod: ListPodData) - -# InspectPod takes the name or ID of an image and returns a string representation of data associated with the -# pod. You must serialize the string into JSON to use it further. A [PodNotFound](#PodNotFound) error will -# be returned if the pod cannot be found. -method InspectPod(name: string) -> (pod: string) - -# StartPod starts containers in a pod. It takes the name or ID of pod. If the pod cannot be found, a [PodNotFound](#PodNotFound) -# error will be returned. Containers in a pod are started independently. If there is an error starting one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was started with no errors, the pod ID is returned. -# See also [CreatePod](#CreatePod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.StartPod '{"name": "135d71b9495f"}' -# { -# "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6", -# } -# ~~~ -method StartPod(name: string) -> (pod: string) - -# StopPod stops containers in a pod. It takes the name or ID of a pod and a timeout. -# If the pod cannot be found, a [PodNotFound](#PodNotFound) error will be returned instead. -# Containers in a pod are stopped independently. If there is an error stopping one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was stopped with no errors, the pod ID is returned. -# See also [KillPod](KillPod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.StopPod '{"name": "135d71b9495f"}' -# { -# "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -# } -# ~~~ -method StopPod(name: string, timeout: int) -> (pod: string) - -# RestartPod will restart containers in a pod given a pod name or ID. Containers in -# the pod that are running will be stopped, then all stopped containers will be run. -# If the pod cannot be found by name or ID, a [PodNotFound](#PodNotFound) error will be returned. -# Containers in a pod are restarted independently. If there is an error restarting one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was restarted with no errors, the pod ID is returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.RestartPod '{"name": "135d71b9495f"}' -# { -# "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -# } -# ~~~ -method RestartPod(name: string) -> (pod: string) - -# KillPod takes the name or ID of a pod as well as a signal to be applied to the pod. If the pod cannot be found, a -# [PodNotFound](#PodNotFound) error is returned. -# Containers in a pod are killed independently. If there is an error killing one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was killed with no errors, the pod ID is returned. -# See also [StopPod](StopPod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.KillPod '{"name": "foobar", "signal": 15}' -# { -# "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -# } -# ~~~ -method KillPod(name: string, signal: int) -> (pod: string) - -# PausePod takes the name or ID of a pod and pauses the running containers associated with it. If the pod cannot be found, -# a [PodNotFound](#PodNotFound) error will be returned. -# Containers in a pod are paused independently. If there is an error pausing one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was paused with no errors, the pod ID is returned. -# See also [UnpausePod](#UnpausePod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.PausePod '{"name": "foobar"}' -# { -# "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -# } -# ~~~ -method PausePod(name: string) -> (pod: string) - -# UnpausePod takes the name or ID of a pod and unpauses the paused containers associated with it. If the pod cannot be -# found, a [PodNotFound](#PodNotFound) error will be returned. -# Containers in a pod are unpaused independently. If there is an error unpausing one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was unpaused with no errors, the pod ID is returned. -# See also [PausePod](#PausePod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.UnpausePod '{"name": "foobar"}' -# { -# "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -# } -# ~~~ -method UnpausePod(name: string) -> (pod: string) - -# RemovePod takes the name or ID of a pod as well a boolean representing whether a running -# container in the pod can be stopped and removed. If a pod has containers associated with it, and force is not true, -# an error will occur. -# If the pod cannot be found by name or ID, a [PodNotFound](#PodNotFound) error will be returned. -# Containers in a pod are removed independently. If there is an error removing any container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was removed with no errors, the pod ID is returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.RemovePod '{"name": "62f4fd98cb57", "force": "true"}' -# { -# "pod": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -# } -# ~~~ -method RemovePod(name: string, force: bool) -> (pod: string) - -# This method has not be implemented yet. -# method WaitPod() -> (notimplemented: NotImplemented) - -method TopPod(pod: string, latest: bool, descriptors: []string) -> (stats: []string) - -# GetPodStats takes the name or ID of a pod and returns a pod name and slice of ContainerStats structure which -# contains attributes like memory and cpu usage. If the pod cannot be found, a [PodNotFound](#PodNotFound) -# error will be returned. If the pod has no running containers associated with it, a [NoContainerRunning](#NoContainerRunning) -# error will be returned. -# #### Example -# ~~~ -# $ varlink call unix:/run/podman/io.podman/io.podman.GetPodStats '{"name": "7f62b508b6f12b11d8fe02e"}' -# { -# "containers": [ -# { -# "block_input": 0, -# "block_output": 0, -# "cpu": 2.833470544016107524276e-08, -# "cpu_nano": 54363072, -# "id": "a64b51f805121fe2c5a3dc5112eb61d6ed139e3d1c99110360d08b58d48e4a93", -# "mem_limit": 12276146176, -# "mem_perc": 7.974359265237864966003e-03, -# "mem_usage": 978944, -# "name": "quirky_heisenberg", -# "net_input": 866, -# "net_output": 7388, -# "pids": 1, -# "system_nano": 20000000 -# } -# ], -# "pod": "7f62b508b6f12b11d8fe02e0db4de6b9e43a7d7699b33a4fc0d574f6e82b4ebd" -# } -# ~~~ -method GetPodStats(name: string) -> (pod: string, containers: []ContainerStats) - -# GetPodsByStatus searches for pods whose status is included in statuses -method GetPodsByStatus(statuses: []string) -> (pods: []string) - -# ImageExists talks a full or partial image ID or name and returns an int as to whether -# the image exists in local storage. An int result of 0 means the image does exist in -# local storage; whereas 1 indicates the image does not exists in local storage. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.ImageExists '{"name": "imageddoesntexist"}' -# { -# "exists": 1 -# } -# ~~~ -method ImageExists(name: string) -> (exists: int) - -# ContainerExists takes a full or partial container ID or name and returns an int as to -# whether the container exists in local storage. A result of 0 means the container does -# exists; whereas a result of 1 means it could not be found. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.ContainerExists '{"name": "flamboyant_payne"}'{ -# "exists": 0 -# } -# ~~~ -method ContainerExists(name: string) -> (exists: int) - -# ContainerCheckPoint performs a checkpopint on a container by its name or full/partial container -# ID. On successful checkpoint, the id of the checkpointed container is returned. -method ContainerCheckpoint(name: string, keep: bool, leaveRunning: bool, tcpEstablished: bool) -> (id: string) - -# ContainerRestore restores a container that has been checkpointed. The container to be restored can -# be identified by its name or full/partial container ID. A successful restore will result in the return -# of the container's ID. -method ContainerRestore(name: string, keep: bool, tcpEstablished: bool) -> (id: string) - -# ContainerRunlabel runs executes a command as described by a given container image label. -method ContainerRunlabel(runlabel: Runlabel) -> () - -# ExecContainer executes a command in the given container. -method ExecContainer(opts: ExecOpts) -> () - -# ListContainerMounts gathers all the mounted container mount points and returns them as an array -# of strings -# #### Example -# ~~~ -# $ varlink call unix:/run/podman/io.podman/io.podman.ListContainerMounts -# { -# "mounts": { -# "04e4c255269ed2545e7f8bd1395a75f7949c50c223415c00c1d54bfa20f3b3d9": "/var/lib/containers/storage/overlay/a078925828f57e20467ca31cfca8a849210d21ec7e5757332b72b6924f441c17/merged", -# "1d58c319f9e881a644a5122ff84419dccf6d138f744469281446ab243ef38924": "/var/lib/containers/storage/overlay/948fcf93f8cb932f0f03fd52e3180a58627d547192ffe3b88e0013b98ddcd0d2/merged" -# } -# } -# ~~~ -method ListContainerMounts() -> (mounts: [string]string) - -# MountContainer mounts a container by name or full/partial ID. Upon a successful mount, the destination -# mount is returned as a string. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.MountContainer '{"name": "jolly_shannon"}'{ -# "path": "/var/lib/containers/storage/overlay/419eeb04e783ea159149ced67d9fcfc15211084d65e894792a96bedfae0470ca/merged" -# } -# ~~~ -method MountContainer(name: string) -> (path: string) - -# UnmountContainer umounts a container by its name or full/partial container ID. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.UnmountContainer '{"name": "jolly_shannon", "force": false}' -# {} -# ~~~ -method UnmountContainer(name: string, force: bool) -> () - -# ImagesPrune removes all unused images from the local store. Upon successful pruning, -# the IDs of the removed images are returned. -method ImagesPrune(all: bool) -> (pruned: []string) - -# This function is not implemented yet. -# method ListContainerPorts(name: string) -> (notimplemented: NotImplemented) - -# GenerateKube generates a Kubernetes v1 Pod description of a Podman container or pod -# and its containers. The description is in YAML. See also [ReplayKube](ReplayKube). -method GenerateKube(name: string, service: bool) -> (pod: KubePodService) - -# ReplayKube recreates a pod and its containers based on a Kubernetes v1 Pod description (in YAML) -# like that created by GenerateKube. See also [GenerateKube](GenerateKube). -# method ReplayKube() -> (notimplemented: NotImplemented) - -# ContainerConfig returns a container's config in string form. This call is for -# development of Podman only and generally should not be used. -method ContainerConfig(name: string) -> (config: string) - -# ContainerArtifacts returns a container's artifacts in string form. This call is for -# development of Podman only and generally should not be used. -method ContainerArtifacts(name: string, artifactName: string) -> (config: string) - -# ContainerInspectData returns a container's inspect data in string form. This call is for -# development of Podman only and generally should not be used. -method ContainerInspectData(name: string, size: bool) -> (config: string) - -# ContainerStateData returns a container's state config in string form. This call is for -# development of Podman only and generally should not be used. -method ContainerStateData(name: string) -> (config: string) - -# PodStateData returns inspectr level information of a given pod in string form. This call is for -# development of Podman only and generally should not be used. -method PodStateData(name: string) -> (config: string) - -# This call is for the development of Podman only and should not be used. -method CreateFromCC(in: []string) -> (id: string) - -# Spec returns the oci spec for a container. This call is for development of Podman only and generally should not be used. -method Spec(name: string) -> (config: string) - -# Sendfile allows a remote client to send a file to the host -method SendFile(type: string, length: int) -> (file_handle: string) - -# ReceiveFile allows the host to send a remote client a file -method ReceiveFile(path: string, delete: bool) -> (len: int) - -# VolumeCreate creates a volume on a remote host -method VolumeCreate(options: VolumeCreateOpts) -> (volumeName: string) - -# VolumeRemove removes a volume on a remote host -method VolumeRemove(options: VolumeRemoveOpts) -> (successes: []string, failures: [string]string) - -# GetVolumes gets slice of the volumes on a remote host -method GetVolumes(args: []string, all: bool) -> (volumes: []Volume) - -# InspectVolume inspects a single volume. Returns inspect JSON in the form of a -# string. -method InspectVolume(name: string) -> (volume: string) - -# VolumesPrune removes unused volumes on the host -method VolumesPrune() -> (prunedNames: []string, prunedErrors: []string) - -# ImageSave allows you to save an image from the local image storage to a tarball -method ImageSave(options: ImageSaveOptions) -> (reply: MoreResponse) - -# GetPodsByContext allows you to get a list pod ids depending on all, latest, or a list of -# pod names. The definition of latest pod means the latest by creation date. In a multi- -# user environment, results might differ from what you expect. -method GetPodsByContext(all: bool, latest: bool, args: []string) -> (pods: []string) - -# LoadImage allows you to load an image into local storage from a tarball. -method LoadImage(name: string, inputFile: string, quiet: bool, deleteFile: bool) -> (reply: MoreResponse) - -# GetEvents returns known libpod events filtered by the options provided. -method GetEvents(filter: []string, since: string, until: string) -> (events: Event) - -# Diff returns a diff between libpod objects -method Diff(name: string) -> (diffs: []DiffInfo) - -# GetLayersMapWithImageInfo is for the development of Podman and should not be used. -method GetLayersMapWithImageInfo() -> (layerMap: string) - -# BuildImageHierarchyMap is for the development of Podman and should not be used. -method BuildImageHierarchyMap(name: string) -> (imageInfo: string) - -# ImageNotFound means the image could not be found by the provided name or ID in local storage. -error ImageNotFound (id: string, reason: string) - -# ContainerNotFound means the container could not be found by the provided name or ID in local storage. -error ContainerNotFound (id: string, reason: string) - -# NoContainerRunning means none of the containers requested are running in a command that requires a running container. -error NoContainerRunning () - -# PodNotFound means the pod could not be found by the provided name or ID in local storage. -error PodNotFound (name: string, reason: string) - -# VolumeNotFound means the volume could not be found by the name or ID in local storage. -error VolumeNotFound (id: string, reason: string) - -# PodContainerError means a container associated with a pod failed to perform an operation. It contains -# a container ID of the container that failed. -error PodContainerError (podname: string, errors: []PodContainerErrorData) - -# NoContainersInPod means a pod has no containers on which to perform the operation. It contains -# the pod ID. -error NoContainersInPod (name: string) - -# InvalidState indicates that a container or pod was in an improper state for the requested operation -error InvalidState (id: string, reason: string) - -# ErrorOccurred is a generic error for an error that occurs during the execution. The actual error message -# is includes as part of the error's text. -error ErrorOccurred (reason: string) - -# RuntimeErrors generally means a runtime could not be found or gotten. -error RuntimeError (reason: string) - -# The Podman endpoint requires that you use a streaming connection. -error WantsMoreRequired (reason: string) - -# Container is already stopped -error ErrCtrStopped (id: string) - -# This function requires CGroupsV2 to run in rootless mode. -error ErrRequiresCgroupsV2ForRootless(reason: string) diff --git a/iopodman/iopodman.go b/iopodman/iopodman.go deleted file mode 100644 index f9e9802..0000000 --- a/iopodman/iopodman.go +++ /dev/null @@ -1,11148 +0,0 @@ -// Code generated by github.com/varlink/go/cmd/varlink-go-interface-generator, DO NOT EDIT. - -// Podman Service Interface and API description. The master version of this document can be found -// in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in the upstream libpod repository. -package iopodman - -import ( - "context" - "encoding/json" - "fmt" - "github.com/varlink/go/varlink" -) - -// Generated type declarations - -type Volume struct { - Name string `json:"name"` - Labels map[string]string `json:"labels"` - MountPoint string `json:"mountPoint"` - Driver string `json:"driver"` - Options map[string]string `json:"options"` -} - -type NotImplemented struct { - Comment string `json:"comment"` -} - -type StringResponse struct { - Message string `json:"message"` -} - -type LogLine struct { - Device string `json:"device"` - ParseLogType string `json:"parseLogType"` - Time string `json:"time"` - Msg string `json:"msg"` - Cid string `json:"cid"` -} - -// ContainerChanges describes the return struct for ListContainerChanges -type ContainerChanges struct { - Changed []string `json:"changed"` - Added []string `json:"added"` - Deleted []string `json:"deleted"` -} - -type ImageSaveOptions struct { - Name string `json:"name"` - Format string `json:"format"` - Output string `json:"output"` - OutputType string `json:"outputType"` - MoreTags []string `json:"moreTags"` - Quiet bool `json:"quiet"` - Compress bool `json:"compress"` -} - -type VolumeCreateOpts struct { - VolumeName string `json:"volumeName"` - Driver string `json:"driver"` - Labels map[string]string `json:"labels"` - Options map[string]string `json:"options"` -} - -type VolumeRemoveOpts struct { - Volumes []string `json:"volumes"` - All bool `json:"all"` - Force bool `json:"force"` -} - -type Image struct { - Id string `json:"id"` - Digest string `json:"digest"` - Digests []string `json:"digests"` - ParentId string `json:"parentId"` - RepoTags []string `json:"repoTags"` - RepoDigests []string `json:"repoDigests"` - Created string `json:"created"` - Size int64 `json:"size"` - VirtualSize int64 `json:"virtualSize"` - Containers int64 `json:"containers"` - Labels map[string]string `json:"labels"` - IsParent bool `json:"isParent"` - TopLayer string `json:"topLayer"` - ReadOnly bool `json:"readOnly"` -} - -// ImageHistory describes the returned structure from ImageHistory. -type ImageHistory struct { - Id string `json:"id"` - Created string `json:"created"` - CreatedBy string `json:"createdBy"` - Tags []string `json:"tags"` - Size int64 `json:"size"` - Comment string `json:"comment"` -} - -// Represents a single search result from SearchImages -type ImageSearchResult struct { - Description string `json:"description"` - Is_official bool `json:"is_official"` - Is_automated bool `json:"is_automated"` - Registry string `json:"registry"` - Name string `json:"name"` - Star_count int64 `json:"star_count"` -} - -type ImageSearchFilter struct { - Is_official *bool `json:"is_official,omitempty"` - Is_automated *bool `json:"is_automated,omitempty"` - Star_count int64 `json:"star_count"` -} - -type KubePodService struct { - Pod string `json:"pod"` - Service string `json:"service"` -} - -type Container struct { - Id string `json:"id"` - Image string `json:"image"` - Imageid string `json:"imageid"` - Command []string `json:"command"` - Createdat string `json:"createdat"` - Runningfor string `json:"runningfor"` - Status string `json:"status"` - Ports []ContainerPortMappings `json:"ports"` - Rootfssize int64 `json:"rootfssize"` - Rwsize int64 `json:"rwsize"` - Names string `json:"names"` - Labels map[string]string `json:"labels"` - Mounts []ContainerMount `json:"mounts"` - Containerrunning bool `json:"containerrunning"` - Namespaces ContainerNameSpace `json:"namespaces"` -} - -// ContainerStats is the return struct for the stats of a container -type ContainerStats struct { - Id string `json:"id"` - Name string `json:"name"` - Cpu float64 `json:"cpu"` - Cpu_nano int64 `json:"cpu_nano"` - System_nano int64 `json:"system_nano"` - Mem_usage int64 `json:"mem_usage"` - Mem_limit int64 `json:"mem_limit"` - Mem_perc float64 `json:"mem_perc"` - Net_input int64 `json:"net_input"` - Net_output int64 `json:"net_output"` - Block_output int64 `json:"block_output"` - Block_input int64 `json:"block_input"` - Pids int64 `json:"pids"` -} - -type PsOpts struct { - All bool `json:"all"` - Filters *[]string `json:"filters,omitempty"` - Last *int64 `json:"last,omitempty"` - Latest *bool `json:"latest,omitempty"` - NoTrunc *bool `json:"noTrunc,omitempty"` - Pod *bool `json:"pod,omitempty"` - Quiet *bool `json:"quiet,omitempty"` - Size *bool `json:"size,omitempty"` - Sort *string `json:"sort,omitempty"` - Sync *bool `json:"sync,omitempty"` -} - -type PsContainer struct { - Id string `json:"id"` - Image string `json:"image"` - Command string `json:"command"` - Created string `json:"created"` - Ports string `json:"ports"` - Names string `json:"names"` - IsInfra bool `json:"isInfra"` - Status string `json:"status"` - State string `json:"state"` - PidNum int64 `json:"pidNum"` - RootFsSize int64 `json:"rootFsSize"` - RwSize int64 `json:"rwSize"` - Pod string `json:"pod"` - CreatedAt string `json:"createdAt"` - ExitedAt string `json:"exitedAt"` - StartedAt string `json:"startedAt"` - Labels map[string]string `json:"labels"` - NsPid string `json:"nsPid"` - Cgroup string `json:"cgroup"` - Ipc string `json:"ipc"` - Mnt string `json:"mnt"` - Net string `json:"net"` - PidNs string `json:"pidNs"` - User string `json:"user"` - Uts string `json:"uts"` - Mounts string `json:"mounts"` -} - -// ContainerMount describes the struct for mounts in a container -type ContainerMount struct { - Destination string `json:"destination"` - Type string `json:"type"` - Source string `json:"source"` - Options []string `json:"options"` -} - -// ContainerPortMappings describes the struct for portmappings in an existing container -type ContainerPortMappings struct { - Host_port string `json:"host_port"` - Host_ip string `json:"host_ip"` - Protocol string `json:"protocol"` - Container_port string `json:"container_port"` -} - -// ContainerNamespace describes the namespace structure for an existing container -type ContainerNameSpace struct { - User string `json:"user"` - Uts string `json:"uts"` - Pidns string `json:"pidns"` - Pid string `json:"pid"` - Cgroup string `json:"cgroup"` - Net string `json:"net"` - Mnt string `json:"mnt"` - Ipc string `json:"ipc"` -} - -// InfoDistribution describes the host's distribution -type InfoDistribution struct { - Distribution string `json:"distribution"` - Version string `json:"version"` -} - -// InfoHost describes the host stats portion of PodmanInfo -type InfoHost struct { - Buildah_version string `json:"buildah_version"` - Distribution InfoDistribution `json:"distribution"` - Mem_free int64 `json:"mem_free"` - Mem_total int64 `json:"mem_total"` - Swap_free int64 `json:"swap_free"` - Swap_total int64 `json:"swap_total"` - Arch string `json:"arch"` - Cpus int64 `json:"cpus"` - Hostname string `json:"hostname"` - Kernel string `json:"kernel"` - Os string `json:"os"` - Uptime string `json:"uptime"` - Eventlogger string `json:"eventlogger"` -} - -// InfoGraphStatus describes the detailed status of the storage driver -type InfoGraphStatus struct { - Backing_filesystem string `json:"backing_filesystem"` - Native_overlay_diff string `json:"native_overlay_diff"` - Supports_d_type string `json:"supports_d_type"` -} - -// InfoStore describes the host's storage informatoin -type InfoStore struct { - Containers int64 `json:"containers"` - Images int64 `json:"images"` - Graph_driver_name string `json:"graph_driver_name"` - Graph_driver_options string `json:"graph_driver_options"` - Graph_root string `json:"graph_root"` - Graph_status InfoGraphStatus `json:"graph_status"` - Run_root string `json:"run_root"` -} - -// InfoPodman provides details on the Podman binary -type InfoPodmanBinary struct { - Compiler string `json:"compiler"` - Go_version string `json:"go_version"` - Podman_version string `json:"podman_version"` - Git_commit string `json:"git_commit"` -} - -// PodmanInfo describes the Podman host and build -type PodmanInfo struct { - Host InfoHost `json:"host"` - Registries []string `json:"registries"` - Insecure_registries []string `json:"insecure_registries"` - Store InfoStore `json:"store"` - Podman InfoPodmanBinary `json:"podman"` -} - -// Sockets describes sockets location for a container -type Sockets struct { - Container_id string `json:"container_id"` - Io_socket string `json:"io_socket"` - Control_socket string `json:"control_socket"` -} - -// Create is an input structure for creating containers. -// args[0] is the image name or id -// args[1-] are the new commands if changed -type Create struct { - Args []string `json:"args"` - AddHost *[]string `json:"addHost,omitempty"` - Annotation *[]string `json:"annotation,omitempty"` - Attach *[]string `json:"attach,omitempty"` - BlkioWeight *string `json:"blkioWeight,omitempty"` - BlkioWeightDevice *[]string `json:"blkioWeightDevice,omitempty"` - CapAdd *[]string `json:"capAdd,omitempty"` - CapDrop *[]string `json:"capDrop,omitempty"` - CgroupParent *string `json:"cgroupParent,omitempty"` - CidFile *string `json:"cidFile,omitempty"` - ConmonPidfile *string `json:"conmonPidfile,omitempty"` - Command *[]string `json:"command,omitempty"` - CpuPeriod *int64 `json:"cpuPeriod,omitempty"` - CpuQuota *int64 `json:"cpuQuota,omitempty"` - CpuRtPeriod *int64 `json:"cpuRtPeriod,omitempty"` - CpuRtRuntime *int64 `json:"cpuRtRuntime,omitempty"` - CpuShares *int64 `json:"cpuShares,omitempty"` - Cpus *float64 `json:"cpus,omitempty"` - CpuSetCpus *string `json:"cpuSetCpus,omitempty"` - CpuSetMems *string `json:"cpuSetMems,omitempty"` - Detach *bool `json:"detach,omitempty"` - DetachKeys *string `json:"detachKeys,omitempty"` - Device *[]string `json:"device,omitempty"` - DeviceReadBps *[]string `json:"deviceReadBps,omitempty"` - DeviceReadIops *[]string `json:"deviceReadIops,omitempty"` - DeviceWriteBps *[]string `json:"deviceWriteBps,omitempty"` - DeviceWriteIops *[]string `json:"deviceWriteIops,omitempty"` - Dns *[]string `json:"dns,omitempty"` - DnsOpt *[]string `json:"dnsOpt,omitempty"` - DnsSearch *[]string `json:"dnsSearch,omitempty"` - DnsServers *[]string `json:"dnsServers,omitempty"` - Entrypoint *string `json:"entrypoint,omitempty"` - Env *[]string `json:"env,omitempty"` - EnvFile *[]string `json:"envFile,omitempty"` - Expose *[]string `json:"expose,omitempty"` - Gidmap *[]string `json:"gidmap,omitempty"` - Groupadd *[]string `json:"groupadd,omitempty"` - HealthcheckCommand *string `json:"healthcheckCommand,omitempty"` - HealthcheckInterval *string `json:"healthcheckInterval,omitempty"` - HealthcheckRetries *int64 `json:"healthcheckRetries,omitempty"` - HealthcheckStartPeriod *string `json:"healthcheckStartPeriod,omitempty"` - HealthcheckTimeout *string `json:"healthcheckTimeout,omitempty"` - Hostname *string `json:"hostname,omitempty"` - ImageVolume *string `json:"imageVolume,omitempty"` - Init *bool `json:"init,omitempty"` - InitPath *string `json:"initPath,omitempty"` - Interactive *bool `json:"interactive,omitempty"` - Ip *string `json:"ip,omitempty"` - Ipc *string `json:"ipc,omitempty"` - KernelMemory *string `json:"kernelMemory,omitempty"` - Label *[]string `json:"label,omitempty"` - LabelFile *[]string `json:"labelFile,omitempty"` - LogDriver *string `json:"logDriver,omitempty"` - LogOpt *[]string `json:"logOpt,omitempty"` - MacAddress *string `json:"macAddress,omitempty"` - Memory *string `json:"memory,omitempty"` - MemoryReservation *string `json:"memoryReservation,omitempty"` - MemorySwap *string `json:"memorySwap,omitempty"` - MemorySwappiness *int64 `json:"memorySwappiness,omitempty"` - Name *string `json:"name,omitempty"` - Net *string `json:"net,omitempty"` - Network *string `json:"network,omitempty"` - NoHosts *bool `json:"noHosts,omitempty"` - OomKillDisable *bool `json:"oomKillDisable,omitempty"` - OomScoreAdj *int64 `json:"oomScoreAdj,omitempty"` - OverrideArch *string `json:"overrideArch,omitempty"` - OverrideOS *string `json:"overrideOS,omitempty"` - Pid *string `json:"pid,omitempty"` - PidsLimit *int64 `json:"pidsLimit,omitempty"` - Pod *string `json:"pod,omitempty"` - Privileged *bool `json:"privileged,omitempty"` - Publish *[]string `json:"publish,omitempty"` - PublishAll *bool `json:"publishAll,omitempty"` - Pull *string `json:"pull,omitempty"` - Quiet *bool `json:"quiet,omitempty"` - Readonly *bool `json:"readonly,omitempty"` - Readonlytmpfs *bool `json:"readonlytmpfs,omitempty"` - Restart *string `json:"restart,omitempty"` - Rm *bool `json:"rm,omitempty"` - Rootfs *bool `json:"rootfs,omitempty"` - SecurityOpt *[]string `json:"securityOpt,omitempty"` - ShmSize *string `json:"shmSize,omitempty"` - StopSignal *string `json:"stopSignal,omitempty"` - StopTimeout *int64 `json:"stopTimeout,omitempty"` - StorageOpt *[]string `json:"storageOpt,omitempty"` - Subuidname *string `json:"subuidname,omitempty"` - Subgidname *string `json:"subgidname,omitempty"` - Sysctl *[]string `json:"sysctl,omitempty"` - Systemd *string `json:"systemd,omitempty"` - Tmpfs *[]string `json:"tmpfs,omitempty"` - Tty *bool `json:"tty,omitempty"` - Uidmap *[]string `json:"uidmap,omitempty"` - Ulimit *[]string `json:"ulimit,omitempty"` - User *string `json:"user,omitempty"` - Userns *string `json:"userns,omitempty"` - Uts *string `json:"uts,omitempty"` - Mount *[]string `json:"mount,omitempty"` - Volume *[]string `json:"volume,omitempty"` - VolumesFrom *[]string `json:"volumesFrom,omitempty"` - WorkDir *string `json:"workDir,omitempty"` -} - -// BuildOptions are are used to describe describe physical attributes of the build -type BuildOptions struct { - AddHosts []string `json:"addHosts"` - CgroupParent string `json:"cgroupParent"` - CpuPeriod int64 `json:"cpuPeriod"` - CpuQuota int64 `json:"cpuQuota"` - CpuShares int64 `json:"cpuShares"` - CpusetCpus string `json:"cpusetCpus"` - CpusetMems string `json:"cpusetMems"` - Memory int64 `json:"memory"` - MemorySwap int64 `json:"memorySwap"` - ShmSize string `json:"shmSize"` - Ulimit []string `json:"ulimit"` - Volume []string `json:"volume"` -} - -// BuildInfo is used to describe user input for building images -type BuildInfo struct { - AdditionalTags []string `json:"additionalTags"` - Annotations []string `json:"annotations"` - BuildArgs map[string]string `json:"buildArgs"` - BuildOptions BuildOptions `json:"buildOptions"` - CniConfigDir string `json:"cniConfigDir"` - CniPluginDir string `json:"cniPluginDir"` - Compression string `json:"compression"` - ContextDir string `json:"contextDir"` - DefaultsMountFilePath string `json:"defaultsMountFilePath"` - Dockerfiles []string `json:"dockerfiles"` - Err string `json:"err"` - ForceRmIntermediateCtrs bool `json:"forceRmIntermediateCtrs"` - Iidfile string `json:"iidfile"` - Label []string `json:"label"` - Layers bool `json:"layers"` - Nocache bool `json:"nocache"` - Out string `json:"out"` - Output string `json:"output"` - OutputFormat string `json:"outputFormat"` - PullPolicy string `json:"pullPolicy"` - Quiet bool `json:"quiet"` - RemoteIntermediateCtrs bool `json:"remoteIntermediateCtrs"` - ReportWriter string `json:"reportWriter"` - RuntimeArgs []string `json:"runtimeArgs"` - Squash bool `json:"squash"` -} - -// MoreResponse is a struct for when responses from varlink requires longer output -type MoreResponse struct { - Logs []string `json:"logs"` - Id string `json:"id"` -} - -// ListPodContainerInfo is a returned struct for describing containers -// in a pod. -type ListPodContainerInfo struct { - Name string `json:"name"` - Id string `json:"id"` - Status string `json:"status"` -} - -// PodCreate is an input structure for creating pods. -// It emulates options to podman pod create. The infraCommand and -// infraImage options are currently NotSupported. -type PodCreate struct { - Name string `json:"name"` - CgroupParent string `json:"cgroupParent"` - Labels map[string]string `json:"labels"` - Share []string `json:"share"` - Infra bool `json:"infra"` - InfraCommand string `json:"infraCommand"` - InfraImage string `json:"infraImage"` - Publish []string `json:"publish"` -} - -// ListPodData is the returned struct for an individual pod -type ListPodData struct { - Id string `json:"id"` - Name string `json:"name"` - Createdat string `json:"createdat"` - Cgroup string `json:"cgroup"` - Status string `json:"status"` - Labels map[string]string `json:"labels"` - Numberofcontainers string `json:"numberofcontainers"` - Containersinfo []ListPodContainerInfo `json:"containersinfo"` -} - -type PodContainerErrorData struct { - Containerid string `json:"containerid"` - Reason string `json:"reason"` -} - -// Runlabel describes the required input for container runlabel -type Runlabel struct { - Image string `json:"image"` - Authfile string `json:"authfile"` - Display bool `json:"display"` - Name string `json:"name"` - Pull bool `json:"pull"` - Label string `json:"label"` - ExtraArgs []string `json:"extraArgs"` - Opts map[string]string `json:"opts"` -} - -// Event describes a libpod struct -type Event struct { - Id string `json:"id"` - Image string `json:"image"` - Name string `json:"name"` - Status string `json:"status"` - Time string `json:"time"` - Type string `json:"type"` -} - -type DiffInfo struct { - Path string `json:"path"` - ChangeType string `json:"changeType"` -} - -type ExecOpts struct { - Name string `json:"name"` - Tty bool `json:"tty"` - Privileged bool `json:"privileged"` - Cmd []string `json:"cmd"` - User *string `json:"user,omitempty"` - Workdir *string `json:"workdir,omitempty"` - Env *[]string `json:"env,omitempty"` - DetachKeys *string `json:"detachKeys,omitempty"` -} - -// ImageNotFound means the image could not be found by the provided name or ID in local storage. -type ImageNotFound struct { - Id string `json:"id"` - Reason string `json:"reason"` -} - -func (e ImageNotFound) Error() string { - s := "io.podman.ImageNotFound" - s += fmt.Sprintf("(Id: %v, Reason: %v)", e.Id, e.Reason) - return s -} - -// ContainerNotFound means the container could not be found by the provided name or ID in local storage. -type ContainerNotFound struct { - Id string `json:"id"` - Reason string `json:"reason"` -} - -func (e ContainerNotFound) Error() string { - s := "io.podman.ContainerNotFound" - s += fmt.Sprintf("(Id: %v, Reason: %v)", e.Id, e.Reason) - return s -} - -// NoContainerRunning means none of the containers requested are running in a command that requires a running container. -type NoContainerRunning struct{} - -func (e NoContainerRunning) Error() string { - s := "io.podman.NoContainerRunning" - return s -} - -// PodNotFound means the pod could not be found by the provided name or ID in local storage. -type PodNotFound struct { - Name string `json:"name"` - Reason string `json:"reason"` -} - -func (e PodNotFound) Error() string { - s := "io.podman.PodNotFound" - s += fmt.Sprintf("(Name: %v, Reason: %v)", e.Name, e.Reason) - return s -} - -// VolumeNotFound means the volume could not be found by the name or ID in local storage. -type VolumeNotFound struct { - Id string `json:"id"` - Reason string `json:"reason"` -} - -func (e VolumeNotFound) Error() string { - s := "io.podman.VolumeNotFound" - s += fmt.Sprintf("(Id: %v, Reason: %v)", e.Id, e.Reason) - return s -} - -// PodContainerError means a container associated with a pod failed to perform an operation. It contains -// a container ID of the container that failed. -type PodContainerError struct { - Podname string `json:"podname"` - Errors []PodContainerErrorData `json:"errors"` -} - -func (e PodContainerError) Error() string { - s := "io.podman.PodContainerError" - s += fmt.Sprintf("(Podname: %v, Errors: %v)", e.Podname, e.Errors) - return s -} - -// NoContainersInPod means a pod has no containers on which to perform the operation. It contains -// the pod ID. -type NoContainersInPod struct { - Name string `json:"name"` -} - -func (e NoContainersInPod) Error() string { - s := "io.podman.NoContainersInPod" - s += fmt.Sprintf("(Name: %v)", e.Name) - return s -} - -// InvalidState indicates that a container or pod was in an improper state for the requested operation -type InvalidState struct { - Id string `json:"id"` - Reason string `json:"reason"` -} - -func (e InvalidState) Error() string { - s := "io.podman.InvalidState" - s += fmt.Sprintf("(Id: %v, Reason: %v)", e.Id, e.Reason) - return s -} - -// ErrorOccurred is a generic error for an error that occurs during the execution. The actual error message -// is includes as part of the error's text. -type ErrorOccurred struct { - Reason string `json:"reason"` -} - -func (e ErrorOccurred) Error() string { - s := "io.podman.ErrorOccurred" - s += fmt.Sprintf("(Reason: %v)", e.Reason) - return s -} - -// RuntimeErrors generally means a runtime could not be found or gotten. -type RuntimeError struct { - Reason string `json:"reason"` -} - -func (e RuntimeError) Error() string { - s := "io.podman.RuntimeError" - s += fmt.Sprintf("(Reason: %v)", e.Reason) - return s -} - -// The Podman endpoint requires that you use a streaming connection. -type WantsMoreRequired struct { - Reason string `json:"reason"` -} - -func (e WantsMoreRequired) Error() string { - s := "io.podman.WantsMoreRequired" - s += fmt.Sprintf("(Reason: %v)", e.Reason) - return s -} - -// Container is already stopped -type ErrCtrStopped struct { - Id string `json:"id"` -} - -func (e ErrCtrStopped) Error() string { - s := "io.podman.ErrCtrStopped" - s += fmt.Sprintf("(Id: %v)", e.Id) - return s -} - -// This function requires CGroupsV2 to run in rootless mode. -type ErrRequiresCgroupsV2ForRootless struct { - Reason string `json:"reason"` -} - -func (e ErrRequiresCgroupsV2ForRootless) Error() string { - s := "io.podman.ErrRequiresCgroupsV2ForRootless" - s += fmt.Sprintf("(Reason: %v)", e.Reason) - return s -} - -func Dispatch_Error(err error) error { - if e, ok := err.(*varlink.Error); ok { - switch e.Name { - case "io.podman.ImageNotFound": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param ImageNotFound - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.ContainerNotFound": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param ContainerNotFound - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.NoContainerRunning": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param NoContainerRunning - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.PodNotFound": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param PodNotFound - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.VolumeNotFound": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param VolumeNotFound - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.PodContainerError": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param PodContainerError - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.NoContainersInPod": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param NoContainersInPod - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.InvalidState": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param InvalidState - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.ErrorOccurred": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param ErrorOccurred - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.RuntimeError": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param RuntimeError - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.WantsMoreRequired": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param WantsMoreRequired - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.ErrCtrStopped": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param ErrCtrStopped - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - case "io.podman.ErrRequiresCgroupsV2ForRootless": - errorRawParameters := e.Parameters.(*json.RawMessage) - if errorRawParameters == nil { - return e - } - var param ErrRequiresCgroupsV2ForRootless - err := json.Unmarshal(*errorRawParameters, ¶m) - if err != nil { - return e - } - return ¶m - } - } - return err -} - -// Generated client method calls - -// GetVersion returns version and build information of the podman service -type GetVersion_methods struct{} - -func GetVersion() GetVersion_methods { return GetVersion_methods{} } - -func (m GetVersion_methods) Call(ctx context.Context, c *varlink.Connection) (version_out_ string, go_version_out_ string, git_commit_out_ string, built_out_ string, os_arch_out_ string, remote_api_version_out_ int64, err_ error) { - receive, err_ := m.Send(ctx, c, 0) - if err_ != nil { - return - } - version_out_, go_version_out_, git_commit_out_, built_out_, os_arch_out_, remote_api_version_out_, _, err_ = receive(ctx) - return -} - -func (m GetVersion_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64) (func(ctx context.Context) (string, string, string, string, string, int64, uint64, error), error) { - receive, err := c.Send(ctx, "io.podman.GetVersion", nil, flags) - if err != nil { - return nil, err - } - return func(context.Context) (version_out_ string, go_version_out_ string, git_commit_out_ string, built_out_ string, os_arch_out_ string, remote_api_version_out_ int64, flags uint64, err error) { - var out struct { - Version string `json:"version"` - Go_version string `json:"go_version"` - Git_commit string `json:"git_commit"` - Built string `json:"built"` - Os_arch string `json:"os_arch"` - Remote_api_version int64 `json:"remote_api_version"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - version_out_ = out.Version - go_version_out_ = out.Go_version - git_commit_out_ = out.Git_commit - built_out_ = out.Built - os_arch_out_ = out.Os_arch - remote_api_version_out_ = out.Remote_api_version - return - }, nil -} - -func (m GetVersion_methods) Upgrade(ctx context.Context, c *varlink.Connection) (func(ctx context.Context) (version_out_ string, go_version_out_ string, git_commit_out_ string, built_out_ string, os_arch_out_ string, remote_api_version_out_ int64, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - receive, err := c.Upgrade(ctx, "io.podman.GetVersion", nil) - if err != nil { - return nil, err - } - return func(context.Context) (version_out_ string, go_version_out_ string, git_commit_out_ string, built_out_ string, os_arch_out_ string, remote_api_version_out_ int64, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Version string `json:"version"` - Go_version string `json:"go_version"` - Git_commit string `json:"git_commit"` - Built string `json:"built"` - Os_arch string `json:"os_arch"` - Remote_api_version int64 `json:"remote_api_version"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - version_out_ = out.Version - go_version_out_ = out.Go_version - git_commit_out_ = out.Git_commit - built_out_ = out.Built - os_arch_out_ = out.Os_arch - remote_api_version_out_ = out.Remote_api_version - return - }, nil -} - -// GetInfo returns a [PodmanInfo](#PodmanInfo) struct that describes podman and its host such as storage stats, -// build information of Podman, and system-wide registries. -type GetInfo_methods struct{} - -func GetInfo() GetInfo_methods { return GetInfo_methods{} } - -func (m GetInfo_methods) Call(ctx context.Context, c *varlink.Connection) (info_out_ PodmanInfo, err_ error) { - receive, err_ := m.Send(ctx, c, 0) - if err_ != nil { - return - } - info_out_, _, err_ = receive(ctx) - return -} - -func (m GetInfo_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64) (func(ctx context.Context) (PodmanInfo, uint64, error), error) { - receive, err := c.Send(ctx, "io.podman.GetInfo", nil, flags) - if err != nil { - return nil, err - } - return func(context.Context) (info_out_ PodmanInfo, flags uint64, err error) { - var out struct { - Info PodmanInfo `json:"info"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - info_out_ = out.Info - return - }, nil -} - -func (m GetInfo_methods) Upgrade(ctx context.Context, c *varlink.Connection) (func(ctx context.Context) (info_out_ PodmanInfo, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - receive, err := c.Upgrade(ctx, "io.podman.GetInfo", nil) - if err != nil { - return nil, err - } - return func(context.Context) (info_out_ PodmanInfo, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Info PodmanInfo `json:"info"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - info_out_ = out.Info - return - }, nil -} - -// ListContainers returns information about all containers. -// See also [GetContainer](#GetContainer). -type ListContainers_methods struct{} - -func ListContainers() ListContainers_methods { return ListContainers_methods{} } - -func (m ListContainers_methods) Call(ctx context.Context, c *varlink.Connection) (containers_out_ []Container, err_ error) { - receive, err_ := m.Send(ctx, c, 0) - if err_ != nil { - return - } - containers_out_, _, err_ = receive(ctx) - return -} - -func (m ListContainers_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64) (func(ctx context.Context) ([]Container, uint64, error), error) { - receive, err := c.Send(ctx, "io.podman.ListContainers", nil, flags) - if err != nil { - return nil, err - } - return func(context.Context) (containers_out_ []Container, flags uint64, err error) { - var out struct { - Containers []Container `json:"containers"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - containers_out_ = []Container(out.Containers) - return - }, nil -} - -func (m ListContainers_methods) Upgrade(ctx context.Context, c *varlink.Connection) (func(ctx context.Context) (containers_out_ []Container, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - receive, err := c.Upgrade(ctx, "io.podman.ListContainers", nil) - if err != nil { - return nil, err - } - return func(context.Context) (containers_out_ []Container, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Containers []Container `json:"containers"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - containers_out_ = []Container(out.Containers) - return - }, nil -} - -type Ps_methods struct{} - -func Ps() Ps_methods { return Ps_methods{} } - -func (m Ps_methods) Call(ctx context.Context, c *varlink.Connection, opts_in_ PsOpts) (containers_out_ []PsContainer, err_ error) { - receive, err_ := m.Send(ctx, c, 0, opts_in_) - if err_ != nil { - return - } - containers_out_, _, err_ = receive(ctx) - return -} - -func (m Ps_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, opts_in_ PsOpts) (func(ctx context.Context) ([]PsContainer, uint64, error), error) { - var in struct { - Opts PsOpts `json:"opts"` - } - in.Opts = opts_in_ - receive, err := c.Send(ctx, "io.podman.Ps", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (containers_out_ []PsContainer, flags uint64, err error) { - var out struct { - Containers []PsContainer `json:"containers"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - containers_out_ = []PsContainer(out.Containers) - return - }, nil -} - -func (m Ps_methods) Upgrade(ctx context.Context, c *varlink.Connection, opts_in_ PsOpts) (func(ctx context.Context) (containers_out_ []PsContainer, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Opts PsOpts `json:"opts"` - } - in.Opts = opts_in_ - receive, err := c.Upgrade(ctx, "io.podman.Ps", in) - if err != nil { - return nil, err - } - return func(context.Context) (containers_out_ []PsContainer, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Containers []PsContainer `json:"containers"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - containers_out_ = []PsContainer(out.Containers) - return - }, nil -} - -type GetContainersByStatus_methods struct{} - -func GetContainersByStatus() GetContainersByStatus_methods { return GetContainersByStatus_methods{} } - -func (m GetContainersByStatus_methods) Call(ctx context.Context, c *varlink.Connection, status_in_ []string) (containerS_out_ []Container, err_ error) { - receive, err_ := m.Send(ctx, c, 0, status_in_) - if err_ != nil { - return - } - containerS_out_, _, err_ = receive(ctx) - return -} - -func (m GetContainersByStatus_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, status_in_ []string) (func(ctx context.Context) ([]Container, uint64, error), error) { - var in struct { - Status []string `json:"status"` - } - in.Status = []string(status_in_) - receive, err := c.Send(ctx, "io.podman.GetContainersByStatus", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (containerS_out_ []Container, flags uint64, err error) { - var out struct { - ContainerS []Container `json:"containerS"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - containerS_out_ = []Container(out.ContainerS) - return - }, nil -} - -func (m GetContainersByStatus_methods) Upgrade(ctx context.Context, c *varlink.Connection, status_in_ []string) (func(ctx context.Context) (containerS_out_ []Container, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Status []string `json:"status"` - } - in.Status = []string(status_in_) - receive, err := c.Upgrade(ctx, "io.podman.GetContainersByStatus", in) - if err != nil { - return nil, err - } - return func(context.Context) (containerS_out_ []Container, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - ContainerS []Container `json:"containerS"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - containerS_out_ = []Container(out.ContainerS) - return - }, nil -} - -type Top_methods struct{} - -func Top() Top_methods { return Top_methods{} } - -func (m Top_methods) Call(ctx context.Context, c *varlink.Connection, nameOrID_in_ string, descriptors_in_ []string) (top_out_ []string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, nameOrID_in_, descriptors_in_) - if err_ != nil { - return - } - top_out_, _, err_ = receive(ctx) - return -} - -func (m Top_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, nameOrID_in_ string, descriptors_in_ []string) (func(ctx context.Context) ([]string, uint64, error), error) { - var in struct { - NameOrID string `json:"nameOrID"` - Descriptors []string `json:"descriptors"` - } - in.NameOrID = nameOrID_in_ - in.Descriptors = []string(descriptors_in_) - receive, err := c.Send(ctx, "io.podman.Top", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (top_out_ []string, flags uint64, err error) { - var out struct { - Top []string `json:"top"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - top_out_ = []string(out.Top) - return - }, nil -} - -func (m Top_methods) Upgrade(ctx context.Context, c *varlink.Connection, nameOrID_in_ string, descriptors_in_ []string) (func(ctx context.Context) (top_out_ []string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - NameOrID string `json:"nameOrID"` - Descriptors []string `json:"descriptors"` - } - in.NameOrID = nameOrID_in_ - in.Descriptors = []string(descriptors_in_) - receive, err := c.Upgrade(ctx, "io.podman.Top", in) - if err != nil { - return nil, err - } - return func(context.Context) (top_out_ []string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Top []string `json:"top"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - top_out_ = []string(out.Top) - return - }, nil -} - -// HealthCheckRun executes defined container's healthcheck command -// and returns the container's health status. -type HealthCheckRun_methods struct{} - -func HealthCheckRun() HealthCheckRun_methods { return HealthCheckRun_methods{} } - -func (m HealthCheckRun_methods) Call(ctx context.Context, c *varlink.Connection, nameOrID_in_ string) (healthCheckStatus_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, nameOrID_in_) - if err_ != nil { - return - } - healthCheckStatus_out_, _, err_ = receive(ctx) - return -} - -func (m HealthCheckRun_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, nameOrID_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - NameOrID string `json:"nameOrID"` - } - in.NameOrID = nameOrID_in_ - receive, err := c.Send(ctx, "io.podman.HealthCheckRun", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (healthCheckStatus_out_ string, flags uint64, err error) { - var out struct { - HealthCheckStatus string `json:"healthCheckStatus"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - healthCheckStatus_out_ = out.HealthCheckStatus - return - }, nil -} - -func (m HealthCheckRun_methods) Upgrade(ctx context.Context, c *varlink.Connection, nameOrID_in_ string) (func(ctx context.Context) (healthCheckStatus_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - NameOrID string `json:"nameOrID"` - } - in.NameOrID = nameOrID_in_ - receive, err := c.Upgrade(ctx, "io.podman.HealthCheckRun", in) - if err != nil { - return nil, err - } - return func(context.Context) (healthCheckStatus_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - HealthCheckStatus string `json:"healthCheckStatus"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - healthCheckStatus_out_ = out.HealthCheckStatus - return - }, nil -} - -// GetContainer returns information about a single container. If a container -// with the given id doesn't exist, a [ContainerNotFound](#ContainerNotFound) -// error will be returned. See also [ListContainers](ListContainers) and -// [InspectContainer](#InspectContainer). -type GetContainer_methods struct{} - -func GetContainer() GetContainer_methods { return GetContainer_methods{} } - -func (m GetContainer_methods) Call(ctx context.Context, c *varlink.Connection, id_in_ string) (container_out_ Container, err_ error) { - receive, err_ := m.Send(ctx, c, 0, id_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m GetContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, id_in_ string) (func(ctx context.Context) (Container, uint64, error), error) { - var in struct { - Id string `json:"id"` - } - in.Id = id_in_ - receive, err := c.Send(ctx, "io.podman.GetContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ Container, flags uint64, err error) { - var out struct { - Container Container `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m GetContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, id_in_ string) (func(ctx context.Context) (container_out_ Container, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Id string `json:"id"` - } - in.Id = id_in_ - receive, err := c.Upgrade(ctx, "io.podman.GetContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ Container, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container Container `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// GetContainersByContext allows you to get a list of container ids depending on all, latest, or a list of -// container names. The definition of latest container means the latest by creation date. In a multi- -// user environment, results might differ from what you expect. -type GetContainersByContext_methods struct{} - -func GetContainersByContext() GetContainersByContext_methods { return GetContainersByContext_methods{} } - -func (m GetContainersByContext_methods) Call(ctx context.Context, c *varlink.Connection, all_in_ bool, latest_in_ bool, args_in_ []string) (containers_out_ []string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, all_in_, latest_in_, args_in_) - if err_ != nil { - return - } - containers_out_, _, err_ = receive(ctx) - return -} - -func (m GetContainersByContext_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, all_in_ bool, latest_in_ bool, args_in_ []string) (func(ctx context.Context) ([]string, uint64, error), error) { - var in struct { - All bool `json:"all"` - Latest bool `json:"latest"` - Args []string `json:"args"` - } - in.All = all_in_ - in.Latest = latest_in_ - in.Args = []string(args_in_) - receive, err := c.Send(ctx, "io.podman.GetContainersByContext", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (containers_out_ []string, flags uint64, err error) { - var out struct { - Containers []string `json:"containers"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - containers_out_ = []string(out.Containers) - return - }, nil -} - -func (m GetContainersByContext_methods) Upgrade(ctx context.Context, c *varlink.Connection, all_in_ bool, latest_in_ bool, args_in_ []string) (func(ctx context.Context) (containers_out_ []string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - All bool `json:"all"` - Latest bool `json:"latest"` - Args []string `json:"args"` - } - in.All = all_in_ - in.Latest = latest_in_ - in.Args = []string(args_in_) - receive, err := c.Upgrade(ctx, "io.podman.GetContainersByContext", in) - if err != nil { - return nil, err - } - return func(context.Context) (containers_out_ []string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Containers []string `json:"containers"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - containers_out_ = []string(out.Containers) - return - }, nil -} - -// CreateContainer creates a new container from an image. It uses a [Create](#Create) type for input. -type CreateContainer_methods struct{} - -func CreateContainer() CreateContainer_methods { return CreateContainer_methods{} } - -func (m CreateContainer_methods) Call(ctx context.Context, c *varlink.Connection, create_in_ Create) (container_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, create_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m CreateContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, create_in_ Create) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Create Create `json:"create"` - } - in.Create = create_in_ - receive, err := c.Send(ctx, "io.podman.CreateContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, err error) { - var out struct { - Container string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m CreateContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, create_in_ Create) (func(ctx context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Create Create `json:"create"` - } - in.Create = create_in_ - receive, err := c.Upgrade(ctx, "io.podman.CreateContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// InspectContainer data takes a name or ID of a container returns the inspection -// data in string format. You can then serialize the string into JSON. A [ContainerNotFound](#ContainerNotFound) -// error will be returned if the container cannot be found. See also [InspectImage](#InspectImage). -type InspectContainer_methods struct{} - -func InspectContainer() InspectContainer_methods { return InspectContainer_methods{} } - -func (m InspectContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (container_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m InspectContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.InspectContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, err error) { - var out struct { - Container string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m InspectContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.InspectContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// ListContainerProcesses takes a name or ID of a container and returns the processes -// running inside the container as array of strings. It will accept an array of string -// arguments that represent ps options. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -// error will be returned. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}' -// { -// "container": [ -// " UID PID PPID C STIME TTY TIME CMD", -// " 0 21220 21210 0 09:05 pts/0 00:00:00 /bin/sh", -// " 0 21232 21220 0 09:05 pts/0 00:00:00 top", -// " 0 21284 21220 0 09:05 pts/0 00:00:00 vi /etc/hosts" -// ] -// } -// ~~~ -type ListContainerProcesses_methods struct{} - -func ListContainerProcesses() ListContainerProcesses_methods { return ListContainerProcesses_methods{} } - -func (m ListContainerProcesses_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, opts_in_ []string) (container_out_ []string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, opts_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m ListContainerProcesses_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, opts_in_ []string) (func(ctx context.Context) ([]string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Opts []string `json:"opts"` - } - in.Name = name_in_ - in.Opts = []string(opts_in_) - receive, err := c.Send(ctx, "io.podman.ListContainerProcesses", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ []string, flags uint64, err error) { - var out struct { - Container []string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = []string(out.Container) - return - }, nil -} - -func (m ListContainerProcesses_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, opts_in_ []string) (func(ctx context.Context) (container_out_ []string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Opts []string `json:"opts"` - } - in.Name = name_in_ - in.Opts = []string(opts_in_) - receive, err := c.Upgrade(ctx, "io.podman.ListContainerProcesses", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ []string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container []string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = []string(out.Container) - return - }, nil -} - -// GetContainerLogs takes a name or ID of a container and returns the logs of that container. -// If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) error will be returned. -// The container logs are returned as an array of strings. GetContainerLogs will honor the streaming -// capability of varlink if the client invokes it. -type GetContainerLogs_methods struct{} - -func GetContainerLogs() GetContainerLogs_methods { return GetContainerLogs_methods{} } - -func (m GetContainerLogs_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (container_out_ []string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m GetContainerLogs_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) ([]string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.GetContainerLogs", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ []string, flags uint64, err error) { - var out struct { - Container []string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = []string(out.Container) - return - }, nil -} - -func (m GetContainerLogs_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (container_out_ []string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.GetContainerLogs", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ []string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container []string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = []string(out.Container) - return - }, nil -} - -type GetContainersLogs_methods struct{} - -func GetContainersLogs() GetContainersLogs_methods { return GetContainersLogs_methods{} } - -func (m GetContainersLogs_methods) Call(ctx context.Context, c *varlink.Connection, names_in_ []string, follow_in_ bool, latest_in_ bool, since_in_ string, tail_in_ int64, timestamps_in_ bool) (log_out_ LogLine, err_ error) { - receive, err_ := m.Send(ctx, c, 0, names_in_, follow_in_, latest_in_, since_in_, tail_in_, timestamps_in_) - if err_ != nil { - return - } - log_out_, _, err_ = receive(ctx) - return -} - -func (m GetContainersLogs_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, names_in_ []string, follow_in_ bool, latest_in_ bool, since_in_ string, tail_in_ int64, timestamps_in_ bool) (func(ctx context.Context) (LogLine, uint64, error), error) { - var in struct { - Names []string `json:"names"` - Follow bool `json:"follow"` - Latest bool `json:"latest"` - Since string `json:"since"` - Tail int64 `json:"tail"` - Timestamps bool `json:"timestamps"` - } - in.Names = []string(names_in_) - in.Follow = follow_in_ - in.Latest = latest_in_ - in.Since = since_in_ - in.Tail = tail_in_ - in.Timestamps = timestamps_in_ - receive, err := c.Send(ctx, "io.podman.GetContainersLogs", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (log_out_ LogLine, flags uint64, err error) { - var out struct { - Log LogLine `json:"log"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - log_out_ = out.Log - return - }, nil -} - -func (m GetContainersLogs_methods) Upgrade(ctx context.Context, c *varlink.Connection, names_in_ []string, follow_in_ bool, latest_in_ bool, since_in_ string, tail_in_ int64, timestamps_in_ bool) (func(ctx context.Context) (log_out_ LogLine, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Names []string `json:"names"` - Follow bool `json:"follow"` - Latest bool `json:"latest"` - Since string `json:"since"` - Tail int64 `json:"tail"` - Timestamps bool `json:"timestamps"` - } - in.Names = []string(names_in_) - in.Follow = follow_in_ - in.Latest = latest_in_ - in.Since = since_in_ - in.Tail = tail_in_ - in.Timestamps = timestamps_in_ - receive, err := c.Upgrade(ctx, "io.podman.GetContainersLogs", in) - if err != nil { - return nil, err - } - return func(context.Context) (log_out_ LogLine, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Log LogLine `json:"log"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - log_out_ = out.Log - return - }, nil -} - -// ListContainerChanges takes a name or ID of a container and returns changes between the container and -// its base image. It returns a struct of changed, deleted, and added path names. -type ListContainerChanges_methods struct{} - -func ListContainerChanges() ListContainerChanges_methods { return ListContainerChanges_methods{} } - -func (m ListContainerChanges_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (container_out_ ContainerChanges, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m ListContainerChanges_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (ContainerChanges, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.ListContainerChanges", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ ContainerChanges, flags uint64, err error) { - var out struct { - Container ContainerChanges `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m ListContainerChanges_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (container_out_ ContainerChanges, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.ListContainerChanges", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ ContainerChanges, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container ContainerChanges `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// ExportContainer creates an image from a container. It takes the name or ID of a container and a -// path representing the target tarfile. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -// error will be returned. -// The return value is the written tarfile. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.ExportContainer '{"name": "flamboyant_payne", "path": "/tmp/payne.tar" }' -// { -// "tarfile": "/tmp/payne.tar" -// } -// ~~~ -type ExportContainer_methods struct{} - -func ExportContainer() ExportContainer_methods { return ExportContainer_methods{} } - -func (m ExportContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, path_in_ string) (tarfile_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, path_in_) - if err_ != nil { - return - } - tarfile_out_, _, err_ = receive(ctx) - return -} - -func (m ExportContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, path_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Path string `json:"path"` - } - in.Name = name_in_ - in.Path = path_in_ - receive, err := c.Send(ctx, "io.podman.ExportContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (tarfile_out_ string, flags uint64, err error) { - var out struct { - Tarfile string `json:"tarfile"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - tarfile_out_ = out.Tarfile - return - }, nil -} - -func (m ExportContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, path_in_ string) (func(ctx context.Context) (tarfile_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Path string `json:"path"` - } - in.Name = name_in_ - in.Path = path_in_ - receive, err := c.Upgrade(ctx, "io.podman.ExportContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (tarfile_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Tarfile string `json:"tarfile"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - tarfile_out_ = out.Tarfile - return - }, nil -} - -// GetContainerStats takes the name or ID of a container and returns a single ContainerStats structure which -// contains attributes like memory and cpu usage. If the container cannot be found, a -// [ContainerNotFound](#ContainerNotFound) error will be returned. If the container is not running, a [NoContainerRunning](#NoContainerRunning) -// error will be returned -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.GetContainerStats '{"name": "c33e4164f384"}' -// { -// "container": { -// "block_input": 0, -// "block_output": 0, -// "cpu": 2.571123918839990154678e-08, -// "cpu_nano": 49037378, -// "id": "c33e4164f384aa9d979072a63319d66b74fd7a128be71fa68ede24f33ec6cfee", -// "mem_limit": 33080606720, -// "mem_perc": 2.166828456524753747370e-03, -// "mem_usage": 716800, -// "name": "competent_wozniak", -// "net_input": 768, -// "net_output": 5910, -// "pids": 1, -// "system_nano": 10000000 -// } -// } -// ~~~ -type GetContainerStats_methods struct{} - -func GetContainerStats() GetContainerStats_methods { return GetContainerStats_methods{} } - -func (m GetContainerStats_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (container_out_ ContainerStats, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m GetContainerStats_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (ContainerStats, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.GetContainerStats", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ ContainerStats, flags uint64, err error) { - var out struct { - Container ContainerStats `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m GetContainerStats_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (container_out_ ContainerStats, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.GetContainerStats", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ ContainerStats, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container ContainerStats `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// GetContainerStatsWithHistory takes a previous set of container statistics and uses libpod functions -// to calculate the containers statistics based on current and previous measurements. -type GetContainerStatsWithHistory_methods struct{} - -func GetContainerStatsWithHistory() GetContainerStatsWithHistory_methods { - return GetContainerStatsWithHistory_methods{} -} - -func (m GetContainerStatsWithHistory_methods) Call(ctx context.Context, c *varlink.Connection, previousStats_in_ ContainerStats) (container_out_ ContainerStats, err_ error) { - receive, err_ := m.Send(ctx, c, 0, previousStats_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m GetContainerStatsWithHistory_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, previousStats_in_ ContainerStats) (func(ctx context.Context) (ContainerStats, uint64, error), error) { - var in struct { - PreviousStats ContainerStats `json:"previousStats"` - } - in.PreviousStats = previousStats_in_ - receive, err := c.Send(ctx, "io.podman.GetContainerStatsWithHistory", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ ContainerStats, flags uint64, err error) { - var out struct { - Container ContainerStats `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m GetContainerStatsWithHistory_methods) Upgrade(ctx context.Context, c *varlink.Connection, previousStats_in_ ContainerStats) (func(ctx context.Context) (container_out_ ContainerStats, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - PreviousStats ContainerStats `json:"previousStats"` - } - in.PreviousStats = previousStats_in_ - receive, err := c.Upgrade(ctx, "io.podman.GetContainerStatsWithHistory", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ ContainerStats, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container ContainerStats `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// StartContainer starts a created or stopped container. It takes the name or ID of container. It returns -// the container ID once started. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -// error will be returned. See also [CreateContainer](#CreateContainer). -type StartContainer_methods struct{} - -func StartContainer() StartContainer_methods { return StartContainer_methods{} } - -func (m StartContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (container_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m StartContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.StartContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, err error) { - var out struct { - Container string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m StartContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.StartContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// StopContainer stops a container given a timeout. It takes the name or ID of a container as well as a -// timeout value. The timeout value the time before a forcible stop to the container is applied. It -// returns the container ID once stopped. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -// error will be returned instead. See also [KillContainer](KillContainer). -// #### Error -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}' -// { -// "container": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -// } -// ~~~ -type StopContainer_methods struct{} - -func StopContainer() StopContainer_methods { return StopContainer_methods{} } - -func (m StopContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, timeout_in_ int64) (container_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, timeout_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m StopContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, timeout_in_ int64) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Timeout int64 `json:"timeout"` - } - in.Name = name_in_ - in.Timeout = timeout_in_ - receive, err := c.Send(ctx, "io.podman.StopContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, err error) { - var out struct { - Container string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m StopContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, timeout_in_ int64) (func(ctx context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Timeout int64 `json:"timeout"` - } - in.Name = name_in_ - in.Timeout = timeout_in_ - receive, err := c.Upgrade(ctx, "io.podman.StopContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// InitContainer initializes the given container. It accepts a container name or -// ID, and will initialize the container matching that ID if possible, and error -// if not. Containers can only be initialized when they are in the Created or -// Exited states. Initialization prepares a container to be started, but does not -// start the container. It is intended to be used to debug a container's state -// prior to starting it. -type InitContainer_methods struct{} - -func InitContainer() InitContainer_methods { return InitContainer_methods{} } - -func (m InitContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (container_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m InitContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.InitContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, err error) { - var out struct { - Container string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m InitContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.InitContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// RestartContainer will restart a running container given a container name or ID and timeout value. The timeout -// value is the time before a forcible stop is used to stop the container. If the container cannot be found by -// name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise, the ID of the -// container will be returned. -type RestartContainer_methods struct{} - -func RestartContainer() RestartContainer_methods { return RestartContainer_methods{} } - -func (m RestartContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, timeout_in_ int64) (container_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, timeout_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m RestartContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, timeout_in_ int64) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Timeout int64 `json:"timeout"` - } - in.Name = name_in_ - in.Timeout = timeout_in_ - receive, err := c.Send(ctx, "io.podman.RestartContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, err error) { - var out struct { - Container string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m RestartContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, timeout_in_ int64) (func(ctx context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Timeout int64 `json:"timeout"` - } - in.Name = name_in_ - in.Timeout = timeout_in_ - receive, err := c.Upgrade(ctx, "io.podman.RestartContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// KillContainer takes the name or ID of a container as well as a signal to be applied to the container. Once the -// container has been killed, the container's ID is returned. If the container cannot be found, a -// [ContainerNotFound](#ContainerNotFound) error is returned. See also [StopContainer](StopContainer). -type KillContainer_methods struct{} - -func KillContainer() KillContainer_methods { return KillContainer_methods{} } - -func (m KillContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, signal_in_ int64) (container_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, signal_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m KillContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, signal_in_ int64) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Signal int64 `json:"signal"` - } - in.Name = name_in_ - in.Signal = signal_in_ - receive, err := c.Send(ctx, "io.podman.KillContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, err error) { - var out struct { - Container string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m KillContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, signal_in_ int64) (func(ctx context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Signal int64 `json:"signal"` - } - in.Name = name_in_ - in.Signal = signal_in_ - receive, err := c.Upgrade(ctx, "io.podman.KillContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// PauseContainer takes the name or ID of container and pauses it. If the container cannot be found, -// a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. -// See also [UnpauseContainer](#UnpauseContainer). -type PauseContainer_methods struct{} - -func PauseContainer() PauseContainer_methods { return PauseContainer_methods{} } - -func (m PauseContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (container_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m PauseContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.PauseContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, err error) { - var out struct { - Container string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m PauseContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.PauseContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// UnpauseContainer takes the name or ID of container and unpauses a paused container. If the container cannot be -// found, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. -// See also [PauseContainer](#PauseContainer). -type UnpauseContainer_methods struct{} - -func UnpauseContainer() UnpauseContainer_methods { return UnpauseContainer_methods{} } - -func (m UnpauseContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (container_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m UnpauseContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.UnpauseContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, err error) { - var out struct { - Container string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m UnpauseContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.UnpauseContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// Attach takes the name or ID of a container and sets up the ability to remotely attach to its console. The start -// bool is whether you wish to start the container in question first. -type Attach_methods struct{} - -func Attach() Attach_methods { return Attach_methods{} } - -func (m Attach_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, detachKeys_in_ string, start_in_ bool) (err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, detachKeys_in_, start_in_) - if err_ != nil { - return - } - _, err_ = receive(ctx) - return -} - -func (m Attach_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, detachKeys_in_ string, start_in_ bool) (func(ctx context.Context) (uint64, error), error) { - var in struct { - Name string `json:"name"` - DetachKeys string `json:"detachKeys"` - Start bool `json:"start"` - } - in.Name = name_in_ - in.DetachKeys = detachKeys_in_ - in.Start = start_in_ - receive, err := c.Send(ctx, "io.podman.Attach", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (flags uint64, err error) { - flags, err = receive(ctx, nil) - if err != nil { - err = Dispatch_Error(err) - return - } - return - }, nil -} - -func (m Attach_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, detachKeys_in_ string, start_in_ bool) (func(ctx context.Context) (flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - DetachKeys string `json:"detachKeys"` - Start bool `json:"start"` - } - in.Name = name_in_ - in.DetachKeys = detachKeys_in_ - in.Start = start_in_ - receive, err := c.Upgrade(ctx, "io.podman.Attach", in) - if err != nil { - return nil, err - } - return func(context.Context) (flags uint64, conn varlink.ReadWriterContext, err error) { - flags, conn, err = receive(ctx, nil) - if err != nil { - err = Dispatch_Error(err) - return - } - return - }, nil -} - -type AttachControl_methods struct{} - -func AttachControl() AttachControl_methods { return AttachControl_methods{} } - -func (m AttachControl_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - _, err_ = receive(ctx) - return -} - -func (m AttachControl_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.AttachControl", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (flags uint64, err error) { - flags, err = receive(ctx, nil) - if err != nil { - err = Dispatch_Error(err) - return - } - return - }, nil -} - -func (m AttachControl_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.AttachControl", in) - if err != nil { - return nil, err - } - return func(context.Context) (flags uint64, conn varlink.ReadWriterContext, err error) { - flags, conn, err = receive(ctx, nil) - if err != nil { - err = Dispatch_Error(err) - return - } - return - }, nil -} - -// GetAttachSockets takes the name or ID of an existing container. It returns file paths for two sockets needed -// to properly communicate with a container. The first is the actual I/O socket that the container uses. The -// second is a "control" socket where things like resizing the TTY events are sent. If the container cannot be -// found, a [ContainerNotFound](#ContainerNotFound) error will be returned. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/io.podman/io.podman.GetAttachSockets '{"name": "b7624e775431219161"}' -// { -// "sockets": { -// "container_id": "b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca", -// "control_socket": "/var/lib/containers/storage/overlay-containers/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/userdata/ctl", -// "io_socket": "/var/run/libpod/socket/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/attach" -// } -// } -// ~~~ -type GetAttachSockets_methods struct{} - -func GetAttachSockets() GetAttachSockets_methods { return GetAttachSockets_methods{} } - -func (m GetAttachSockets_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (sockets_out_ Sockets, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - sockets_out_, _, err_ = receive(ctx) - return -} - -func (m GetAttachSockets_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (Sockets, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.GetAttachSockets", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (sockets_out_ Sockets, flags uint64, err error) { - var out struct { - Sockets Sockets `json:"sockets"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - sockets_out_ = out.Sockets - return - }, nil -} - -func (m GetAttachSockets_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (sockets_out_ Sockets, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.GetAttachSockets", in) - if err != nil { - return nil, err - } - return func(context.Context) (sockets_out_ Sockets, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Sockets Sockets `json:"sockets"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - sockets_out_ = out.Sockets - return - }, nil -} - -// WaitContainer takes the name or ID of a container and waits the given interval in milliseconds until the container -// stops. Upon stopping, the return code of the container is returned. If the container container cannot be found by ID -// or name, a [ContainerNotFound](#ContainerNotFound) error is returned. -type WaitContainer_methods struct{} - -func WaitContainer() WaitContainer_methods { return WaitContainer_methods{} } - -func (m WaitContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, interval_in_ int64) (exitcode_out_ int64, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, interval_in_) - if err_ != nil { - return - } - exitcode_out_, _, err_ = receive(ctx) - return -} - -func (m WaitContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, interval_in_ int64) (func(ctx context.Context) (int64, uint64, error), error) { - var in struct { - Name string `json:"name"` - Interval int64 `json:"interval"` - } - in.Name = name_in_ - in.Interval = interval_in_ - receive, err := c.Send(ctx, "io.podman.WaitContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (exitcode_out_ int64, flags uint64, err error) { - var out struct { - Exitcode int64 `json:"exitcode"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - exitcode_out_ = out.Exitcode - return - }, nil -} - -func (m WaitContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, interval_in_ int64) (func(ctx context.Context) (exitcode_out_ int64, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Interval int64 `json:"interval"` - } - in.Name = name_in_ - in.Interval = interval_in_ - receive, err := c.Upgrade(ctx, "io.podman.WaitContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (exitcode_out_ int64, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Exitcode int64 `json:"exitcode"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - exitcode_out_ = out.Exitcode - return - }, nil -} - -// RemoveContainer requires the name or ID of a container as well as a boolean that -// indicates whether a container should be forcefully removed (e.g., by stopping it), and a boolean -// indicating whether to remove builtin volumes. Upon successful removal of the -// container, its ID is returned. If the -// container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned. -// See also [EvictContainer](EvictContainer). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.RemoveContainer '{"name": "62f4fd98cb57"}' -// { -// "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -// } -// ~~~ -type RemoveContainer_methods struct{} - -func RemoveContainer() RemoveContainer_methods { return RemoveContainer_methods{} } - -func (m RemoveContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, force_in_ bool, removeVolumes_in_ bool) (container_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, force_in_, removeVolumes_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m RemoveContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, force_in_ bool, removeVolumes_in_ bool) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - RemoveVolumes bool `json:"removeVolumes"` - } - in.Name = name_in_ - in.Force = force_in_ - in.RemoveVolumes = removeVolumes_in_ - receive, err := c.Send(ctx, "io.podman.RemoveContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, err error) { - var out struct { - Container string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m RemoveContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, force_in_ bool, removeVolumes_in_ bool) (func(ctx context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - RemoveVolumes bool `json:"removeVolumes"` - } - in.Name = name_in_ - in.Force = force_in_ - in.RemoveVolumes = removeVolumes_in_ - receive, err := c.Upgrade(ctx, "io.podman.RemoveContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// EvictContainer requires the name or ID of a container as well as a boolean that -// indicates to remove builtin volumes. Upon successful eviction of the container, -// its ID is returned. If the container cannot be found by name or ID, -// a [ContainerNotFound](#ContainerNotFound) error will be returned. -// See also [RemoveContainer](RemoveContainer). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.EvictContainer '{"name": "62f4fd98cb57"}' -// { -// "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -// } -// ~~~ -type EvictContainer_methods struct{} - -func EvictContainer() EvictContainer_methods { return EvictContainer_methods{} } - -func (m EvictContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, removeVolumes_in_ bool) (container_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, removeVolumes_in_) - if err_ != nil { - return - } - container_out_, _, err_ = receive(ctx) - return -} - -func (m EvictContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, removeVolumes_in_ bool) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - RemoveVolumes bool `json:"removeVolumes"` - } - in.Name = name_in_ - in.RemoveVolumes = removeVolumes_in_ - receive, err := c.Send(ctx, "io.podman.EvictContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, err error) { - var out struct { - Container string `json:"container"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -func (m EvictContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, removeVolumes_in_ bool) (func(ctx context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - RemoveVolumes bool `json:"removeVolumes"` - } - in.Name = name_in_ - in.RemoveVolumes = removeVolumes_in_ - receive, err := c.Upgrade(ctx, "io.podman.EvictContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (container_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Container string `json:"container"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - container_out_ = out.Container - return - }, nil -} - -// DeleteStoppedContainers will delete all containers that are not running. It will return a list the deleted -// container IDs. See also [RemoveContainer](RemoveContainer). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.DeleteStoppedContainers -// { -// "containers": [ -// "451410b931d00def8aa9b4f8084e4d4a39e5e04ea61f358cf53a5cf95afcdcee", -// "8b60f754a3e01389494a9581ade97d35c2765b6e2f19acd2d3040c82a32d1bc0", -// "cf2e99d4d3cad6073df199ed32bbe64b124f3e1aba6d78821aa8460e70d30084", -// "db901a329587312366e5ecff583d08f0875b4b79294322df67d90fc6eed08fc1" -// ] -// } -// ~~~ -type DeleteStoppedContainers_methods struct{} - -func DeleteStoppedContainers() DeleteStoppedContainers_methods { - return DeleteStoppedContainers_methods{} -} - -func (m DeleteStoppedContainers_methods) Call(ctx context.Context, c *varlink.Connection) (containers_out_ []string, err_ error) { - receive, err_ := m.Send(ctx, c, 0) - if err_ != nil { - return - } - containers_out_, _, err_ = receive(ctx) - return -} - -func (m DeleteStoppedContainers_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64) (func(ctx context.Context) ([]string, uint64, error), error) { - receive, err := c.Send(ctx, "io.podman.DeleteStoppedContainers", nil, flags) - if err != nil { - return nil, err - } - return func(context.Context) (containers_out_ []string, flags uint64, err error) { - var out struct { - Containers []string `json:"containers"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - containers_out_ = []string(out.Containers) - return - }, nil -} - -func (m DeleteStoppedContainers_methods) Upgrade(ctx context.Context, c *varlink.Connection) (func(ctx context.Context) (containers_out_ []string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - receive, err := c.Upgrade(ctx, "io.podman.DeleteStoppedContainers", nil) - if err != nil { - return nil, err - } - return func(context.Context) (containers_out_ []string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Containers []string `json:"containers"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - containers_out_ = []string(out.Containers) - return - }, nil -} - -// ListImages returns information about the images that are currently in storage. -// See also [InspectImage](#InspectImage). -type ListImages_methods struct{} - -func ListImages() ListImages_methods { return ListImages_methods{} } - -func (m ListImages_methods) Call(ctx context.Context, c *varlink.Connection) (images_out_ []Image, err_ error) { - receive, err_ := m.Send(ctx, c, 0) - if err_ != nil { - return - } - images_out_, _, err_ = receive(ctx) - return -} - -func (m ListImages_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64) (func(ctx context.Context) ([]Image, uint64, error), error) { - receive, err := c.Send(ctx, "io.podman.ListImages", nil, flags) - if err != nil { - return nil, err - } - return func(context.Context) (images_out_ []Image, flags uint64, err error) { - var out struct { - Images []Image `json:"images"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - images_out_ = []Image(out.Images) - return - }, nil -} - -func (m ListImages_methods) Upgrade(ctx context.Context, c *varlink.Connection) (func(ctx context.Context) (images_out_ []Image, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - receive, err := c.Upgrade(ctx, "io.podman.ListImages", nil) - if err != nil { - return nil, err - } - return func(context.Context) (images_out_ []Image, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Images []Image `json:"images"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - images_out_ = []Image(out.Images) - return - }, nil -} - -// GetImage returns information about a single image in storage. -// If the image caGetImage returns be found, [ImageNotFound](#ImageNotFound) will be returned. -type GetImage_methods struct{} - -func GetImage() GetImage_methods { return GetImage_methods{} } - -func (m GetImage_methods) Call(ctx context.Context, c *varlink.Connection, id_in_ string) (image_out_ Image, err_ error) { - receive, err_ := m.Send(ctx, c, 0, id_in_) - if err_ != nil { - return - } - image_out_, _, err_ = receive(ctx) - return -} - -func (m GetImage_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, id_in_ string) (func(ctx context.Context) (Image, uint64, error), error) { - var in struct { - Id string `json:"id"` - } - in.Id = id_in_ - receive, err := c.Send(ctx, "io.podman.GetImage", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ Image, flags uint64, err error) { - var out struct { - Image Image `json:"image"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -func (m GetImage_methods) Upgrade(ctx context.Context, c *varlink.Connection, id_in_ string) (func(ctx context.Context) (image_out_ Image, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Id string `json:"id"` - } - in.Id = id_in_ - receive, err := c.Upgrade(ctx, "io.podman.GetImage", in) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ Image, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Image Image `json:"image"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -// BuildImage takes a [BuildInfo](#BuildInfo) structure and builds an image. At a minimum, you must provide the -// contextDir tarball path, the 'dockerfiles' path, and 'output' option in the BuildInfo structure. The 'output' -// options is the name of the of the resulting build. It will return a [MoreResponse](#MoreResponse) structure -// that contains the build logs and resulting image ID. -// #### Example -// ~~~ -// $ sudo varlink call -m unix:///run/podman/io.podman/io.podman.BuildImage '{"build":{"contextDir":"/tmp/t/context.tar","dockerfiles":["Dockerfile"], "output":"foobar"}}' -// { -// "image": { -// "id": "", -// "logs": [ -// "STEP 1: FROM alpine\n" -// ] -// } -// } -// { -// "image": { -// "id": "", -// "logs": [ -// "STEP 2: COMMIT foobar\n" -// ] -// } -// } -// { -// "image": { -// "id": "", -// "logs": [ -// "b7b28af77ffec6054d13378df4fdf02725830086c7444d9c278af25312aa39b9\n" -// ] -// } -// } -// { -// "image": { -// "id": "b7b28af77ffec6054d13378df4fdf02725830086c7444d9c278af25312aa39b9", -// "logs": [] -// } -// } -// ~~~ -type BuildImage_methods struct{} - -func BuildImage() BuildImage_methods { return BuildImage_methods{} } - -func (m BuildImage_methods) Call(ctx context.Context, c *varlink.Connection, build_in_ BuildInfo) (image_out_ MoreResponse, err_ error) { - receive, err_ := m.Send(ctx, c, 0, build_in_) - if err_ != nil { - return - } - image_out_, _, err_ = receive(ctx) - return -} - -func (m BuildImage_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, build_in_ BuildInfo) (func(ctx context.Context) (MoreResponse, uint64, error), error) { - var in struct { - Build BuildInfo `json:"build"` - } - in.Build = build_in_ - receive, err := c.Send(ctx, "io.podman.BuildImage", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ MoreResponse, flags uint64, err error) { - var out struct { - Image MoreResponse `json:"image"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -func (m BuildImage_methods) Upgrade(ctx context.Context, c *varlink.Connection, build_in_ BuildInfo) (func(ctx context.Context) (image_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Build BuildInfo `json:"build"` - } - in.Build = build_in_ - receive, err := c.Upgrade(ctx, "io.podman.BuildImage", in) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Image MoreResponse `json:"image"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -// InspectImage takes the name or ID of an image and returns a string representation of data associated with the -// mage. You must serialize the string into JSON to use it further. An [ImageNotFound](#ImageNotFound) error will -// be returned if the image cannot be found. -type InspectImage_methods struct{} - -func InspectImage() InspectImage_methods { return InspectImage_methods{} } - -func (m InspectImage_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (image_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - image_out_, _, err_ = receive(ctx) - return -} - -func (m InspectImage_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.InspectImage", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ string, flags uint64, err error) { - var out struct { - Image string `json:"image"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -func (m InspectImage_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (image_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.InspectImage", in) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Image string `json:"image"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -// HistoryImage takes the name or ID of an image and returns information about its history and layers. The returned -// history is in the form of an array of ImageHistory structures. If the image cannot be found, an -// [ImageNotFound](#ImageNotFound) error is returned. -type HistoryImage_methods struct{} - -func HistoryImage() HistoryImage_methods { return HistoryImage_methods{} } - -func (m HistoryImage_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (history_out_ []ImageHistory, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - history_out_, _, err_ = receive(ctx) - return -} - -func (m HistoryImage_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) ([]ImageHistory, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.HistoryImage", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (history_out_ []ImageHistory, flags uint64, err error) { - var out struct { - History []ImageHistory `json:"history"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - history_out_ = []ImageHistory(out.History) - return - }, nil -} - -func (m HistoryImage_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (history_out_ []ImageHistory, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.HistoryImage", in) - if err != nil { - return nil, err - } - return func(context.Context) (history_out_ []ImageHistory, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - History []ImageHistory `json:"history"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - history_out_ = []ImageHistory(out.History) - return - }, nil -} - -// PushImage takes two input arguments: the name or ID of an image, the fully-qualified destination name of the image, -// It will return an [ImageNotFound](#ImageNotFound) error if -// the image cannot be found in local storage; otherwise it will return a [MoreResponse](#MoreResponse) -type PushImage_methods struct{} - -func PushImage() PushImage_methods { return PushImage_methods{} } - -func (m PushImage_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, tag_in_ string, compress_in_ bool, format_in_ string, removeSignatures_in_ bool, signBy_in_ string) (reply_out_ MoreResponse, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, tag_in_, compress_in_, format_in_, removeSignatures_in_, signBy_in_) - if err_ != nil { - return - } - reply_out_, _, err_ = receive(ctx) - return -} - -func (m PushImage_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, tag_in_ string, compress_in_ bool, format_in_ string, removeSignatures_in_ bool, signBy_in_ string) (func(ctx context.Context) (MoreResponse, uint64, error), error) { - var in struct { - Name string `json:"name"` - Tag string `json:"tag"` - Compress bool `json:"compress"` - Format string `json:"format"` - RemoveSignatures bool `json:"removeSignatures"` - SignBy string `json:"signBy"` - } - in.Name = name_in_ - in.Tag = tag_in_ - in.Compress = compress_in_ - in.Format = format_in_ - in.RemoveSignatures = removeSignatures_in_ - in.SignBy = signBy_in_ - receive, err := c.Send(ctx, "io.podman.PushImage", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (reply_out_ MoreResponse, flags uint64, err error) { - var out struct { - Reply MoreResponse `json:"reply"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - reply_out_ = out.Reply - return - }, nil -} - -func (m PushImage_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, tag_in_ string, compress_in_ bool, format_in_ string, removeSignatures_in_ bool, signBy_in_ string) (func(ctx context.Context) (reply_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Tag string `json:"tag"` - Compress bool `json:"compress"` - Format string `json:"format"` - RemoveSignatures bool `json:"removeSignatures"` - SignBy string `json:"signBy"` - } - in.Name = name_in_ - in.Tag = tag_in_ - in.Compress = compress_in_ - in.Format = format_in_ - in.RemoveSignatures = removeSignatures_in_ - in.SignBy = signBy_in_ - receive, err := c.Upgrade(ctx, "io.podman.PushImage", in) - if err != nil { - return nil, err - } - return func(context.Context) (reply_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Reply MoreResponse `json:"reply"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - reply_out_ = out.Reply - return - }, nil -} - -// TagImage takes the name or ID of an image in local storage as well as the desired tag name. If the image cannot -// be found, an [ImageNotFound](#ImageNotFound) error will be returned; otherwise, the ID of the image is returned on success. -type TagImage_methods struct{} - -func TagImage() TagImage_methods { return TagImage_methods{} } - -func (m TagImage_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, tagged_in_ string) (image_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, tagged_in_) - if err_ != nil { - return - } - image_out_, _, err_ = receive(ctx) - return -} - -func (m TagImage_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, tagged_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Tagged string `json:"tagged"` - } - in.Name = name_in_ - in.Tagged = tagged_in_ - receive, err := c.Send(ctx, "io.podman.TagImage", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ string, flags uint64, err error) { - var out struct { - Image string `json:"image"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -func (m TagImage_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, tagged_in_ string) (func(ctx context.Context) (image_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Tagged string `json:"tagged"` - } - in.Name = name_in_ - in.Tagged = tagged_in_ - receive, err := c.Upgrade(ctx, "io.podman.TagImage", in) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Image string `json:"image"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -// RemoveImage takes the name or ID of an image as well as a boolean that determines if containers using that image -// should be deleted. If the image cannot be found, an [ImageNotFound](#ImageNotFound) error will be returned. The -// ID of the removed image is returned when complete. See also [DeleteUnusedImages](DeleteUnusedImages). -// #### Example -// ~~~ -// varlink call -m unix:/run/podman/io.podman/io.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}' -// { -// "image": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e" -// } -// ~~~ -type RemoveImage_methods struct{} - -func RemoveImage() RemoveImage_methods { return RemoveImage_methods{} } - -func (m RemoveImage_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, force_in_ bool) (image_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, force_in_) - if err_ != nil { - return - } - image_out_, _, err_ = receive(ctx) - return -} - -func (m RemoveImage_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, force_in_ bool) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - } - in.Name = name_in_ - in.Force = force_in_ - receive, err := c.Send(ctx, "io.podman.RemoveImage", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ string, flags uint64, err error) { - var out struct { - Image string `json:"image"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -func (m RemoveImage_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, force_in_ bool) (func(ctx context.Context) (image_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - } - in.Name = name_in_ - in.Force = force_in_ - receive, err := c.Upgrade(ctx, "io.podman.RemoveImage", in) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Image string `json:"image"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -// SearchImages searches available registries for images that contain the -// contents of "query" in their name. If "limit" is given, limits the amount of -// search results per registry. -type SearchImages_methods struct{} - -func SearchImages() SearchImages_methods { return SearchImages_methods{} } - -func (m SearchImages_methods) Call(ctx context.Context, c *varlink.Connection, query_in_ string, limit_in_ *int64, filter_in_ ImageSearchFilter) (results_out_ []ImageSearchResult, err_ error) { - receive, err_ := m.Send(ctx, c, 0, query_in_, limit_in_, filter_in_) - if err_ != nil { - return - } - results_out_, _, err_ = receive(ctx) - return -} - -func (m SearchImages_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, query_in_ string, limit_in_ *int64, filter_in_ ImageSearchFilter) (func(ctx context.Context) ([]ImageSearchResult, uint64, error), error) { - var in struct { - Query string `json:"query"` - Limit *int64 `json:"limit,omitempty"` - Filter ImageSearchFilter `json:"filter"` - } - in.Query = query_in_ - in.Limit = limit_in_ - in.Filter = filter_in_ - receive, err := c.Send(ctx, "io.podman.SearchImages", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (results_out_ []ImageSearchResult, flags uint64, err error) { - var out struct { - Results []ImageSearchResult `json:"results"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - results_out_ = []ImageSearchResult(out.Results) - return - }, nil -} - -func (m SearchImages_methods) Upgrade(ctx context.Context, c *varlink.Connection, query_in_ string, limit_in_ *int64, filter_in_ ImageSearchFilter) (func(ctx context.Context) (results_out_ []ImageSearchResult, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Query string `json:"query"` - Limit *int64 `json:"limit,omitempty"` - Filter ImageSearchFilter `json:"filter"` - } - in.Query = query_in_ - in.Limit = limit_in_ - in.Filter = filter_in_ - receive, err := c.Upgrade(ctx, "io.podman.SearchImages", in) - if err != nil { - return nil, err - } - return func(context.Context) (results_out_ []ImageSearchResult, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Results []ImageSearchResult `json:"results"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - results_out_ = []ImageSearchResult(out.Results) - return - }, nil -} - -// DeleteUnusedImages deletes any images not associated with a container. The IDs of the deleted images are returned -// in a string array. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.DeleteUnusedImages -// { -// "images": [ -// "166ea6588079559c724c15223f52927f514f73dd5c5cf2ae2d143e3b2e6e9b52", -// "da86e6ba6ca197bf6bc5e9d900febd906b133eaa4750e6bed647b0fbe50ed43e", -// "3ef70f7291f47dfe2b82931a993e16f5a44a0e7a68034c3e0e086d77f5829adc", -// "59788edf1f3e78cd0ebe6ce1446e9d10788225db3dedcfd1a59f764bad2b2690" -// ] -// } -// ~~~ -type DeleteUnusedImages_methods struct{} - -func DeleteUnusedImages() DeleteUnusedImages_methods { return DeleteUnusedImages_methods{} } - -func (m DeleteUnusedImages_methods) Call(ctx context.Context, c *varlink.Connection) (images_out_ []string, err_ error) { - receive, err_ := m.Send(ctx, c, 0) - if err_ != nil { - return - } - images_out_, _, err_ = receive(ctx) - return -} - -func (m DeleteUnusedImages_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64) (func(ctx context.Context) ([]string, uint64, error), error) { - receive, err := c.Send(ctx, "io.podman.DeleteUnusedImages", nil, flags) - if err != nil { - return nil, err - } - return func(context.Context) (images_out_ []string, flags uint64, err error) { - var out struct { - Images []string `json:"images"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - images_out_ = []string(out.Images) - return - }, nil -} - -func (m DeleteUnusedImages_methods) Upgrade(ctx context.Context, c *varlink.Connection) (func(ctx context.Context) (images_out_ []string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - receive, err := c.Upgrade(ctx, "io.podman.DeleteUnusedImages", nil) - if err != nil { - return nil, err - } - return func(context.Context) (images_out_ []string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Images []string `json:"images"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - images_out_ = []string(out.Images) - return - }, nil -} - -// Commit, creates an image from an existing container. It requires the name or -// ID of the container as well as the resulting image name. Optionally, you can define an author and message -// to be added to the resulting image. You can also define changes to the resulting image for the following -// attributes: _CMD, ENTRYPOINT, ENV, EXPOSE, LABEL, ONBUILD, STOPSIGNAL, USER, VOLUME, and WORKDIR_. To pause the -// container while it is being committed, pass a _true_ bool for the pause argument. If the container cannot -// be found by the ID or name provided, a (ContainerNotFound)[#ContainerNotFound] error will be returned; otherwise, -// the resulting image's ID will be returned as a string inside a MoreResponse. -type Commit_methods struct{} - -func Commit() Commit_methods { return Commit_methods{} } - -func (m Commit_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, image_name_in_ string, changes_in_ []string, author_in_ string, message_in_ string, pause_in_ bool, manifestType_in_ string) (reply_out_ MoreResponse, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, image_name_in_, changes_in_, author_in_, message_in_, pause_in_, manifestType_in_) - if err_ != nil { - return - } - reply_out_, _, err_ = receive(ctx) - return -} - -func (m Commit_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, image_name_in_ string, changes_in_ []string, author_in_ string, message_in_ string, pause_in_ bool, manifestType_in_ string) (func(ctx context.Context) (MoreResponse, uint64, error), error) { - var in struct { - Name string `json:"name"` - Image_name string `json:"image_name"` - Changes []string `json:"changes"` - Author string `json:"author"` - Message string `json:"message"` - Pause bool `json:"pause"` - ManifestType string `json:"manifestType"` - } - in.Name = name_in_ - in.Image_name = image_name_in_ - in.Changes = []string(changes_in_) - in.Author = author_in_ - in.Message = message_in_ - in.Pause = pause_in_ - in.ManifestType = manifestType_in_ - receive, err := c.Send(ctx, "io.podman.Commit", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (reply_out_ MoreResponse, flags uint64, err error) { - var out struct { - Reply MoreResponse `json:"reply"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - reply_out_ = out.Reply - return - }, nil -} - -func (m Commit_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, image_name_in_ string, changes_in_ []string, author_in_ string, message_in_ string, pause_in_ bool, manifestType_in_ string) (func(ctx context.Context) (reply_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Image_name string `json:"image_name"` - Changes []string `json:"changes"` - Author string `json:"author"` - Message string `json:"message"` - Pause bool `json:"pause"` - ManifestType string `json:"manifestType"` - } - in.Name = name_in_ - in.Image_name = image_name_in_ - in.Changes = []string(changes_in_) - in.Author = author_in_ - in.Message = message_in_ - in.Pause = pause_in_ - in.ManifestType = manifestType_in_ - receive, err := c.Upgrade(ctx, "io.podman.Commit", in) - if err != nil { - return nil, err - } - return func(context.Context) (reply_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Reply MoreResponse `json:"reply"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - reply_out_ = out.Reply - return - }, nil -} - -// ImportImage imports an image from a source (like tarball) into local storage. The image can have additional -// descriptions added to it using the message and changes options. See also [ExportImage](ExportImage). -type ImportImage_methods struct{} - -func ImportImage() ImportImage_methods { return ImportImage_methods{} } - -func (m ImportImage_methods) Call(ctx context.Context, c *varlink.Connection, source_in_ string, reference_in_ string, message_in_ string, changes_in_ []string, delete_in_ bool) (image_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, source_in_, reference_in_, message_in_, changes_in_, delete_in_) - if err_ != nil { - return - } - image_out_, _, err_ = receive(ctx) - return -} - -func (m ImportImage_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, source_in_ string, reference_in_ string, message_in_ string, changes_in_ []string, delete_in_ bool) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Source string `json:"source"` - Reference string `json:"reference"` - Message string `json:"message"` - Changes []string `json:"changes"` - Delete bool `json:"delete"` - } - in.Source = source_in_ - in.Reference = reference_in_ - in.Message = message_in_ - in.Changes = []string(changes_in_) - in.Delete = delete_in_ - receive, err := c.Send(ctx, "io.podman.ImportImage", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ string, flags uint64, err error) { - var out struct { - Image string `json:"image"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -func (m ImportImage_methods) Upgrade(ctx context.Context, c *varlink.Connection, source_in_ string, reference_in_ string, message_in_ string, changes_in_ []string, delete_in_ bool) (func(ctx context.Context) (image_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Source string `json:"source"` - Reference string `json:"reference"` - Message string `json:"message"` - Changes []string `json:"changes"` - Delete bool `json:"delete"` - } - in.Source = source_in_ - in.Reference = reference_in_ - in.Message = message_in_ - in.Changes = []string(changes_in_) - in.Delete = delete_in_ - receive, err := c.Upgrade(ctx, "io.podman.ImportImage", in) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Image string `json:"image"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -// ExportImage takes the name or ID of an image and exports it to a destination like a tarball. There is also -// a boolean option to force compression. It also takes in a string array of tags to be able to save multiple -// tags of the same image to a tarball (each tag should be of the form :). Upon completion, the ID -// of the image is returned. If the image cannot be found in local storage, an [ImageNotFound](#ImageNotFound) -// error will be returned. See also [ImportImage](ImportImage). -type ExportImage_methods struct{} - -func ExportImage() ExportImage_methods { return ExportImage_methods{} } - -func (m ExportImage_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, destination_in_ string, compress_in_ bool, tags_in_ []string) (image_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, destination_in_, compress_in_, tags_in_) - if err_ != nil { - return - } - image_out_, _, err_ = receive(ctx) - return -} - -func (m ExportImage_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, destination_in_ string, compress_in_ bool, tags_in_ []string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Destination string `json:"destination"` - Compress bool `json:"compress"` - Tags []string `json:"tags"` - } - in.Name = name_in_ - in.Destination = destination_in_ - in.Compress = compress_in_ - in.Tags = []string(tags_in_) - receive, err := c.Send(ctx, "io.podman.ExportImage", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ string, flags uint64, err error) { - var out struct { - Image string `json:"image"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -func (m ExportImage_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, destination_in_ string, compress_in_ bool, tags_in_ []string) (func(ctx context.Context) (image_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Destination string `json:"destination"` - Compress bool `json:"compress"` - Tags []string `json:"tags"` - } - in.Name = name_in_ - in.Destination = destination_in_ - in.Compress = compress_in_ - in.Tags = []string(tags_in_) - receive, err := c.Upgrade(ctx, "io.podman.ExportImage", in) - if err != nil { - return nil, err - } - return func(context.Context) (image_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Image string `json:"image"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - image_out_ = out.Image - return - }, nil -} - -// PullImage pulls an image from a repository to local storage. After a successful pull, the image id and logs -// are returned as a [MoreResponse](#MoreResponse). This connection also will handle a WantsMores request to send -// status as it occurs. -type PullImage_methods struct{} - -func PullImage() PullImage_methods { return PullImage_methods{} } - -func (m PullImage_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (reply_out_ MoreResponse, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - reply_out_, _, err_ = receive(ctx) - return -} - -func (m PullImage_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (MoreResponse, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.PullImage", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (reply_out_ MoreResponse, flags uint64, err error) { - var out struct { - Reply MoreResponse `json:"reply"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - reply_out_ = out.Reply - return - }, nil -} - -func (m PullImage_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (reply_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.PullImage", in) - if err != nil { - return nil, err - } - return func(context.Context) (reply_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Reply MoreResponse `json:"reply"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - reply_out_ = out.Reply - return - }, nil -} - -// CreatePod creates a new empty pod. It uses a [PodCreate](#PodCreate) type for input. -// On success, the ID of the newly created pod will be returned. -// #### Example -// ~~~ -// $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"name": "test"}}' -// { -// "pod": "b05dee7bd4ccfee688099fe1588a7a898d6ddd6897de9251d4671c9b0feacb2a" -// } -// # $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"infra": true, "share": ["ipc", "net", "uts"]}}' -// { -// "pod": "d7697449a8035f613c1a8891286502aca68fff7d5d49a85279b3bda229af3b28" -// } -// ~~~ -type CreatePod_methods struct{} - -func CreatePod() CreatePod_methods { return CreatePod_methods{} } - -func (m CreatePod_methods) Call(ctx context.Context, c *varlink.Connection, create_in_ PodCreate) (pod_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, create_in_) - if err_ != nil { - return - } - pod_out_, _, err_ = receive(ctx) - return -} - -func (m CreatePod_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, create_in_ PodCreate) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Create PodCreate `json:"create"` - } - in.Create = create_in_ - receive, err := c.Send(ctx, "io.podman.CreatePod", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -func (m CreatePod_methods) Upgrade(ctx context.Context, c *varlink.Connection, create_in_ PodCreate) (func(ctx context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Create PodCreate `json:"create"` - } - in.Create = create_in_ - receive, err := c.Upgrade(ctx, "io.podman.CreatePod", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -// ListPods returns a list of pods in no particular order. They are -// returned as an array of ListPodData structs. See also [GetPod](#GetPod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.ListPods -// { -// "pods": [ -// { -// "cgroup": "machine.slice", -// "containersinfo": [ -// { -// "id": "00c130a45de0411f109f1a0cfea2e298df71db20fa939de5cab8b2160a36be45", -// "name": "1840835294cf-infra", -// "status": "running" -// }, -// { -// "id": "49a5cce72093a5ca47c6de86f10ad7bb36391e2d89cef765f807e460865a0ec6", -// "name": "upbeat_murdock", -// "status": "running" -// } -// ], -// "createdat": "2018-12-07 13:10:15.014139258 -0600 CST", -// "id": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f", -// "name": "foobar", -// "numberofcontainers": "2", -// "status": "Running" -// }, -// { -// "cgroup": "machine.slice", -// "containersinfo": [ -// { -// "id": "1ca4b7bbba14a75ba00072d4b705c77f3df87db0109afaa44d50cb37c04a477e", -// "name": "784306f655c6-infra", -// "status": "running" -// } -// ], -// "createdat": "2018-12-07 13:09:57.105112457 -0600 CST", -// "id": "784306f655c6200aea321dd430ba685e9b2cc1f7d7528a72f3ff74ffb29485a2", -// "name": "nostalgic_pike", -// "numberofcontainers": "1", -// "status": "Running" -// } -// ] -// } -// ~~~ -type ListPods_methods struct{} - -func ListPods() ListPods_methods { return ListPods_methods{} } - -func (m ListPods_methods) Call(ctx context.Context, c *varlink.Connection) (pods_out_ []ListPodData, err_ error) { - receive, err_ := m.Send(ctx, c, 0) - if err_ != nil { - return - } - pods_out_, _, err_ = receive(ctx) - return -} - -func (m ListPods_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64) (func(ctx context.Context) ([]ListPodData, uint64, error), error) { - receive, err := c.Send(ctx, "io.podman.ListPods", nil, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pods_out_ []ListPodData, flags uint64, err error) { - var out struct { - Pods []ListPodData `json:"pods"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pods_out_ = []ListPodData(out.Pods) - return - }, nil -} - -func (m ListPods_methods) Upgrade(ctx context.Context, c *varlink.Connection) (func(ctx context.Context) (pods_out_ []ListPodData, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - receive, err := c.Upgrade(ctx, "io.podman.ListPods", nil) - if err != nil { - return nil, err - } - return func(context.Context) (pods_out_ []ListPodData, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pods []ListPodData `json:"pods"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pods_out_ = []ListPodData(out.Pods) - return - }, nil -} - -// GetPod takes a name or ID of a pod and returns single [ListPodData](#ListPodData) -// structure. A [PodNotFound](#PodNotFound) error will be returned if the pod cannot be found. -// See also [ListPods](ListPods). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.GetPod '{"name": "foobar"}' -// { -// "pod": { -// "cgroup": "machine.slice", -// "containersinfo": [ -// { -// "id": "00c130a45de0411f109f1a0cfea2e298df71db20fa939de5cab8b2160a36be45", -// "name": "1840835294cf-infra", -// "status": "running" -// }, -// { -// "id": "49a5cce72093a5ca47c6de86f10ad7bb36391e2d89cef765f807e460865a0ec6", -// "name": "upbeat_murdock", -// "status": "running" -// } -// ], -// "createdat": "2018-12-07 13:10:15.014139258 -0600 CST", -// "id": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f", -// "name": "foobar", -// "numberofcontainers": "2", -// "status": "Running" -// } -// } -// ~~~ -type GetPod_methods struct{} - -func GetPod() GetPod_methods { return GetPod_methods{} } - -func (m GetPod_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (pod_out_ ListPodData, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - pod_out_, _, err_ = receive(ctx) - return -} - -func (m GetPod_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (ListPodData, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.GetPod", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ ListPodData, flags uint64, err error) { - var out struct { - Pod ListPodData `json:"pod"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -func (m GetPod_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (pod_out_ ListPodData, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.GetPod", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ ListPodData, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod ListPodData `json:"pod"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -// InspectPod takes the name or ID of an image and returns a string representation of data associated with the -// pod. You must serialize the string into JSON to use it further. A [PodNotFound](#PodNotFound) error will -// be returned if the pod cannot be found. -type InspectPod_methods struct{} - -func InspectPod() InspectPod_methods { return InspectPod_methods{} } - -func (m InspectPod_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (pod_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - pod_out_, _, err_ = receive(ctx) - return -} - -func (m InspectPod_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.InspectPod", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -func (m InspectPod_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.InspectPod", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -// StartPod starts containers in a pod. It takes the name or ID of pod. If the pod cannot be found, a [PodNotFound](#PodNotFound) -// error will be returned. Containers in a pod are started independently. If there is an error starting one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was started with no errors, the pod ID is returned. -// See also [CreatePod](#CreatePod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.StartPod '{"name": "135d71b9495f"}' -// { -// "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6", -// } -// ~~~ -type StartPod_methods struct{} - -func StartPod() StartPod_methods { return StartPod_methods{} } - -func (m StartPod_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (pod_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - pod_out_, _, err_ = receive(ctx) - return -} - -func (m StartPod_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.StartPod", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -func (m StartPod_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.StartPod", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -// StopPod stops containers in a pod. It takes the name or ID of a pod and a timeout. -// If the pod cannot be found, a [PodNotFound](#PodNotFound) error will be returned instead. -// Containers in a pod are stopped independently. If there is an error stopping one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was stopped with no errors, the pod ID is returned. -// See also [KillPod](KillPod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.StopPod '{"name": "135d71b9495f"}' -// { -// "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -// } -// ~~~ -type StopPod_methods struct{} - -func StopPod() StopPod_methods { return StopPod_methods{} } - -func (m StopPod_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, timeout_in_ int64) (pod_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, timeout_in_) - if err_ != nil { - return - } - pod_out_, _, err_ = receive(ctx) - return -} - -func (m StopPod_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, timeout_in_ int64) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Timeout int64 `json:"timeout"` - } - in.Name = name_in_ - in.Timeout = timeout_in_ - receive, err := c.Send(ctx, "io.podman.StopPod", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -func (m StopPod_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, timeout_in_ int64) (func(ctx context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Timeout int64 `json:"timeout"` - } - in.Name = name_in_ - in.Timeout = timeout_in_ - receive, err := c.Upgrade(ctx, "io.podman.StopPod", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -// RestartPod will restart containers in a pod given a pod name or ID. Containers in -// the pod that are running will be stopped, then all stopped containers will be run. -// If the pod cannot be found by name or ID, a [PodNotFound](#PodNotFound) error will be returned. -// Containers in a pod are restarted independently. If there is an error restarting one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was restarted with no errors, the pod ID is returned. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.RestartPod '{"name": "135d71b9495f"}' -// { -// "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -// } -// ~~~ -type RestartPod_methods struct{} - -func RestartPod() RestartPod_methods { return RestartPod_methods{} } - -func (m RestartPod_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (pod_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - pod_out_, _, err_ = receive(ctx) - return -} - -func (m RestartPod_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.RestartPod", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -func (m RestartPod_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.RestartPod", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -// KillPod takes the name or ID of a pod as well as a signal to be applied to the pod. If the pod cannot be found, a -// [PodNotFound](#PodNotFound) error is returned. -// Containers in a pod are killed independently. If there is an error killing one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was killed with no errors, the pod ID is returned. -// See also [StopPod](StopPod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.KillPod '{"name": "foobar", "signal": 15}' -// { -// "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -// } -// ~~~ -type KillPod_methods struct{} - -func KillPod() KillPod_methods { return KillPod_methods{} } - -func (m KillPod_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, signal_in_ int64) (pod_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, signal_in_) - if err_ != nil { - return - } - pod_out_, _, err_ = receive(ctx) - return -} - -func (m KillPod_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, signal_in_ int64) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Signal int64 `json:"signal"` - } - in.Name = name_in_ - in.Signal = signal_in_ - receive, err := c.Send(ctx, "io.podman.KillPod", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -func (m KillPod_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, signal_in_ int64) (func(ctx context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Signal int64 `json:"signal"` - } - in.Name = name_in_ - in.Signal = signal_in_ - receive, err := c.Upgrade(ctx, "io.podman.KillPod", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -// PausePod takes the name or ID of a pod and pauses the running containers associated with it. If the pod cannot be found, -// a [PodNotFound](#PodNotFound) error will be returned. -// Containers in a pod are paused independently. If there is an error pausing one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was paused with no errors, the pod ID is returned. -// See also [UnpausePod](#UnpausePod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.PausePod '{"name": "foobar"}' -// { -// "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -// } -// ~~~ -type PausePod_methods struct{} - -func PausePod() PausePod_methods { return PausePod_methods{} } - -func (m PausePod_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (pod_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - pod_out_, _, err_ = receive(ctx) - return -} - -func (m PausePod_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.PausePod", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -func (m PausePod_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.PausePod", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -// UnpausePod takes the name or ID of a pod and unpauses the paused containers associated with it. If the pod cannot be -// found, a [PodNotFound](#PodNotFound) error will be returned. -// Containers in a pod are unpaused independently. If there is an error unpausing one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was unpaused with no errors, the pod ID is returned. -// See also [PausePod](#PausePod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.UnpausePod '{"name": "foobar"}' -// { -// "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -// } -// ~~~ -type UnpausePod_methods struct{} - -func UnpausePod() UnpausePod_methods { return UnpausePod_methods{} } - -func (m UnpausePod_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (pod_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - pod_out_, _, err_ = receive(ctx) - return -} - -func (m UnpausePod_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.UnpausePod", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -func (m UnpausePod_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.UnpausePod", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -// RemovePod takes the name or ID of a pod as well a boolean representing whether a running -// container in the pod can be stopped and removed. If a pod has containers associated with it, and force is not true, -// an error will occur. -// If the pod cannot be found by name or ID, a [PodNotFound](#PodNotFound) error will be returned. -// Containers in a pod are removed independently. If there is an error removing any container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was removed with no errors, the pod ID is returned. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.RemovePod '{"name": "62f4fd98cb57", "force": "true"}' -// { -// "pod": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -// } -// ~~~ -type RemovePod_methods struct{} - -func RemovePod() RemovePod_methods { return RemovePod_methods{} } - -func (m RemovePod_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, force_in_ bool) (pod_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, force_in_) - if err_ != nil { - return - } - pod_out_, _, err_ = receive(ctx) - return -} - -func (m RemovePod_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, force_in_ bool) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - } - in.Name = name_in_ - in.Force = force_in_ - receive, err := c.Send(ctx, "io.podman.RemovePod", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -func (m RemovePod_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, force_in_ bool) (func(ctx context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - } - in.Name = name_in_ - in.Force = force_in_ - receive, err := c.Upgrade(ctx, "io.podman.RemovePod", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod string `json:"pod"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -type TopPod_methods struct{} - -func TopPod() TopPod_methods { return TopPod_methods{} } - -func (m TopPod_methods) Call(ctx context.Context, c *varlink.Connection, pod_in_ string, latest_in_ bool, descriptors_in_ []string) (stats_out_ []string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, pod_in_, latest_in_, descriptors_in_) - if err_ != nil { - return - } - stats_out_, _, err_ = receive(ctx) - return -} - -func (m TopPod_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, pod_in_ string, latest_in_ bool, descriptors_in_ []string) (func(ctx context.Context) ([]string, uint64, error), error) { - var in struct { - Pod string `json:"pod"` - Latest bool `json:"latest"` - Descriptors []string `json:"descriptors"` - } - in.Pod = pod_in_ - in.Latest = latest_in_ - in.Descriptors = []string(descriptors_in_) - receive, err := c.Send(ctx, "io.podman.TopPod", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (stats_out_ []string, flags uint64, err error) { - var out struct { - Stats []string `json:"stats"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - stats_out_ = []string(out.Stats) - return - }, nil -} - -func (m TopPod_methods) Upgrade(ctx context.Context, c *varlink.Connection, pod_in_ string, latest_in_ bool, descriptors_in_ []string) (func(ctx context.Context) (stats_out_ []string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Pod string `json:"pod"` - Latest bool `json:"latest"` - Descriptors []string `json:"descriptors"` - } - in.Pod = pod_in_ - in.Latest = latest_in_ - in.Descriptors = []string(descriptors_in_) - receive, err := c.Upgrade(ctx, "io.podman.TopPod", in) - if err != nil { - return nil, err - } - return func(context.Context) (stats_out_ []string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Stats []string `json:"stats"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - stats_out_ = []string(out.Stats) - return - }, nil -} - -// GetPodStats takes the name or ID of a pod and returns a pod name and slice of ContainerStats structure which -// contains attributes like memory and cpu usage. If the pod cannot be found, a [PodNotFound](#PodNotFound) -// error will be returned. If the pod has no running containers associated with it, a [NoContainerRunning](#NoContainerRunning) -// error will be returned. -// #### Example -// ~~~ -// $ varlink call unix:/run/podman/io.podman/io.podman.GetPodStats '{"name": "7f62b508b6f12b11d8fe02e"}' -// { -// "containers": [ -// { -// "block_input": 0, -// "block_output": 0, -// "cpu": 2.833470544016107524276e-08, -// "cpu_nano": 54363072, -// "id": "a64b51f805121fe2c5a3dc5112eb61d6ed139e3d1c99110360d08b58d48e4a93", -// "mem_limit": 12276146176, -// "mem_perc": 7.974359265237864966003e-03, -// "mem_usage": 978944, -// "name": "quirky_heisenberg", -// "net_input": 866, -// "net_output": 7388, -// "pids": 1, -// "system_nano": 20000000 -// } -// ], -// "pod": "7f62b508b6f12b11d8fe02e0db4de6b9e43a7d7699b33a4fc0d574f6e82b4ebd" -// } -// ~~~ -type GetPodStats_methods struct{} - -func GetPodStats() GetPodStats_methods { return GetPodStats_methods{} } - -func (m GetPodStats_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (pod_out_ string, containers_out_ []ContainerStats, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - pod_out_, containers_out_, _, err_ = receive(ctx) - return -} - -func (m GetPodStats_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, []ContainerStats, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.GetPodStats", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, containers_out_ []ContainerStats, flags uint64, err error) { - var out struct { - Pod string `json:"pod"` - Containers []ContainerStats `json:"containers"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - containers_out_ = []ContainerStats(out.Containers) - return - }, nil -} - -func (m GetPodStats_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (pod_out_ string, containers_out_ []ContainerStats, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.GetPodStats", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ string, containers_out_ []ContainerStats, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod string `json:"pod"` - Containers []ContainerStats `json:"containers"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - containers_out_ = []ContainerStats(out.Containers) - return - }, nil -} - -// GetPodsByStatus searches for pods whose status is included in statuses -type GetPodsByStatus_methods struct{} - -func GetPodsByStatus() GetPodsByStatus_methods { return GetPodsByStatus_methods{} } - -func (m GetPodsByStatus_methods) Call(ctx context.Context, c *varlink.Connection, statuses_in_ []string) (pods_out_ []string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, statuses_in_) - if err_ != nil { - return - } - pods_out_, _, err_ = receive(ctx) - return -} - -func (m GetPodsByStatus_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, statuses_in_ []string) (func(ctx context.Context) ([]string, uint64, error), error) { - var in struct { - Statuses []string `json:"statuses"` - } - in.Statuses = []string(statuses_in_) - receive, err := c.Send(ctx, "io.podman.GetPodsByStatus", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pods_out_ []string, flags uint64, err error) { - var out struct { - Pods []string `json:"pods"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pods_out_ = []string(out.Pods) - return - }, nil -} - -func (m GetPodsByStatus_methods) Upgrade(ctx context.Context, c *varlink.Connection, statuses_in_ []string) (func(ctx context.Context) (pods_out_ []string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Statuses []string `json:"statuses"` - } - in.Statuses = []string(statuses_in_) - receive, err := c.Upgrade(ctx, "io.podman.GetPodsByStatus", in) - if err != nil { - return nil, err - } - return func(context.Context) (pods_out_ []string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pods []string `json:"pods"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pods_out_ = []string(out.Pods) - return - }, nil -} - -// ImageExists talks a full or partial image ID or name and returns an int as to whether -// the image exists in local storage. An int result of 0 means the image does exist in -// local storage; whereas 1 indicates the image does not exists in local storage. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.ImageExists '{"name": "imageddoesntexist"}' -// { -// "exists": 1 -// } -// ~~~ -type ImageExists_methods struct{} - -func ImageExists() ImageExists_methods { return ImageExists_methods{} } - -func (m ImageExists_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (exists_out_ int64, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - exists_out_, _, err_ = receive(ctx) - return -} - -func (m ImageExists_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (int64, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.ImageExists", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (exists_out_ int64, flags uint64, err error) { - var out struct { - Exists int64 `json:"exists"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - exists_out_ = out.Exists - return - }, nil -} - -func (m ImageExists_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (exists_out_ int64, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.ImageExists", in) - if err != nil { - return nil, err - } - return func(context.Context) (exists_out_ int64, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Exists int64 `json:"exists"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - exists_out_ = out.Exists - return - }, nil -} - -// ContainerExists takes a full or partial container ID or name and returns an int as to -// whether the container exists in local storage. A result of 0 means the container does -// exists; whereas a result of 1 means it could not be found. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.ContainerExists '{"name": "flamboyant_payne"}'{ -// "exists": 0 -// } -// ~~~ -type ContainerExists_methods struct{} - -func ContainerExists() ContainerExists_methods { return ContainerExists_methods{} } - -func (m ContainerExists_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (exists_out_ int64, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - exists_out_, _, err_ = receive(ctx) - return -} - -func (m ContainerExists_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (int64, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.ContainerExists", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (exists_out_ int64, flags uint64, err error) { - var out struct { - Exists int64 `json:"exists"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - exists_out_ = out.Exists - return - }, nil -} - -func (m ContainerExists_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (exists_out_ int64, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.ContainerExists", in) - if err != nil { - return nil, err - } - return func(context.Context) (exists_out_ int64, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Exists int64 `json:"exists"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - exists_out_ = out.Exists - return - }, nil -} - -// ContainerCheckPoint performs a checkpopint on a container by its name or full/partial container -// ID. On successful checkpoint, the id of the checkpointed container is returned. -type ContainerCheckpoint_methods struct{} - -func ContainerCheckpoint() ContainerCheckpoint_methods { return ContainerCheckpoint_methods{} } - -func (m ContainerCheckpoint_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, keep_in_ bool, leaveRunning_in_ bool, tcpEstablished_in_ bool) (id_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, keep_in_, leaveRunning_in_, tcpEstablished_in_) - if err_ != nil { - return - } - id_out_, _, err_ = receive(ctx) - return -} - -func (m ContainerCheckpoint_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, keep_in_ bool, leaveRunning_in_ bool, tcpEstablished_in_ bool) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Keep bool `json:"keep"` - LeaveRunning bool `json:"leaveRunning"` - TcpEstablished bool `json:"tcpEstablished"` - } - in.Name = name_in_ - in.Keep = keep_in_ - in.LeaveRunning = leaveRunning_in_ - in.TcpEstablished = tcpEstablished_in_ - receive, err := c.Send(ctx, "io.podman.ContainerCheckpoint", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (id_out_ string, flags uint64, err error) { - var out struct { - Id string `json:"id"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - id_out_ = out.Id - return - }, nil -} - -func (m ContainerCheckpoint_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, keep_in_ bool, leaveRunning_in_ bool, tcpEstablished_in_ bool) (func(ctx context.Context) (id_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Keep bool `json:"keep"` - LeaveRunning bool `json:"leaveRunning"` - TcpEstablished bool `json:"tcpEstablished"` - } - in.Name = name_in_ - in.Keep = keep_in_ - in.LeaveRunning = leaveRunning_in_ - in.TcpEstablished = tcpEstablished_in_ - receive, err := c.Upgrade(ctx, "io.podman.ContainerCheckpoint", in) - if err != nil { - return nil, err - } - return func(context.Context) (id_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Id string `json:"id"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - id_out_ = out.Id - return - }, nil -} - -// ContainerRestore restores a container that has been checkpointed. The container to be restored can -// be identified by its name or full/partial container ID. A successful restore will result in the return -// of the container's ID. -type ContainerRestore_methods struct{} - -func ContainerRestore() ContainerRestore_methods { return ContainerRestore_methods{} } - -func (m ContainerRestore_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, keep_in_ bool, tcpEstablished_in_ bool) (id_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, keep_in_, tcpEstablished_in_) - if err_ != nil { - return - } - id_out_, _, err_ = receive(ctx) - return -} - -func (m ContainerRestore_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, keep_in_ bool, tcpEstablished_in_ bool) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Keep bool `json:"keep"` - TcpEstablished bool `json:"tcpEstablished"` - } - in.Name = name_in_ - in.Keep = keep_in_ - in.TcpEstablished = tcpEstablished_in_ - receive, err := c.Send(ctx, "io.podman.ContainerRestore", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (id_out_ string, flags uint64, err error) { - var out struct { - Id string `json:"id"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - id_out_ = out.Id - return - }, nil -} - -func (m ContainerRestore_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, keep_in_ bool, tcpEstablished_in_ bool) (func(ctx context.Context) (id_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Keep bool `json:"keep"` - TcpEstablished bool `json:"tcpEstablished"` - } - in.Name = name_in_ - in.Keep = keep_in_ - in.TcpEstablished = tcpEstablished_in_ - receive, err := c.Upgrade(ctx, "io.podman.ContainerRestore", in) - if err != nil { - return nil, err - } - return func(context.Context) (id_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Id string `json:"id"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - id_out_ = out.Id - return - }, nil -} - -// ContainerRunlabel runs executes a command as described by a given container image label. -type ContainerRunlabel_methods struct{} - -func ContainerRunlabel() ContainerRunlabel_methods { return ContainerRunlabel_methods{} } - -func (m ContainerRunlabel_methods) Call(ctx context.Context, c *varlink.Connection, runlabel_in_ Runlabel) (err_ error) { - receive, err_ := m.Send(ctx, c, 0, runlabel_in_) - if err_ != nil { - return - } - _, err_ = receive(ctx) - return -} - -func (m ContainerRunlabel_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, runlabel_in_ Runlabel) (func(ctx context.Context) (uint64, error), error) { - var in struct { - Runlabel Runlabel `json:"runlabel"` - } - in.Runlabel = runlabel_in_ - receive, err := c.Send(ctx, "io.podman.ContainerRunlabel", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (flags uint64, err error) { - flags, err = receive(ctx, nil) - if err != nil { - err = Dispatch_Error(err) - return - } - return - }, nil -} - -func (m ContainerRunlabel_methods) Upgrade(ctx context.Context, c *varlink.Connection, runlabel_in_ Runlabel) (func(ctx context.Context) (flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Runlabel Runlabel `json:"runlabel"` - } - in.Runlabel = runlabel_in_ - receive, err := c.Upgrade(ctx, "io.podman.ContainerRunlabel", in) - if err != nil { - return nil, err - } - return func(context.Context) (flags uint64, conn varlink.ReadWriterContext, err error) { - flags, conn, err = receive(ctx, nil) - if err != nil { - err = Dispatch_Error(err) - return - } - return - }, nil -} - -// ExecContainer executes a command in the given container. -type ExecContainer_methods struct{} - -func ExecContainer() ExecContainer_methods { return ExecContainer_methods{} } - -func (m ExecContainer_methods) Call(ctx context.Context, c *varlink.Connection, opts_in_ ExecOpts) (err_ error) { - receive, err_ := m.Send(ctx, c, 0, opts_in_) - if err_ != nil { - return - } - _, err_ = receive(ctx) - return -} - -func (m ExecContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, opts_in_ ExecOpts) (func(ctx context.Context) (uint64, error), error) { - var in struct { - Opts ExecOpts `json:"opts"` - } - in.Opts = opts_in_ - receive, err := c.Send(ctx, "io.podman.ExecContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (flags uint64, err error) { - flags, err = receive(ctx, nil) - if err != nil { - err = Dispatch_Error(err) - return - } - return - }, nil -} - -func (m ExecContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, opts_in_ ExecOpts) (func(ctx context.Context) (flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Opts ExecOpts `json:"opts"` - } - in.Opts = opts_in_ - receive, err := c.Upgrade(ctx, "io.podman.ExecContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (flags uint64, conn varlink.ReadWriterContext, err error) { - flags, conn, err = receive(ctx, nil) - if err != nil { - err = Dispatch_Error(err) - return - } - return - }, nil -} - -// ListContainerMounts gathers all the mounted container mount points and returns them as an array -// of strings -// #### Example -// ~~~ -// $ varlink call unix:/run/podman/io.podman/io.podman.ListContainerMounts -// { -// "mounts": { -// "04e4c255269ed2545e7f8bd1395a75f7949c50c223415c00c1d54bfa20f3b3d9": "/var/lib/containers/storage/overlay/a078925828f57e20467ca31cfca8a849210d21ec7e5757332b72b6924f441c17/merged", -// "1d58c319f9e881a644a5122ff84419dccf6d138f744469281446ab243ef38924": "/var/lib/containers/storage/overlay/948fcf93f8cb932f0f03fd52e3180a58627d547192ffe3b88e0013b98ddcd0d2/merged" -// } -// } -// ~~~ -type ListContainerMounts_methods struct{} - -func ListContainerMounts() ListContainerMounts_methods { return ListContainerMounts_methods{} } - -func (m ListContainerMounts_methods) Call(ctx context.Context, c *varlink.Connection) (mounts_out_ map[string]string, err_ error) { - receive, err_ := m.Send(ctx, c, 0) - if err_ != nil { - return - } - mounts_out_, _, err_ = receive(ctx) - return -} - -func (m ListContainerMounts_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64) (func(ctx context.Context) (map[string]string, uint64, error), error) { - receive, err := c.Send(ctx, "io.podman.ListContainerMounts", nil, flags) - if err != nil { - return nil, err - } - return func(context.Context) (mounts_out_ map[string]string, flags uint64, err error) { - var out struct { - Mounts map[string]string `json:"mounts"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - mounts_out_ = map[string]string(out.Mounts) - return - }, nil -} - -func (m ListContainerMounts_methods) Upgrade(ctx context.Context, c *varlink.Connection) (func(ctx context.Context) (mounts_out_ map[string]string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - receive, err := c.Upgrade(ctx, "io.podman.ListContainerMounts", nil) - if err != nil { - return nil, err - } - return func(context.Context) (mounts_out_ map[string]string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Mounts map[string]string `json:"mounts"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - mounts_out_ = map[string]string(out.Mounts) - return - }, nil -} - -// MountContainer mounts a container by name or full/partial ID. Upon a successful mount, the destination -// mount is returned as a string. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.MountContainer '{"name": "jolly_shannon"}'{ -// "path": "/var/lib/containers/storage/overlay/419eeb04e783ea159149ced67d9fcfc15211084d65e894792a96bedfae0470ca/merged" -// } -// ~~~ -type MountContainer_methods struct{} - -func MountContainer() MountContainer_methods { return MountContainer_methods{} } - -func (m MountContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (path_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - path_out_, _, err_ = receive(ctx) - return -} - -func (m MountContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.MountContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (path_out_ string, flags uint64, err error) { - var out struct { - Path string `json:"path"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - path_out_ = out.Path - return - }, nil -} - -func (m MountContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (path_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.MountContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (path_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Path string `json:"path"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - path_out_ = out.Path - return - }, nil -} - -// UnmountContainer umounts a container by its name or full/partial container ID. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.UnmountContainer '{"name": "jolly_shannon", "force": false}' -// {} -// ~~~ -type UnmountContainer_methods struct{} - -func UnmountContainer() UnmountContainer_methods { return UnmountContainer_methods{} } - -func (m UnmountContainer_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, force_in_ bool) (err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, force_in_) - if err_ != nil { - return - } - _, err_ = receive(ctx) - return -} - -func (m UnmountContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, force_in_ bool) (func(ctx context.Context) (uint64, error), error) { - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - } - in.Name = name_in_ - in.Force = force_in_ - receive, err := c.Send(ctx, "io.podman.UnmountContainer", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (flags uint64, err error) { - flags, err = receive(ctx, nil) - if err != nil { - err = Dispatch_Error(err) - return - } - return - }, nil -} - -func (m UnmountContainer_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, force_in_ bool) (func(ctx context.Context) (flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - } - in.Name = name_in_ - in.Force = force_in_ - receive, err := c.Upgrade(ctx, "io.podman.UnmountContainer", in) - if err != nil { - return nil, err - } - return func(context.Context) (flags uint64, conn varlink.ReadWriterContext, err error) { - flags, conn, err = receive(ctx, nil) - if err != nil { - err = Dispatch_Error(err) - return - } - return - }, nil -} - -// ImagesPrune removes all unused images from the local store. Upon successful pruning, -// the IDs of the removed images are returned. -type ImagesPrune_methods struct{} - -func ImagesPrune() ImagesPrune_methods { return ImagesPrune_methods{} } - -func (m ImagesPrune_methods) Call(ctx context.Context, c *varlink.Connection, all_in_ bool) (pruned_out_ []string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, all_in_) - if err_ != nil { - return - } - pruned_out_, _, err_ = receive(ctx) - return -} - -func (m ImagesPrune_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, all_in_ bool) (func(ctx context.Context) ([]string, uint64, error), error) { - var in struct { - All bool `json:"all"` - } - in.All = all_in_ - receive, err := c.Send(ctx, "io.podman.ImagesPrune", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pruned_out_ []string, flags uint64, err error) { - var out struct { - Pruned []string `json:"pruned"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pruned_out_ = []string(out.Pruned) - return - }, nil -} - -func (m ImagesPrune_methods) Upgrade(ctx context.Context, c *varlink.Connection, all_in_ bool) (func(ctx context.Context) (pruned_out_ []string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - All bool `json:"all"` - } - in.All = all_in_ - receive, err := c.Upgrade(ctx, "io.podman.ImagesPrune", in) - if err != nil { - return nil, err - } - return func(context.Context) (pruned_out_ []string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pruned []string `json:"pruned"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pruned_out_ = []string(out.Pruned) - return - }, nil -} - -// GenerateKube generates a Kubernetes v1 Pod description of a Podman container or pod -// and its containers. The description is in YAML. See also [ReplayKube](ReplayKube). -type GenerateKube_methods struct{} - -func GenerateKube() GenerateKube_methods { return GenerateKube_methods{} } - -func (m GenerateKube_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, service_in_ bool) (pod_out_ KubePodService, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, service_in_) - if err_ != nil { - return - } - pod_out_, _, err_ = receive(ctx) - return -} - -func (m GenerateKube_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, service_in_ bool) (func(ctx context.Context) (KubePodService, uint64, error), error) { - var in struct { - Name string `json:"name"` - Service bool `json:"service"` - } - in.Name = name_in_ - in.Service = service_in_ - receive, err := c.Send(ctx, "io.podman.GenerateKube", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ KubePodService, flags uint64, err error) { - var out struct { - Pod KubePodService `json:"pod"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -func (m GenerateKube_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, service_in_ bool) (func(ctx context.Context) (pod_out_ KubePodService, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Service bool `json:"service"` - } - in.Name = name_in_ - in.Service = service_in_ - receive, err := c.Upgrade(ctx, "io.podman.GenerateKube", in) - if err != nil { - return nil, err - } - return func(context.Context) (pod_out_ KubePodService, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pod KubePodService `json:"pod"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pod_out_ = out.Pod - return - }, nil -} - -// ContainerConfig returns a container's config in string form. This call is for -// development of Podman only and generally should not be used. -type ContainerConfig_methods struct{} - -func ContainerConfig() ContainerConfig_methods { return ContainerConfig_methods{} } - -func (m ContainerConfig_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (config_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - config_out_, _, err_ = receive(ctx) - return -} - -func (m ContainerConfig_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.ContainerConfig", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, err error) { - var out struct { - Config string `json:"config"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -func (m ContainerConfig_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.ContainerConfig", in) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Config string `json:"config"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -// ContainerArtifacts returns a container's artifacts in string form. This call is for -// development of Podman only and generally should not be used. -type ContainerArtifacts_methods struct{} - -func ContainerArtifacts() ContainerArtifacts_methods { return ContainerArtifacts_methods{} } - -func (m ContainerArtifacts_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, artifactName_in_ string) (config_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, artifactName_in_) - if err_ != nil { - return - } - config_out_, _, err_ = receive(ctx) - return -} - -func (m ContainerArtifacts_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, artifactName_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - ArtifactName string `json:"artifactName"` - } - in.Name = name_in_ - in.ArtifactName = artifactName_in_ - receive, err := c.Send(ctx, "io.podman.ContainerArtifacts", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, err error) { - var out struct { - Config string `json:"config"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -func (m ContainerArtifacts_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, artifactName_in_ string) (func(ctx context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - ArtifactName string `json:"artifactName"` - } - in.Name = name_in_ - in.ArtifactName = artifactName_in_ - receive, err := c.Upgrade(ctx, "io.podman.ContainerArtifacts", in) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Config string `json:"config"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -// ContainerInspectData returns a container's inspect data in string form. This call is for -// development of Podman only and generally should not be used. -type ContainerInspectData_methods struct{} - -func ContainerInspectData() ContainerInspectData_methods { return ContainerInspectData_methods{} } - -func (m ContainerInspectData_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, size_in_ bool) (config_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, size_in_) - if err_ != nil { - return - } - config_out_, _, err_ = receive(ctx) - return -} - -func (m ContainerInspectData_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, size_in_ bool) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - Size bool `json:"size"` - } - in.Name = name_in_ - in.Size = size_in_ - receive, err := c.Send(ctx, "io.podman.ContainerInspectData", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, err error) { - var out struct { - Config string `json:"config"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -func (m ContainerInspectData_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, size_in_ bool) (func(ctx context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - Size bool `json:"size"` - } - in.Name = name_in_ - in.Size = size_in_ - receive, err := c.Upgrade(ctx, "io.podman.ContainerInspectData", in) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Config string `json:"config"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -// ContainerStateData returns a container's state config in string form. This call is for -// development of Podman only and generally should not be used. -type ContainerStateData_methods struct{} - -func ContainerStateData() ContainerStateData_methods { return ContainerStateData_methods{} } - -func (m ContainerStateData_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (config_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - config_out_, _, err_ = receive(ctx) - return -} - -func (m ContainerStateData_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.ContainerStateData", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, err error) { - var out struct { - Config string `json:"config"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -func (m ContainerStateData_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.ContainerStateData", in) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Config string `json:"config"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -// PodStateData returns inspectr level information of a given pod in string form. This call is for -// development of Podman only and generally should not be used. -type PodStateData_methods struct{} - -func PodStateData() PodStateData_methods { return PodStateData_methods{} } - -func (m PodStateData_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (config_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - config_out_, _, err_ = receive(ctx) - return -} - -func (m PodStateData_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.PodStateData", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, err error) { - var out struct { - Config string `json:"config"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -func (m PodStateData_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.PodStateData", in) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Config string `json:"config"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -// This call is for the development of Podman only and should not be used. -type CreateFromCC_methods struct{} - -func CreateFromCC() CreateFromCC_methods { return CreateFromCC_methods{} } - -func (m CreateFromCC_methods) Call(ctx context.Context, c *varlink.Connection, in_in_ []string) (id_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, in_in_) - if err_ != nil { - return - } - id_out_, _, err_ = receive(ctx) - return -} - -func (m CreateFromCC_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, in_in_ []string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - In []string `json:"in"` - } - in.In = []string(in_in_) - receive, err := c.Send(ctx, "io.podman.CreateFromCC", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (id_out_ string, flags uint64, err error) { - var out struct { - Id string `json:"id"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - id_out_ = out.Id - return - }, nil -} - -func (m CreateFromCC_methods) Upgrade(ctx context.Context, c *varlink.Connection, in_in_ []string) (func(ctx context.Context) (id_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - In []string `json:"in"` - } - in.In = []string(in_in_) - receive, err := c.Upgrade(ctx, "io.podman.CreateFromCC", in) - if err != nil { - return nil, err - } - return func(context.Context) (id_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Id string `json:"id"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - id_out_ = out.Id - return - }, nil -} - -// Spec returns the oci spec for a container. This call is for development of Podman only and generally should not be used. -type Spec_methods struct{} - -func Spec() Spec_methods { return Spec_methods{} } - -func (m Spec_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (config_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - config_out_, _, err_ = receive(ctx) - return -} - -func (m Spec_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.Spec", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, err error) { - var out struct { - Config string `json:"config"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -func (m Spec_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.Spec", in) - if err != nil { - return nil, err - } - return func(context.Context) (config_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Config string `json:"config"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - config_out_ = out.Config - return - }, nil -} - -// Sendfile allows a remote client to send a file to the host -type SendFile_methods struct{} - -func SendFile() SendFile_methods { return SendFile_methods{} } - -func (m SendFile_methods) Call(ctx context.Context, c *varlink.Connection, type_in_ string, length_in_ int64) (file_handle_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, type_in_, length_in_) - if err_ != nil { - return - } - file_handle_out_, _, err_ = receive(ctx) - return -} - -func (m SendFile_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, type_in_ string, length_in_ int64) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Type string `json:"type"` - Length int64 `json:"length"` - } - in.Type = type_in_ - in.Length = length_in_ - receive, err := c.Send(ctx, "io.podman.SendFile", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (file_handle_out_ string, flags uint64, err error) { - var out struct { - File_handle string `json:"file_handle"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - file_handle_out_ = out.File_handle - return - }, nil -} - -func (m SendFile_methods) Upgrade(ctx context.Context, c *varlink.Connection, type_in_ string, length_in_ int64) (func(ctx context.Context) (file_handle_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Type string `json:"type"` - Length int64 `json:"length"` - } - in.Type = type_in_ - in.Length = length_in_ - receive, err := c.Upgrade(ctx, "io.podman.SendFile", in) - if err != nil { - return nil, err - } - return func(context.Context) (file_handle_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - File_handle string `json:"file_handle"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - file_handle_out_ = out.File_handle - return - }, nil -} - -// ReceiveFile allows the host to send a remote client a file -type ReceiveFile_methods struct{} - -func ReceiveFile() ReceiveFile_methods { return ReceiveFile_methods{} } - -func (m ReceiveFile_methods) Call(ctx context.Context, c *varlink.Connection, path_in_ string, delete_in_ bool) (len_out_ int64, err_ error) { - receive, err_ := m.Send(ctx, c, 0, path_in_, delete_in_) - if err_ != nil { - return - } - len_out_, _, err_ = receive(ctx) - return -} - -func (m ReceiveFile_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, path_in_ string, delete_in_ bool) (func(ctx context.Context) (int64, uint64, error), error) { - var in struct { - Path string `json:"path"` - Delete bool `json:"delete"` - } - in.Path = path_in_ - in.Delete = delete_in_ - receive, err := c.Send(ctx, "io.podman.ReceiveFile", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (len_out_ int64, flags uint64, err error) { - var out struct { - Len int64 `json:"len"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - len_out_ = out.Len - return - }, nil -} - -func (m ReceiveFile_methods) Upgrade(ctx context.Context, c *varlink.Connection, path_in_ string, delete_in_ bool) (func(ctx context.Context) (len_out_ int64, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Path string `json:"path"` - Delete bool `json:"delete"` - } - in.Path = path_in_ - in.Delete = delete_in_ - receive, err := c.Upgrade(ctx, "io.podman.ReceiveFile", in) - if err != nil { - return nil, err - } - return func(context.Context) (len_out_ int64, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Len int64 `json:"len"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - len_out_ = out.Len - return - }, nil -} - -// VolumeCreate creates a volume on a remote host -type VolumeCreate_methods struct{} - -func VolumeCreate() VolumeCreate_methods { return VolumeCreate_methods{} } - -func (m VolumeCreate_methods) Call(ctx context.Context, c *varlink.Connection, options_in_ VolumeCreateOpts) (volumeName_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, options_in_) - if err_ != nil { - return - } - volumeName_out_, _, err_ = receive(ctx) - return -} - -func (m VolumeCreate_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, options_in_ VolumeCreateOpts) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Options VolumeCreateOpts `json:"options"` - } - in.Options = options_in_ - receive, err := c.Send(ctx, "io.podman.VolumeCreate", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (volumeName_out_ string, flags uint64, err error) { - var out struct { - VolumeName string `json:"volumeName"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - volumeName_out_ = out.VolumeName - return - }, nil -} - -func (m VolumeCreate_methods) Upgrade(ctx context.Context, c *varlink.Connection, options_in_ VolumeCreateOpts) (func(ctx context.Context) (volumeName_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Options VolumeCreateOpts `json:"options"` - } - in.Options = options_in_ - receive, err := c.Upgrade(ctx, "io.podman.VolumeCreate", in) - if err != nil { - return nil, err - } - return func(context.Context) (volumeName_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - VolumeName string `json:"volumeName"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - volumeName_out_ = out.VolumeName - return - }, nil -} - -// VolumeRemove removes a volume on a remote host -type VolumeRemove_methods struct{} - -func VolumeRemove() VolumeRemove_methods { return VolumeRemove_methods{} } - -func (m VolumeRemove_methods) Call(ctx context.Context, c *varlink.Connection, options_in_ VolumeRemoveOpts) (successes_out_ []string, failures_out_ map[string]string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, options_in_) - if err_ != nil { - return - } - successes_out_, failures_out_, _, err_ = receive(ctx) - return -} - -func (m VolumeRemove_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, options_in_ VolumeRemoveOpts) (func(ctx context.Context) ([]string, map[string]string, uint64, error), error) { - var in struct { - Options VolumeRemoveOpts `json:"options"` - } - in.Options = options_in_ - receive, err := c.Send(ctx, "io.podman.VolumeRemove", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (successes_out_ []string, failures_out_ map[string]string, flags uint64, err error) { - var out struct { - Successes []string `json:"successes"` - Failures map[string]string `json:"failures"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - successes_out_ = []string(out.Successes) - failures_out_ = map[string]string(out.Failures) - return - }, nil -} - -func (m VolumeRemove_methods) Upgrade(ctx context.Context, c *varlink.Connection, options_in_ VolumeRemoveOpts) (func(ctx context.Context) (successes_out_ []string, failures_out_ map[string]string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Options VolumeRemoveOpts `json:"options"` - } - in.Options = options_in_ - receive, err := c.Upgrade(ctx, "io.podman.VolumeRemove", in) - if err != nil { - return nil, err - } - return func(context.Context) (successes_out_ []string, failures_out_ map[string]string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Successes []string `json:"successes"` - Failures map[string]string `json:"failures"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - successes_out_ = []string(out.Successes) - failures_out_ = map[string]string(out.Failures) - return - }, nil -} - -// GetVolumes gets slice of the volumes on a remote host -type GetVolumes_methods struct{} - -func GetVolumes() GetVolumes_methods { return GetVolumes_methods{} } - -func (m GetVolumes_methods) Call(ctx context.Context, c *varlink.Connection, args_in_ []string, all_in_ bool) (volumes_out_ []Volume, err_ error) { - receive, err_ := m.Send(ctx, c, 0, args_in_, all_in_) - if err_ != nil { - return - } - volumes_out_, _, err_ = receive(ctx) - return -} - -func (m GetVolumes_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, args_in_ []string, all_in_ bool) (func(ctx context.Context) ([]Volume, uint64, error), error) { - var in struct { - Args []string `json:"args"` - All bool `json:"all"` - } - in.Args = []string(args_in_) - in.All = all_in_ - receive, err := c.Send(ctx, "io.podman.GetVolumes", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (volumes_out_ []Volume, flags uint64, err error) { - var out struct { - Volumes []Volume `json:"volumes"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - volumes_out_ = []Volume(out.Volumes) - return - }, nil -} - -func (m GetVolumes_methods) Upgrade(ctx context.Context, c *varlink.Connection, args_in_ []string, all_in_ bool) (func(ctx context.Context) (volumes_out_ []Volume, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Args []string `json:"args"` - All bool `json:"all"` - } - in.Args = []string(args_in_) - in.All = all_in_ - receive, err := c.Upgrade(ctx, "io.podman.GetVolumes", in) - if err != nil { - return nil, err - } - return func(context.Context) (volumes_out_ []Volume, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Volumes []Volume `json:"volumes"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - volumes_out_ = []Volume(out.Volumes) - return - }, nil -} - -// InspectVolume inspects a single volume. Returns inspect JSON in the form of a -// string. -type InspectVolume_methods struct{} - -func InspectVolume() InspectVolume_methods { return InspectVolume_methods{} } - -func (m InspectVolume_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (volume_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - volume_out_, _, err_ = receive(ctx) - return -} - -func (m InspectVolume_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.InspectVolume", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (volume_out_ string, flags uint64, err error) { - var out struct { - Volume string `json:"volume"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - volume_out_ = out.Volume - return - }, nil -} - -func (m InspectVolume_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (volume_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.InspectVolume", in) - if err != nil { - return nil, err - } - return func(context.Context) (volume_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Volume string `json:"volume"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - volume_out_ = out.Volume - return - }, nil -} - -// VolumesPrune removes unused volumes on the host -type VolumesPrune_methods struct{} - -func VolumesPrune() VolumesPrune_methods { return VolumesPrune_methods{} } - -func (m VolumesPrune_methods) Call(ctx context.Context, c *varlink.Connection) (prunedNames_out_ []string, prunedErrors_out_ []string, err_ error) { - receive, err_ := m.Send(ctx, c, 0) - if err_ != nil { - return - } - prunedNames_out_, prunedErrors_out_, _, err_ = receive(ctx) - return -} - -func (m VolumesPrune_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64) (func(ctx context.Context) ([]string, []string, uint64, error), error) { - receive, err := c.Send(ctx, "io.podman.VolumesPrune", nil, flags) - if err != nil { - return nil, err - } - return func(context.Context) (prunedNames_out_ []string, prunedErrors_out_ []string, flags uint64, err error) { - var out struct { - PrunedNames []string `json:"prunedNames"` - PrunedErrors []string `json:"prunedErrors"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - prunedNames_out_ = []string(out.PrunedNames) - prunedErrors_out_ = []string(out.PrunedErrors) - return - }, nil -} - -func (m VolumesPrune_methods) Upgrade(ctx context.Context, c *varlink.Connection) (func(ctx context.Context) (prunedNames_out_ []string, prunedErrors_out_ []string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - receive, err := c.Upgrade(ctx, "io.podman.VolumesPrune", nil) - if err != nil { - return nil, err - } - return func(context.Context) (prunedNames_out_ []string, prunedErrors_out_ []string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - PrunedNames []string `json:"prunedNames"` - PrunedErrors []string `json:"prunedErrors"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - prunedNames_out_ = []string(out.PrunedNames) - prunedErrors_out_ = []string(out.PrunedErrors) - return - }, nil -} - -// ImageSave allows you to save an image from the local image storage to a tarball -type ImageSave_methods struct{} - -func ImageSave() ImageSave_methods { return ImageSave_methods{} } - -func (m ImageSave_methods) Call(ctx context.Context, c *varlink.Connection, options_in_ ImageSaveOptions) (reply_out_ MoreResponse, err_ error) { - receive, err_ := m.Send(ctx, c, 0, options_in_) - if err_ != nil { - return - } - reply_out_, _, err_ = receive(ctx) - return -} - -func (m ImageSave_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, options_in_ ImageSaveOptions) (func(ctx context.Context) (MoreResponse, uint64, error), error) { - var in struct { - Options ImageSaveOptions `json:"options"` - } - in.Options = options_in_ - receive, err := c.Send(ctx, "io.podman.ImageSave", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (reply_out_ MoreResponse, flags uint64, err error) { - var out struct { - Reply MoreResponse `json:"reply"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - reply_out_ = out.Reply - return - }, nil -} - -func (m ImageSave_methods) Upgrade(ctx context.Context, c *varlink.Connection, options_in_ ImageSaveOptions) (func(ctx context.Context) (reply_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Options ImageSaveOptions `json:"options"` - } - in.Options = options_in_ - receive, err := c.Upgrade(ctx, "io.podman.ImageSave", in) - if err != nil { - return nil, err - } - return func(context.Context) (reply_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Reply MoreResponse `json:"reply"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - reply_out_ = out.Reply - return - }, nil -} - -// GetPodsByContext allows you to get a list pod ids depending on all, latest, or a list of -// pod names. The definition of latest pod means the latest by creation date. In a multi- -// user environment, results might differ from what you expect. -type GetPodsByContext_methods struct{} - -func GetPodsByContext() GetPodsByContext_methods { return GetPodsByContext_methods{} } - -func (m GetPodsByContext_methods) Call(ctx context.Context, c *varlink.Connection, all_in_ bool, latest_in_ bool, args_in_ []string) (pods_out_ []string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, all_in_, latest_in_, args_in_) - if err_ != nil { - return - } - pods_out_, _, err_ = receive(ctx) - return -} - -func (m GetPodsByContext_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, all_in_ bool, latest_in_ bool, args_in_ []string) (func(ctx context.Context) ([]string, uint64, error), error) { - var in struct { - All bool `json:"all"` - Latest bool `json:"latest"` - Args []string `json:"args"` - } - in.All = all_in_ - in.Latest = latest_in_ - in.Args = []string(args_in_) - receive, err := c.Send(ctx, "io.podman.GetPodsByContext", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (pods_out_ []string, flags uint64, err error) { - var out struct { - Pods []string `json:"pods"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pods_out_ = []string(out.Pods) - return - }, nil -} - -func (m GetPodsByContext_methods) Upgrade(ctx context.Context, c *varlink.Connection, all_in_ bool, latest_in_ bool, args_in_ []string) (func(ctx context.Context) (pods_out_ []string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - All bool `json:"all"` - Latest bool `json:"latest"` - Args []string `json:"args"` - } - in.All = all_in_ - in.Latest = latest_in_ - in.Args = []string(args_in_) - receive, err := c.Upgrade(ctx, "io.podman.GetPodsByContext", in) - if err != nil { - return nil, err - } - return func(context.Context) (pods_out_ []string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Pods []string `json:"pods"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - pods_out_ = []string(out.Pods) - return - }, nil -} - -// LoadImage allows you to load an image into local storage from a tarball. -type LoadImage_methods struct{} - -func LoadImage() LoadImage_methods { return LoadImage_methods{} } - -func (m LoadImage_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string, inputFile_in_ string, quiet_in_ bool, deleteFile_in_ bool) (reply_out_ MoreResponse, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_, inputFile_in_, quiet_in_, deleteFile_in_) - if err_ != nil { - return - } - reply_out_, _, err_ = receive(ctx) - return -} - -func (m LoadImage_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, inputFile_in_ string, quiet_in_ bool, deleteFile_in_ bool) (func(ctx context.Context) (MoreResponse, uint64, error), error) { - var in struct { - Name string `json:"name"` - InputFile string `json:"inputFile"` - Quiet bool `json:"quiet"` - DeleteFile bool `json:"deleteFile"` - } - in.Name = name_in_ - in.InputFile = inputFile_in_ - in.Quiet = quiet_in_ - in.DeleteFile = deleteFile_in_ - receive, err := c.Send(ctx, "io.podman.LoadImage", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (reply_out_ MoreResponse, flags uint64, err error) { - var out struct { - Reply MoreResponse `json:"reply"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - reply_out_ = out.Reply - return - }, nil -} - -func (m LoadImage_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string, inputFile_in_ string, quiet_in_ bool, deleteFile_in_ bool) (func(ctx context.Context) (reply_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - InputFile string `json:"inputFile"` - Quiet bool `json:"quiet"` - DeleteFile bool `json:"deleteFile"` - } - in.Name = name_in_ - in.InputFile = inputFile_in_ - in.Quiet = quiet_in_ - in.DeleteFile = deleteFile_in_ - receive, err := c.Upgrade(ctx, "io.podman.LoadImage", in) - if err != nil { - return nil, err - } - return func(context.Context) (reply_out_ MoreResponse, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Reply MoreResponse `json:"reply"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - reply_out_ = out.Reply - return - }, nil -} - -// GetEvents returns known libpod events filtered by the options provided. -type GetEvents_methods struct{} - -func GetEvents() GetEvents_methods { return GetEvents_methods{} } - -func (m GetEvents_methods) Call(ctx context.Context, c *varlink.Connection, filter_in_ []string, since_in_ string, until_in_ string) (events_out_ Event, err_ error) { - receive, err_ := m.Send(ctx, c, 0, filter_in_, since_in_, until_in_) - if err_ != nil { - return - } - events_out_, _, err_ = receive(ctx) - return -} - -func (m GetEvents_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, filter_in_ []string, since_in_ string, until_in_ string) (func(ctx context.Context) (Event, uint64, error), error) { - var in struct { - Filter []string `json:"filter"` - Since string `json:"since"` - Until string `json:"until"` - } - in.Filter = []string(filter_in_) - in.Since = since_in_ - in.Until = until_in_ - receive, err := c.Send(ctx, "io.podman.GetEvents", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (events_out_ Event, flags uint64, err error) { - var out struct { - Events Event `json:"events"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - events_out_ = out.Events - return - }, nil -} - -func (m GetEvents_methods) Upgrade(ctx context.Context, c *varlink.Connection, filter_in_ []string, since_in_ string, until_in_ string) (func(ctx context.Context) (events_out_ Event, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Filter []string `json:"filter"` - Since string `json:"since"` - Until string `json:"until"` - } - in.Filter = []string(filter_in_) - in.Since = since_in_ - in.Until = until_in_ - receive, err := c.Upgrade(ctx, "io.podman.GetEvents", in) - if err != nil { - return nil, err - } - return func(context.Context) (events_out_ Event, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Events Event `json:"events"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - events_out_ = out.Events - return - }, nil -} - -// Diff returns a diff between libpod objects -type Diff_methods struct{} - -func Diff() Diff_methods { return Diff_methods{} } - -func (m Diff_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (diffs_out_ []DiffInfo, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - diffs_out_, _, err_ = receive(ctx) - return -} - -func (m Diff_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) ([]DiffInfo, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.Diff", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (diffs_out_ []DiffInfo, flags uint64, err error) { - var out struct { - Diffs []DiffInfo `json:"diffs"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - diffs_out_ = []DiffInfo(out.Diffs) - return - }, nil -} - -func (m Diff_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (diffs_out_ []DiffInfo, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.Diff", in) - if err != nil { - return nil, err - } - return func(context.Context) (diffs_out_ []DiffInfo, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - Diffs []DiffInfo `json:"diffs"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - diffs_out_ = []DiffInfo(out.Diffs) - return - }, nil -} - -// GetLayersMapWithImageInfo is for the development of Podman and should not be used. -type GetLayersMapWithImageInfo_methods struct{} - -func GetLayersMapWithImageInfo() GetLayersMapWithImageInfo_methods { - return GetLayersMapWithImageInfo_methods{} -} - -func (m GetLayersMapWithImageInfo_methods) Call(ctx context.Context, c *varlink.Connection) (layerMap_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0) - if err_ != nil { - return - } - layerMap_out_, _, err_ = receive(ctx) - return -} - -func (m GetLayersMapWithImageInfo_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64) (func(ctx context.Context) (string, uint64, error), error) { - receive, err := c.Send(ctx, "io.podman.GetLayersMapWithImageInfo", nil, flags) - if err != nil { - return nil, err - } - return func(context.Context) (layerMap_out_ string, flags uint64, err error) { - var out struct { - LayerMap string `json:"layerMap"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - layerMap_out_ = out.LayerMap - return - }, nil -} - -func (m GetLayersMapWithImageInfo_methods) Upgrade(ctx context.Context, c *varlink.Connection) (func(ctx context.Context) (layerMap_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - receive, err := c.Upgrade(ctx, "io.podman.GetLayersMapWithImageInfo", nil) - if err != nil { - return nil, err - } - return func(context.Context) (layerMap_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - LayerMap string `json:"layerMap"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - layerMap_out_ = out.LayerMap - return - }, nil -} - -// BuildImageHierarchyMap is for the development of Podman and should not be used. -type BuildImageHierarchyMap_methods struct{} - -func BuildImageHierarchyMap() BuildImageHierarchyMap_methods { return BuildImageHierarchyMap_methods{} } - -func (m BuildImageHierarchyMap_methods) Call(ctx context.Context, c *varlink.Connection, name_in_ string) (imageInfo_out_ string, err_ error) { - receive, err_ := m.Send(ctx, c, 0, name_in_) - if err_ != nil { - return - } - imageInfo_out_, _, err_ = receive(ctx) - return -} - -func (m BuildImageHierarchyMap_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string) (func(ctx context.Context) (string, uint64, error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Send(ctx, "io.podman.BuildImageHierarchyMap", in, flags) - if err != nil { - return nil, err - } - return func(context.Context) (imageInfo_out_ string, flags uint64, err error) { - var out struct { - ImageInfo string `json:"imageInfo"` - } - flags, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - imageInfo_out_ = out.ImageInfo - return - }, nil -} - -func (m BuildImageHierarchyMap_methods) Upgrade(ctx context.Context, c *varlink.Connection, name_in_ string) (func(ctx context.Context) (imageInfo_out_ string, flags uint64, conn varlink.ReadWriterContext, err_ error), error) { - var in struct { - Name string `json:"name"` - } - in.Name = name_in_ - receive, err := c.Upgrade(ctx, "io.podman.BuildImageHierarchyMap", in) - if err != nil { - return nil, err - } - return func(context.Context) (imageInfo_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { - var out struct { - ImageInfo string `json:"imageInfo"` - } - flags, conn, err = receive(ctx, &out) - if err != nil { - err = Dispatch_Error(err) - return - } - imageInfo_out_ = out.ImageInfo - return - }, nil -} - -// Generated service interface with all methods - -type iopodmanInterface interface { - GetVersion(ctx context.Context, c VarlinkCall) error - GetInfo(ctx context.Context, c VarlinkCall) error - ListContainers(ctx context.Context, c VarlinkCall) error - Ps(ctx context.Context, c VarlinkCall, opts_ PsOpts) error - GetContainersByStatus(ctx context.Context, c VarlinkCall, status_ []string) error - Top(ctx context.Context, c VarlinkCall, nameOrID_ string, descriptors_ []string) error - HealthCheckRun(ctx context.Context, c VarlinkCall, nameOrID_ string) error - GetContainer(ctx context.Context, c VarlinkCall, id_ string) error - GetContainersByContext(ctx context.Context, c VarlinkCall, all_ bool, latest_ bool, args_ []string) error - CreateContainer(ctx context.Context, c VarlinkCall, create_ Create) error - InspectContainer(ctx context.Context, c VarlinkCall, name_ string) error - ListContainerProcesses(ctx context.Context, c VarlinkCall, name_ string, opts_ []string) error - GetContainerLogs(ctx context.Context, c VarlinkCall, name_ string) error - GetContainersLogs(ctx context.Context, c VarlinkCall, names_ []string, follow_ bool, latest_ bool, since_ string, tail_ int64, timestamps_ bool) error - ListContainerChanges(ctx context.Context, c VarlinkCall, name_ string) error - ExportContainer(ctx context.Context, c VarlinkCall, name_ string, path_ string) error - GetContainerStats(ctx context.Context, c VarlinkCall, name_ string) error - GetContainerStatsWithHistory(ctx context.Context, c VarlinkCall, previousStats_ ContainerStats) error - StartContainer(ctx context.Context, c VarlinkCall, name_ string) error - StopContainer(ctx context.Context, c VarlinkCall, name_ string, timeout_ int64) error - InitContainer(ctx context.Context, c VarlinkCall, name_ string) error - RestartContainer(ctx context.Context, c VarlinkCall, name_ string, timeout_ int64) error - KillContainer(ctx context.Context, c VarlinkCall, name_ string, signal_ int64) error - PauseContainer(ctx context.Context, c VarlinkCall, name_ string) error - UnpauseContainer(ctx context.Context, c VarlinkCall, name_ string) error - Attach(ctx context.Context, c VarlinkCall, name_ string, detachKeys_ string, start_ bool) error - AttachControl(ctx context.Context, c VarlinkCall, name_ string) error - GetAttachSockets(ctx context.Context, c VarlinkCall, name_ string) error - WaitContainer(ctx context.Context, c VarlinkCall, name_ string, interval_ int64) error - RemoveContainer(ctx context.Context, c VarlinkCall, name_ string, force_ bool, removeVolumes_ bool) error - EvictContainer(ctx context.Context, c VarlinkCall, name_ string, removeVolumes_ bool) error - DeleteStoppedContainers(ctx context.Context, c VarlinkCall) error - ListImages(ctx context.Context, c VarlinkCall) error - GetImage(ctx context.Context, c VarlinkCall, id_ string) error - BuildImage(ctx context.Context, c VarlinkCall, build_ BuildInfo) error - InspectImage(ctx context.Context, c VarlinkCall, name_ string) error - HistoryImage(ctx context.Context, c VarlinkCall, name_ string) error - PushImage(ctx context.Context, c VarlinkCall, name_ string, tag_ string, compress_ bool, format_ string, removeSignatures_ bool, signBy_ string) error - TagImage(ctx context.Context, c VarlinkCall, name_ string, tagged_ string) error - RemoveImage(ctx context.Context, c VarlinkCall, name_ string, force_ bool) error - SearchImages(ctx context.Context, c VarlinkCall, query_ string, limit_ *int64, filter_ ImageSearchFilter) error - DeleteUnusedImages(ctx context.Context, c VarlinkCall) error - Commit(ctx context.Context, c VarlinkCall, name_ string, image_name_ string, changes_ []string, author_ string, message_ string, pause_ bool, manifestType_ string) error - ImportImage(ctx context.Context, c VarlinkCall, source_ string, reference_ string, message_ string, changes_ []string, delete_ bool) error - ExportImage(ctx context.Context, c VarlinkCall, name_ string, destination_ string, compress_ bool, tags_ []string) error - PullImage(ctx context.Context, c VarlinkCall, name_ string) error - CreatePod(ctx context.Context, c VarlinkCall, create_ PodCreate) error - ListPods(ctx context.Context, c VarlinkCall) error - GetPod(ctx context.Context, c VarlinkCall, name_ string) error - InspectPod(ctx context.Context, c VarlinkCall, name_ string) error - StartPod(ctx context.Context, c VarlinkCall, name_ string) error - StopPod(ctx context.Context, c VarlinkCall, name_ string, timeout_ int64) error - RestartPod(ctx context.Context, c VarlinkCall, name_ string) error - KillPod(ctx context.Context, c VarlinkCall, name_ string, signal_ int64) error - PausePod(ctx context.Context, c VarlinkCall, name_ string) error - UnpausePod(ctx context.Context, c VarlinkCall, name_ string) error - RemovePod(ctx context.Context, c VarlinkCall, name_ string, force_ bool) error - TopPod(ctx context.Context, c VarlinkCall, pod_ string, latest_ bool, descriptors_ []string) error - GetPodStats(ctx context.Context, c VarlinkCall, name_ string) error - GetPodsByStatus(ctx context.Context, c VarlinkCall, statuses_ []string) error - ImageExists(ctx context.Context, c VarlinkCall, name_ string) error - ContainerExists(ctx context.Context, c VarlinkCall, name_ string) error - ContainerCheckpoint(ctx context.Context, c VarlinkCall, name_ string, keep_ bool, leaveRunning_ bool, tcpEstablished_ bool) error - ContainerRestore(ctx context.Context, c VarlinkCall, name_ string, keep_ bool, tcpEstablished_ bool) error - ContainerRunlabel(ctx context.Context, c VarlinkCall, runlabel_ Runlabel) error - ExecContainer(ctx context.Context, c VarlinkCall, opts_ ExecOpts) error - ListContainerMounts(ctx context.Context, c VarlinkCall) error - MountContainer(ctx context.Context, c VarlinkCall, name_ string) error - UnmountContainer(ctx context.Context, c VarlinkCall, name_ string, force_ bool) error - ImagesPrune(ctx context.Context, c VarlinkCall, all_ bool) error - GenerateKube(ctx context.Context, c VarlinkCall, name_ string, service_ bool) error - ContainerConfig(ctx context.Context, c VarlinkCall, name_ string) error - ContainerArtifacts(ctx context.Context, c VarlinkCall, name_ string, artifactName_ string) error - ContainerInspectData(ctx context.Context, c VarlinkCall, name_ string, size_ bool) error - ContainerStateData(ctx context.Context, c VarlinkCall, name_ string) error - PodStateData(ctx context.Context, c VarlinkCall, name_ string) error - CreateFromCC(ctx context.Context, c VarlinkCall, in_ []string) error - Spec(ctx context.Context, c VarlinkCall, name_ string) error - SendFile(ctx context.Context, c VarlinkCall, type_ string, length_ int64) error - ReceiveFile(ctx context.Context, c VarlinkCall, path_ string, delete_ bool) error - VolumeCreate(ctx context.Context, c VarlinkCall, options_ VolumeCreateOpts) error - VolumeRemove(ctx context.Context, c VarlinkCall, options_ VolumeRemoveOpts) error - GetVolumes(ctx context.Context, c VarlinkCall, args_ []string, all_ bool) error - InspectVolume(ctx context.Context, c VarlinkCall, name_ string) error - VolumesPrune(ctx context.Context, c VarlinkCall) error - ImageSave(ctx context.Context, c VarlinkCall, options_ ImageSaveOptions) error - GetPodsByContext(ctx context.Context, c VarlinkCall, all_ bool, latest_ bool, args_ []string) error - LoadImage(ctx context.Context, c VarlinkCall, name_ string, inputFile_ string, quiet_ bool, deleteFile_ bool) error - GetEvents(ctx context.Context, c VarlinkCall, filter_ []string, since_ string, until_ string) error - Diff(ctx context.Context, c VarlinkCall, name_ string) error - GetLayersMapWithImageInfo(ctx context.Context, c VarlinkCall) error - BuildImageHierarchyMap(ctx context.Context, c VarlinkCall, name_ string) error -} - -// Generated service object with all methods - -type VarlinkCall struct{ varlink.Call } - -// Generated reply methods for all varlink errors - -// ImageNotFound means the image could not be found by the provided name or ID in local storage. -func (c *VarlinkCall) ReplyImageNotFound(ctx context.Context, id_ string, reason_ string) error { - var out ImageNotFound - out.Id = id_ - out.Reason = reason_ - return c.ReplyError(ctx, "io.podman.ImageNotFound", &out) -} - -// ContainerNotFound means the container could not be found by the provided name or ID in local storage. -func (c *VarlinkCall) ReplyContainerNotFound(ctx context.Context, id_ string, reason_ string) error { - var out ContainerNotFound - out.Id = id_ - out.Reason = reason_ - return c.ReplyError(ctx, "io.podman.ContainerNotFound", &out) -} - -// NoContainerRunning means none of the containers requested are running in a command that requires a running container. -func (c *VarlinkCall) ReplyNoContainerRunning(ctx context.Context) error { - var out NoContainerRunning - return c.ReplyError(ctx, "io.podman.NoContainerRunning", &out) -} - -// PodNotFound means the pod could not be found by the provided name or ID in local storage. -func (c *VarlinkCall) ReplyPodNotFound(ctx context.Context, name_ string, reason_ string) error { - var out PodNotFound - out.Name = name_ - out.Reason = reason_ - return c.ReplyError(ctx, "io.podman.PodNotFound", &out) -} - -// VolumeNotFound means the volume could not be found by the name or ID in local storage. -func (c *VarlinkCall) ReplyVolumeNotFound(ctx context.Context, id_ string, reason_ string) error { - var out VolumeNotFound - out.Id = id_ - out.Reason = reason_ - return c.ReplyError(ctx, "io.podman.VolumeNotFound", &out) -} - -// PodContainerError means a container associated with a pod failed to perform an operation. It contains -// a container ID of the container that failed. -func (c *VarlinkCall) ReplyPodContainerError(ctx context.Context, podname_ string, errors_ []PodContainerErrorData) error { - var out PodContainerError - out.Podname = podname_ - out.Errors = []PodContainerErrorData(errors_) - return c.ReplyError(ctx, "io.podman.PodContainerError", &out) -} - -// NoContainersInPod means a pod has no containers on which to perform the operation. It contains -// the pod ID. -func (c *VarlinkCall) ReplyNoContainersInPod(ctx context.Context, name_ string) error { - var out NoContainersInPod - out.Name = name_ - return c.ReplyError(ctx, "io.podman.NoContainersInPod", &out) -} - -// InvalidState indicates that a container or pod was in an improper state for the requested operation -func (c *VarlinkCall) ReplyInvalidState(ctx context.Context, id_ string, reason_ string) error { - var out InvalidState - out.Id = id_ - out.Reason = reason_ - return c.ReplyError(ctx, "io.podman.InvalidState", &out) -} - -// ErrorOccurred is a generic error for an error that occurs during the execution. The actual error message -// is includes as part of the error's text. -func (c *VarlinkCall) ReplyErrorOccurred(ctx context.Context, reason_ string) error { - var out ErrorOccurred - out.Reason = reason_ - return c.ReplyError(ctx, "io.podman.ErrorOccurred", &out) -} - -// RuntimeErrors generally means a runtime could not be found or gotten. -func (c *VarlinkCall) ReplyRuntimeError(ctx context.Context, reason_ string) error { - var out RuntimeError - out.Reason = reason_ - return c.ReplyError(ctx, "io.podman.RuntimeError", &out) -} - -// The Podman endpoint requires that you use a streaming connection. -func (c *VarlinkCall) ReplyWantsMoreRequired(ctx context.Context, reason_ string) error { - var out WantsMoreRequired - out.Reason = reason_ - return c.ReplyError(ctx, "io.podman.WantsMoreRequired", &out) -} - -// Container is already stopped -func (c *VarlinkCall) ReplyErrCtrStopped(ctx context.Context, id_ string) error { - var out ErrCtrStopped - out.Id = id_ - return c.ReplyError(ctx, "io.podman.ErrCtrStopped", &out) -} - -// This function requires CGroupsV2 to run in rootless mode. -func (c *VarlinkCall) ReplyErrRequiresCgroupsV2ForRootless(ctx context.Context, reason_ string) error { - var out ErrRequiresCgroupsV2ForRootless - out.Reason = reason_ - return c.ReplyError(ctx, "io.podman.ErrRequiresCgroupsV2ForRootless", &out) -} - -// Generated reply methods for all varlink methods - -func (c *VarlinkCall) ReplyGetVersion(ctx context.Context, version_ string, go_version_ string, git_commit_ string, built_ string, os_arch_ string, remote_api_version_ int64) error { - var out struct { - Version string `json:"version"` - Go_version string `json:"go_version"` - Git_commit string `json:"git_commit"` - Built string `json:"built"` - Os_arch string `json:"os_arch"` - Remote_api_version int64 `json:"remote_api_version"` - } - out.Version = version_ - out.Go_version = go_version_ - out.Git_commit = git_commit_ - out.Built = built_ - out.Os_arch = os_arch_ - out.Remote_api_version = remote_api_version_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetInfo(ctx context.Context, info_ PodmanInfo) error { - var out struct { - Info PodmanInfo `json:"info"` - } - out.Info = info_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyListContainers(ctx context.Context, containers_ []Container) error { - var out struct { - Containers []Container `json:"containers"` - } - out.Containers = []Container(containers_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyPs(ctx context.Context, containers_ []PsContainer) error { - var out struct { - Containers []PsContainer `json:"containers"` - } - out.Containers = []PsContainer(containers_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetContainersByStatus(ctx context.Context, containerS_ []Container) error { - var out struct { - ContainerS []Container `json:"containerS"` - } - out.ContainerS = []Container(containerS_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyTop(ctx context.Context, top_ []string) error { - var out struct { - Top []string `json:"top"` - } - out.Top = []string(top_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyHealthCheckRun(ctx context.Context, healthCheckStatus_ string) error { - var out struct { - HealthCheckStatus string `json:"healthCheckStatus"` - } - out.HealthCheckStatus = healthCheckStatus_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetContainer(ctx context.Context, container_ Container) error { - var out struct { - Container Container `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetContainersByContext(ctx context.Context, containers_ []string) error { - var out struct { - Containers []string `json:"containers"` - } - out.Containers = []string(containers_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyCreateContainer(ctx context.Context, container_ string) error { - var out struct { - Container string `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyInspectContainer(ctx context.Context, container_ string) error { - var out struct { - Container string `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyListContainerProcesses(ctx context.Context, container_ []string) error { - var out struct { - Container []string `json:"container"` - } - out.Container = []string(container_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetContainerLogs(ctx context.Context, container_ []string) error { - var out struct { - Container []string `json:"container"` - } - out.Container = []string(container_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetContainersLogs(ctx context.Context, log_ LogLine) error { - var out struct { - Log LogLine `json:"log"` - } - out.Log = log_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyListContainerChanges(ctx context.Context, container_ ContainerChanges) error { - var out struct { - Container ContainerChanges `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyExportContainer(ctx context.Context, tarfile_ string) error { - var out struct { - Tarfile string `json:"tarfile"` - } - out.Tarfile = tarfile_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetContainerStats(ctx context.Context, container_ ContainerStats) error { - var out struct { - Container ContainerStats `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetContainerStatsWithHistory(ctx context.Context, container_ ContainerStats) error { - var out struct { - Container ContainerStats `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyStartContainer(ctx context.Context, container_ string) error { - var out struct { - Container string `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyStopContainer(ctx context.Context, container_ string) error { - var out struct { - Container string `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyInitContainer(ctx context.Context, container_ string) error { - var out struct { - Container string `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyRestartContainer(ctx context.Context, container_ string) error { - var out struct { - Container string `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyKillContainer(ctx context.Context, container_ string) error { - var out struct { - Container string `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyPauseContainer(ctx context.Context, container_ string) error { - var out struct { - Container string `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyUnpauseContainer(ctx context.Context, container_ string) error { - var out struct { - Container string `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyAttach(ctx context.Context) error { - return c.Reply(ctx, nil) -} - -func (c *VarlinkCall) ReplyAttachControl(ctx context.Context) error { - return c.Reply(ctx, nil) -} - -func (c *VarlinkCall) ReplyGetAttachSockets(ctx context.Context, sockets_ Sockets) error { - var out struct { - Sockets Sockets `json:"sockets"` - } - out.Sockets = sockets_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyWaitContainer(ctx context.Context, exitcode_ int64) error { - var out struct { - Exitcode int64 `json:"exitcode"` - } - out.Exitcode = exitcode_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyRemoveContainer(ctx context.Context, container_ string) error { - var out struct { - Container string `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyEvictContainer(ctx context.Context, container_ string) error { - var out struct { - Container string `json:"container"` - } - out.Container = container_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyDeleteStoppedContainers(ctx context.Context, containers_ []string) error { - var out struct { - Containers []string `json:"containers"` - } - out.Containers = []string(containers_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyListImages(ctx context.Context, images_ []Image) error { - var out struct { - Images []Image `json:"images"` - } - out.Images = []Image(images_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetImage(ctx context.Context, image_ Image) error { - var out struct { - Image Image `json:"image"` - } - out.Image = image_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyBuildImage(ctx context.Context, image_ MoreResponse) error { - var out struct { - Image MoreResponse `json:"image"` - } - out.Image = image_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyInspectImage(ctx context.Context, image_ string) error { - var out struct { - Image string `json:"image"` - } - out.Image = image_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyHistoryImage(ctx context.Context, history_ []ImageHistory) error { - var out struct { - History []ImageHistory `json:"history"` - } - out.History = []ImageHistory(history_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyPushImage(ctx context.Context, reply_ MoreResponse) error { - var out struct { - Reply MoreResponse `json:"reply"` - } - out.Reply = reply_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyTagImage(ctx context.Context, image_ string) error { - var out struct { - Image string `json:"image"` - } - out.Image = image_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyRemoveImage(ctx context.Context, image_ string) error { - var out struct { - Image string `json:"image"` - } - out.Image = image_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplySearchImages(ctx context.Context, results_ []ImageSearchResult) error { - var out struct { - Results []ImageSearchResult `json:"results"` - } - out.Results = []ImageSearchResult(results_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyDeleteUnusedImages(ctx context.Context, images_ []string) error { - var out struct { - Images []string `json:"images"` - } - out.Images = []string(images_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyCommit(ctx context.Context, reply_ MoreResponse) error { - var out struct { - Reply MoreResponse `json:"reply"` - } - out.Reply = reply_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyImportImage(ctx context.Context, image_ string) error { - var out struct { - Image string `json:"image"` - } - out.Image = image_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyExportImage(ctx context.Context, image_ string) error { - var out struct { - Image string `json:"image"` - } - out.Image = image_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyPullImage(ctx context.Context, reply_ MoreResponse) error { - var out struct { - Reply MoreResponse `json:"reply"` - } - out.Reply = reply_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyCreatePod(ctx context.Context, pod_ string) error { - var out struct { - Pod string `json:"pod"` - } - out.Pod = pod_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyListPods(ctx context.Context, pods_ []ListPodData) error { - var out struct { - Pods []ListPodData `json:"pods"` - } - out.Pods = []ListPodData(pods_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetPod(ctx context.Context, pod_ ListPodData) error { - var out struct { - Pod ListPodData `json:"pod"` - } - out.Pod = pod_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyInspectPod(ctx context.Context, pod_ string) error { - var out struct { - Pod string `json:"pod"` - } - out.Pod = pod_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyStartPod(ctx context.Context, pod_ string) error { - var out struct { - Pod string `json:"pod"` - } - out.Pod = pod_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyStopPod(ctx context.Context, pod_ string) error { - var out struct { - Pod string `json:"pod"` - } - out.Pod = pod_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyRestartPod(ctx context.Context, pod_ string) error { - var out struct { - Pod string `json:"pod"` - } - out.Pod = pod_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyKillPod(ctx context.Context, pod_ string) error { - var out struct { - Pod string `json:"pod"` - } - out.Pod = pod_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyPausePod(ctx context.Context, pod_ string) error { - var out struct { - Pod string `json:"pod"` - } - out.Pod = pod_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyUnpausePod(ctx context.Context, pod_ string) error { - var out struct { - Pod string `json:"pod"` - } - out.Pod = pod_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyRemovePod(ctx context.Context, pod_ string) error { - var out struct { - Pod string `json:"pod"` - } - out.Pod = pod_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyTopPod(ctx context.Context, stats_ []string) error { - var out struct { - Stats []string `json:"stats"` - } - out.Stats = []string(stats_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetPodStats(ctx context.Context, pod_ string, containers_ []ContainerStats) error { - var out struct { - Pod string `json:"pod"` - Containers []ContainerStats `json:"containers"` - } - out.Pod = pod_ - out.Containers = []ContainerStats(containers_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetPodsByStatus(ctx context.Context, pods_ []string) error { - var out struct { - Pods []string `json:"pods"` - } - out.Pods = []string(pods_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyImageExists(ctx context.Context, exists_ int64) error { - var out struct { - Exists int64 `json:"exists"` - } - out.Exists = exists_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyContainerExists(ctx context.Context, exists_ int64) error { - var out struct { - Exists int64 `json:"exists"` - } - out.Exists = exists_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyContainerCheckpoint(ctx context.Context, id_ string) error { - var out struct { - Id string `json:"id"` - } - out.Id = id_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyContainerRestore(ctx context.Context, id_ string) error { - var out struct { - Id string `json:"id"` - } - out.Id = id_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyContainerRunlabel(ctx context.Context) error { - return c.Reply(ctx, nil) -} - -func (c *VarlinkCall) ReplyExecContainer(ctx context.Context) error { - return c.Reply(ctx, nil) -} - -func (c *VarlinkCall) ReplyListContainerMounts(ctx context.Context, mounts_ map[string]string) error { - var out struct { - Mounts map[string]string `json:"mounts"` - } - out.Mounts = map[string]string(mounts_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyMountContainer(ctx context.Context, path_ string) error { - var out struct { - Path string `json:"path"` - } - out.Path = path_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyUnmountContainer(ctx context.Context) error { - return c.Reply(ctx, nil) -} - -func (c *VarlinkCall) ReplyImagesPrune(ctx context.Context, pruned_ []string) error { - var out struct { - Pruned []string `json:"pruned"` - } - out.Pruned = []string(pruned_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGenerateKube(ctx context.Context, pod_ KubePodService) error { - var out struct { - Pod KubePodService `json:"pod"` - } - out.Pod = pod_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyContainerConfig(ctx context.Context, config_ string) error { - var out struct { - Config string `json:"config"` - } - out.Config = config_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyContainerArtifacts(ctx context.Context, config_ string) error { - var out struct { - Config string `json:"config"` - } - out.Config = config_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyContainerInspectData(ctx context.Context, config_ string) error { - var out struct { - Config string `json:"config"` - } - out.Config = config_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyContainerStateData(ctx context.Context, config_ string) error { - var out struct { - Config string `json:"config"` - } - out.Config = config_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyPodStateData(ctx context.Context, config_ string) error { - var out struct { - Config string `json:"config"` - } - out.Config = config_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyCreateFromCC(ctx context.Context, id_ string) error { - var out struct { - Id string `json:"id"` - } - out.Id = id_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplySpec(ctx context.Context, config_ string) error { - var out struct { - Config string `json:"config"` - } - out.Config = config_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplySendFile(ctx context.Context, file_handle_ string) error { - var out struct { - File_handle string `json:"file_handle"` - } - out.File_handle = file_handle_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyReceiveFile(ctx context.Context, len_ int64) error { - var out struct { - Len int64 `json:"len"` - } - out.Len = len_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyVolumeCreate(ctx context.Context, volumeName_ string) error { - var out struct { - VolumeName string `json:"volumeName"` - } - out.VolumeName = volumeName_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyVolumeRemove(ctx context.Context, successes_ []string, failures_ map[string]string) error { - var out struct { - Successes []string `json:"successes"` - Failures map[string]string `json:"failures"` - } - out.Successes = []string(successes_) - out.Failures = map[string]string(failures_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetVolumes(ctx context.Context, volumes_ []Volume) error { - var out struct { - Volumes []Volume `json:"volumes"` - } - out.Volumes = []Volume(volumes_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyInspectVolume(ctx context.Context, volume_ string) error { - var out struct { - Volume string `json:"volume"` - } - out.Volume = volume_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyVolumesPrune(ctx context.Context, prunedNames_ []string, prunedErrors_ []string) error { - var out struct { - PrunedNames []string `json:"prunedNames"` - PrunedErrors []string `json:"prunedErrors"` - } - out.PrunedNames = []string(prunedNames_) - out.PrunedErrors = []string(prunedErrors_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyImageSave(ctx context.Context, reply_ MoreResponse) error { - var out struct { - Reply MoreResponse `json:"reply"` - } - out.Reply = reply_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetPodsByContext(ctx context.Context, pods_ []string) error { - var out struct { - Pods []string `json:"pods"` - } - out.Pods = []string(pods_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyLoadImage(ctx context.Context, reply_ MoreResponse) error { - var out struct { - Reply MoreResponse `json:"reply"` - } - out.Reply = reply_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetEvents(ctx context.Context, events_ Event) error { - var out struct { - Events Event `json:"events"` - } - out.Events = events_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyDiff(ctx context.Context, diffs_ []DiffInfo) error { - var out struct { - Diffs []DiffInfo `json:"diffs"` - } - out.Diffs = []DiffInfo(diffs_) - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyGetLayersMapWithImageInfo(ctx context.Context, layerMap_ string) error { - var out struct { - LayerMap string `json:"layerMap"` - } - out.LayerMap = layerMap_ - return c.Reply(ctx, &out) -} - -func (c *VarlinkCall) ReplyBuildImageHierarchyMap(ctx context.Context, imageInfo_ string) error { - var out struct { - ImageInfo string `json:"imageInfo"` - } - out.ImageInfo = imageInfo_ - return c.Reply(ctx, &out) -} - -// Generated dummy implementations for all varlink methods - -// GetVersion returns version and build information of the podman service -func (s *VarlinkInterface) GetVersion(ctx context.Context, c VarlinkCall) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetVersion") -} - -// GetInfo returns a [PodmanInfo](#PodmanInfo) struct that describes podman and its host such as storage stats, -// build information of Podman, and system-wide registries. -func (s *VarlinkInterface) GetInfo(ctx context.Context, c VarlinkCall) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetInfo") -} - -// ListContainers returns information about all containers. -// See also [GetContainer](#GetContainer). -func (s *VarlinkInterface) ListContainers(ctx context.Context, c VarlinkCall) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ListContainers") -} - -func (s *VarlinkInterface) Ps(ctx context.Context, c VarlinkCall, opts_ PsOpts) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.Ps") -} - -func (s *VarlinkInterface) GetContainersByStatus(ctx context.Context, c VarlinkCall, status_ []string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetContainersByStatus") -} - -func (s *VarlinkInterface) Top(ctx context.Context, c VarlinkCall, nameOrID_ string, descriptors_ []string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.Top") -} - -// HealthCheckRun executes defined container's healthcheck command -// and returns the container's health status. -func (s *VarlinkInterface) HealthCheckRun(ctx context.Context, c VarlinkCall, nameOrID_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.HealthCheckRun") -} - -// GetContainer returns information about a single container. If a container -// with the given id doesn't exist, a [ContainerNotFound](#ContainerNotFound) -// error will be returned. See also [ListContainers](ListContainers) and -// [InspectContainer](#InspectContainer). -func (s *VarlinkInterface) GetContainer(ctx context.Context, c VarlinkCall, id_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetContainer") -} - -// GetContainersByContext allows you to get a list of container ids depending on all, latest, or a list of -// container names. The definition of latest container means the latest by creation date. In a multi- -// user environment, results might differ from what you expect. -func (s *VarlinkInterface) GetContainersByContext(ctx context.Context, c VarlinkCall, all_ bool, latest_ bool, args_ []string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetContainersByContext") -} - -// CreateContainer creates a new container from an image. It uses a [Create](#Create) type for input. -func (s *VarlinkInterface) CreateContainer(ctx context.Context, c VarlinkCall, create_ Create) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.CreateContainer") -} - -// InspectContainer data takes a name or ID of a container returns the inspection -// data in string format. You can then serialize the string into JSON. A [ContainerNotFound](#ContainerNotFound) -// error will be returned if the container cannot be found. See also [InspectImage](#InspectImage). -func (s *VarlinkInterface) InspectContainer(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.InspectContainer") -} - -// ListContainerProcesses takes a name or ID of a container and returns the processes -// running inside the container as array of strings. It will accept an array of string -// arguments that represent ps options. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -// error will be returned. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}' -// { -// "container": [ -// " UID PID PPID C STIME TTY TIME CMD", -// " 0 21220 21210 0 09:05 pts/0 00:00:00 /bin/sh", -// " 0 21232 21220 0 09:05 pts/0 00:00:00 top", -// " 0 21284 21220 0 09:05 pts/0 00:00:00 vi /etc/hosts" -// ] -// } -// ~~~ -func (s *VarlinkInterface) ListContainerProcesses(ctx context.Context, c VarlinkCall, name_ string, opts_ []string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ListContainerProcesses") -} - -// GetContainerLogs takes a name or ID of a container and returns the logs of that container. -// If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) error will be returned. -// The container logs are returned as an array of strings. GetContainerLogs will honor the streaming -// capability of varlink if the client invokes it. -func (s *VarlinkInterface) GetContainerLogs(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetContainerLogs") -} - -func (s *VarlinkInterface) GetContainersLogs(ctx context.Context, c VarlinkCall, names_ []string, follow_ bool, latest_ bool, since_ string, tail_ int64, timestamps_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetContainersLogs") -} - -// ListContainerChanges takes a name or ID of a container and returns changes between the container and -// its base image. It returns a struct of changed, deleted, and added path names. -func (s *VarlinkInterface) ListContainerChanges(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ListContainerChanges") -} - -// ExportContainer creates an image from a container. It takes the name or ID of a container and a -// path representing the target tarfile. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -// error will be returned. -// The return value is the written tarfile. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.ExportContainer '{"name": "flamboyant_payne", "path": "/tmp/payne.tar" }' -// { -// "tarfile": "/tmp/payne.tar" -// } -// ~~~ -func (s *VarlinkInterface) ExportContainer(ctx context.Context, c VarlinkCall, name_ string, path_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ExportContainer") -} - -// GetContainerStats takes the name or ID of a container and returns a single ContainerStats structure which -// contains attributes like memory and cpu usage. If the container cannot be found, a -// [ContainerNotFound](#ContainerNotFound) error will be returned. If the container is not running, a [NoContainerRunning](#NoContainerRunning) -// error will be returned -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.GetContainerStats '{"name": "c33e4164f384"}' -// { -// "container": { -// "block_input": 0, -// "block_output": 0, -// "cpu": 2.571123918839990154678e-08, -// "cpu_nano": 49037378, -// "id": "c33e4164f384aa9d979072a63319d66b74fd7a128be71fa68ede24f33ec6cfee", -// "mem_limit": 33080606720, -// "mem_perc": 2.166828456524753747370e-03, -// "mem_usage": 716800, -// "name": "competent_wozniak", -// "net_input": 768, -// "net_output": 5910, -// "pids": 1, -// "system_nano": 10000000 -// } -// } -// ~~~ -func (s *VarlinkInterface) GetContainerStats(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetContainerStats") -} - -// GetContainerStatsWithHistory takes a previous set of container statistics and uses libpod functions -// to calculate the containers statistics based on current and previous measurements. -func (s *VarlinkInterface) GetContainerStatsWithHistory(ctx context.Context, c VarlinkCall, previousStats_ ContainerStats) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetContainerStatsWithHistory") -} - -// StartContainer starts a created or stopped container. It takes the name or ID of container. It returns -// the container ID once started. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -// error will be returned. See also [CreateContainer](#CreateContainer). -func (s *VarlinkInterface) StartContainer(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.StartContainer") -} - -// StopContainer stops a container given a timeout. It takes the name or ID of a container as well as a -// timeout value. The timeout value the time before a forcible stop to the container is applied. It -// returns the container ID once stopped. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -// error will be returned instead. See also [KillContainer](KillContainer). -// #### Error -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}' -// { -// "container": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -// } -// ~~~ -func (s *VarlinkInterface) StopContainer(ctx context.Context, c VarlinkCall, name_ string, timeout_ int64) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.StopContainer") -} - -// InitContainer initializes the given container. It accepts a container name or -// ID, and will initialize the container matching that ID if possible, and error -// if not. Containers can only be initialized when they are in the Created or -// Exited states. Initialization prepares a container to be started, but does not -// start the container. It is intended to be used to debug a container's state -// prior to starting it. -func (s *VarlinkInterface) InitContainer(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.InitContainer") -} - -// RestartContainer will restart a running container given a container name or ID and timeout value. The timeout -// value is the time before a forcible stop is used to stop the container. If the container cannot be found by -// name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise, the ID of the -// container will be returned. -func (s *VarlinkInterface) RestartContainer(ctx context.Context, c VarlinkCall, name_ string, timeout_ int64) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.RestartContainer") -} - -// KillContainer takes the name or ID of a container as well as a signal to be applied to the container. Once the -// container has been killed, the container's ID is returned. If the container cannot be found, a -// [ContainerNotFound](#ContainerNotFound) error is returned. See also [StopContainer](StopContainer). -func (s *VarlinkInterface) KillContainer(ctx context.Context, c VarlinkCall, name_ string, signal_ int64) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.KillContainer") -} - -// PauseContainer takes the name or ID of container and pauses it. If the container cannot be found, -// a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. -// See also [UnpauseContainer](#UnpauseContainer). -func (s *VarlinkInterface) PauseContainer(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.PauseContainer") -} - -// UnpauseContainer takes the name or ID of container and unpauses a paused container. If the container cannot be -// found, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. -// See also [PauseContainer](#PauseContainer). -func (s *VarlinkInterface) UnpauseContainer(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.UnpauseContainer") -} - -// Attach takes the name or ID of a container and sets up the ability to remotely attach to its console. The start -// bool is whether you wish to start the container in question first. -func (s *VarlinkInterface) Attach(ctx context.Context, c VarlinkCall, name_ string, detachKeys_ string, start_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.Attach") -} - -func (s *VarlinkInterface) AttachControl(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.AttachControl") -} - -// GetAttachSockets takes the name or ID of an existing container. It returns file paths for two sockets needed -// to properly communicate with a container. The first is the actual I/O socket that the container uses. The -// second is a "control" socket where things like resizing the TTY events are sent. If the container cannot be -// found, a [ContainerNotFound](#ContainerNotFound) error will be returned. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/io.podman/io.podman.GetAttachSockets '{"name": "b7624e775431219161"}' -// { -// "sockets": { -// "container_id": "b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca", -// "control_socket": "/var/lib/containers/storage/overlay-containers/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/userdata/ctl", -// "io_socket": "/var/run/libpod/socket/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/attach" -// } -// } -// ~~~ -func (s *VarlinkInterface) GetAttachSockets(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetAttachSockets") -} - -// WaitContainer takes the name or ID of a container and waits the given interval in milliseconds until the container -// stops. Upon stopping, the return code of the container is returned. If the container container cannot be found by ID -// or name, a [ContainerNotFound](#ContainerNotFound) error is returned. -func (s *VarlinkInterface) WaitContainer(ctx context.Context, c VarlinkCall, name_ string, interval_ int64) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.WaitContainer") -} - -// RemoveContainer requires the name or ID of a container as well as a boolean that -// indicates whether a container should be forcefully removed (e.g., by stopping it), and a boolean -// indicating whether to remove builtin volumes. Upon successful removal of the -// container, its ID is returned. If the -// container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned. -// See also [EvictContainer](EvictContainer). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.RemoveContainer '{"name": "62f4fd98cb57"}' -// { -// "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -// } -// ~~~ -func (s *VarlinkInterface) RemoveContainer(ctx context.Context, c VarlinkCall, name_ string, force_ bool, removeVolumes_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.RemoveContainer") -} - -// EvictContainer requires the name or ID of a container as well as a boolean that -// indicates to remove builtin volumes. Upon successful eviction of the container, -// its ID is returned. If the container cannot be found by name or ID, -// a [ContainerNotFound](#ContainerNotFound) error will be returned. -// See also [RemoveContainer](RemoveContainer). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.EvictContainer '{"name": "62f4fd98cb57"}' -// { -// "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -// } -// ~~~ -func (s *VarlinkInterface) EvictContainer(ctx context.Context, c VarlinkCall, name_ string, removeVolumes_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.EvictContainer") -} - -// DeleteStoppedContainers will delete all containers that are not running. It will return a list the deleted -// container IDs. See also [RemoveContainer](RemoveContainer). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.DeleteStoppedContainers -// { -// "containers": [ -// "451410b931d00def8aa9b4f8084e4d4a39e5e04ea61f358cf53a5cf95afcdcee", -// "8b60f754a3e01389494a9581ade97d35c2765b6e2f19acd2d3040c82a32d1bc0", -// "cf2e99d4d3cad6073df199ed32bbe64b124f3e1aba6d78821aa8460e70d30084", -// "db901a329587312366e5ecff583d08f0875b4b79294322df67d90fc6eed08fc1" -// ] -// } -// ~~~ -func (s *VarlinkInterface) DeleteStoppedContainers(ctx context.Context, c VarlinkCall) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.DeleteStoppedContainers") -} - -// ListImages returns information about the images that are currently in storage. -// See also [InspectImage](#InspectImage). -func (s *VarlinkInterface) ListImages(ctx context.Context, c VarlinkCall) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ListImages") -} - -// GetImage returns information about a single image in storage. -// If the image caGetImage returns be found, [ImageNotFound](#ImageNotFound) will be returned. -func (s *VarlinkInterface) GetImage(ctx context.Context, c VarlinkCall, id_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetImage") -} - -// BuildImage takes a [BuildInfo](#BuildInfo) structure and builds an image. At a minimum, you must provide the -// contextDir tarball path, the 'dockerfiles' path, and 'output' option in the BuildInfo structure. The 'output' -// options is the name of the of the resulting build. It will return a [MoreResponse](#MoreResponse) structure -// that contains the build logs and resulting image ID. -// #### Example -// ~~~ -// $ sudo varlink call -m unix:///run/podman/io.podman/io.podman.BuildImage '{"build":{"contextDir":"/tmp/t/context.tar","dockerfiles":["Dockerfile"], "output":"foobar"}}' -// { -// "image": { -// "id": "", -// "logs": [ -// "STEP 1: FROM alpine\n" -// ] -// } -// } -// { -// "image": { -// "id": "", -// "logs": [ -// "STEP 2: COMMIT foobar\n" -// ] -// } -// } -// { -// "image": { -// "id": "", -// "logs": [ -// "b7b28af77ffec6054d13378df4fdf02725830086c7444d9c278af25312aa39b9\n" -// ] -// } -// } -// { -// "image": { -// "id": "b7b28af77ffec6054d13378df4fdf02725830086c7444d9c278af25312aa39b9", -// "logs": [] -// } -// } -// ~~~ -func (s *VarlinkInterface) BuildImage(ctx context.Context, c VarlinkCall, build_ BuildInfo) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.BuildImage") -} - -// InspectImage takes the name or ID of an image and returns a string representation of data associated with the -// mage. You must serialize the string into JSON to use it further. An [ImageNotFound](#ImageNotFound) error will -// be returned if the image cannot be found. -func (s *VarlinkInterface) InspectImage(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.InspectImage") -} - -// HistoryImage takes the name or ID of an image and returns information about its history and layers. The returned -// history is in the form of an array of ImageHistory structures. If the image cannot be found, an -// [ImageNotFound](#ImageNotFound) error is returned. -func (s *VarlinkInterface) HistoryImage(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.HistoryImage") -} - -// PushImage takes two input arguments: the name or ID of an image, the fully-qualified destination name of the image, -// It will return an [ImageNotFound](#ImageNotFound) error if -// the image cannot be found in local storage; otherwise it will return a [MoreResponse](#MoreResponse) -func (s *VarlinkInterface) PushImage(ctx context.Context, c VarlinkCall, name_ string, tag_ string, compress_ bool, format_ string, removeSignatures_ bool, signBy_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.PushImage") -} - -// TagImage takes the name or ID of an image in local storage as well as the desired tag name. If the image cannot -// be found, an [ImageNotFound](#ImageNotFound) error will be returned; otherwise, the ID of the image is returned on success. -func (s *VarlinkInterface) TagImage(ctx context.Context, c VarlinkCall, name_ string, tagged_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.TagImage") -} - -// RemoveImage takes the name or ID of an image as well as a boolean that determines if containers using that image -// should be deleted. If the image cannot be found, an [ImageNotFound](#ImageNotFound) error will be returned. The -// ID of the removed image is returned when complete. See also [DeleteUnusedImages](DeleteUnusedImages). -// #### Example -// ~~~ -// varlink call -m unix:/run/podman/io.podman/io.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}' -// { -// "image": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e" -// } -// ~~~ -func (s *VarlinkInterface) RemoveImage(ctx context.Context, c VarlinkCall, name_ string, force_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.RemoveImage") -} - -// SearchImages searches available registries for images that contain the -// contents of "query" in their name. If "limit" is given, limits the amount of -// search results per registry. -func (s *VarlinkInterface) SearchImages(ctx context.Context, c VarlinkCall, query_ string, limit_ *int64, filter_ ImageSearchFilter) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.SearchImages") -} - -// DeleteUnusedImages deletes any images not associated with a container. The IDs of the deleted images are returned -// in a string array. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.DeleteUnusedImages -// { -// "images": [ -// "166ea6588079559c724c15223f52927f514f73dd5c5cf2ae2d143e3b2e6e9b52", -// "da86e6ba6ca197bf6bc5e9d900febd906b133eaa4750e6bed647b0fbe50ed43e", -// "3ef70f7291f47dfe2b82931a993e16f5a44a0e7a68034c3e0e086d77f5829adc", -// "59788edf1f3e78cd0ebe6ce1446e9d10788225db3dedcfd1a59f764bad2b2690" -// ] -// } -// ~~~ -func (s *VarlinkInterface) DeleteUnusedImages(ctx context.Context, c VarlinkCall) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.DeleteUnusedImages") -} - -// Commit, creates an image from an existing container. It requires the name or -// ID of the container as well as the resulting image name. Optionally, you can define an author and message -// to be added to the resulting image. You can also define changes to the resulting image for the following -// attributes: _CMD, ENTRYPOINT, ENV, EXPOSE, LABEL, ONBUILD, STOPSIGNAL, USER, VOLUME, and WORKDIR_. To pause the -// container while it is being committed, pass a _true_ bool for the pause argument. If the container cannot -// be found by the ID or name provided, a (ContainerNotFound)[#ContainerNotFound] error will be returned; otherwise, -// the resulting image's ID will be returned as a string inside a MoreResponse. -func (s *VarlinkInterface) Commit(ctx context.Context, c VarlinkCall, name_ string, image_name_ string, changes_ []string, author_ string, message_ string, pause_ bool, manifestType_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.Commit") -} - -// ImportImage imports an image from a source (like tarball) into local storage. The image can have additional -// descriptions added to it using the message and changes options. See also [ExportImage](ExportImage). -func (s *VarlinkInterface) ImportImage(ctx context.Context, c VarlinkCall, source_ string, reference_ string, message_ string, changes_ []string, delete_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ImportImage") -} - -// ExportImage takes the name or ID of an image and exports it to a destination like a tarball. There is also -// a boolean option to force compression. It also takes in a string array of tags to be able to save multiple -// tags of the same image to a tarball (each tag should be of the form :). Upon completion, the ID -// of the image is returned. If the image cannot be found in local storage, an [ImageNotFound](#ImageNotFound) -// error will be returned. See also [ImportImage](ImportImage). -func (s *VarlinkInterface) ExportImage(ctx context.Context, c VarlinkCall, name_ string, destination_ string, compress_ bool, tags_ []string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ExportImage") -} - -// PullImage pulls an image from a repository to local storage. After a successful pull, the image id and logs -// are returned as a [MoreResponse](#MoreResponse). This connection also will handle a WantsMores request to send -// status as it occurs. -func (s *VarlinkInterface) PullImage(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.PullImage") -} - -// CreatePod creates a new empty pod. It uses a [PodCreate](#PodCreate) type for input. -// On success, the ID of the newly created pod will be returned. -// #### Example -// ~~~ -// $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"name": "test"}}' -// { -// "pod": "b05dee7bd4ccfee688099fe1588a7a898d6ddd6897de9251d4671c9b0feacb2a" -// } -// # $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"infra": true, "share": ["ipc", "net", "uts"]}}' -// { -// "pod": "d7697449a8035f613c1a8891286502aca68fff7d5d49a85279b3bda229af3b28" -// } -// ~~~ -func (s *VarlinkInterface) CreatePod(ctx context.Context, c VarlinkCall, create_ PodCreate) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.CreatePod") -} - -// ListPods returns a list of pods in no particular order. They are -// returned as an array of ListPodData structs. See also [GetPod](#GetPod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.ListPods -// { -// "pods": [ -// { -// "cgroup": "machine.slice", -// "containersinfo": [ -// { -// "id": "00c130a45de0411f109f1a0cfea2e298df71db20fa939de5cab8b2160a36be45", -// "name": "1840835294cf-infra", -// "status": "running" -// }, -// { -// "id": "49a5cce72093a5ca47c6de86f10ad7bb36391e2d89cef765f807e460865a0ec6", -// "name": "upbeat_murdock", -// "status": "running" -// } -// ], -// "createdat": "2018-12-07 13:10:15.014139258 -0600 CST", -// "id": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f", -// "name": "foobar", -// "numberofcontainers": "2", -// "status": "Running" -// }, -// { -// "cgroup": "machine.slice", -// "containersinfo": [ -// { -// "id": "1ca4b7bbba14a75ba00072d4b705c77f3df87db0109afaa44d50cb37c04a477e", -// "name": "784306f655c6-infra", -// "status": "running" -// } -// ], -// "createdat": "2018-12-07 13:09:57.105112457 -0600 CST", -// "id": "784306f655c6200aea321dd430ba685e9b2cc1f7d7528a72f3ff74ffb29485a2", -// "name": "nostalgic_pike", -// "numberofcontainers": "1", -// "status": "Running" -// } -// ] -// } -// ~~~ -func (s *VarlinkInterface) ListPods(ctx context.Context, c VarlinkCall) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ListPods") -} - -// GetPod takes a name or ID of a pod and returns single [ListPodData](#ListPodData) -// structure. A [PodNotFound](#PodNotFound) error will be returned if the pod cannot be found. -// See also [ListPods](ListPods). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.GetPod '{"name": "foobar"}' -// { -// "pod": { -// "cgroup": "machine.slice", -// "containersinfo": [ -// { -// "id": "00c130a45de0411f109f1a0cfea2e298df71db20fa939de5cab8b2160a36be45", -// "name": "1840835294cf-infra", -// "status": "running" -// }, -// { -// "id": "49a5cce72093a5ca47c6de86f10ad7bb36391e2d89cef765f807e460865a0ec6", -// "name": "upbeat_murdock", -// "status": "running" -// } -// ], -// "createdat": "2018-12-07 13:10:15.014139258 -0600 CST", -// "id": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f", -// "name": "foobar", -// "numberofcontainers": "2", -// "status": "Running" -// } -// } -// ~~~ -func (s *VarlinkInterface) GetPod(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetPod") -} - -// InspectPod takes the name or ID of an image and returns a string representation of data associated with the -// pod. You must serialize the string into JSON to use it further. A [PodNotFound](#PodNotFound) error will -// be returned if the pod cannot be found. -func (s *VarlinkInterface) InspectPod(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.InspectPod") -} - -// StartPod starts containers in a pod. It takes the name or ID of pod. If the pod cannot be found, a [PodNotFound](#PodNotFound) -// error will be returned. Containers in a pod are started independently. If there is an error starting one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was started with no errors, the pod ID is returned. -// See also [CreatePod](#CreatePod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.StartPod '{"name": "135d71b9495f"}' -// { -// "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6", -// } -// ~~~ -func (s *VarlinkInterface) StartPod(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.StartPod") -} - -// StopPod stops containers in a pod. It takes the name or ID of a pod and a timeout. -// If the pod cannot be found, a [PodNotFound](#PodNotFound) error will be returned instead. -// Containers in a pod are stopped independently. If there is an error stopping one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was stopped with no errors, the pod ID is returned. -// See also [KillPod](KillPod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.StopPod '{"name": "135d71b9495f"}' -// { -// "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -// } -// ~~~ -func (s *VarlinkInterface) StopPod(ctx context.Context, c VarlinkCall, name_ string, timeout_ int64) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.StopPod") -} - -// RestartPod will restart containers in a pod given a pod name or ID. Containers in -// the pod that are running will be stopped, then all stopped containers will be run. -// If the pod cannot be found by name or ID, a [PodNotFound](#PodNotFound) error will be returned. -// Containers in a pod are restarted independently. If there is an error restarting one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was restarted with no errors, the pod ID is returned. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.RestartPod '{"name": "135d71b9495f"}' -// { -// "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -// } -// ~~~ -func (s *VarlinkInterface) RestartPod(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.RestartPod") -} - -// KillPod takes the name or ID of a pod as well as a signal to be applied to the pod. If the pod cannot be found, a -// [PodNotFound](#PodNotFound) error is returned. -// Containers in a pod are killed independently. If there is an error killing one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was killed with no errors, the pod ID is returned. -// See also [StopPod](StopPod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.KillPod '{"name": "foobar", "signal": 15}' -// { -// "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -// } -// ~~~ -func (s *VarlinkInterface) KillPod(ctx context.Context, c VarlinkCall, name_ string, signal_ int64) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.KillPod") -} - -// PausePod takes the name or ID of a pod and pauses the running containers associated with it. If the pod cannot be found, -// a [PodNotFound](#PodNotFound) error will be returned. -// Containers in a pod are paused independently. If there is an error pausing one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was paused with no errors, the pod ID is returned. -// See also [UnpausePod](#UnpausePod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.PausePod '{"name": "foobar"}' -// { -// "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -// } -// ~~~ -func (s *VarlinkInterface) PausePod(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.PausePod") -} - -// UnpausePod takes the name or ID of a pod and unpauses the paused containers associated with it. If the pod cannot be -// found, a [PodNotFound](#PodNotFound) error will be returned. -// Containers in a pod are unpaused independently. If there is an error unpausing one container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was unpaused with no errors, the pod ID is returned. -// See also [PausePod](#PausePod). -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.UnpausePod '{"name": "foobar"}' -// { -// "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -// } -// ~~~ -func (s *VarlinkInterface) UnpausePod(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.UnpausePod") -} - -// RemovePod takes the name or ID of a pod as well a boolean representing whether a running -// container in the pod can be stopped and removed. If a pod has containers associated with it, and force is not true, -// an error will occur. -// If the pod cannot be found by name or ID, a [PodNotFound](#PodNotFound) error will be returned. -// Containers in a pod are removed independently. If there is an error removing any container, the ID of those containers -// will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -// If the pod was removed with no errors, the pod ID is returned. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.RemovePod '{"name": "62f4fd98cb57", "force": "true"}' -// { -// "pod": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -// } -// ~~~ -func (s *VarlinkInterface) RemovePod(ctx context.Context, c VarlinkCall, name_ string, force_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.RemovePod") -} - -func (s *VarlinkInterface) TopPod(ctx context.Context, c VarlinkCall, pod_ string, latest_ bool, descriptors_ []string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.TopPod") -} - -// GetPodStats takes the name or ID of a pod and returns a pod name and slice of ContainerStats structure which -// contains attributes like memory and cpu usage. If the pod cannot be found, a [PodNotFound](#PodNotFound) -// error will be returned. If the pod has no running containers associated with it, a [NoContainerRunning](#NoContainerRunning) -// error will be returned. -// #### Example -// ~~~ -// $ varlink call unix:/run/podman/io.podman/io.podman.GetPodStats '{"name": "7f62b508b6f12b11d8fe02e"}' -// { -// "containers": [ -// { -// "block_input": 0, -// "block_output": 0, -// "cpu": 2.833470544016107524276e-08, -// "cpu_nano": 54363072, -// "id": "a64b51f805121fe2c5a3dc5112eb61d6ed139e3d1c99110360d08b58d48e4a93", -// "mem_limit": 12276146176, -// "mem_perc": 7.974359265237864966003e-03, -// "mem_usage": 978944, -// "name": "quirky_heisenberg", -// "net_input": 866, -// "net_output": 7388, -// "pids": 1, -// "system_nano": 20000000 -// } -// ], -// "pod": "7f62b508b6f12b11d8fe02e0db4de6b9e43a7d7699b33a4fc0d574f6e82b4ebd" -// } -// ~~~ -func (s *VarlinkInterface) GetPodStats(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetPodStats") -} - -// GetPodsByStatus searches for pods whose status is included in statuses -func (s *VarlinkInterface) GetPodsByStatus(ctx context.Context, c VarlinkCall, statuses_ []string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetPodsByStatus") -} - -// ImageExists talks a full or partial image ID or name and returns an int as to whether -// the image exists in local storage. An int result of 0 means the image does exist in -// local storage; whereas 1 indicates the image does not exists in local storage. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.ImageExists '{"name": "imageddoesntexist"}' -// { -// "exists": 1 -// } -// ~~~ -func (s *VarlinkInterface) ImageExists(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ImageExists") -} - -// ContainerExists takes a full or partial container ID or name and returns an int as to -// whether the container exists in local storage. A result of 0 means the container does -// exists; whereas a result of 1 means it could not be found. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.ContainerExists '{"name": "flamboyant_payne"}'{ -// "exists": 0 -// } -// ~~~ -func (s *VarlinkInterface) ContainerExists(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ContainerExists") -} - -// ContainerCheckPoint performs a checkpopint on a container by its name or full/partial container -// ID. On successful checkpoint, the id of the checkpointed container is returned. -func (s *VarlinkInterface) ContainerCheckpoint(ctx context.Context, c VarlinkCall, name_ string, keep_ bool, leaveRunning_ bool, tcpEstablished_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ContainerCheckpoint") -} - -// ContainerRestore restores a container that has been checkpointed. The container to be restored can -// be identified by its name or full/partial container ID. A successful restore will result in the return -// of the container's ID. -func (s *VarlinkInterface) ContainerRestore(ctx context.Context, c VarlinkCall, name_ string, keep_ bool, tcpEstablished_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ContainerRestore") -} - -// ContainerRunlabel runs executes a command as described by a given container image label. -func (s *VarlinkInterface) ContainerRunlabel(ctx context.Context, c VarlinkCall, runlabel_ Runlabel) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ContainerRunlabel") -} - -// ExecContainer executes a command in the given container. -func (s *VarlinkInterface) ExecContainer(ctx context.Context, c VarlinkCall, opts_ ExecOpts) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ExecContainer") -} - -// ListContainerMounts gathers all the mounted container mount points and returns them as an array -// of strings -// #### Example -// ~~~ -// $ varlink call unix:/run/podman/io.podman/io.podman.ListContainerMounts -// { -// "mounts": { -// "04e4c255269ed2545e7f8bd1395a75f7949c50c223415c00c1d54bfa20f3b3d9": "/var/lib/containers/storage/overlay/a078925828f57e20467ca31cfca8a849210d21ec7e5757332b72b6924f441c17/merged", -// "1d58c319f9e881a644a5122ff84419dccf6d138f744469281446ab243ef38924": "/var/lib/containers/storage/overlay/948fcf93f8cb932f0f03fd52e3180a58627d547192ffe3b88e0013b98ddcd0d2/merged" -// } -// } -// ~~~ -func (s *VarlinkInterface) ListContainerMounts(ctx context.Context, c VarlinkCall) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ListContainerMounts") -} - -// MountContainer mounts a container by name or full/partial ID. Upon a successful mount, the destination -// mount is returned as a string. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.MountContainer '{"name": "jolly_shannon"}'{ -// "path": "/var/lib/containers/storage/overlay/419eeb04e783ea159149ced67d9fcfc15211084d65e894792a96bedfae0470ca/merged" -// } -// ~~~ -func (s *VarlinkInterface) MountContainer(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.MountContainer") -} - -// UnmountContainer umounts a container by its name or full/partial container ID. -// #### Example -// ~~~ -// $ varlink call -m unix:/run/podman/io.podman/io.podman.UnmountContainer '{"name": "jolly_shannon", "force": false}' -// {} -// ~~~ -func (s *VarlinkInterface) UnmountContainer(ctx context.Context, c VarlinkCall, name_ string, force_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.UnmountContainer") -} - -// ImagesPrune removes all unused images from the local store. Upon successful pruning, -// the IDs of the removed images are returned. -func (s *VarlinkInterface) ImagesPrune(ctx context.Context, c VarlinkCall, all_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ImagesPrune") -} - -// GenerateKube generates a Kubernetes v1 Pod description of a Podman container or pod -// and its containers. The description is in YAML. See also [ReplayKube](ReplayKube). -func (s *VarlinkInterface) GenerateKube(ctx context.Context, c VarlinkCall, name_ string, service_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GenerateKube") -} - -// ContainerConfig returns a container's config in string form. This call is for -// development of Podman only and generally should not be used. -func (s *VarlinkInterface) ContainerConfig(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ContainerConfig") -} - -// ContainerArtifacts returns a container's artifacts in string form. This call is for -// development of Podman only and generally should not be used. -func (s *VarlinkInterface) ContainerArtifacts(ctx context.Context, c VarlinkCall, name_ string, artifactName_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ContainerArtifacts") -} - -// ContainerInspectData returns a container's inspect data in string form. This call is for -// development of Podman only and generally should not be used. -func (s *VarlinkInterface) ContainerInspectData(ctx context.Context, c VarlinkCall, name_ string, size_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ContainerInspectData") -} - -// ContainerStateData returns a container's state config in string form. This call is for -// development of Podman only and generally should not be used. -func (s *VarlinkInterface) ContainerStateData(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ContainerStateData") -} - -// PodStateData returns inspectr level information of a given pod in string form. This call is for -// development of Podman only and generally should not be used. -func (s *VarlinkInterface) PodStateData(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.PodStateData") -} - -// This call is for the development of Podman only and should not be used. -func (s *VarlinkInterface) CreateFromCC(ctx context.Context, c VarlinkCall, in_ []string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.CreateFromCC") -} - -// Spec returns the oci spec for a container. This call is for development of Podman only and generally should not be used. -func (s *VarlinkInterface) Spec(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.Spec") -} - -// Sendfile allows a remote client to send a file to the host -func (s *VarlinkInterface) SendFile(ctx context.Context, c VarlinkCall, type_ string, length_ int64) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.SendFile") -} - -// ReceiveFile allows the host to send a remote client a file -func (s *VarlinkInterface) ReceiveFile(ctx context.Context, c VarlinkCall, path_ string, delete_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ReceiveFile") -} - -// VolumeCreate creates a volume on a remote host -func (s *VarlinkInterface) VolumeCreate(ctx context.Context, c VarlinkCall, options_ VolumeCreateOpts) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.VolumeCreate") -} - -// VolumeRemove removes a volume on a remote host -func (s *VarlinkInterface) VolumeRemove(ctx context.Context, c VarlinkCall, options_ VolumeRemoveOpts) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.VolumeRemove") -} - -// GetVolumes gets slice of the volumes on a remote host -func (s *VarlinkInterface) GetVolumes(ctx context.Context, c VarlinkCall, args_ []string, all_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetVolumes") -} - -// InspectVolume inspects a single volume. Returns inspect JSON in the form of a -// string. -func (s *VarlinkInterface) InspectVolume(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.InspectVolume") -} - -// VolumesPrune removes unused volumes on the host -func (s *VarlinkInterface) VolumesPrune(ctx context.Context, c VarlinkCall) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.VolumesPrune") -} - -// ImageSave allows you to save an image from the local image storage to a tarball -func (s *VarlinkInterface) ImageSave(ctx context.Context, c VarlinkCall, options_ ImageSaveOptions) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.ImageSave") -} - -// GetPodsByContext allows you to get a list pod ids depending on all, latest, or a list of -// pod names. The definition of latest pod means the latest by creation date. In a multi- -// user environment, results might differ from what you expect. -func (s *VarlinkInterface) GetPodsByContext(ctx context.Context, c VarlinkCall, all_ bool, latest_ bool, args_ []string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetPodsByContext") -} - -// LoadImage allows you to load an image into local storage from a tarball. -func (s *VarlinkInterface) LoadImage(ctx context.Context, c VarlinkCall, name_ string, inputFile_ string, quiet_ bool, deleteFile_ bool) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.LoadImage") -} - -// GetEvents returns known libpod events filtered by the options provided. -func (s *VarlinkInterface) GetEvents(ctx context.Context, c VarlinkCall, filter_ []string, since_ string, until_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetEvents") -} - -// Diff returns a diff between libpod objects -func (s *VarlinkInterface) Diff(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.Diff") -} - -// GetLayersMapWithImageInfo is for the development of Podman and should not be used. -func (s *VarlinkInterface) GetLayersMapWithImageInfo(ctx context.Context, c VarlinkCall) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.GetLayersMapWithImageInfo") -} - -// BuildImageHierarchyMap is for the development of Podman and should not be used. -func (s *VarlinkInterface) BuildImageHierarchyMap(ctx context.Context, c VarlinkCall, name_ string) error { - return c.ReplyMethodNotImplemented(ctx, "io.podman.BuildImageHierarchyMap") -} - -// Generated method call dispatcher - -func (s *VarlinkInterface) VarlinkDispatch(ctx context.Context, call varlink.Call, methodname string) error { - switch methodname { - case "GetVersion": - return s.iopodmanInterface.GetVersion(ctx, VarlinkCall{call}) - - case "GetInfo": - return s.iopodmanInterface.GetInfo(ctx, VarlinkCall{call}) - - case "ListContainers": - return s.iopodmanInterface.ListContainers(ctx, VarlinkCall{call}) - - case "Ps": - var in struct { - Opts PsOpts `json:"opts"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.Ps(ctx, VarlinkCall{call}, in.Opts) - - case "GetContainersByStatus": - var in struct { - Status []string `json:"status"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetContainersByStatus(ctx, VarlinkCall{call}, []string(in.Status)) - - case "Top": - var in struct { - NameOrID string `json:"nameOrID"` - Descriptors []string `json:"descriptors"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.Top(ctx, VarlinkCall{call}, in.NameOrID, []string(in.Descriptors)) - - case "HealthCheckRun": - var in struct { - NameOrID string `json:"nameOrID"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.HealthCheckRun(ctx, VarlinkCall{call}, in.NameOrID) - - case "GetContainer": - var in struct { - Id string `json:"id"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetContainer(ctx, VarlinkCall{call}, in.Id) - - case "GetContainersByContext": - var in struct { - All bool `json:"all"` - Latest bool `json:"latest"` - Args []string `json:"args"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetContainersByContext(ctx, VarlinkCall{call}, in.All, in.Latest, []string(in.Args)) - - case "CreateContainer": - var in struct { - Create Create `json:"create"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.CreateContainer(ctx, VarlinkCall{call}, in.Create) - - case "InspectContainer": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.InspectContainer(ctx, VarlinkCall{call}, in.Name) - - case "ListContainerProcesses": - var in struct { - Name string `json:"name"` - Opts []string `json:"opts"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ListContainerProcesses(ctx, VarlinkCall{call}, in.Name, []string(in.Opts)) - - case "GetContainerLogs": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetContainerLogs(ctx, VarlinkCall{call}, in.Name) - - case "GetContainersLogs": - var in struct { - Names []string `json:"names"` - Follow bool `json:"follow"` - Latest bool `json:"latest"` - Since string `json:"since"` - Tail int64 `json:"tail"` - Timestamps bool `json:"timestamps"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetContainersLogs(ctx, VarlinkCall{call}, []string(in.Names), in.Follow, in.Latest, in.Since, in.Tail, in.Timestamps) - - case "ListContainerChanges": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ListContainerChanges(ctx, VarlinkCall{call}, in.Name) - - case "ExportContainer": - var in struct { - Name string `json:"name"` - Path string `json:"path"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ExportContainer(ctx, VarlinkCall{call}, in.Name, in.Path) - - case "GetContainerStats": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetContainerStats(ctx, VarlinkCall{call}, in.Name) - - case "GetContainerStatsWithHistory": - var in struct { - PreviousStats ContainerStats `json:"previousStats"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetContainerStatsWithHistory(ctx, VarlinkCall{call}, in.PreviousStats) - - case "StartContainer": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.StartContainer(ctx, VarlinkCall{call}, in.Name) - - case "StopContainer": - var in struct { - Name string `json:"name"` - Timeout int64 `json:"timeout"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.StopContainer(ctx, VarlinkCall{call}, in.Name, in.Timeout) - - case "InitContainer": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.InitContainer(ctx, VarlinkCall{call}, in.Name) - - case "RestartContainer": - var in struct { - Name string `json:"name"` - Timeout int64 `json:"timeout"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.RestartContainer(ctx, VarlinkCall{call}, in.Name, in.Timeout) - - case "KillContainer": - var in struct { - Name string `json:"name"` - Signal int64 `json:"signal"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.KillContainer(ctx, VarlinkCall{call}, in.Name, in.Signal) - - case "PauseContainer": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.PauseContainer(ctx, VarlinkCall{call}, in.Name) - - case "UnpauseContainer": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.UnpauseContainer(ctx, VarlinkCall{call}, in.Name) - - case "Attach": - var in struct { - Name string `json:"name"` - DetachKeys string `json:"detachKeys"` - Start bool `json:"start"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.Attach(ctx, VarlinkCall{call}, in.Name, in.DetachKeys, in.Start) - - case "AttachControl": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.AttachControl(ctx, VarlinkCall{call}, in.Name) - - case "GetAttachSockets": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetAttachSockets(ctx, VarlinkCall{call}, in.Name) - - case "WaitContainer": - var in struct { - Name string `json:"name"` - Interval int64 `json:"interval"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.WaitContainer(ctx, VarlinkCall{call}, in.Name, in.Interval) - - case "RemoveContainer": - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - RemoveVolumes bool `json:"removeVolumes"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.RemoveContainer(ctx, VarlinkCall{call}, in.Name, in.Force, in.RemoveVolumes) - - case "EvictContainer": - var in struct { - Name string `json:"name"` - RemoveVolumes bool `json:"removeVolumes"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.EvictContainer(ctx, VarlinkCall{call}, in.Name, in.RemoveVolumes) - - case "DeleteStoppedContainers": - return s.iopodmanInterface.DeleteStoppedContainers(ctx, VarlinkCall{call}) - - case "ListImages": - return s.iopodmanInterface.ListImages(ctx, VarlinkCall{call}) - - case "GetImage": - var in struct { - Id string `json:"id"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetImage(ctx, VarlinkCall{call}, in.Id) - - case "BuildImage": - var in struct { - Build BuildInfo `json:"build"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.BuildImage(ctx, VarlinkCall{call}, in.Build) - - case "InspectImage": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.InspectImage(ctx, VarlinkCall{call}, in.Name) - - case "HistoryImage": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.HistoryImage(ctx, VarlinkCall{call}, in.Name) - - case "PushImage": - var in struct { - Name string `json:"name"` - Tag string `json:"tag"` - Compress bool `json:"compress"` - Format string `json:"format"` - RemoveSignatures bool `json:"removeSignatures"` - SignBy string `json:"signBy"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.PushImage(ctx, VarlinkCall{call}, in.Name, in.Tag, in.Compress, in.Format, in.RemoveSignatures, in.SignBy) - - case "TagImage": - var in struct { - Name string `json:"name"` - Tagged string `json:"tagged"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.TagImage(ctx, VarlinkCall{call}, in.Name, in.Tagged) - - case "RemoveImage": - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.RemoveImage(ctx, VarlinkCall{call}, in.Name, in.Force) - - case "SearchImages": - var in struct { - Query string `json:"query"` - Limit *int64 `json:"limit,omitempty"` - Filter ImageSearchFilter `json:"filter"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.SearchImages(ctx, VarlinkCall{call}, in.Query, in.Limit, in.Filter) - - case "DeleteUnusedImages": - return s.iopodmanInterface.DeleteUnusedImages(ctx, VarlinkCall{call}) - - case "Commit": - var in struct { - Name string `json:"name"` - Image_name string `json:"image_name"` - Changes []string `json:"changes"` - Author string `json:"author"` - Message string `json:"message"` - Pause bool `json:"pause"` - ManifestType string `json:"manifestType"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.Commit(ctx, VarlinkCall{call}, in.Name, in.Image_name, []string(in.Changes), in.Author, in.Message, in.Pause, in.ManifestType) - - case "ImportImage": - var in struct { - Source string `json:"source"` - Reference string `json:"reference"` - Message string `json:"message"` - Changes []string `json:"changes"` - Delete bool `json:"delete"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ImportImage(ctx, VarlinkCall{call}, in.Source, in.Reference, in.Message, []string(in.Changes), in.Delete) - - case "ExportImage": - var in struct { - Name string `json:"name"` - Destination string `json:"destination"` - Compress bool `json:"compress"` - Tags []string `json:"tags"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ExportImage(ctx, VarlinkCall{call}, in.Name, in.Destination, in.Compress, []string(in.Tags)) - - case "PullImage": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.PullImage(ctx, VarlinkCall{call}, in.Name) - - case "CreatePod": - var in struct { - Create PodCreate `json:"create"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.CreatePod(ctx, VarlinkCall{call}, in.Create) - - case "ListPods": - return s.iopodmanInterface.ListPods(ctx, VarlinkCall{call}) - - case "GetPod": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetPod(ctx, VarlinkCall{call}, in.Name) - - case "InspectPod": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.InspectPod(ctx, VarlinkCall{call}, in.Name) - - case "StartPod": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.StartPod(ctx, VarlinkCall{call}, in.Name) - - case "StopPod": - var in struct { - Name string `json:"name"` - Timeout int64 `json:"timeout"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.StopPod(ctx, VarlinkCall{call}, in.Name, in.Timeout) - - case "RestartPod": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.RestartPod(ctx, VarlinkCall{call}, in.Name) - - case "KillPod": - var in struct { - Name string `json:"name"` - Signal int64 `json:"signal"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.KillPod(ctx, VarlinkCall{call}, in.Name, in.Signal) - - case "PausePod": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.PausePod(ctx, VarlinkCall{call}, in.Name) - - case "UnpausePod": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.UnpausePod(ctx, VarlinkCall{call}, in.Name) - - case "RemovePod": - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.RemovePod(ctx, VarlinkCall{call}, in.Name, in.Force) - - case "TopPod": - var in struct { - Pod string `json:"pod"` - Latest bool `json:"latest"` - Descriptors []string `json:"descriptors"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.TopPod(ctx, VarlinkCall{call}, in.Pod, in.Latest, []string(in.Descriptors)) - - case "GetPodStats": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetPodStats(ctx, VarlinkCall{call}, in.Name) - - case "GetPodsByStatus": - var in struct { - Statuses []string `json:"statuses"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetPodsByStatus(ctx, VarlinkCall{call}, []string(in.Statuses)) - - case "ImageExists": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ImageExists(ctx, VarlinkCall{call}, in.Name) - - case "ContainerExists": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ContainerExists(ctx, VarlinkCall{call}, in.Name) - - case "ContainerCheckpoint": - var in struct { - Name string `json:"name"` - Keep bool `json:"keep"` - LeaveRunning bool `json:"leaveRunning"` - TcpEstablished bool `json:"tcpEstablished"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ContainerCheckpoint(ctx, VarlinkCall{call}, in.Name, in.Keep, in.LeaveRunning, in.TcpEstablished) - - case "ContainerRestore": - var in struct { - Name string `json:"name"` - Keep bool `json:"keep"` - TcpEstablished bool `json:"tcpEstablished"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ContainerRestore(ctx, VarlinkCall{call}, in.Name, in.Keep, in.TcpEstablished) - - case "ContainerRunlabel": - var in struct { - Runlabel Runlabel `json:"runlabel"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ContainerRunlabel(ctx, VarlinkCall{call}, in.Runlabel) - - case "ExecContainer": - var in struct { - Opts ExecOpts `json:"opts"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ExecContainer(ctx, VarlinkCall{call}, in.Opts) - - case "ListContainerMounts": - return s.iopodmanInterface.ListContainerMounts(ctx, VarlinkCall{call}) - - case "MountContainer": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.MountContainer(ctx, VarlinkCall{call}, in.Name) - - case "UnmountContainer": - var in struct { - Name string `json:"name"` - Force bool `json:"force"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.UnmountContainer(ctx, VarlinkCall{call}, in.Name, in.Force) - - case "ImagesPrune": - var in struct { - All bool `json:"all"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ImagesPrune(ctx, VarlinkCall{call}, in.All) - - case "GenerateKube": - var in struct { - Name string `json:"name"` - Service bool `json:"service"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GenerateKube(ctx, VarlinkCall{call}, in.Name, in.Service) - - case "ContainerConfig": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ContainerConfig(ctx, VarlinkCall{call}, in.Name) - - case "ContainerArtifacts": - var in struct { - Name string `json:"name"` - ArtifactName string `json:"artifactName"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ContainerArtifacts(ctx, VarlinkCall{call}, in.Name, in.ArtifactName) - - case "ContainerInspectData": - var in struct { - Name string `json:"name"` - Size bool `json:"size"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ContainerInspectData(ctx, VarlinkCall{call}, in.Name, in.Size) - - case "ContainerStateData": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ContainerStateData(ctx, VarlinkCall{call}, in.Name) - - case "PodStateData": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.PodStateData(ctx, VarlinkCall{call}, in.Name) - - case "CreateFromCC": - var in struct { - In []string `json:"in"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.CreateFromCC(ctx, VarlinkCall{call}, []string(in.In)) - - case "Spec": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.Spec(ctx, VarlinkCall{call}, in.Name) - - case "SendFile": - var in struct { - Type string `json:"type"` - Length int64 `json:"length"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.SendFile(ctx, VarlinkCall{call}, in.Type, in.Length) - - case "ReceiveFile": - var in struct { - Path string `json:"path"` - Delete bool `json:"delete"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ReceiveFile(ctx, VarlinkCall{call}, in.Path, in.Delete) - - case "VolumeCreate": - var in struct { - Options VolumeCreateOpts `json:"options"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.VolumeCreate(ctx, VarlinkCall{call}, in.Options) - - case "VolumeRemove": - var in struct { - Options VolumeRemoveOpts `json:"options"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.VolumeRemove(ctx, VarlinkCall{call}, in.Options) - - case "GetVolumes": - var in struct { - Args []string `json:"args"` - All bool `json:"all"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetVolumes(ctx, VarlinkCall{call}, []string(in.Args), in.All) - - case "InspectVolume": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.InspectVolume(ctx, VarlinkCall{call}, in.Name) - - case "VolumesPrune": - return s.iopodmanInterface.VolumesPrune(ctx, VarlinkCall{call}) - - case "ImageSave": - var in struct { - Options ImageSaveOptions `json:"options"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.ImageSave(ctx, VarlinkCall{call}, in.Options) - - case "GetPodsByContext": - var in struct { - All bool `json:"all"` - Latest bool `json:"latest"` - Args []string `json:"args"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetPodsByContext(ctx, VarlinkCall{call}, in.All, in.Latest, []string(in.Args)) - - case "LoadImage": - var in struct { - Name string `json:"name"` - InputFile string `json:"inputFile"` - Quiet bool `json:"quiet"` - DeleteFile bool `json:"deleteFile"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.LoadImage(ctx, VarlinkCall{call}, in.Name, in.InputFile, in.Quiet, in.DeleteFile) - - case "GetEvents": - var in struct { - Filter []string `json:"filter"` - Since string `json:"since"` - Until string `json:"until"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.GetEvents(ctx, VarlinkCall{call}, []string(in.Filter), in.Since, in.Until) - - case "Diff": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.Diff(ctx, VarlinkCall{call}, in.Name) - - case "GetLayersMapWithImageInfo": - return s.iopodmanInterface.GetLayersMapWithImageInfo(ctx, VarlinkCall{call}) - - case "BuildImageHierarchyMap": - var in struct { - Name string `json:"name"` - } - err := call.GetParameters(&in) - if err != nil { - return call.ReplyInvalidParameter(ctx, "parameters") - } - return s.iopodmanInterface.BuildImageHierarchyMap(ctx, VarlinkCall{call}, in.Name) - - default: - return call.ReplyMethodNotFound(ctx, methodname) - } -} - -// Generated varlink interface name - -func (s *VarlinkInterface) VarlinkGetName() string { - return `io.podman` -} - -// Generated varlink interface description - -func (s *VarlinkInterface) VarlinkGetDescription() string { - return `# Podman Service Interface and API description. The master version of this document can be found -# in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in the upstream libpod repository. -interface io.podman - -type Volume ( - name: string, - labels: [string]string, - mountPoint: string, - driver: string, - options: [string]string -) - -type NotImplemented ( - comment: string -) - -type StringResponse ( - message: string -) - -type LogLine ( - device: string, - parseLogType : string, - time: string, - msg: string, - cid: string -) - -# ContainerChanges describes the return struct for ListContainerChanges -type ContainerChanges ( - changed: []string, - added: []string, - deleted: []string -) - -type ImageSaveOptions ( - name: string, - format: string, - output: string, - outputType: string, - moreTags: []string, - quiet: bool, - compress: bool -) - -type VolumeCreateOpts ( - volumeName: string, - driver: string, - labels: [string]string, - options: [string]string -) - -type VolumeRemoveOpts ( - volumes: []string, - all: bool, - force: bool -) - -type Image ( - id: string, - digest: string, - digests: []string, - parentId: string, - repoTags: []string, - repoDigests: []string, - created: string, # as RFC3339 - size: int, - virtualSize: int, - containers: int, - labels: [string]string, - isParent: bool, - topLayer: string, - readOnly: bool -) - -# ImageHistory describes the returned structure from ImageHistory. -type ImageHistory ( - id: string, - created: string, # as RFC3339 - createdBy: string, - tags: []string, - size: int, - comment: string -) - -# Represents a single search result from SearchImages -type ImageSearchResult ( - description: string, - is_official: bool, - is_automated: bool, - registry: string, - name: string, - star_count: int -) - -type ImageSearchFilter ( - is_official: ?bool, - is_automated: ?bool, - star_count: int -) - -type KubePodService ( - pod: string, - service: string -) - -type Container ( - id: string, - image: string, - imageid: string, - command: []string, - createdat: string, # as RFC3339 - runningfor: string, - status: string, - ports: []ContainerPortMappings, - rootfssize: int, - rwsize: int, - names: string, - labels: [string]string, - mounts: []ContainerMount, - containerrunning: bool, - namespaces: ContainerNameSpace -) - -# ContainerStats is the return struct for the stats of a container -type ContainerStats ( - id: string, - name: string, - cpu: float, - cpu_nano: int, - system_nano: int, - mem_usage: int, - mem_limit: int, - mem_perc: float, - net_input: int, - net_output: int, - block_output: int, - block_input: int, - pids: int -) - -type PsOpts ( - all: bool, - filters: ?[]string, - last: ?int, - latest: ?bool, - noTrunc: ?bool, - pod: ?bool, - quiet: ?bool, - size: ?bool, - sort: ?string, - sync: ?bool -) - -type PsContainer ( - id: string, - image: string, - command: string, - created: string, - ports: string, - names: string, - isInfra: bool, - status: string, - state: string, - pidNum: int, - rootFsSize: int, - rwSize: int, - pod: string, - createdAt: string, - exitedAt: string, - startedAt: string, - labels: [string]string, - nsPid: string, - cgroup: string, - ipc: string, - mnt: string, - net: string, - pidNs: string, - user: string, - uts: string, - mounts: string -) - -# ContainerMount describes the struct for mounts in a container -type ContainerMount ( - destination: string, - type: string, - source: string, - options: []string -) - -# ContainerPortMappings describes the struct for portmappings in an existing container -type ContainerPortMappings ( - host_port: string, - host_ip: string, - protocol: string, - container_port: string -) - -# ContainerNamespace describes the namespace structure for an existing container -type ContainerNameSpace ( - user: string, - uts: string, - pidns: string, - pid: string, - cgroup: string, - net: string, - mnt: string, - ipc: string -) - -# InfoDistribution describes the host's distribution -type InfoDistribution ( - distribution: string, - version: string -) - -# InfoHost describes the host stats portion of PodmanInfo -type InfoHost ( - buildah_version: string, - distribution: InfoDistribution, - mem_free: int, - mem_total: int, - swap_free: int, - swap_total: int, - arch: string, - cpus: int, - hostname: string, - kernel: string, - os: string, - uptime: string, - eventlogger: string -) - -# InfoGraphStatus describes the detailed status of the storage driver -type InfoGraphStatus ( - backing_filesystem: string, - native_overlay_diff: string, - supports_d_type: string -) - -# InfoStore describes the host's storage informatoin -type InfoStore ( - containers: int, - images: int, - graph_driver_name: string, - graph_driver_options: string, - graph_root: string, - graph_status: InfoGraphStatus, - run_root: string -) - -# InfoPodman provides details on the Podman binary -type InfoPodmanBinary ( - compiler: string, - go_version: string, - podman_version: string, - git_commit: string -) - -# PodmanInfo describes the Podman host and build -type PodmanInfo ( - host: InfoHost, - registries: []string, - insecure_registries: []string, - store: InfoStore, - podman: InfoPodmanBinary -) - -# Sockets describes sockets location for a container -type Sockets( - container_id: string, - io_socket: string, - control_socket: string -) - -# Create is an input structure for creating containers. -# args[0] is the image name or id -# args[1-] are the new commands if changed -type Create ( - args: []string, - addHost: ?[]string, - annotation: ?[]string, - attach: ?[]string, - blkioWeight: ?string, - blkioWeightDevice: ?[]string, - capAdd: ?[]string, - capDrop: ?[]string, - cgroupParent: ?string, - cidFile: ?string, - conmonPidfile: ?string, - command: ?[]string, - cpuPeriod: ?int, - cpuQuota: ?int, - cpuRtPeriod: ?int, - cpuRtRuntime: ?int, - cpuShares: ?int, - cpus: ?float, - cpuSetCpus: ?string, - cpuSetMems: ?string, - detach: ?bool, - detachKeys: ?string, - device: ?[]string, - deviceReadBps: ?[]string, - deviceReadIops: ?[]string, - deviceWriteBps: ?[]string, - deviceWriteIops: ?[]string, - dns: ?[]string, - dnsOpt: ?[]string, - dnsSearch: ?[]string, - dnsServers: ?[]string, - entrypoint: ?string, - env: ?[]string, - envFile: ?[]string, - expose: ?[]string, - gidmap: ?[]string, - groupadd: ?[]string, - healthcheckCommand: ?string, - healthcheckInterval: ?string, - healthcheckRetries: ?int, - healthcheckStartPeriod: ?string, - healthcheckTimeout:?string, - hostname: ?string, - imageVolume: ?string, - init: ?bool, - initPath: ?string, - interactive: ?bool, - ip: ?string, - ipc: ?string, - kernelMemory: ?string, - label: ?[]string, - labelFile: ?[]string, - logDriver: ?string, - logOpt: ?[]string, - macAddress: ?string, - memory: ?string, - memoryReservation: ?string, - memorySwap: ?string, - memorySwappiness: ?int, - name: ?string, - net: ?string, - network: ?string, - noHosts: ?bool, - oomKillDisable: ?bool, - oomScoreAdj: ?int, - overrideArch: ?string, - overrideOS: ?string, - pid: ?string, - pidsLimit: ?int, - pod: ?string, - privileged: ?bool, - publish: ?[]string, - publishAll: ?bool, - pull: ?string, - quiet: ?bool, - readonly: ?bool, - readonlytmpfs: ?bool, - restart: ?string, - rm: ?bool, - rootfs: ?bool, - securityOpt: ?[]string, - shmSize: ?string, - stopSignal: ?string, - stopTimeout: ?int, - storageOpt: ?[]string, - subuidname: ?string, - subgidname: ?string, - sysctl: ?[]string, - systemd: ?string, - tmpfs: ?[]string, - tty: ?bool, - uidmap: ?[]string, - ulimit: ?[]string, - user: ?string, - userns: ?string, - uts: ?string, - mount: ?[]string, - volume: ?[]string, - volumesFrom: ?[]string, - workDir: ?string -) - -# BuildOptions are are used to describe describe physical attributes of the build -type BuildOptions ( - addHosts: []string, - cgroupParent: string, - cpuPeriod: int, - cpuQuota: int, - cpuShares: int, - cpusetCpus: string, - cpusetMems: string, - memory: int, - memorySwap: int, - shmSize: string, - ulimit: []string, - volume: []string -) - -# BuildInfo is used to describe user input for building images -type BuildInfo ( - additionalTags: []string, - annotations: []string, - buildArgs: [string]string, - buildOptions: BuildOptions, - cniConfigDir: string, - cniPluginDir: string, - compression: string, - contextDir: string, - defaultsMountFilePath: string, - dockerfiles: []string, - err: string, - forceRmIntermediateCtrs: bool, - iidfile: string, - label: []string, - layers: bool, - nocache: bool, - out: string, - output: string, - outputFormat: string, - pullPolicy: string, - quiet: bool, - remoteIntermediateCtrs: bool, - reportWriter: string, - runtimeArgs: []string, - squash: bool -) - -# MoreResponse is a struct for when responses from varlink requires longer output -type MoreResponse ( - logs: []string, - id: string -) - -# ListPodContainerInfo is a returned struct for describing containers -# in a pod. -type ListPodContainerInfo ( - name: string, - id: string, - status: string -) - -# PodCreate is an input structure for creating pods. -# It emulates options to podman pod create. The infraCommand and -# infraImage options are currently NotSupported. -type PodCreate ( - name: string, - cgroupParent: string, - labels: [string]string, - share: []string, - infra: bool, - infraCommand: string, - infraImage: string, - publish: []string -) - -# ListPodData is the returned struct for an individual pod -type ListPodData ( - id: string, - name: string, - createdat: string, - cgroup: string, - status: string, - labels: [string]string, - numberofcontainers: string, - containersinfo: []ListPodContainerInfo -) - -type PodContainerErrorData ( - containerid: string, - reason: string -) - -# Runlabel describes the required input for container runlabel -type Runlabel( - image: string, - authfile: string, - display: bool, - name: string, - pull: bool, - label: string, - extraArgs: []string, - opts: [string]string -) - -# Event describes a libpod struct -type Event( - # TODO: make status and type a enum at some point? - # id is the container, volume, pod, image ID - id: string, - # image is the image name where applicable - image: string, - # name is the name of the pod, container, image - name: string, - # status describes the event that happened (i.e. create, remove, ...) - status: string, - # time the event happened - time: string, - # type describes object the event happened with (image, container...) - type: string -) - -type DiffInfo( - # path that is different - path: string, - # Add, Delete, Modify - changeType: string -) - -type ExecOpts( - # container name or id - name: string, - # Create pseudo tty - tty: bool, - # privileged access in container - privileged: bool, - # command to execute in container - cmd: []string, - # user to use in container - user: ?string, - # workdir to run command in container - workdir: ?string, - # slice of keyword=value environment variables - env: ?[]string, - # string of detach keys - detachKeys: ?string -) - -# GetVersion returns version and build information of the podman service -method GetVersion() -> ( - version: string, - go_version: string, - git_commit: string, - built: string, # as RFC3339 - os_arch: string, - remote_api_version: int -) - -# GetInfo returns a [PodmanInfo](#PodmanInfo) struct that describes podman and its host such as storage stats, -# build information of Podman, and system-wide registries. -method GetInfo() -> (info: PodmanInfo) - -# ListContainers returns information about all containers. -# See also [GetContainer](#GetContainer). -method ListContainers() -> (containers: []Container) - -method Ps(opts: PsOpts) -> (containers: []PsContainer) - -method GetContainersByStatus(status: []string) -> (containerS: []Container) - -method Top (nameOrID: string, descriptors: []string) -> (top: []string) - -# HealthCheckRun executes defined container's healthcheck command -# and returns the container's health status. -method HealthCheckRun (nameOrID: string) -> (healthCheckStatus: string) - -# GetContainer returns information about a single container. If a container -# with the given id doesn't exist, a [ContainerNotFound](#ContainerNotFound) -# error will be returned. See also [ListContainers](ListContainers) and -# [InspectContainer](#InspectContainer). -method GetContainer(id: string) -> (container: Container) - -# GetContainersByContext allows you to get a list of container ids depending on all, latest, or a list of -# container names. The definition of latest container means the latest by creation date. In a multi- -# user environment, results might differ from what you expect. -method GetContainersByContext(all: bool, latest: bool, args: []string) -> (containers: []string) - -# CreateContainer creates a new container from an image. It uses a [Create](#Create) type for input. -method CreateContainer(create: Create) -> (container: string) - -# InspectContainer data takes a name or ID of a container returns the inspection -# data in string format. You can then serialize the string into JSON. A [ContainerNotFound](#ContainerNotFound) -# error will be returned if the container cannot be found. See also [InspectImage](#InspectImage). -method InspectContainer(name: string) -> (container: string) - -# ListContainerProcesses takes a name or ID of a container and returns the processes -# running inside the container as array of strings. It will accept an array of string -# arguments that represent ps options. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -# error will be returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}' -# { -# "container": [ -# " UID PID PPID C STIME TTY TIME CMD", -# " 0 21220 21210 0 09:05 pts/0 00:00:00 /bin/sh", -# " 0 21232 21220 0 09:05 pts/0 00:00:00 top", -# " 0 21284 21220 0 09:05 pts/0 00:00:00 vi /etc/hosts" -# ] -# } -# ~~~ -method ListContainerProcesses(name: string, opts: []string) -> (container: []string) - -# GetContainerLogs takes a name or ID of a container and returns the logs of that container. -# If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) error will be returned. -# The container logs are returned as an array of strings. GetContainerLogs will honor the streaming -# capability of varlink if the client invokes it. -method GetContainerLogs(name: string) -> (container: []string) - -method GetContainersLogs(names: []string, follow: bool, latest: bool, since: string, tail: int, timestamps: bool) -> (log: LogLine) - -# ListContainerChanges takes a name or ID of a container and returns changes between the container and -# its base image. It returns a struct of changed, deleted, and added path names. -method ListContainerChanges(name: string) -> (container: ContainerChanges) - -# ExportContainer creates an image from a container. It takes the name or ID of a container and a -# path representing the target tarfile. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -# error will be returned. -# The return value is the written tarfile. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.ExportContainer '{"name": "flamboyant_payne", "path": "/tmp/payne.tar" }' -# { -# "tarfile": "/tmp/payne.tar" -# } -# ~~~ -method ExportContainer(name: string, path: string) -> (tarfile: string) - -# GetContainerStats takes the name or ID of a container and returns a single ContainerStats structure which -# contains attributes like memory and cpu usage. If the container cannot be found, a -# [ContainerNotFound](#ContainerNotFound) error will be returned. If the container is not running, a [NoContainerRunning](#NoContainerRunning) -# error will be returned -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.GetContainerStats '{"name": "c33e4164f384"}' -# { -# "container": { -# "block_input": 0, -# "block_output": 0, -# "cpu": 2.571123918839990154678e-08, -# "cpu_nano": 49037378, -# "id": "c33e4164f384aa9d979072a63319d66b74fd7a128be71fa68ede24f33ec6cfee", -# "mem_limit": 33080606720, -# "mem_perc": 2.166828456524753747370e-03, -# "mem_usage": 716800, -# "name": "competent_wozniak", -# "net_input": 768, -# "net_output": 5910, -# "pids": 1, -# "system_nano": 10000000 -# } -# } -# ~~~ -method GetContainerStats(name: string) -> (container: ContainerStats) - -# GetContainerStatsWithHistory takes a previous set of container statistics and uses libpod functions -# to calculate the containers statistics based on current and previous measurements. -method GetContainerStatsWithHistory(previousStats: ContainerStats) -> (container: ContainerStats) - -# This method has not be implemented yet. -# method ResizeContainerTty() -> (notimplemented: NotImplemented) - -# StartContainer starts a created or stopped container. It takes the name or ID of container. It returns -# the container ID once started. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -# error will be returned. See also [CreateContainer](#CreateContainer). -method StartContainer(name: string) -> (container: string) - -# StopContainer stops a container given a timeout. It takes the name or ID of a container as well as a -# timeout value. The timeout value the time before a forcible stop to the container is applied. It -# returns the container ID once stopped. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -# error will be returned instead. See also [KillContainer](KillContainer). -# #### Error -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}' -# { -# "container": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -# } -# ~~~ -method StopContainer(name: string, timeout: int) -> (container: string) - -# InitContainer initializes the given container. It accepts a container name or -# ID, and will initialize the container matching that ID if possible, and error -# if not. Containers can only be initialized when they are in the Created or -# Exited states. Initialization prepares a container to be started, but does not -# start the container. It is intended to be used to debug a container's state -# prior to starting it. -method InitContainer(name: string) -> (container: string) - -# RestartContainer will restart a running container given a container name or ID and timeout value. The timeout -# value is the time before a forcible stop is used to stop the container. If the container cannot be found by -# name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise, the ID of the -# container will be returned. -method RestartContainer(name: string, timeout: int) -> (container: string) - -# KillContainer takes the name or ID of a container as well as a signal to be applied to the container. Once the -# container has been killed, the container's ID is returned. If the container cannot be found, a -# [ContainerNotFound](#ContainerNotFound) error is returned. See also [StopContainer](StopContainer). -method KillContainer(name: string, signal: int) -> (container: string) - -# This method has not be implemented yet. -# method UpdateContainer() -> (notimplemented: NotImplemented) - -# This method has not be implemented yet. -# method RenameContainer() -> (notimplemented: NotImplemented) - -# PauseContainer takes the name or ID of container and pauses it. If the container cannot be found, -# a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. -# See also [UnpauseContainer](#UnpauseContainer). -method PauseContainer(name: string) -> (container: string) - -# UnpauseContainer takes the name or ID of container and unpauses a paused container. If the container cannot be -# found, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. -# See also [PauseContainer](#PauseContainer). -method UnpauseContainer(name: string) -> (container: string) - -# Attach takes the name or ID of a container and sets up the ability to remotely attach to its console. The start -# bool is whether you wish to start the container in question first. -method Attach(name: string, detachKeys: string, start: bool) -> () - -method AttachControl(name: string) -> () - -# GetAttachSockets takes the name or ID of an existing container. It returns file paths for two sockets needed -# to properly communicate with a container. The first is the actual I/O socket that the container uses. The -# second is a "control" socket where things like resizing the TTY events are sent. If the container cannot be -# found, a [ContainerNotFound](#ContainerNotFound) error will be returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/io.podman/io.podman.GetAttachSockets '{"name": "b7624e775431219161"}' -# { -# "sockets": { -# "container_id": "b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca", -# "control_socket": "/var/lib/containers/storage/overlay-containers/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/userdata/ctl", -# "io_socket": "/var/run/libpod/socket/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/attach" -# } -# } -# ~~~ -method GetAttachSockets(name: string) -> (sockets: Sockets) - -# WaitContainer takes the name or ID of a container and waits the given interval in milliseconds until the container -# stops. Upon stopping, the return code of the container is returned. If the container container cannot be found by ID -# or name, a [ContainerNotFound](#ContainerNotFound) error is returned. -method WaitContainer(name: string, interval: int) -> (exitcode: int) - -# RemoveContainer requires the name or ID of a container as well as a boolean that -# indicates whether a container should be forcefully removed (e.g., by stopping it), and a boolean -# indicating whether to remove builtin volumes. Upon successful removal of the -# container, its ID is returned. If the -# container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned. -# See also [EvictContainer](EvictContainer). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.RemoveContainer '{"name": "62f4fd98cb57"}' -# { -# "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -# } -# ~~~ -method RemoveContainer(name: string, force: bool, removeVolumes: bool) -> (container: string) - -# EvictContainer requires the name or ID of a container as well as a boolean that -# indicates to remove builtin volumes. Upon successful eviction of the container, -# its ID is returned. If the container cannot be found by name or ID, -# a [ContainerNotFound](#ContainerNotFound) error will be returned. -# See also [RemoveContainer](RemoveContainer). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.EvictContainer '{"name": "62f4fd98cb57"}' -# { -# "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -# } -# ~~~ -method EvictContainer(name: string, removeVolumes: bool) -> (container: string) - -# DeleteStoppedContainers will delete all containers that are not running. It will return a list the deleted -# container IDs. See also [RemoveContainer](RemoveContainer). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.DeleteStoppedContainers -# { -# "containers": [ -# "451410b931d00def8aa9b4f8084e4d4a39e5e04ea61f358cf53a5cf95afcdcee", -# "8b60f754a3e01389494a9581ade97d35c2765b6e2f19acd2d3040c82a32d1bc0", -# "cf2e99d4d3cad6073df199ed32bbe64b124f3e1aba6d78821aa8460e70d30084", -# "db901a329587312366e5ecff583d08f0875b4b79294322df67d90fc6eed08fc1" -# ] -# } -# ~~~ -method DeleteStoppedContainers() -> (containers: []string) - -# ListImages returns information about the images that are currently in storage. -# See also [InspectImage](#InspectImage). -method ListImages() -> (images: []Image) - -# GetImage returns information about a single image in storage. -# If the image caGetImage returns be found, [ImageNotFound](#ImageNotFound) will be returned. -method GetImage(id: string) -> (image: Image) - -# BuildImage takes a [BuildInfo](#BuildInfo) structure and builds an image. At a minimum, you must provide the -# contextDir tarball path, the 'dockerfiles' path, and 'output' option in the BuildInfo structure. The 'output' -# options is the name of the of the resulting build. It will return a [MoreResponse](#MoreResponse) structure -# that contains the build logs and resulting image ID. -# #### Example -# ~~~ -# $ sudo varlink call -m unix:///run/podman/io.podman/io.podman.BuildImage '{"build":{"contextDir":"/tmp/t/context.tar","dockerfiles":["Dockerfile"], "output":"foobar"}}' -# { -# "image": { -# "id": "", -# "logs": [ -# "STEP 1: FROM alpine\n" -# ] -# } -# } -# { -# "image": { -# "id": "", -# "logs": [ -# "STEP 2: COMMIT foobar\n" -# ] -# } -# } -# { -# "image": { -# "id": "", -# "logs": [ -# "b7b28af77ffec6054d13378df4fdf02725830086c7444d9c278af25312aa39b9\n" -# ] -# } -# } -# { -# "image": { -# "id": "b7b28af77ffec6054d13378df4fdf02725830086c7444d9c278af25312aa39b9", -# "logs": [] -# } -# } -# ~~~ -method BuildImage(build: BuildInfo) -> (image: MoreResponse) - -# This function is not implemented yet. -# method CreateImage() -> (notimplemented: NotImplemented) - -# InspectImage takes the name or ID of an image and returns a string representation of data associated with the -#image. You must serialize the string into JSON to use it further. An [ImageNotFound](#ImageNotFound) error will -# be returned if the image cannot be found. -method InspectImage(name: string) -> (image: string) - -# HistoryImage takes the name or ID of an image and returns information about its history and layers. The returned -# history is in the form of an array of ImageHistory structures. If the image cannot be found, an -# [ImageNotFound](#ImageNotFound) error is returned. -method HistoryImage(name: string) -> (history: []ImageHistory) - -# PushImage takes two input arguments: the name or ID of an image, the fully-qualified destination name of the image, -# It will return an [ImageNotFound](#ImageNotFound) error if -# the image cannot be found in local storage; otherwise it will return a [MoreResponse](#MoreResponse) -method PushImage(name: string, tag: string, compress: bool, format: string, removeSignatures: bool, signBy: string) -> (reply: MoreResponse) - -# TagImage takes the name or ID of an image in local storage as well as the desired tag name. If the image cannot -# be found, an [ImageNotFound](#ImageNotFound) error will be returned; otherwise, the ID of the image is returned on success. -method TagImage(name: string, tagged: string) -> (image: string) - -# RemoveImage takes the name or ID of an image as well as a boolean that determines if containers using that image -# should be deleted. If the image cannot be found, an [ImageNotFound](#ImageNotFound) error will be returned. The -# ID of the removed image is returned when complete. See also [DeleteUnusedImages](DeleteUnusedImages). -# #### Example -# ~~~ -# varlink call -m unix:/run/podman/io.podman/io.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}' -# { -# "image": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e" -# } -# ~~~ -method RemoveImage(name: string, force: bool) -> (image: string) - -# SearchImages searches available registries for images that contain the -# contents of "query" in their name. If "limit" is given, limits the amount of -# search results per registry. -method SearchImages(query: string, limit: ?int, filter: ImageSearchFilter) -> (results: []ImageSearchResult) - -# DeleteUnusedImages deletes any images not associated with a container. The IDs of the deleted images are returned -# in a string array. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.DeleteUnusedImages -# { -# "images": [ -# "166ea6588079559c724c15223f52927f514f73dd5c5cf2ae2d143e3b2e6e9b52", -# "da86e6ba6ca197bf6bc5e9d900febd906b133eaa4750e6bed647b0fbe50ed43e", -# "3ef70f7291f47dfe2b82931a993e16f5a44a0e7a68034c3e0e086d77f5829adc", -# "59788edf1f3e78cd0ebe6ce1446e9d10788225db3dedcfd1a59f764bad2b2690" -# ] -# } -# ~~~ -method DeleteUnusedImages() -> (images: []string) - -# Commit, creates an image from an existing container. It requires the name or -# ID of the container as well as the resulting image name. Optionally, you can define an author and message -# to be added to the resulting image. You can also define changes to the resulting image for the following -# attributes: _CMD, ENTRYPOINT, ENV, EXPOSE, LABEL, ONBUILD, STOPSIGNAL, USER, VOLUME, and WORKDIR_. To pause the -# container while it is being committed, pass a _true_ bool for the pause argument. If the container cannot -# be found by the ID or name provided, a (ContainerNotFound)[#ContainerNotFound] error will be returned; otherwise, -# the resulting image's ID will be returned as a string inside a MoreResponse. -method Commit(name: string, image_name: string, changes: []string, author: string, message: string, pause: bool, manifestType: string) -> (reply: MoreResponse) - -# ImportImage imports an image from a source (like tarball) into local storage. The image can have additional -# descriptions added to it using the message and changes options. See also [ExportImage](ExportImage). -method ImportImage(source: string, reference: string, message: string, changes: []string, delete: bool) -> (image: string) - -# ExportImage takes the name or ID of an image and exports it to a destination like a tarball. There is also -# a boolean option to force compression. It also takes in a string array of tags to be able to save multiple -# tags of the same image to a tarball (each tag should be of the form :). Upon completion, the ID -# of the image is returned. If the image cannot be found in local storage, an [ImageNotFound](#ImageNotFound) -# error will be returned. See also [ImportImage](ImportImage). -method ExportImage(name: string, destination: string, compress: bool, tags: []string) -> (image: string) - -# PullImage pulls an image from a repository to local storage. After a successful pull, the image id and logs -# are returned as a [MoreResponse](#MoreResponse). This connection also will handle a WantsMores request to send -# status as it occurs. -method PullImage(name: string) -> (reply: MoreResponse) - -# CreatePod creates a new empty pod. It uses a [PodCreate](#PodCreate) type for input. -# On success, the ID of the newly created pod will be returned. -# #### Example -# ~~~ -# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"name": "test"}}' -# { -# "pod": "b05dee7bd4ccfee688099fe1588a7a898d6ddd6897de9251d4671c9b0feacb2a" -# } -# -# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"infra": true, "share": ["ipc", "net", "uts"]}}' -# { -# "pod": "d7697449a8035f613c1a8891286502aca68fff7d5d49a85279b3bda229af3b28" -# } -# ~~~ -method CreatePod(create: PodCreate) -> (pod: string) - -# ListPods returns a list of pods in no particular order. They are -# returned as an array of ListPodData structs. See also [GetPod](#GetPod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.ListPods -# { -# "pods": [ -# { -# "cgroup": "machine.slice", -# "containersinfo": [ -# { -# "id": "00c130a45de0411f109f1a0cfea2e298df71db20fa939de5cab8b2160a36be45", -# "name": "1840835294cf-infra", -# "status": "running" -# }, -# { -# "id": "49a5cce72093a5ca47c6de86f10ad7bb36391e2d89cef765f807e460865a0ec6", -# "name": "upbeat_murdock", -# "status": "running" -# } -# ], -# "createdat": "2018-12-07 13:10:15.014139258 -0600 CST", -# "id": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f", -# "name": "foobar", -# "numberofcontainers": "2", -# "status": "Running" -# }, -# { -# "cgroup": "machine.slice", -# "containersinfo": [ -# { -# "id": "1ca4b7bbba14a75ba00072d4b705c77f3df87db0109afaa44d50cb37c04a477e", -# "name": "784306f655c6-infra", -# "status": "running" -# } -# ], -# "createdat": "2018-12-07 13:09:57.105112457 -0600 CST", -# "id": "784306f655c6200aea321dd430ba685e9b2cc1f7d7528a72f3ff74ffb29485a2", -# "name": "nostalgic_pike", -# "numberofcontainers": "1", -# "status": "Running" -# } -# ] -# } -# ~~~ -method ListPods() -> (pods: []ListPodData) - -# GetPod takes a name or ID of a pod and returns single [ListPodData](#ListPodData) -# structure. A [PodNotFound](#PodNotFound) error will be returned if the pod cannot be found. -# See also [ListPods](ListPods). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.GetPod '{"name": "foobar"}' -# { -# "pod": { -# "cgroup": "machine.slice", -# "containersinfo": [ -# { -# "id": "00c130a45de0411f109f1a0cfea2e298df71db20fa939de5cab8b2160a36be45", -# "name": "1840835294cf-infra", -# "status": "running" -# }, -# { -# "id": "49a5cce72093a5ca47c6de86f10ad7bb36391e2d89cef765f807e460865a0ec6", -# "name": "upbeat_murdock", -# "status": "running" -# } -# ], -# "createdat": "2018-12-07 13:10:15.014139258 -0600 CST", -# "id": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f", -# "name": "foobar", -# "numberofcontainers": "2", -# "status": "Running" -# } -# } -# ~~~ -method GetPod(name: string) -> (pod: ListPodData) - -# InspectPod takes the name or ID of an image and returns a string representation of data associated with the -# pod. You must serialize the string into JSON to use it further. A [PodNotFound](#PodNotFound) error will -# be returned if the pod cannot be found. -method InspectPod(name: string) -> (pod: string) - -# StartPod starts containers in a pod. It takes the name or ID of pod. If the pod cannot be found, a [PodNotFound](#PodNotFound) -# error will be returned. Containers in a pod are started independently. If there is an error starting one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was started with no errors, the pod ID is returned. -# See also [CreatePod](#CreatePod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.StartPod '{"name": "135d71b9495f"}' -# { -# "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6", -# } -# ~~~ -method StartPod(name: string) -> (pod: string) - -# StopPod stops containers in a pod. It takes the name or ID of a pod and a timeout. -# If the pod cannot be found, a [PodNotFound](#PodNotFound) error will be returned instead. -# Containers in a pod are stopped independently. If there is an error stopping one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was stopped with no errors, the pod ID is returned. -# See also [KillPod](KillPod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.StopPod '{"name": "135d71b9495f"}' -# { -# "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -# } -# ~~~ -method StopPod(name: string, timeout: int) -> (pod: string) - -# RestartPod will restart containers in a pod given a pod name or ID. Containers in -# the pod that are running will be stopped, then all stopped containers will be run. -# If the pod cannot be found by name or ID, a [PodNotFound](#PodNotFound) error will be returned. -# Containers in a pod are restarted independently. If there is an error restarting one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was restarted with no errors, the pod ID is returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.RestartPod '{"name": "135d71b9495f"}' -# { -# "pod": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -# } -# ~~~ -method RestartPod(name: string) -> (pod: string) - -# KillPod takes the name or ID of a pod as well as a signal to be applied to the pod. If the pod cannot be found, a -# [PodNotFound](#PodNotFound) error is returned. -# Containers in a pod are killed independently. If there is an error killing one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was killed with no errors, the pod ID is returned. -# See also [StopPod](StopPod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.KillPod '{"name": "foobar", "signal": 15}' -# { -# "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -# } -# ~~~ -method KillPod(name: string, signal: int) -> (pod: string) - -# PausePod takes the name or ID of a pod and pauses the running containers associated with it. If the pod cannot be found, -# a [PodNotFound](#PodNotFound) error will be returned. -# Containers in a pod are paused independently. If there is an error pausing one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was paused with no errors, the pod ID is returned. -# See also [UnpausePod](#UnpausePod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.PausePod '{"name": "foobar"}' -# { -# "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -# } -# ~~~ -method PausePod(name: string) -> (pod: string) - -# UnpausePod takes the name or ID of a pod and unpauses the paused containers associated with it. If the pod cannot be -# found, a [PodNotFound](#PodNotFound) error will be returned. -# Containers in a pod are unpaused independently. If there is an error unpausing one container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was unpaused with no errors, the pod ID is returned. -# See also [PausePod](#PausePod). -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.UnpausePod '{"name": "foobar"}' -# { -# "pod": "1840835294cf076a822e4e12ba4152411f131bd869e7f6a4e8b16df9b0ea5c7f" -# } -# ~~~ -method UnpausePod(name: string) -> (pod: string) - -# RemovePod takes the name or ID of a pod as well a boolean representing whether a running -# container in the pod can be stopped and removed. If a pod has containers associated with it, and force is not true, -# an error will occur. -# If the pod cannot be found by name or ID, a [PodNotFound](#PodNotFound) error will be returned. -# Containers in a pod are removed independently. If there is an error removing any container, the ID of those containers -# will be returned in a list, along with the ID of the pod in a [PodContainerError](#PodContainerError). -# If the pod was removed with no errors, the pod ID is returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.RemovePod '{"name": "62f4fd98cb57", "force": "true"}' -# { -# "pod": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -# } -# ~~~ -method RemovePod(name: string, force: bool) -> (pod: string) - -# This method has not be implemented yet. -# method WaitPod() -> (notimplemented: NotImplemented) - -method TopPod(pod: string, latest: bool, descriptors: []string) -> (stats: []string) - -# GetPodStats takes the name or ID of a pod and returns a pod name and slice of ContainerStats structure which -# contains attributes like memory and cpu usage. If the pod cannot be found, a [PodNotFound](#PodNotFound) -# error will be returned. If the pod has no running containers associated with it, a [NoContainerRunning](#NoContainerRunning) -# error will be returned. -# #### Example -# ~~~ -# $ varlink call unix:/run/podman/io.podman/io.podman.GetPodStats '{"name": "7f62b508b6f12b11d8fe02e"}' -# { -# "containers": [ -# { -# "block_input": 0, -# "block_output": 0, -# "cpu": 2.833470544016107524276e-08, -# "cpu_nano": 54363072, -# "id": "a64b51f805121fe2c5a3dc5112eb61d6ed139e3d1c99110360d08b58d48e4a93", -# "mem_limit": 12276146176, -# "mem_perc": 7.974359265237864966003e-03, -# "mem_usage": 978944, -# "name": "quirky_heisenberg", -# "net_input": 866, -# "net_output": 7388, -# "pids": 1, -# "system_nano": 20000000 -# } -# ], -# "pod": "7f62b508b6f12b11d8fe02e0db4de6b9e43a7d7699b33a4fc0d574f6e82b4ebd" -# } -# ~~~ -method GetPodStats(name: string) -> (pod: string, containers: []ContainerStats) - -# GetPodsByStatus searches for pods whose status is included in statuses -method GetPodsByStatus(statuses: []string) -> (pods: []string) - -# ImageExists talks a full or partial image ID or name and returns an int as to whether -# the image exists in local storage. An int result of 0 means the image does exist in -# local storage; whereas 1 indicates the image does not exists in local storage. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.ImageExists '{"name": "imageddoesntexist"}' -# { -# "exists": 1 -# } -# ~~~ -method ImageExists(name: string) -> (exists: int) - -# ContainerExists takes a full or partial container ID or name and returns an int as to -# whether the container exists in local storage. A result of 0 means the container does -# exists; whereas a result of 1 means it could not be found. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.ContainerExists '{"name": "flamboyant_payne"}'{ -# "exists": 0 -# } -# ~~~ -method ContainerExists(name: string) -> (exists: int) - -# ContainerCheckPoint performs a checkpopint on a container by its name or full/partial container -# ID. On successful checkpoint, the id of the checkpointed container is returned. -method ContainerCheckpoint(name: string, keep: bool, leaveRunning: bool, tcpEstablished: bool) -> (id: string) - -# ContainerRestore restores a container that has been checkpointed. The container to be restored can -# be identified by its name or full/partial container ID. A successful restore will result in the return -# of the container's ID. -method ContainerRestore(name: string, keep: bool, tcpEstablished: bool) -> (id: string) - -# ContainerRunlabel runs executes a command as described by a given container image label. -method ContainerRunlabel(runlabel: Runlabel) -> () - -# ExecContainer executes a command in the given container. -method ExecContainer(opts: ExecOpts) -> () - -# ListContainerMounts gathers all the mounted container mount points and returns them as an array -# of strings -# #### Example -# ~~~ -# $ varlink call unix:/run/podman/io.podman/io.podman.ListContainerMounts -# { -# "mounts": { -# "04e4c255269ed2545e7f8bd1395a75f7949c50c223415c00c1d54bfa20f3b3d9": "/var/lib/containers/storage/overlay/a078925828f57e20467ca31cfca8a849210d21ec7e5757332b72b6924f441c17/merged", -# "1d58c319f9e881a644a5122ff84419dccf6d138f744469281446ab243ef38924": "/var/lib/containers/storage/overlay/948fcf93f8cb932f0f03fd52e3180a58627d547192ffe3b88e0013b98ddcd0d2/merged" -# } -# } -# ~~~ -method ListContainerMounts() -> (mounts: [string]string) - -# MountContainer mounts a container by name or full/partial ID. Upon a successful mount, the destination -# mount is returned as a string. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.MountContainer '{"name": "jolly_shannon"}'{ -# "path": "/var/lib/containers/storage/overlay/419eeb04e783ea159149ced67d9fcfc15211084d65e894792a96bedfae0470ca/merged" -# } -# ~~~ -method MountContainer(name: string) -> (path: string) - -# UnmountContainer umounts a container by its name or full/partial container ID. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.podman/io.podman.UnmountContainer '{"name": "jolly_shannon", "force": false}' -# {} -# ~~~ -method UnmountContainer(name: string, force: bool) -> () - -# ImagesPrune removes all unused images from the local store. Upon successful pruning, -# the IDs of the removed images are returned. -method ImagesPrune(all: bool) -> (pruned: []string) - -# This function is not implemented yet. -# method ListContainerPorts(name: string) -> (notimplemented: NotImplemented) - -# GenerateKube generates a Kubernetes v1 Pod description of a Podman container or pod -# and its containers. The description is in YAML. See also [ReplayKube](ReplayKube). -method GenerateKube(name: string, service: bool) -> (pod: KubePodService) - -# ReplayKube recreates a pod and its containers based on a Kubernetes v1 Pod description (in YAML) -# like that created by GenerateKube. See also [GenerateKube](GenerateKube). -# method ReplayKube() -> (notimplemented: NotImplemented) - -# ContainerConfig returns a container's config in string form. This call is for -# development of Podman only and generally should not be used. -method ContainerConfig(name: string) -> (config: string) - -# ContainerArtifacts returns a container's artifacts in string form. This call is for -# development of Podman only and generally should not be used. -method ContainerArtifacts(name: string, artifactName: string) -> (config: string) - -# ContainerInspectData returns a container's inspect data in string form. This call is for -# development of Podman only and generally should not be used. -method ContainerInspectData(name: string, size: bool) -> (config: string) - -# ContainerStateData returns a container's state config in string form. This call is for -# development of Podman only and generally should not be used. -method ContainerStateData(name: string) -> (config: string) - -# PodStateData returns inspectr level information of a given pod in string form. This call is for -# development of Podman only and generally should not be used. -method PodStateData(name: string) -> (config: string) - -# This call is for the development of Podman only and should not be used. -method CreateFromCC(in: []string) -> (id: string) - -# Spec returns the oci spec for a container. This call is for development of Podman only and generally should not be used. -method Spec(name: string) -> (config: string) - -# Sendfile allows a remote client to send a file to the host -method SendFile(type: string, length: int) -> (file_handle: string) - -# ReceiveFile allows the host to send a remote client a file -method ReceiveFile(path: string, delete: bool) -> (len: int) - -# VolumeCreate creates a volume on a remote host -method VolumeCreate(options: VolumeCreateOpts) -> (volumeName: string) - -# VolumeRemove removes a volume on a remote host -method VolumeRemove(options: VolumeRemoveOpts) -> (successes: []string, failures: [string]string) - -# GetVolumes gets slice of the volumes on a remote host -method GetVolumes(args: []string, all: bool) -> (volumes: []Volume) - -# InspectVolume inspects a single volume. Returns inspect JSON in the form of a -# string. -method InspectVolume(name: string) -> (volume: string) - -# VolumesPrune removes unused volumes on the host -method VolumesPrune() -> (prunedNames: []string, prunedErrors: []string) - -# ImageSave allows you to save an image from the local image storage to a tarball -method ImageSave(options: ImageSaveOptions) -> (reply: MoreResponse) - -# GetPodsByContext allows you to get a list pod ids depending on all, latest, or a list of -# pod names. The definition of latest pod means the latest by creation date. In a multi- -# user environment, results might differ from what you expect. -method GetPodsByContext(all: bool, latest: bool, args: []string) -> (pods: []string) - -# LoadImage allows you to load an image into local storage from a tarball. -method LoadImage(name: string, inputFile: string, quiet: bool, deleteFile: bool) -> (reply: MoreResponse) - -# GetEvents returns known libpod events filtered by the options provided. -method GetEvents(filter: []string, since: string, until: string) -> (events: Event) - -# Diff returns a diff between libpod objects -method Diff(name: string) -> (diffs: []DiffInfo) - -# GetLayersMapWithImageInfo is for the development of Podman and should not be used. -method GetLayersMapWithImageInfo() -> (layerMap: string) - -# BuildImageHierarchyMap is for the development of Podman and should not be used. -method BuildImageHierarchyMap(name: string) -> (imageInfo: string) - -# ImageNotFound means the image could not be found by the provided name or ID in local storage. -error ImageNotFound (id: string, reason: string) - -# ContainerNotFound means the container could not be found by the provided name or ID in local storage. -error ContainerNotFound (id: string, reason: string) - -# NoContainerRunning means none of the containers requested are running in a command that requires a running container. -error NoContainerRunning () - -# PodNotFound means the pod could not be found by the provided name or ID in local storage. -error PodNotFound (name: string, reason: string) - -# VolumeNotFound means the volume could not be found by the name or ID in local storage. -error VolumeNotFound (id: string, reason: string) - -# PodContainerError means a container associated with a pod failed to perform an operation. It contains -# a container ID of the container that failed. -error PodContainerError (podname: string, errors: []PodContainerErrorData) - -# NoContainersInPod means a pod has no containers on which to perform the operation. It contains -# the pod ID. -error NoContainersInPod (name: string) - -# InvalidState indicates that a container or pod was in an improper state for the requested operation -error InvalidState (id: string, reason: string) - -# ErrorOccurred is a generic error for an error that occurs during the execution. The actual error message -# is includes as part of the error's text. -error ErrorOccurred (reason: string) - -# RuntimeErrors generally means a runtime could not be found or gotten. -error RuntimeError (reason: string) - -# The Podman endpoint requires that you use a streaming connection. -error WantsMoreRequired (reason: string) - -# Container is already stopped -error ErrCtrStopped (id: string) - -# This function requires CGroupsV2 to run in rootless mode. -error ErrRequiresCgroupsV2ForRootless(reason: string) -` -} - -// Generated service interface - -type VarlinkInterface struct { - iopodmanInterface -} - -func VarlinkNew(m iopodmanInterface) *VarlinkInterface { - return &VarlinkInterface{m} -} From c3945522fb6733ec34d0d8be4c19ceb36814cc0a Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sun, 1 Nov 2020 18:11:04 +0100 Subject: [PATCH 19/31] Fix test, lint --- apiclient/apiclient.go | 3 ++- driver_test.go | 27 ++++----------------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index 25f2a59..98f94c2 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -19,13 +19,14 @@ package apiclient import ( "context" "fmt" - "github.com/hashicorp/go-hclog" "io" "net" "net/http" "os" "strings" "time" + + "github.com/hashicorp/go-hclog" ) type APIClient struct { diff --git a/driver_test.go b/driver_test.go index 1c6e316..9b25950 100644 --- a/driver_test.go +++ b/driver_test.go @@ -78,7 +78,6 @@ func podmanDriverHarness(t *testing.T, cfg map[string]interface{}) *dtestutil.Dr } d := NewPodmanDriver(logger).(*Driver) - d.podmanClient = newPodmanClient() d.config.Volumes.Enabled = true if enforce, err := ioutil.ReadFile("/sys/fs/selinux/enforce"); err == nil { if string(enforce) == "1" { @@ -794,12 +793,10 @@ func TestPodmanDriver_Swap(t *testing.T) { require.Equal(t, int64(41943040), inspectData.HostConfig.MemoryReservation) require.Equal(t, int64(104857600), inspectData.HostConfig.MemorySwap) - procFilesystems, err := getProcFilesystems() - if err == nil { - cgroupv2 := isCGroupV2(procFilesystems) - if cgroupv2 == false { - require.Equal(t, int64(60), inspectData.HostConfig.MemorySwappiness) - } + v2, err := isCGroupV2() + require.NoError(t, err) + if !v2 { + require.Equal(t, int64(60), inspectData.HostConfig.MemorySwappiness) } } @@ -1086,22 +1083,6 @@ func newTaskConfig(variant string, command []string) TaskConfig { } } -func newPodmanClient() *PodmanClient { - level := hclog.Info - if testing.Verbose() { - level = hclog.Trace - } - testLogger := hclog.New(&hclog.LoggerOptions{ - Name: "testClient", - Level: level, - }) - client := &PodmanClient{ - ctx: context.Background(), - logger: testLogger, - } - return client -} - func getPodmanDriver(t *testing.T, harness *dtestutil.DriverHarness) *Driver { driver, ok := harness.Impl().(*Driver) require.True(t, ok) From d49b67fba4527909e7e09080e13a059bb8cf9029 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 2 Nov 2020 10:48:01 +0100 Subject: [PATCH 20/31] Pull image before create container --- apiclient/apiclient.go | 4 ++++ apiclient/container_create.go | 2 +- apiclient/image_exists.go | 42 +++++++++++++++++++++++++++++++++++ apiclient/image_pull.go | 42 +++++++++++++++++++++++++++++++++++ driver.go | 12 ++++++++++ 5 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 apiclient/image_exists.go create mode 100644 apiclient/image_pull.go diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index 98f94c2..b9efeea 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -29,6 +29,10 @@ import ( "github.com/hashicorp/go-hclog" ) +const ( + PODMAN_API_VERSION = "v1.0.0" +) + type APIClient struct { baseUrl string httpClient *http.Client diff --git a/apiclient/container_create.go b/apiclient/container_create.go index 19e4e4e..129142b 100644 --- a/apiclient/container_create.go +++ b/apiclient/container_create.go @@ -40,7 +40,7 @@ func (c *APIClient) ContainerCreate(ctx context.Context, create SpecGenerator) ( } // fmt.Println(string(jsonString)) - res, err := c.Post(ctx, "/v1.24/libpod/containers/create", bytes.NewBuffer(jsonString)) + res, err := c.Post(ctx, fmt.Sprintf("/%s/libpod/containers/create", PODMAN_API_VERSION), bytes.NewBuffer(jsonString)) if err != nil { return response, err } diff --git a/apiclient/image_exists.go b/apiclient/image_exists.go new file mode 100644 index 0000000..f52869f --- /dev/null +++ b/apiclient/image_exists.go @@ -0,0 +1,42 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apiclient + +import ( + "context" + "fmt" + "net/http" +) + +// ImageExists checks if image exists in local store +func (c *APIClient) ImageExists(ctx context.Context, nameWithTag string) (bool, error) { + + res, err := c.Get(ctx, fmt.Sprintf("/libpod/images/%s/exists", nameWithTag)) + if err != nil { + return false, err + } + + defer res.Body.Close() + + if res.StatusCode == http.StatusNotFound { + return false, nil + } + if res.StatusCode == http.StatusNoContent { + return true, nil + } + return false, fmt.Errorf("unknown error, status code: %d", res.StatusCode) +} diff --git a/apiclient/image_pull.go b/apiclient/image_pull.go new file mode 100644 index 0000000..7044d14 --- /dev/null +++ b/apiclient/image_pull.go @@ -0,0 +1,42 @@ +/* +Copyright 2019 Thomas Weber + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package apiclient + +import ( + "context" + "fmt" + "io/ioutil" + "net/http" +) + +// ImagePull pulls a image from a remote location to local storage +func (c *APIClient) ImagePull(ctx context.Context, nameWithTag string) error { + + res, err := c.Post(ctx, fmt.Sprintf("/%s/libpod/images/pull?reference=%s", PODMAN_API_VERSION, nameWithTag), nil) + if err != nil { + return err + } + + defer res.Body.Close() + body, _ := ioutil.ReadAll(res.Body) + + if res.StatusCode != http.StatusOK { + return fmt.Errorf("unknown error, status code: %d: %s", res.StatusCode, body) + } + + return nil +} diff --git a/driver.go b/driver.go index f0d73f6..6baa440 100644 --- a/driver.go +++ b/driver.go @@ -519,6 +519,18 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } if !recoverRunningContainer { + // do we already have this image in local storage? + haveImage, err := d.podmanClient2.ImageExists(d.ctx, createOpts.Image) + if err != nil { + return nil, nil, fmt.Errorf("failed to start task, unable to check for local image: %v", err) + } + if !haveImage { + // image is not in local storage, so we need to pull it + if err = d.podmanClient2.ImagePull(d.ctx, createOpts.Image); err != nil { + return nil, nil, fmt.Errorf("failed to start task, unable to pull image %s: %v", createOpts.Image, err) + } + } + createResponse, err := d.podmanClient2.ContainerCreate(d.ctx, createOpts) for _, w := range createResponse.Warnings { d.logger.Warn("Create Warning", "warning", w) From 4a5c6eedc071560db44f444f105c38fabf205159 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 2 Nov 2020 11:50:51 +0100 Subject: [PATCH 21/31] Fix ContainerInstpect, adopt some loglevels --- apiclient/container_inspect.go | 10 ++++------ driver.go | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/apiclient/container_inspect.go b/apiclient/container_inspect.go index 4f8bba0..00ab5fd 100644 --- a/apiclient/container_inspect.go +++ b/apiclient/container_inspect.go @@ -30,7 +30,7 @@ func (c *APIClient) ContainerInspect(ctx context.Context, name string) (InspectC var inspectData InspectContainerData - res, err := c.Get(ctx, fmt.Sprintf("/containers/%s/json", name)) + res, err := c.Get(ctx, fmt.Sprintf("/%s/libpod/containers/%s/json", PODMAN_API_VERSION, name)) if err != nil { return inspectData, err } @@ -81,8 +81,7 @@ type InspectContainerConfig struct { // Container working directory WorkingDir string `json:"WorkingDir"` // Container entrypoint - // FIXME: was string instead of []string ?? - Entrypoint []string `json:"Entrypoint"` + Entrypoint string `json:"Entrypoint"` // On-build arguments - presently unused. More of Buildah's domain. OnBuild *string `json:"OnBuild"` // Container labels @@ -90,10 +89,9 @@ type InspectContainerConfig struct { // Container annotations Annotations map[string]string `json:"Annotations"` // Container stop signal - // FIXME: can not unmarshal, got string "StopSignal": "\u000f", ??? - // StopSignal uint `json:"StopSignal"` + StopSignal uint `json:"StopSignal"` // Configured healthcheck for the container - // Healthcheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"` + //Healthcheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"` // CreateCommand is the full command plus arguments of the process the // container has been created with. CreateCommand []string `json:"CreateCommand,omitempty"` diff --git a/driver.go b/driver.go index 6baa440..067ece8 100644 --- a/driver.go +++ b/driver.go @@ -677,7 +677,7 @@ func (d *Driver) DestroyTask(taskID string, force bool) error { } if handle.isRunning() { - d.logger.Info("Have to destroyTask but container is still running", "containerID", handle.containerID) + d.logger.Debug("Have to destroyTask but container is still running", "containerID", handle.containerID) // we can not do anything, so catching the error is useless err := d.podmanClient2.ContainerStop(d.ctx, handle.containerID, 60) if err != nil { @@ -708,7 +708,7 @@ func (d *Driver) DestroyTask(taskID string, force bool) error { // InspectTask function returns detailed status information for the referenced taskID. func (d *Driver) InspectTask(taskID string) (*drivers.TaskStatus, error) { - d.logger.Info("InspectTask called") + d.logger.Debug("InspectTask called") handle, ok := d.tasks.Get(taskID) if !ok { return nil, drivers.ErrTaskNotFound From b2cb7a33b3f163c99717a082f455fa396b3af27f Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Tue, 3 Nov 2020 11:24:14 +0100 Subject: [PATCH 22/31] Fixed various bugs Enable filesystem isolation mode, solved weird Env[] problems Expose more podman systeminfo details to nomad Removed custom cgroupv2 detector, rely on podman instead --- apiclient/container_start.go | 2 +- apiclient/system_info.go | 129 +++++++++++++++++++++++++++++++++-- driver.go | 64 +++++++---------- driver_test.go | 5 +- 4 files changed, 152 insertions(+), 48 deletions(-) diff --git a/apiclient/container_start.go b/apiclient/container_start.go index 31f70e3..b9b14b0 100644 --- a/apiclient/container_start.go +++ b/apiclient/container_start.go @@ -27,7 +27,7 @@ import ( // ContainerStart starts a container via id or name func (c *APIClient) ContainerStart(ctx context.Context, name string) error { - res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/start", name), nil) + res, err := c.Post(ctx, fmt.Sprintf("/%s/libpod/containers/%s/start", PODMAN_API_VERSION, name), nil) if err != nil { return err } diff --git a/apiclient/system_info.go b/apiclient/system_info.go index 6904edd..78612f8 100644 --- a/apiclient/system_info.go +++ b/apiclient/system_info.go @@ -32,7 +32,7 @@ func (c *APIClient) SystemInfo(ctx context.Context) (Info, error) { // the libpod/info endpoint seems to have some trouble // using "compat" endpoint and minimal struct // until podman returns proper data. - res, err := c.Get(ctx, "/info") + res, err := c.Get(ctx, fmt.Sprintf("/%s/libpod/info", PODMAN_API_VERSION)) if err != nil { return infoData, err } @@ -54,8 +54,129 @@ func (c *APIClient) SystemInfo(ctx context.Context) (Info, error) { return infoData, nil } -// for now, we only use the podman version, so it's enough to -// declare this tiny struct +// ------------------------------------------------------------------------------------------------------- +// structs copied from https://github.com/containers/podman/blob/master/libpod/define/info.go +// +// some unused parts are modified/commented out to not pull more dependencies +// +// some fields are reordert to make the linter happy (bytes maligned complains) +// ------------------------------------------------------------------------------------------------------- + +// Info is the overall struct that describes the host system +// running libpod/podman type Info struct { - Version string `json:"ServerVersion"` + Host *HostInfo `json:"host"` + Store *StoreInfo `json:"store"` + Registries map[string]interface{} `json:"registries"` + Version Version `json:"version"` +} + +//HostInfo describes the libpod host +type HostInfo struct { + Arch string `json:"arch"` + BuildahVersion string `json:"buildahVersion"` + CgroupManager string `json:"cgroupManager"` + CGroupsVersion string `json:"cgroupVersion"` + Conmon *ConmonInfo `json:"conmon"` + CPUs int `json:"cpus"` + Distribution DistributionInfo `json:"distribution"` + EventLogger string `json:"eventLogger"` + Hostname string `json:"hostname"` + // IDMappings IDMappings `json:"idMappings,omitempty"` + Kernel string `json:"kernel"` + MemFree int64 `json:"memFree"` + MemTotal int64 `json:"memTotal"` + OCIRuntime *OCIRuntimeInfo `json:"ociRuntime"` + OS string `json:"os"` + RemoteSocket *RemoteSocket `json:"remoteSocket,omitempty"` + Rootless bool `json:"rootless"` + RuntimeInfo map[string]interface{} `json:"runtimeInfo,omitempty"` + Slirp4NetNS SlirpInfo `json:"slirp4netns,omitempty"` + SwapFree int64 `json:"swapFree"` + SwapTotal int64 `json:"swapTotal"` + Uptime string `json:"uptime"` + Linkmode string `json:"linkmode"` +} + +// RemoteSocket describes information about the API socket +type RemoteSocket struct { + Path string `json:"path,omitempty"` + Exists bool `json:"exists,omitempty"` +} + +// SlirpInfo describes the slirp executable that +// is being being used. +type SlirpInfo struct { + Executable string `json:"executable"` + Package string `json:"package"` + Version string `json:"version"` +} + +// IDMappings describe the GID and UID mappings +// type IDMappings struct { +// GIDMap []idtools.IDMap `json:"gidmap"` +// UIDMap []idtools.IDMap `json:"uidmap"` +// } + +// DistributionInfo describes the host distribution +// for libpod +type DistributionInfo struct { + Distribution string `json:"distribution"` + Version string `json:"version"` +} + +// ConmonInfo describes the conmon executable being used +type ConmonInfo struct { + Package string `json:"package"` + Path string `json:"path"` + Version string `json:"version"` +} + +// OCIRuntimeInfo describes the runtime (crun or runc) being +// used with podman +type OCIRuntimeInfo struct { + Name string `json:"name"` + Package string `json:"package"` + Path string `json:"path"` + Version string `json:"version"` +} + +// StoreInfo describes the container storage and its +// attributes +type StoreInfo struct { + ConfigFile string `json:"configFile"` + ContainerStore ContainerStore `json:"containerStore"` + GraphDriverName string `json:"graphDriverName"` + GraphOptions map[string]interface{} `json:"graphOptions"` + GraphRoot string `json:"graphRoot"` + GraphStatus map[string]string `json:"graphStatus"` + ImageStore ImageStore `json:"imageStore"` + RunRoot string `json:"runRoot"` + VolumePath string `json:"volumePath"` +} + +// ImageStore describes the image store. Right now only the number +// of images present +type ImageStore struct { + Number int `json:"number"` +} + +// ContainerStore describes the quantity of containers in the +// store by status +type ContainerStore struct { + Number int `json:"number"` + Paused int `json:"paused"` + Running int `json:"running"` + Stopped int `json:"stopped"` +} + +// Version is an output struct for API +type Version struct { + APIVersion string + Version string + GoVersion string + GitCommit string + BuiltTime string + Built int64 + OsArch string } diff --git a/driver.go b/driver.go index 067ece8..0204a0d 100644 --- a/driver.go +++ b/driver.go @@ -17,11 +17,9 @@ limitations under the License. package main import ( - "bufio" "context" "fmt" "net" - "os" "path/filepath" "strconv" "strings" @@ -71,7 +69,7 @@ var ( capabilities = &drivers.Capabilities{ SendSignals: true, Exec: false, - FSIsolation: drivers.FSIsolationNone, + FSIsolation: drivers.FSIsolationImage, NetIsolationModes: []drivers.NetIsolationMode{ drivers.NetIsolationModeGroup, drivers.NetIsolationModeHost, @@ -109,6 +107,11 @@ type Driver struct { // podmanClient encapsulates podman remote calls podmanClient2 *apiclient.APIClient + + // SystemInfo collected at first fingerprint query + systemInfo apiclient.Info + // Queried from systemInfo: is podman running on a cgroupv2 system? + cgroupV2 bool } // TaskState is the state which is encoded in the handle returned in @@ -230,9 +233,16 @@ func (d *Driver) buildFingerprint() *drivers.Fingerprint { // yay! we can enable the driver health = drivers.HealthStateHealthy desc = "ready" - // TODO: we would have more data here... maybe we can return more details to nomad attrs["driver.podman"] = pstructs.NewBoolAttribute(true) - attrs["driver.podman.version"] = pstructs.NewStringAttribute(info.Version) + attrs["driver.podman.version"] = pstructs.NewStringAttribute(info.Version.Version) + attrs["driver.podman.rootless"] = pstructs.NewBoolAttribute(info.Host.Rootless) + attrs["driver.podman.cgroupVersion"] = pstructs.NewStringAttribute(info.Host.CGroupsVersion) + if d.systemInfo.Version.Version == "" { + // keep first received systemInfo in driver struct + // it is used to toggle cgroup v1/v2, rootless/rootful behavior + d.systemInfo = info + d.cgroupV2 = info.Host.CGroupsVersion == "v2" + } } return &drivers.Fingerprint{ @@ -325,6 +335,8 @@ func BuildContainerName(cfg *drivers.TaskConfig) string { // StartTask creates and starts a new Container based on the given TaskConfig. func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error) { + // d.logger.Warn("Env1", "env1", cfg.Env) + if _, ok := d.tasks.Get(cfg.ID); ok { return nil, nil, fmt.Errorf("task with ID %q already started", cfg.ID) } @@ -354,7 +366,6 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } containerName := BuildContainerName(cfg) - cpuShares := uint64(cfg.Resources.LinuxResources.CPUShares) // ensure to include port_map into tasks environment map cfg.Env = taskenv.SetPortMapEnvs(cfg.Env, driverConfig.PortMap) @@ -408,17 +419,16 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } createOpts.ContainerResourceConfig.ResourceLimits.Memory.Swap = &swap } - - v2, err := isCGroupV2() - if err != nil { - return nil, nil, err - } - if !v2 { + if !d.cgroupV2 { swappiness := uint64(driverConfig.MemorySwappiness) createOpts.ContainerResourceConfig.ResourceLimits.Memory.Swappiness = &swappiness } - createOpts.ContainerResourceConfig.ResourceLimits.CPU.Shares = &cpuShares - + // FIXME: can fail for nonRoot due to missing cpu limit delegation permissions, + // see https://github.com/containers/podman/blob/master/troubleshooting.md + if !d.systemInfo.Host.Rootless { + cpuShares := uint64(cfg.Resources.LinuxResources.CPUShares) + createOpts.ContainerResourceConfig.ResourceLimits.CPU.Shares = &cpuShares + } // ------------------------------------------------------------------------------------------- // SECURITY // ------------------------------------------------------------------------------------------- @@ -849,29 +859,3 @@ func isParentPath(parent, path string) bool { rel, err := filepath.Rel(parent, path) return err == nil && !strings.HasPrefix(rel, "..") } - -func isCGroupV2() (bool, error) { - file, err := os.Open("/proc/filesystems") - if err != nil { - return false, err - } - defer file.Close() - - var lines []string - scanner := bufio.NewScanner(file) - for scanner.Scan() { - lines = append(lines, scanner.Text()) - } - if scanner.Err() != nil { - return false, scanner.Err() - } - - cgroupv2 := false - for _, l := range lines { - if strings.HasSuffix(l, "cgroup2") { - cgroupv2 = true - } - } - - return cgroupv2, nil -} diff --git a/driver_test.go b/driver_test.go index 9b25950..a0a10ef 100644 --- a/driver_test.go +++ b/driver_test.go @@ -78,6 +78,7 @@ func podmanDriverHarness(t *testing.T, cfg map[string]interface{}) *dtestutil.Dr } d := NewPodmanDriver(logger).(*Driver) + d.buildFingerprint() d.config.Volumes.Enabled = true if enforce, err := ioutil.ReadFile("/sys/fs/selinux/enforce"); err == nil { if string(enforce) == "1" { @@ -793,9 +794,7 @@ func TestPodmanDriver_Swap(t *testing.T) { require.Equal(t, int64(41943040), inspectData.HostConfig.MemoryReservation) require.Equal(t, int64(104857600), inspectData.HostConfig.MemorySwap) - v2, err := isCGroupV2() - require.NoError(t, err) - if !v2 { + if !getPodmanDriver(t, d).cgroupV2 { require.Equal(t, int64(60), inspectData.HostConfig.MemorySwappiness) } } From d1eddc51d1cef908b3807c717ec3bb4f804ca4b3 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Thu, 5 Nov 2020 13:22:41 +0100 Subject: [PATCH 23/31] Comments --- driver.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/driver.go b/driver.go index 0204a0d..4380e3c 100644 --- a/driver.go +++ b/driver.go @@ -529,6 +529,9 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } if !recoverRunningContainer { + // FIXME: there are more variations of image sources, we should handle it + // e.g. oci-archive:/... etc + // see also https://github.com/containers/podman/issues/6744 // do we already have this image in local storage? haveImage, err := d.podmanClient2.ImageExists(d.ctx, createOpts.Image) if err != nil { From 205f71ecb141d8e426f3a1dd44cb1953ed3d23e7 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Fri, 6 Nov 2020 10:23:03 +0100 Subject: [PATCH 24/31] Code review #51 renamed apiclient package to api improved httpclient context usage improved driver struct, renamed field podmanClient2 to podman --- apiclient/apiclient.go => api/api.go | 27 +++++------ {apiclient => api}/container_create.go | 4 +- {apiclient => api}/container_delete.go | 4 +- {apiclient => api}/container_inspect.go | 4 +- {apiclient => api}/container_kill.go | 4 +- {apiclient => api}/container_start.go | 4 +- {apiclient => api}/container_stats.go | 4 +- {apiclient => api}/container_stop.go | 4 +- {apiclient => api}/container_wait.go | 4 +- {apiclient => api}/image_exists.go | 4 +- {apiclient => api}/image_pull.go | 4 +- {apiclient => api}/system_info.go | 4 +- driver.go | 64 ++++++++++++------------- driver_test.go | 44 ++++++++--------- handle.go | 12 ++--- 15 files changed, 94 insertions(+), 97 deletions(-) rename apiclient/apiclient.go => api/api.go (71%) rename {apiclient => api}/container_create.go (99%) rename {apiclient => api}/container_delete.go (88%) rename {apiclient => api}/container_inspect.go (99%) rename {apiclient => api}/container_kill.go (89%) rename {apiclient => api}/container_start.go (92%) rename {apiclient => api}/container_stats.go (98%) rename {apiclient => api}/container_stop.go (91%) rename {apiclient => api}/container_wait.go (89%) rename {apiclient => api}/image_exists.go (90%) rename {apiclient => api}/image_pull.go (91%) rename {apiclient => api}/system_info.go (98%) diff --git a/apiclient/apiclient.go b/api/api.go similarity index 71% rename from apiclient/apiclient.go rename to api/api.go index b9efeea..1d6ae86 100644 --- a/apiclient/apiclient.go +++ b/api/api.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "context" @@ -33,21 +33,21 @@ const ( PODMAN_API_VERSION = "v1.0.0" ) -type APIClient struct { +type API struct { baseUrl string httpClient *http.Client logger hclog.Logger } -func NewClient(logger hclog.Logger) *APIClient { - ac := &APIClient{ +func NewClient(logger hclog.Logger) *API { + ac := &API{ logger: logger, } ac.SetSocketPath(GuessSocketPath()) return ac } -func (c *APIClient) SetSocketPath(baseUrl string) { +func (c *API) SetSocketPath(baseUrl string) { c.logger.Debug("http baseurl", "url", baseUrl) c.httpClient = &http.Client{ Timeout: 60 * time.Second, @@ -76,35 +76,32 @@ func GuessSocketPath() string { return fmt.Sprintf("unix:/run/user/%d/podman/podman.sock", uid) } -func (c *APIClient) Do(req *http.Request) (*http.Response, error) { +func (c *API) Do(req *http.Request) (*http.Response, error) { res, err := c.httpClient.Do(req) return res, err } -func (c *APIClient) Get(ctx context.Context, path string) (*http.Response, error) { - req, err := http.NewRequest("GET", c.baseUrl+path, nil) +func (c *API) Get(ctx context.Context, path string) (*http.Response, error) { + req, err := http.NewRequestWithContext(ctx, "GET", c.baseUrl+path, nil) if err != nil { return nil, err } - req = req.WithContext(ctx) return c.Do(req) } -func (c *APIClient) Post(ctx context.Context, path string, body io.Reader) (*http.Response, error) { - req, err := http.NewRequest("POST", c.baseUrl+path, body) +func (c *API) Post(ctx context.Context, path string, body io.Reader) (*http.Response, error) { + req, err := http.NewRequestWithContext(ctx, "POST", c.baseUrl+path, body) if err != nil { return nil, err } - req = req.WithContext(ctx) req.Header.Set("Content-Type", "application/json") return c.Do(req) } -func (c *APIClient) Delete(ctx context.Context, path string) (*http.Response, error) { - req, err := http.NewRequest("DELETE", c.baseUrl+path, nil) +func (c *API) Delete(ctx context.Context, path string) (*http.Response, error) { + req, err := http.NewRequestWithContext(ctx, "DELETE", c.baseUrl+path, nil) if err != nil { return nil, err } - req = req.WithContext(ctx) return c.Do(req) } diff --git a/apiclient/container_create.go b/api/container_create.go similarity index 99% rename from apiclient/container_create.go rename to api/container_create.go index 129142b..b2f818c 100644 --- a/apiclient/container_create.go +++ b/api/container_create.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "bytes" @@ -30,7 +30,7 @@ import ( ) // ContainerCreate creates a new container -func (c *APIClient) ContainerCreate(ctx context.Context, create SpecGenerator) (ContainerCreateResponse, error) { +func (c *API) ContainerCreate(ctx context.Context, create SpecGenerator) (ContainerCreateResponse, error) { response := ContainerCreateResponse{} diff --git a/apiclient/container_delete.go b/api/container_delete.go similarity index 88% rename from apiclient/container_delete.go rename to api/container_delete.go index 46d90ea..fcf8100 100644 --- a/apiclient/container_delete.go +++ b/api/container_delete.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "context" @@ -24,7 +24,7 @@ import ( // ContainerDelete deletes a container. // It takes the name or ID of a container. -func (c *APIClient) ContainerDelete(ctx context.Context, name string, force bool, deleteVolumes bool) error { +func (c *API) ContainerDelete(ctx context.Context, name string, force bool, deleteVolumes bool) error { res, err := c.Delete(ctx, fmt.Sprintf("/containers/%s?force=%t&v=%t", name, force, deleteVolumes)) if err != nil { diff --git a/apiclient/container_inspect.go b/api/container_inspect.go similarity index 99% rename from apiclient/container_inspect.go rename to api/container_inspect.go index 00ab5fd..464fcd2 100644 --- a/apiclient/container_inspect.go +++ b/api/container_inspect.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "context" @@ -26,7 +26,7 @@ import ( ) // ContainerInspect data takes a name or ID of a container returns the inspection data -func (c *APIClient) ContainerInspect(ctx context.Context, name string) (InspectContainerData, error) { +func (c *API) ContainerInspect(ctx context.Context, name string) (InspectContainerData, error) { var inspectData InspectContainerData diff --git a/apiclient/container_kill.go b/api/container_kill.go similarity index 89% rename from apiclient/container_kill.go rename to api/container_kill.go index 35d8b29..248bfa7 100644 --- a/apiclient/container_kill.go +++ b/api/container_kill.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "context" @@ -23,7 +23,7 @@ import ( ) // ContainerKill sends a signal to a container -func (c *APIClient) ContainerKill(ctx context.Context, name string, signal string) error { +func (c *API) ContainerKill(ctx context.Context, name string, signal string) error { res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/kill?signal=%s", name, signal), nil) if err != nil { diff --git a/apiclient/container_start.go b/api/container_start.go similarity index 92% rename from apiclient/container_start.go rename to api/container_start.go index b9b14b0..6f62884 100644 --- a/apiclient/container_start.go +++ b/api/container_start.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "context" @@ -25,7 +25,7 @@ import ( ) // ContainerStart starts a container via id or name -func (c *APIClient) ContainerStart(ctx context.Context, name string) error { +func (c *API) ContainerStart(ctx context.Context, name string) error { res, err := c.Post(ctx, fmt.Sprintf("/%s/libpod/containers/%s/start", PODMAN_API_VERSION, name), nil) if err != nil { diff --git a/apiclient/container_stats.go b/api/container_stats.go similarity index 98% rename from apiclient/container_stats.go rename to api/container_stats.go index 03be794..04031e2 100644 --- a/apiclient/container_stats.go +++ b/api/container_stats.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "context" @@ -30,7 +30,7 @@ var ContainerNotFound = errors.New("No such Container") var ContainerWrongState = errors.New("Container has wrong state") // ContainerStats data takes a name or ID of a container returns stats data -func (c *APIClient) ContainerStats(ctx context.Context, name string) (Stats, error) { +func (c *API) ContainerStats(ctx context.Context, name string) (Stats, error) { var stats Stats res, err := c.Get(ctx, fmt.Sprintf("libpod/containers/%s/stats?stream=false", name)) diff --git a/apiclient/container_stop.go b/api/container_stop.go similarity index 91% rename from apiclient/container_stop.go rename to api/container_stop.go index 6ced42e..92454df 100644 --- a/apiclient/container_stop.go +++ b/api/container_stop.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "context" @@ -26,7 +26,7 @@ import ( // timeout value. The timeout value the time before a forcible stop to the container is applied. // If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) // error will be returned instead. -func (c *APIClient) ContainerStop(ctx context.Context, name string, timeout int) error { +func (c *API) ContainerStop(ctx context.Context, name string, timeout int) error { res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/stop?timeout=%d", name, timeout), nil) if err != nil { diff --git a/apiclient/container_wait.go b/api/container_wait.go similarity index 89% rename from apiclient/container_wait.go rename to api/container_wait.go index fd0a7b6..487e6cb 100644 --- a/apiclient/container_wait.go +++ b/api/container_wait.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "context" @@ -23,7 +23,7 @@ import ( ) // ContainerWait waits on a container to met a given condition -func (c *APIClient) ContainerWait(ctx context.Context, name string, condition string) error { +func (c *API) ContainerWait(ctx context.Context, name string, condition string) error { res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/wait?condition=%s", name, condition), nil) if err != nil { diff --git a/apiclient/image_exists.go b/api/image_exists.go similarity index 90% rename from apiclient/image_exists.go rename to api/image_exists.go index f52869f..bd115c3 100644 --- a/apiclient/image_exists.go +++ b/api/image_exists.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "context" @@ -23,7 +23,7 @@ import ( ) // ImageExists checks if image exists in local store -func (c *APIClient) ImageExists(ctx context.Context, nameWithTag string) (bool, error) { +func (c *API) ImageExists(ctx context.Context, nameWithTag string) (bool, error) { res, err := c.Get(ctx, fmt.Sprintf("/libpod/images/%s/exists", nameWithTag)) if err != nil { diff --git a/apiclient/image_pull.go b/api/image_pull.go similarity index 91% rename from apiclient/image_pull.go rename to api/image_pull.go index 7044d14..4ef0fa7 100644 --- a/apiclient/image_pull.go +++ b/api/image_pull.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "context" @@ -24,7 +24,7 @@ import ( ) // ImagePull pulls a image from a remote location to local storage -func (c *APIClient) ImagePull(ctx context.Context, nameWithTag string) error { +func (c *API) ImagePull(ctx context.Context, nameWithTag string) error { res, err := c.Post(ctx, fmt.Sprintf("/%s/libpod/images/pull?reference=%s", PODMAN_API_VERSION, nameWithTag), nil) if err != nil { diff --git a/apiclient/system_info.go b/api/system_info.go similarity index 98% rename from apiclient/system_info.go rename to api/system_info.go index 78612f8..f22d740 100644 --- a/apiclient/system_info.go +++ b/api/system_info.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package apiclient +package api import ( "context" @@ -25,7 +25,7 @@ import ( ) // SystemInfo returns information on the system and libpod configuration -func (c *APIClient) SystemInfo(ctx context.Context) (Info, error) { +func (c *API) SystemInfo(ctx context.Context) (Info, error) { var infoData Info diff --git a/driver.go b/driver.go index 4380e3c..64f4b34 100644 --- a/driver.go +++ b/driver.go @@ -28,7 +28,7 @@ import ( "github.com/hashicorp/nomad/nomad/structs" "github.com/hashicorp/go-hclog" - "github.com/hashicorp/nomad-driver-podman/apiclient" + "github.com/hashicorp/nomad-driver-podman/api" "github.com/hashicorp/nomad-driver-podman/version" "github.com/hashicorp/nomad/client/stats" "github.com/hashicorp/nomad/client/taskenv" @@ -106,10 +106,10 @@ type Driver struct { logger hclog.Logger // podmanClient encapsulates podman remote calls - podmanClient2 *apiclient.APIClient + podman *api.API // SystemInfo collected at first fingerprint query - systemInfo apiclient.Info + systemInfo api.Info // Queried from systemInfo: is podman running on a cgroupv2 system? cgroupV2 bool } @@ -134,7 +134,7 @@ func NewPodmanDriver(logger hclog.Logger) drivers.DriverPlugin { ctx: ctx, signalShutdown: cancel, logger: logger.Named(pluginName), - podmanClient2: apiclient.NewClient(logger), + podman: api.NewClient(logger), } } @@ -168,7 +168,7 @@ func (d *Driver) SetConfig(cfg *base.Config) error { } if config.SocketPath != "" { - d.podmanClient2.SetSocketPath(config.SocketPath) + d.podman.SetSocketPath(config.SocketPath) } return nil @@ -226,7 +226,7 @@ func (d *Driver) buildFingerprint() *drivers.Fingerprint { desc = "disabled" // try to connect and get version info - info, err := d.podmanClient2.SystemInfo(d.ctx) + info, err := d.podman.SystemInfo(d.ctx) if err != nil { d.logger.Error("Could not get podman info", "err", err) } else { @@ -272,7 +272,7 @@ func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error { } d.logger.Debug("Checking for recoverable task", "task", handle.Config.Name, "taskid", handle.Config.ID, "container", taskState.ContainerID) - inspectData, err := d.podmanClient2.ContainerInspect(d.ctx, taskState.ContainerID) + inspectData, err := d.podman.ContainerInspect(d.ctx, taskState.ContainerID) if err != nil { d.logger.Warn("Recovery lookup failed", "task", handle.Config.ID, "container", taskState.ContainerID, "err", err) return nil @@ -301,7 +301,7 @@ func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error { // are we allowed to restart a stopped container? if d.config.RecoverStopped { d.logger.Debug("Found a stopped container, try to start it", "container", inspectData.State.Pid) - if err = d.podmanClient2.ContainerStart(d.ctx, inspectData.ID); err != nil { + if err = d.podman.ContainerStart(d.ctx, inspectData.ID); err != nil { d.logger.Warn("Recovery restart failed", "task", handle.Config.ID, "container", taskState.ContainerID, "err", err) } else { d.logger.Info("Restarted a container during recovery", "container", inspectData.ID) @@ -310,7 +310,7 @@ func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error { } else { // no, let's cleanup here to prepare for a StartTask() d.logger.Debug("Found a stopped container, removing it", "container", inspectData.ID) - if err = d.podmanClient2.ContainerStart(d.ctx, inspectData.ID); err != nil { + if err = d.podman.ContainerStart(d.ctx, inspectData.ID); err != nil { d.logger.Warn("Recovery cleanup failed", "task", handle.Config.ID, "container", inspectData.ID) } h.procState = drivers.TaskStateExited @@ -353,8 +353,8 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive return nil, nil, fmt.Errorf("image name required") } - createOpts := apiclient.SpecGenerator{} - createOpts.ContainerBasicConfig.LogConfiguration = &apiclient.LogConfig{} + createOpts := api.SpecGenerator{} + createOpts.ContainerBasicConfig.LogConfiguration = &api.LogConfig{} allArgs := []string{} if driverConfig.Command != "" { allArgs = append(allArgs, driverConfig.Command) @@ -448,19 +448,19 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } // Configure network if cfg.NetworkIsolation != nil && cfg.NetworkIsolation.Path != "" { - createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.Path + createOpts.ContainerNetworkConfig.NetNS.NSMode = api.Path createOpts.ContainerNetworkConfig.NetNS.Value = cfg.NetworkIsolation.Path } else { if driverConfig.NetworkMode == "" { - createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.Bridge + createOpts.ContainerNetworkConfig.NetNS.NSMode = api.Bridge } else if driverConfig.NetworkMode == "bridge" { - createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.Bridge + createOpts.ContainerNetworkConfig.NetNS.NSMode = api.Bridge } else if driverConfig.NetworkMode == "host" { - createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.Host + createOpts.ContainerNetworkConfig.NetNS.NSMode = api.Host } else if driverConfig.NetworkMode == "none" { - createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.NoNetwork + createOpts.ContainerNetworkConfig.NetNS.NSMode = api.NoNetwork } else if driverConfig.NetworkMode == "slirp4netns" { - createOpts.ContainerNetworkConfig.NetNS.NSMode = apiclient.Slirp + createOpts.ContainerNetworkConfig.NetNS.NSMode = api.Slirp } else { // FIXME: needs more work, parsing etc. return nil, nil, fmt.Errorf("Unknown/Unsupported network mode: %s", driverConfig.NetworkMode) @@ -474,7 +474,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive return nil, nil, fmt.Errorf("Trying to map ports but no network interface is available") } } else { - publishedPorts := []apiclient.PortMapping{} + publishedPorts := []api.PortMapping{} network := cfg.Resources.NomadResources.Networks[0] allPorts := []structs.Port{} allPorts = append(allPorts, network.ReservedPorts...) @@ -491,13 +491,13 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } // we map both udp and tcp ports - publishedPorts = append(publishedPorts, apiclient.PortMapping{ + publishedPorts = append(publishedPorts, api.PortMapping{ HostIP: network.IP, HostPort: hostPort, ContainerPort: containerPort, Protocol: "tcp", }) - publishedPorts = append(publishedPorts, apiclient.PortMapping{ + publishedPorts = append(publishedPorts, api.PortMapping{ HostIP: network.IP, HostPort: hostPort, ContainerPort: containerPort, @@ -511,7 +511,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive containerID := "" recoverRunningContainer := false // check if there is a container with same name - otherContainerInspect, err := d.podmanClient2.ContainerInspect(d.ctx, containerName) + otherContainerInspect, err := d.podman.ContainerInspect(d.ctx, containerName) if err == nil { // ok, seems we found a container with similar name if otherContainerInspect.State.Running { @@ -522,7 +522,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } else { // let's remove the old, dead container d.logger.Info("Detect stopped container with same name, removing it", "task", cfg.ID, "container", otherContainerInspect.ID) - if err = d.podmanClient2.ContainerDelete(d.ctx, otherContainerInspect.ID, true, true); err != nil { + if err = d.podman.ContainerDelete(d.ctx, otherContainerInspect.ID, true, true); err != nil { return nil, nil, nstructs.WrapRecoverable(fmt.Sprintf("failed to remove dead container: %v", err), err) } } @@ -533,18 +533,18 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive // e.g. oci-archive:/... etc // see also https://github.com/containers/podman/issues/6744 // do we already have this image in local storage? - haveImage, err := d.podmanClient2.ImageExists(d.ctx, createOpts.Image) + haveImage, err := d.podman.ImageExists(d.ctx, createOpts.Image) if err != nil { return nil, nil, fmt.Errorf("failed to start task, unable to check for local image: %v", err) } if !haveImage { // image is not in local storage, so we need to pull it - if err = d.podmanClient2.ImagePull(d.ctx, createOpts.Image); err != nil { + if err = d.podman.ImagePull(d.ctx, createOpts.Image); err != nil { return nil, nil, fmt.Errorf("failed to start task, unable to pull image %s: %v", createOpts.Image, err) } } - createResponse, err := d.podmanClient2.ContainerCreate(d.ctx, createOpts) + createResponse, err := d.podman.ContainerCreate(d.ctx, createOpts) for _, w := range createResponse.Warnings { d.logger.Warn("Create Warning", "warning", w) } @@ -556,19 +556,19 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive cleanup := func() { d.logger.Debug("Cleaning up", "container", containerID) - if err := d.podmanClient2.ContainerDelete(d.ctx, containerID, true, true); err != nil { + if err := d.podman.ContainerDelete(d.ctx, containerID, true, true); err != nil { d.logger.Error("failed to clean up from an error in Start", "error", err) } } if !recoverRunningContainer { - if err = d.podmanClient2.ContainerStart(d.ctx, containerID); err != nil { + if err = d.podman.ContainerStart(d.ctx, containerID); err != nil { cleanup() return nil, nil, fmt.Errorf("failed to start task, could not start container: %v", err) } } - inspectData, err := d.podmanClient2.ContainerInspect(d.ctx, containerID) + inspectData, err := d.podman.ContainerInspect(d.ctx, containerID) if err != nil { d.logger.Error("failed to inspect container", "err", err) cleanup() @@ -669,7 +669,7 @@ func (d *Driver) StopTask(taskID string, timeout time.Duration, signal string) e return drivers.ErrTaskNotFound } // fixme send proper signal to container - err := d.podmanClient2.ContainerStop(d.ctx, handle.containerID, int(timeout.Seconds())) + err := d.podman.ContainerStop(d.ctx, handle.containerID, int(timeout.Seconds())) if err != nil { d.logger.Error("Could not stop/kill container", "containerID", handle.containerID, "err", err) return err @@ -692,7 +692,7 @@ func (d *Driver) DestroyTask(taskID string, force bool) error { if handle.isRunning() { d.logger.Debug("Have to destroyTask but container is still running", "containerID", handle.containerID) // we can not do anything, so catching the error is useless - err := d.podmanClient2.ContainerStop(d.ctx, handle.containerID, 60) + err := d.podman.ContainerStop(d.ctx, handle.containerID, 60) if err != nil { d.logger.Warn("failed to stop/kill container during destroy", "error", err) } @@ -709,7 +709,7 @@ func (d *Driver) DestroyTask(taskID string, force bool) error { } if handle.removeContainerOnExit { - err := d.podmanClient2.ContainerDelete(d.ctx, handle.containerID, true, true) + err := d.podman.ContainerDelete(d.ctx, handle.containerID, true, true) if err != nil { d.logger.Warn("Could not remove container", "container", handle.containerID, "error", err) } @@ -757,7 +757,7 @@ func (d *Driver) SignalTask(taskID string, signal string) error { return drivers.ErrTaskNotFound } - return d.podmanClient2.ContainerKill(d.ctx, handle.containerID, signal) + return d.podman.ContainerKill(d.ctx, handle.containerID, signal) } // ExecTask function is used by the Nomad client to execute commands inside the task execution context. diff --git a/driver_test.go b/driver_test.go index a0a10ef..491e0c2 100644 --- a/driver_test.go +++ b/driver_test.go @@ -30,7 +30,7 @@ import ( "time" "github.com/hashicorp/go-hclog" - "github.com/hashicorp/nomad-driver-podman/apiclient" + "github.com/hashicorp/nomad-driver-podman/api" "github.com/hashicorp/nomad/client/taskenv" "github.com/hashicorp/nomad/helper/freeport" "github.com/hashicorp/nomad/helper/testlog" @@ -226,7 +226,7 @@ func TestPodmanDriver_Start_StoppedContainer(t *testing.T) { // the case of dockerd getting restarted and stopping containers while // Nomad is watching them. containerName := BuildContainerName(task) - createOpts := apiclient.SpecGenerator{} + createOpts := api.SpecGenerator{} createOpts.ContainerBasicConfig.Name = containerName createOpts.ContainerStorageConfig.Image = taskCfg.Image createOpts.ContainerBasicConfig.Command = []string{ @@ -234,7 +234,7 @@ func TestPodmanDriver_Start_StoppedContainer(t *testing.T) { "5", } - _, err := getPodmanDriver(t, d).podmanClient2.ContainerCreate(context.Background(), createOpts) + _, err := getPodmanDriver(t, d).podman.ContainerCreate(context.Background(), createOpts) require.NoError(t, err) _, _, err = d.StartTask(task) @@ -340,8 +340,8 @@ func TestPodmanDriver_GC_Container_on(t *testing.T) { d.DestroyTask(task.ID, true) // see if the container does not exist (404) - _, err = getPodmanDriver(t, d).podmanClient2.ContainerStats(context.Background(), containerName) - require.Error(t, err, apiclient.ContainerNotFound) + _, err = getPodmanDriver(t, d).podman.ContainerStats(context.Background(), containerName) + require.Error(t, err, api.ContainerNotFound) } // check if container is destroyed if gc.container=false @@ -386,11 +386,11 @@ func TestPodmanDriver_GC_Container_off(t *testing.T) { d.DestroyTask(task.ID, true) // see if the stopped container can be inspected - _, err = getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) + _, err = getPodmanDriver(t, d).podman.ContainerInspect(context.Background(), containerName) require.NoError(t, err) // and cleanup after ourself - err = getPodmanDriver(t, d).podmanClient2.ContainerDelete(context.Background(), containerName, true, true) + err = getPodmanDriver(t, d).podman.ContainerDelete(context.Background(), containerName, true, true) require.NoError(t, err) } @@ -528,7 +528,7 @@ func TestPodmanDriver_PortMap(t *testing.T) { defer d.DestroyTask(task.ID, true) - inspectData, err := getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) + inspectData, err := getPodmanDriver(t, d).podman.ContainerInspect(context.Background(), containerName) require.NoError(t, err) // Verify that the port environment variables are set @@ -536,27 +536,27 @@ func TestPodmanDriver_PortMap(t *testing.T) { require.Contains(t, inspectData.Config.Env, "NOMAD_PORT_REDIS=6379") // Verify that the correct ports are bound - expectedPortBindings := map[string][]apiclient.InspectHostPort{ - "8888/tcp": []apiclient.InspectHostPort{ - apiclient.InspectHostPort{ + expectedPortBindings := map[string][]api.InspectHostPort{ + "8888/tcp": []api.InspectHostPort{ + api.InspectHostPort{ HostIP: "127.0.0.1", HostPort: strconv.Itoa(ports[0]), }, }, - "8888/udp": []apiclient.InspectHostPort{ - apiclient.InspectHostPort{ + "8888/udp": []api.InspectHostPort{ + api.InspectHostPort{ HostIP: "127.0.0.1", HostPort: strconv.Itoa(ports[0]), }, }, - "6379/tcp": []apiclient.InspectHostPort{ - apiclient.InspectHostPort{ + "6379/tcp": []api.InspectHostPort{ + api.InspectHostPort{ HostIP: "127.0.0.1", HostPort: strconv.Itoa(ports[1]), }, }, - "6379/udp": []apiclient.InspectHostPort{ - apiclient.InspectHostPort{ + "6379/udp": []api.InspectHostPort{ + api.InspectHostPort{ HostIP: "127.0.0.1", HostPort: strconv.Itoa(ports[1]), }, @@ -786,7 +786,7 @@ func TestPodmanDriver_Swap(t *testing.T) { case <-time.After(time.Duration(tu.TestMultiplier()*2) * time.Second): } // inspect container to learn about the actual podman limits - inspectData, err := getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) + inspectData, err := getPodmanDriver(t, d).podman.ContainerInspect(context.Background(), containerName) require.NoError(t, err) // see if the configured values are set correctly @@ -846,7 +846,7 @@ func TestPodmanDriver_Tmpfs(t *testing.T) { } // see if tmpfs was propagated to podman - inspectData, err := getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) + inspectData, err := getPodmanDriver(t, d).podman.ContainerInspect(context.Background(), containerName) require.NoError(t, err) expectedFilesystem := map[string]string{ @@ -1005,7 +1005,7 @@ func TestPodmanDriver_NetworkMode(t *testing.T) { require.NoError(t, d.WaitUntilStarted(task.ID, time.Duration(tu.TestMultiplier()*3)*time.Second)) - inspectData, err := getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) + inspectData, err := getPodmanDriver(t, d).podman.ContainerInspect(context.Background(), containerName) require.NoError(t, err) if tc.mode == "host" { require.Equal(t, "host", inspectData.HostConfig.NetworkMode) @@ -1089,7 +1089,7 @@ func getPodmanDriver(t *testing.T, harness *dtestutil.DriverHarness) *Driver { } // helper to start, destroy and inspect a long running container -func startDestroyInspect(t *testing.T, taskCfg TaskConfig, taskName string) apiclient.InspectContainerData { +func startDestroyInspect(t *testing.T, taskCfg TaskConfig, taskName string) api.InspectContainerData { if !tu.IsCI() { t.Parallel() } @@ -1122,7 +1122,7 @@ func startDestroyInspect(t *testing.T, taskCfg TaskConfig, taskName string) apic t.Fatalf("wait channel should not have received an exit result") case <-time.After(time.Duration(tu.TestMultiplier()*2) * time.Second): } - inspectData, err := getPodmanDriver(t, d).podmanClient2.ContainerInspect(context.Background(), containerName) + inspectData, err := getPodmanDriver(t, d).podman.ContainerInspect(context.Background(), containerName) require.NoError(t, err) return inspectData diff --git a/handle.go b/handle.go index 760d309..cd4bddf 100644 --- a/handle.go +++ b/handle.go @@ -24,7 +24,7 @@ import ( "time" hclog "github.com/hashicorp/go-hclog" - "github.com/hashicorp/nomad-driver-podman/apiclient" + "github.com/hashicorp/nomad-driver-podman/api" "github.com/hashicorp/nomad/client/stats" "github.com/hashicorp/nomad/plugins/drivers" ) @@ -55,7 +55,7 @@ type TaskHandle struct { removeContainerOnExit bool - containerStats apiclient.Stats + containerStats api.Stats } func (h *TaskHandle) taskStatus() *drivers.TaskStatus { @@ -176,18 +176,18 @@ func (h *TaskHandle) runContainerMonitor() { timer.Reset(interval) } - containerStats, statsErr := h.driver.podmanClient2.ContainerStats(h.driver.ctx, h.containerID) + containerStats, statsErr := h.driver.podman.ContainerStats(h.driver.ctx, h.containerID) if statsErr != nil { gone := false - if errors.Is(statsErr, apiclient.ContainerNotFound) { + if errors.Is(statsErr, api.ContainerNotFound) { gone = true - } else if errors.Is(statsErr, apiclient.ContainerWrongState) { + } else if errors.Is(statsErr, api.ContainerWrongState) { gone = true } if gone { h.logger.Debug("Container is not running anymore", "container", h.containerID, "err", statsErr) // container was stopped, get exit code and other post mortem infos - inspectData, err := h.driver.podmanClient2.ContainerInspect(h.driver.ctx, h.containerID) + inspectData, err := h.driver.podman.ContainerInspect(h.driver.ctx, h.containerID) h.stateLock.Lock() h.completedAt = time.Now() if err != nil { From 48050ff43eb428df6ecacdd506b43a55cc29bc92 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Fri, 6 Nov 2020 14:55:29 +0100 Subject: [PATCH 25/31] Code review #51 Renamed GuessSocketPath to DefaultSocketPath Removed api-version constant Cleaned up api-endpoints, do not use "compat" api, always send api version Worked around flaky tests by adding sleeps to avoid very shortliving containers --- api/api.go | 10 +++------- api/container_create.go | 2 +- api/container_delete.go | 2 +- api/container_inspect.go | 2 +- api/container_kill.go | 2 +- api/container_start.go | 2 +- api/container_stats.go | 2 +- api/container_stop.go | 2 +- api/container_wait.go | 2 +- api/image_exists.go | 2 +- api/image_pull.go | 2 +- api/system_info.go | 2 +- driver_test.go | 9 ++++++--- 13 files changed, 20 insertions(+), 21 deletions(-) diff --git a/api/api.go b/api/api.go index 1d6ae86..aacd7d0 100644 --- a/api/api.go +++ b/api/api.go @@ -29,10 +29,6 @@ import ( "github.com/hashicorp/go-hclog" ) -const ( - PODMAN_API_VERSION = "v1.0.0" -) - type API struct { baseUrl string httpClient *http.Client @@ -43,7 +39,7 @@ func NewClient(logger hclog.Logger) *API { ac := &API{ logger: logger, } - ac.SetSocketPath(GuessSocketPath()) + ac.SetSocketPath(DefaultSocketPath()) return ac } @@ -65,8 +61,8 @@ func (c *API) SetSocketPath(baseUrl string) { } } -// GuessSocketPath returns the default unix domain socket path for root or non-root users -func GuessSocketPath() string { +// DefaultSocketPath returns the default unix domain socket path for root or non-root users +func DefaultSocketPath() string { uid := os.Getuid() // are we root? if uid == 0 { diff --git a/api/container_create.go b/api/container_create.go index b2f818c..9318236 100644 --- a/api/container_create.go +++ b/api/container_create.go @@ -40,7 +40,7 @@ func (c *API) ContainerCreate(ctx context.Context, create SpecGenerator) (Contai } // fmt.Println(string(jsonString)) - res, err := c.Post(ctx, fmt.Sprintf("/%s/libpod/containers/create", PODMAN_API_VERSION), bytes.NewBuffer(jsonString)) + res, err := c.Post(ctx, "/v1.0.0/libpod/containers/create", bytes.NewBuffer(jsonString)) if err != nil { return response, err } diff --git a/api/container_delete.go b/api/container_delete.go index fcf8100..d0c54fa 100644 --- a/api/container_delete.go +++ b/api/container_delete.go @@ -26,7 +26,7 @@ import ( // It takes the name or ID of a container. func (c *API) ContainerDelete(ctx context.Context, name string, force bool, deleteVolumes bool) error { - res, err := c.Delete(ctx, fmt.Sprintf("/containers/%s?force=%t&v=%t", name, force, deleteVolumes)) + res, err := c.Delete(ctx, fmt.Sprintf("/v1.0.0/libpod/containers/%s?force=%t&v=%t", name, force, deleteVolumes)) if err != nil { return err } diff --git a/api/container_inspect.go b/api/container_inspect.go index 464fcd2..b3560ee 100644 --- a/api/container_inspect.go +++ b/api/container_inspect.go @@ -30,7 +30,7 @@ func (c *API) ContainerInspect(ctx context.Context, name string) (InspectContain var inspectData InspectContainerData - res, err := c.Get(ctx, fmt.Sprintf("/%s/libpod/containers/%s/json", PODMAN_API_VERSION, name)) + res, err := c.Get(ctx, fmt.Sprintf("/v1.0.0/libpod/containers/%s/json", name)) if err != nil { return inspectData, err } diff --git a/api/container_kill.go b/api/container_kill.go index 248bfa7..cfaaa23 100644 --- a/api/container_kill.go +++ b/api/container_kill.go @@ -25,7 +25,7 @@ import ( // ContainerKill sends a signal to a container func (c *API) ContainerKill(ctx context.Context, name string, signal string) error { - res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/kill?signal=%s", name, signal), nil) + res, err := c.Post(ctx, fmt.Sprintf("/v1.0.0/libpod/containers/%s/kill?signal=%s", name, signal), nil) if err != nil { return err } diff --git a/api/container_start.go b/api/container_start.go index 6f62884..88c3b3c 100644 --- a/api/container_start.go +++ b/api/container_start.go @@ -27,7 +27,7 @@ import ( // ContainerStart starts a container via id or name func (c *API) ContainerStart(ctx context.Context, name string) error { - res, err := c.Post(ctx, fmt.Sprintf("/%s/libpod/containers/%s/start", PODMAN_API_VERSION, name), nil) + res, err := c.Post(ctx, fmt.Sprintf("/v1.0.0/libpod/containers/%s/start", name), nil) if err != nil { return err } diff --git a/api/container_stats.go b/api/container_stats.go index 04031e2..1a83cb6 100644 --- a/api/container_stats.go +++ b/api/container_stats.go @@ -33,7 +33,7 @@ var ContainerWrongState = errors.New("Container has wrong state") func (c *API) ContainerStats(ctx context.Context, name string) (Stats, error) { var stats Stats - res, err := c.Get(ctx, fmt.Sprintf("libpod/containers/%s/stats?stream=false", name)) + res, err := c.Get(ctx, fmt.Sprintf("/v1.0.0/libpod/containers/%s/stats?stream=false", name)) if err != nil { return stats, err } diff --git a/api/container_stop.go b/api/container_stop.go index 92454df..6fa4164 100644 --- a/api/container_stop.go +++ b/api/container_stop.go @@ -28,7 +28,7 @@ import ( // error will be returned instead. func (c *API) ContainerStop(ctx context.Context, name string, timeout int) error { - res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/stop?timeout=%d", name, timeout), nil) + res, err := c.Post(ctx, fmt.Sprintf("/v1.0.0/libpod/containers/%s/stop?timeout=%d", name, timeout), nil) if err != nil { return err } diff --git a/api/container_wait.go b/api/container_wait.go index 487e6cb..a7eb565 100644 --- a/api/container_wait.go +++ b/api/container_wait.go @@ -25,7 +25,7 @@ import ( // ContainerWait waits on a container to met a given condition func (c *API) ContainerWait(ctx context.Context, name string, condition string) error { - res, err := c.Post(ctx, fmt.Sprintf("/containers/%s/wait?condition=%s", name, condition), nil) + res, err := c.Post(ctx, fmt.Sprintf("/v1.0.0/libpod/containers/%s/wait?condition=%s", name, condition), nil) if err != nil { return err } diff --git a/api/image_exists.go b/api/image_exists.go index bd115c3..d27bb8d 100644 --- a/api/image_exists.go +++ b/api/image_exists.go @@ -25,7 +25,7 @@ import ( // ImageExists checks if image exists in local store func (c *API) ImageExists(ctx context.Context, nameWithTag string) (bool, error) { - res, err := c.Get(ctx, fmt.Sprintf("/libpod/images/%s/exists", nameWithTag)) + res, err := c.Get(ctx, fmt.Sprintf("/v1.0.0/libpod/images/%s/exists", nameWithTag)) if err != nil { return false, err } diff --git a/api/image_pull.go b/api/image_pull.go index 4ef0fa7..0ff3e37 100644 --- a/api/image_pull.go +++ b/api/image_pull.go @@ -26,7 +26,7 @@ import ( // ImagePull pulls a image from a remote location to local storage func (c *API) ImagePull(ctx context.Context, nameWithTag string) error { - res, err := c.Post(ctx, fmt.Sprintf("/%s/libpod/images/pull?reference=%s", PODMAN_API_VERSION, nameWithTag), nil) + res, err := c.Post(ctx, fmt.Sprintf("/v1.0.0/libpod/images/pull?reference=%s", nameWithTag), nil) if err != nil { return err } diff --git a/api/system_info.go b/api/system_info.go index f22d740..1ffc115 100644 --- a/api/system_info.go +++ b/api/system_info.go @@ -32,7 +32,7 @@ func (c *API) SystemInfo(ctx context.Context) (Info, error) { // the libpod/info endpoint seems to have some trouble // using "compat" endpoint and minimal struct // until podman returns proper data. - res, err := c.Get(ctx, fmt.Sprintf("/%s/libpod/info", PODMAN_API_VERSION)) + res, err := c.Get(ctx, "/v1.0.0/libpod/info") if err != nil { return infoData, err } diff --git a/driver_test.go b/driver_test.go index 491e0c2..61e830a 100644 --- a/driver_test.go +++ b/driver_test.go @@ -702,7 +702,9 @@ func TestPodmanDriver_User(t *testing.T) { taskCfg := newTaskConfig("", []string{ // print our username to stdout - "whoami", + "sh", + "-c", + "sleep 1; whoami", }) task := &drivers.TaskConfig{ @@ -899,8 +901,9 @@ func TestPodmanDriver_Dns(t *testing.T) { } taskCfg := newTaskConfig("", []string{ - "cat", - "/etc/resolv.conf", + "sh", + "-c", + "sleep 1; cat /etc/resolv.conf", }) // config { // dns = [ From 1e6ba5abc3cf7983eb58e63ef554f78405b9e291 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Fri, 6 Nov 2020 20:50:48 +0100 Subject: [PATCH 26/31] Change license headers to MPL-2 --- api/api.go | 16 +++------------- api/container_create.go | 16 +++------------- api/container_delete.go | 16 +++------------- api/container_inspect.go | 16 +++------------- api/container_kill.go | 16 +++------------- api/container_start.go | 16 +++------------- api/container_stats.go | 16 +++------------- api/container_stop.go | 16 +++------------- api/container_wait.go | 16 +++------------- api/image_exists.go | 16 +++------------- api/image_pull.go | 16 +++------------- api/system_info.go | 16 +++------------- config.go | 16 +++------------- driver.go | 16 +++------------- driver_test.go | 16 +++------------- handle.go | 16 +++------------- main.go | 16 +++------------- state.go | 16 +++------------- 18 files changed, 54 insertions(+), 234 deletions(-) diff --git a/api/api.go b/api/api.go index aacd7d0..09ddf5d 100644 --- a/api/api.go +++ b/api/api.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/api/container_create.go b/api/container_create.go index 9318236..b7fa022 100644 --- a/api/container_create.go +++ b/api/container_create.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/api/container_delete.go b/api/container_delete.go index d0c54fa..71f735e 100644 --- a/api/container_delete.go +++ b/api/container_delete.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/api/container_inspect.go b/api/container_inspect.go index b3560ee..db9185e 100644 --- a/api/container_inspect.go +++ b/api/container_inspect.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/api/container_kill.go b/api/container_kill.go index cfaaa23..b96089c 100644 --- a/api/container_kill.go +++ b/api/container_kill.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/api/container_start.go b/api/container_start.go index 88c3b3c..114da3f 100644 --- a/api/container_start.go +++ b/api/container_start.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/api/container_stats.go b/api/container_stats.go index 1a83cb6..5aeeab3 100644 --- a/api/container_stats.go +++ b/api/container_stats.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/api/container_stop.go b/api/container_stop.go index 6fa4164..1672381 100644 --- a/api/container_stop.go +++ b/api/container_stop.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/api/container_wait.go b/api/container_wait.go index a7eb565..96f3fa6 100644 --- a/api/container_wait.go +++ b/api/container_wait.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/api/image_exists.go b/api/image_exists.go index d27bb8d..fa8889b 100644 --- a/api/image_exists.go +++ b/api/image_exists.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/api/image_pull.go b/api/image_pull.go index 0ff3e37..8b3734e 100644 --- a/api/image_pull.go +++ b/api/image_pull.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/api/system_info.go b/api/system_info.go index 1ffc115..465a700 100644 --- a/api/system_info.go +++ b/api/system_info.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package api diff --git a/config.go b/config.go index aa08bc1..66deac0 100644 --- a/config.go +++ b/config.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package main diff --git a/driver.go b/driver.go index 64f4b34..9bf536a 100644 --- a/driver.go +++ b/driver.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package main diff --git a/driver_test.go b/driver_test.go index 61e830a..ee795ff 100644 --- a/driver_test.go +++ b/driver_test.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package main diff --git a/handle.go b/handle.go index cd4bddf..3c588bd 100644 --- a/handle.go +++ b/handle.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package main diff --git a/main.go b/main.go index 43155e5..71bf712 100644 --- a/main.go +++ b/main.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package main diff --git a/state.go b/state.go index 9a2424c..aff2fde 100644 --- a/state.go +++ b/state.go @@ -1,17 +1,7 @@ /* -Copyright 2019 Thomas Weber - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. */ package main From 072b63b2a2fe030ca9e1e22c375196f3005ee0ed Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Fri, 6 Nov 2020 21:15:38 +0100 Subject: [PATCH 27/31] Code review #51 Improved comments Simplified TestPodmanDriver_SignalTask --- driver.go | 24 +++++++----------------- driver_test.go | 14 ++++++-------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/driver.go b/driver.go index 9bf536a..e1ae038 100644 --- a/driver.go +++ b/driver.go @@ -360,9 +360,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive // ensure to include port_map into tasks environment map cfg.Env = taskenv.SetPortMapEnvs(cfg.Env, driverConfig.PortMap) - // ------------------------------------------------------------------------------------------- - // BASIC - // ------------------------------------------------------------------------------------------- + // Basic config options createOpts.ContainerBasicConfig.Name = containerName createOpts.ContainerBasicConfig.Command = allArgs createOpts.ContainerBasicConfig.Env = cfg.Env @@ -370,9 +368,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive createOpts.ContainerBasicConfig.LogConfiguration.Path = cfg.StdoutPath - // ------------------------------------------------------------------------------------------- - // STORAGE - // ------------------------------------------------------------------------------------------- + // Storage config options createOpts.ContainerStorageConfig.Init = driverConfig.Init createOpts.ContainerStorageConfig.Image = driverConfig.Image createOpts.ContainerStorageConfig.InitPath = driverConfig.InitPath @@ -383,9 +379,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } createOpts.ContainerStorageConfig.Mounts = allMounts - // ------------------------------------------------------------------------------------------- - // RESOURCES - // ------------------------------------------------------------------------------------------- + // Resources config options createOpts.ContainerResourceConfig.ResourceLimits = &spec.LinuxResources{ Memory: &spec.LinuxMemory{}, CPU: &spec.LinuxCPU{}, @@ -419,16 +413,13 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive cpuShares := uint64(cfg.Resources.LinuxResources.CPUShares) createOpts.ContainerResourceConfig.ResourceLimits.CPU.Shares = &cpuShares } - // ------------------------------------------------------------------------------------------- - // SECURITY - // ------------------------------------------------------------------------------------------- + + // Security config options createOpts.ContainerSecurityConfig.CapAdd = driverConfig.CapAdd createOpts.ContainerSecurityConfig.CapDrop = driverConfig.CapDrop createOpts.ContainerSecurityConfig.User = cfg.User - // ------------------------------------------------------------------------------------------- - // NETWORK - // ------------------------------------------------------------------------------------------- + // Network config options for _, strdns := range driverConfig.Dns { ipdns := net.ParseIP(strdns) if ipdns == nil { @@ -452,7 +443,6 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } else if driverConfig.NetworkMode == "slirp4netns" { createOpts.ContainerNetworkConfig.NetNS.NSMode = api.Slirp } else { - // FIXME: needs more work, parsing etc. return nil, nil, fmt.Errorf("Unknown/Unsupported network mode: %s", driverConfig.NetworkMode) } } @@ -521,7 +511,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive if !recoverRunningContainer { // FIXME: there are more variations of image sources, we should handle it // e.g. oci-archive:/... etc - // see also https://github.com/containers/podman/issues/6744 + // see also https://github.com/hashicorp/nomad-driver-podman/issues/69 // do we already have this image in local storage? haveImage, err := d.podman.ImageExists(d.ctx, createOpts.Image) if err != nil { diff --git a/driver_test.go b/driver_test.go index ee795ff..4a62510 100644 --- a/driver_test.go +++ b/driver_test.go @@ -1032,14 +1032,12 @@ func TestPodmanDriver_SignalTask(t *testing.T) { defer d.DestroyTask(task.ID, true) - go func(t *testing.T) { - time.Sleep(300 * time.Millisecond) - // try to send non-existing singal, should yield an error - require.Error(t, d.SignalTask(task.ID, "FOO")) - time.Sleep(300 * time.Millisecond) - // send a friendly CTRL+C to busybox to stop the container - require.NoError(t, d.SignalTask(task.ID, "SIGINT")) - }(t) + time.Sleep(300 * time.Millisecond) + // try to send non-existing singal, should yield an error + require.Error(t, d.SignalTask(task.ID, "FOO")) + time.Sleep(300 * time.Millisecond) + // send a friendly CTRL+C to busybox to stop the container + require.NoError(t, d.SignalTask(task.ID, "SIGINT")) // Attempt to wait waitCh, err := d.WaitTask(context.Background(), task.ID) From 7f6d2f219a260e8c289008e1f7d8e480111c9539 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 9 Nov 2020 20:30:06 +0100 Subject: [PATCH 28/31] Removed license headers completely --- api/api.go | 6 ------ api/container_create.go | 6 ------ api/container_delete.go | 6 ------ api/container_inspect.go | 6 ------ api/container_kill.go | 6 ------ api/container_start.go | 6 ------ api/container_stats.go | 6 ------ api/container_stop.go | 6 ------ api/container_wait.go | 6 ------ api/image_exists.go | 6 ------ api/image_pull.go | 6 ------ api/system_info.go | 6 ------ 12 files changed, 72 deletions(-) diff --git a/api/api.go b/api/api.go index 09ddf5d..b0088a6 100644 --- a/api/api.go +++ b/api/api.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( diff --git a/api/container_create.go b/api/container_create.go index b7fa022..520f666 100644 --- a/api/container_create.go +++ b/api/container_create.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( diff --git a/api/container_delete.go b/api/container_delete.go index 71f735e..cd51b5d 100644 --- a/api/container_delete.go +++ b/api/container_delete.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( diff --git a/api/container_inspect.go b/api/container_inspect.go index db9185e..24e995c 100644 --- a/api/container_inspect.go +++ b/api/container_inspect.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( diff --git a/api/container_kill.go b/api/container_kill.go index b96089c..e3a6ba3 100644 --- a/api/container_kill.go +++ b/api/container_kill.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( diff --git a/api/container_start.go b/api/container_start.go index 114da3f..2b930b0 100644 --- a/api/container_start.go +++ b/api/container_start.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( diff --git a/api/container_stats.go b/api/container_stats.go index 5aeeab3..7b913c2 100644 --- a/api/container_stats.go +++ b/api/container_stats.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( diff --git a/api/container_stop.go b/api/container_stop.go index 1672381..58a36ee 100644 --- a/api/container_stop.go +++ b/api/container_stop.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( diff --git a/api/container_wait.go b/api/container_wait.go index 96f3fa6..ac83a28 100644 --- a/api/container_wait.go +++ b/api/container_wait.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( diff --git a/api/image_exists.go b/api/image_exists.go index fa8889b..adebde1 100644 --- a/api/image_exists.go +++ b/api/image_exists.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( diff --git a/api/image_pull.go b/api/image_pull.go index 8b3734e..ca14932 100644 --- a/api/image_pull.go +++ b/api/image_pull.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( diff --git a/api/system_info.go b/api/system_info.go index 465a700..fa3e9a0 100644 --- a/api/system_info.go +++ b/api/system_info.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package api import ( From c95221544e6a4f88f586b16fbefbb2ebffb575ac Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 9 Nov 2020 20:47:42 +0100 Subject: [PATCH 29/31] Code review #51 Moved all podman structs to new file structs.go --- api/container_create.go | 545 -------------- api/container_inspect.go | 696 ----------------- api/container_stats.go | 145 ---- api/structs.go | 1516 ++++++++++++++++++++++++++++++++++++++ api/system_info.go | 127 ---- 5 files changed, 1516 insertions(+), 1513 deletions(-) create mode 100644 api/structs.go diff --git a/api/container_create.go b/api/container_create.go index 520f666..dce2c67 100644 --- a/api/container_create.go +++ b/api/container_create.go @@ -6,11 +6,7 @@ import ( "encoding/json" "fmt" "io/ioutil" - "net" "net/http" - "syscall" - - spec "github.com/opencontainers/runtime-spec/specs-go" ) // ContainerCreate creates a new container @@ -80,544 +76,3 @@ type ContainerCreateResponse struct { Id string Warnings []string } - -// ------------------------------------------------------------------------------------------------------- -// structs copied from https://github.com/containers/podman/blob/master/pkg/specgen/specgen.go -// -// some unused parts are modified/commented out to not pull -// more dependencies and also to overcome some json unmarshall/version problems -// -// some fields are reordert to make the linter happy (bytes maligned complains) -// ------------------------------------------------------------------------------------------------------- - -// LogConfig describes the logging characteristics for a container -type LogConfig struct { - // LogDriver is the container's log driver. - // Optional. - Driver string `json:"driver,omitempty"` - // LogPath is the path the container's logs will be stored at. - // Only available if LogDriver is set to "json-file" or "k8s-file". - // Optional. - Path string `json:"path,omitempty"` - // A set of options to accompany the log driver. - // Optional. - Options map[string]string `json:"options,omitempty"` -} - -// ContainerBasicConfig contains the basic parts of a container. -type ContainerBasicConfig struct { - // Name is the name the container will be given. - // If no name is provided, one will be randomly generated. - // Optional. - Name string `json:"name,omitempty"` - // Pod is the ID of the pod the container will join. - // Optional. - Pod string `json:"pod,omitempty"` - // Entrypoint is the container's entrypoint. - // If not given and Image is specified, this will be populated by the - // image's configuration. - // Optional. - Entrypoint []string `json:"entrypoint,omitempty"` - // Command is the container's command. - // If not given and Image is specified, this will be populated by the - // image's configuration. - // Optional. - Command []string `json:"command,omitempty"` - // Env is a set of environment variables that will be set in the - // container. - // Optional. - Env map[string]string `json:"env,omitempty"` - // Labels are key-value pairs that are used to add metadata to - // containers. - // Optional. - Labels map[string]string `json:"labels,omitempty"` - // Annotations are key-value options passed into the container runtime - // that can be used to trigger special behavior. - // Optional. - Annotations map[string]string `json:"annotations,omitempty"` - // StopSignal is the signal that will be used to stop the container. - // Must be a non-zero integer below SIGRTMAX. - // If not provided, the default, SIGTERM, will be used. - // Will conflict with Systemd if Systemd is set to "true" or "always". - // Optional. - StopSignal *syscall.Signal `json:"stop_signal,omitempty"` - // LogConfiguration describes the logging for a container including - // driver, path, and options. - // Optional - LogConfiguration *LogConfig `json:"log_configuration,omitempty"` - // ConmonPidFile is a path at which a PID file for Conmon will be - // placed. - // If not given, a default location will be used. - // Optional. - ConmonPidFile string `json:"conmon_pid_file,omitempty"` - // RestartPolicy is the container's restart policy - an action which - // will be taken when the container exits. - // If not given, the default policy, which does nothing, will be used. - // Optional. - RestartPolicy string `json:"restart_policy,omitempty"` - // OCIRuntime is the name of the OCI runtime that will be used to create - // the container. - // If not specified, the default will be used. - // Optional. - OCIRuntime string `json:"oci_runtime,omitempty"` - // Systemd is whether the container will be started in systemd mode. - // Valid options are "true", "false", and "always". - // "true" enables this mode only if the binary run in the container is - // /sbin/init or systemd. "always" unconditionally enables systemd mode. - // "false" unconditionally disables systemd mode. - // If enabled, mounts and stop signal will be modified. - // If set to "always" or set to "true" and conditionally triggered, - // conflicts with StopSignal. - // If not specified, "false" will be assumed. - // Optional. - Systemd string `json:"systemd,omitempty"` - // Determine how to handle the NOTIFY_SOCKET - do we participate or pass it through - // "container" - let the OCI runtime deal with it, advertise conmon's MAINPID - // "conmon-only" - advertise conmon's MAINPID, send READY when started, don't pass to OCI - // "ignore" - unset NOTIFY_SOCKET - SdNotifyMode string `json:"sdnotifyMode,omitempty"` - // Namespace is the libpod namespace the container will be placed in. - // Optional. - Namespace string `json:"namespace,omitempty"` - - // PidNS is the container's PID namespace. - // It defaults to private. - // Mandatory. - PidNS Namespace `json:"pidns,omitempty"` - - // UtsNS is the container's UTS namespace. - // It defaults to private. - // Must be set to Private to set Hostname. - // Mandatory. - UtsNS Namespace `json:"utsns,omitempty"` - - // Hostname is the container's hostname. If not set, the hostname will - // not be modified (if UtsNS is not private) or will be set to the - // container ID (if UtsNS is private). - // Conflicts with UtsNS if UtsNS is not set to private. - // Optional. - Hostname string `json:"hostname,omitempty"` - // Sysctl sets kernel parameters for the container - Sysctl map[string]string `json:"sysctl,omitempty"` - // ContainerCreateCommand is the command that was used to create this - // container. - // This will be shown in the output of Inspect() on the container, and - // may also be used by some tools that wish to recreate the container - // (e.g. `podman generate systemd --new`). - // Optional. - ContainerCreateCommand []string `json:"containerCreateCommand,omitempty"` - // Timezone is the timezone inside the container. - // Local means it has the same timezone as the host machine - Timezone string `json:"timezone,omitempty"` - // PreserveFDs is a number of additional file descriptors (in addition - // to 0, 1, 2) that will be passed to the executed process. The total FDs - // passed will be 3 + PreserveFDs. - // set tags as `json:"-"` for not supported remote - PreserveFDs uint `json:"-"` - // StopTimeout is a timeout between the container's stop signal being - // sent and SIGKILL being sent. - // If not provided, the default will be used. - // If 0 is used, stop signal will not be sent, and SIGKILL will be sent - // instead. - // Optional. - StopTimeout *uint `json:"stop_timeout,omitempty"` - // RestartRetries is the number of attempts that will be made to restart - // the container. - // Only available when RestartPolicy is set to "on-failure". - // Optional. - RestartRetries *uint `json:"restart_tries,omitempty"` - // Remove indicates if the container should be removed once it has been started - // and exits - Remove bool `json:"remove,omitempty"` - // Terminal is whether the container will create a PTY. - // Optional. - Terminal bool `json:"terminal,omitempty"` - // Stdin is whether the container will keep its STDIN open. - Stdin bool `json:"stdin,omitempty"` -} - -// ContainerStorageConfig contains information on the storage configuration of a -// container. -type ContainerStorageConfig struct { - // Image is the image the container will be based on. The image will be - // used as the container's root filesystem, and its environment vars, - // volumes, and other configuration will be applied to the container. - // Conflicts with Rootfs. - // At least one of Image or Rootfs must be specified. - Image string `json:"image"` - // Rootfs is the path to a directory that will be used as the - // container's root filesystem. No modification will be made to the - // directory, it will be directly mounted into the container as root. - // Conflicts with Image. - // At least one of Image or Rootfs must be specified. - Rootfs string `json:"rootfs,omitempty"` - // ImageVolumeMode indicates how image volumes will be created. - // Supported modes are "ignore" (do not create), "tmpfs" (create as - // tmpfs), and "anonymous" (create as anonymous volumes). - // The default if unset is anonymous. - // Optional. - ImageVolumeMode string `json:"image_volume_mode,omitempty"` - // VolumesFrom is a set of containers whose volumes will be added to - // this container. The name or ID of the container must be provided, and - // may optionally be followed by a : and then one or more - // comma-separated options. Valid options are 'ro', 'rw', and 'z'. - // Options will be used for all volumes sourced from the container. - VolumesFrom []string `json:"volumes_from,omitempty"` - // Init specifies that an init binary will be mounted into the - // container, and will be used as PID1. - Init bool `json:"init,omitempty"` - // InitPath specifies the path to the init binary that will be added if - // Init is specified above. If not specified, the default set in the - // Libpod config will be used. Ignored if Init above is not set. - // Optional. - InitPath string `json:"init_path,omitempty"` - // Mounts are mounts that will be added to the container. - // These will supersede Image Volumes and VolumesFrom volumes where - // there are conflicts. - // Optional. - Mounts []spec.Mount `json:"mounts,omitempty"` - // Volumes are named volumes that will be added to the container. - // These will supersede Image Volumes and VolumesFrom volumes where - // there are conflicts. - // Optional. - Volumes []*NamedVolume `json:"volumes,omitempty"` - // Overlay volumes are named volumes that will be added to the container. - // Optional. - OverlayVolumes []*OverlayVolume `json:"overlay_volumes,omitempty"` - // Devices are devices that will be added to the container. - // Optional. - Devices []spec.LinuxDevice `json:"devices,omitempty"` - // IpcNS is the container's IPC namespace. - // Default is private. - // Conflicts with ShmSize if not set to private. - // Mandatory. - IpcNS Namespace `json:"ipcns,omitempty"` - - // ShmSize is the size of the tmpfs to mount in at /dev/shm, in bytes. - // Conflicts with ShmSize if IpcNS is not private. - // Optional. - ShmSize *int64 `json:"shm_size,omitempty"` - // WorkDir is the container's working directory. - // If unset, the default, /, will be used. - // Optional. - WorkDir string `json:"work_dir,omitempty"` - // RootfsPropagation is the rootfs propagation mode for the container. - // If not set, the default of rslave will be used. - // Optional. - RootfsPropagation string `json:"rootfs_propagation,omitempty"` -} - -// ContainerSecurityConfig is a container's security features, including -// SELinux, Apparmor, and Seccomp. -type ContainerSecurityConfig struct { - // User is the user the container will be run as. - // Can be given as a UID or a username; if a username, it will be - // resolved within the container, using the container's /etc/passwd. - // If unset, the container will be run as root. - // Optional. - User string `json:"user,omitempty"` - // Groups are a list of supplemental groups the container's user will - // be granted access to. - // Optional. - Groups []string `json:"groups,omitempty"` - // CapAdd are capabilities which will be added to the container. - // Conflicts with Privileged. - // Optional. - CapAdd []string `json:"cap_add,omitempty"` - // CapDrop are capabilities which will be removed from the container. - // Conflicts with Privileged. - // Optional. - CapDrop []string `json:"cap_drop,omitempty"` - // SelinuxProcessLabel is the process label the container will use. - // If SELinux is enabled and this is not specified, a label will be - // automatically generated if not specified. - // Optional. - SelinuxOpts []string `json:"selinux_opts,omitempty"` - // ApparmorProfile is the name of the Apparmor profile the container - // will use. - // Optional. - ApparmorProfile string `json:"apparmor_profile,omitempty"` - // SeccompPolicy determines which seccomp profile gets applied - // the container. valid values: empty,default,image - SeccompPolicy string `json:"seccomp_policy,omitempty"` - // SeccompProfilePath is the path to a JSON file containing the - // container's Seccomp profile. - // If not specified, no Seccomp profile will be used. - // Optional. - SeccompProfilePath string `json:"seccomp_profile_path,omitempty"` - // Umask is the umask the init process of the container will be run with. - Umask string `json:"umask,omitempty"` - // ProcOpts are the options used for the proc mount. - ProcOpts []string `json:"procfs_opts,omitempty"` - // Privileged is whether the container is privileged. - // Privileged does the following: - // - Adds all devices on the system to the container. - // - Adds all capabilities to the container. - // - Disables Seccomp, SELinux, and Apparmor confinement. - // (Though SELinux can be manually re-enabled). - // TODO: this conflicts with things. - // TODO: this does more. - Privileged bool `json:"privileged,omitempty"` - // NoNewPrivileges is whether the container will set the no new - // privileges flag on create, which disables gaining additional - // privileges (e.g. via setuid) in the container. - NoNewPrivileges bool `json:"no_new_privileges,omitempty"` - // UserNS is the container's user namespace. - // It defaults to host, indicating that no user namespace will be - // created. - // If set to private, IDMappings must be set. - // Mandatory. - // UserNS Namespace `json:"userns,omitempty"` - - // IDMappings are UID and GID mappings that will be used by user - // namespaces. - // Required if UserNS is private. - // IDMappings *storage.IDMappingOptions `json:"idmappings,omitempty"` - // ReadOnlyFilesystem indicates that everything will be mounted - - // as read-only - ReadOnlyFilesystem bool `json:"read_only_filesystem,omitempty"` -} - -// ContainerCgroupConfig contains configuration information about a container's -// cgroups. -type ContainerCgroupConfig struct { - // CgroupNS is the container's cgroup namespace. - // It defaults to private. - // Mandatory. - CgroupNS Namespace `json:"cgroupns,omitempty"` - - // CgroupsMode sets a policy for how cgroups will be created in the - // container, including the ability to disable creation entirely. - CgroupsMode string `json:"cgroups_mode,omitempty"` - // CgroupParent is the container's CGroup parent. - // If not set, the default for the current cgroup driver will be used. - // Optional. - CgroupParent string `json:"cgroup_parent,omitempty"` -} - -// ContainerNetworkConfig contains information on a container's network -// configuration. -type ContainerNetworkConfig struct { - // NetNS is the configuration to use for the container's network - // namespace. - // Mandatory. - NetNS Namespace `json:"netns,omitempty"` - - // StaticIP is the a IPv4 address of the container. - // Only available if NetNS is set to Bridge. - // Optional. - StaticIP *net.IP `json:"static_ip,omitempty"` - // StaticIPv6 is a static IPv6 address to set in the container. - // Only available if NetNS is set to Bridge. - // Optional. - StaticIPv6 *net.IP `json:"static_ipv6,omitempty"` - // StaticMAC is a static MAC address to set in the container. - // Only available if NetNS is set to bridge. - // Optional. - StaticMAC *net.HardwareAddr `json:"static_mac,omitempty"` - // PortBindings is a set of ports to map into the container. - // Only available if NetNS is set to bridge or slirp. - // Optional. - PortMappings []PortMapping `json:"portmappings,omitempty"` - // Expose is a number of ports that will be forwarded to the container - // if PublishExposedPorts is set. - // Expose is a map of uint16 (port number) to a string representing - // protocol. Allowed protocols are "tcp", "udp", and "sctp", or some - // combination of the three separated by commas. - // If protocol is set to "" we will assume TCP. - // Only available if NetNS is set to Bridge or Slirp, and - // PublishExposedPorts is set. - // Optional. - Expose map[uint16]string `json:"expose,omitempty"` - // CNINetworks is a list of CNI networks to join the container to. - // If this list is empty, the default CNI network will be joined - // instead. If at least one entry is present, we will not join the - // default network (unless it is part of this list). - // Only available if NetNS is set to bridge. - // Optional. - CNINetworks []string `json:"cni_networks,omitempty"` - // DNSServers is a set of DNS servers that will be used in the - // container's resolv.conf, replacing the host's DNS Servers which are - // used by default. - // Conflicts with UseImageResolvConf. - // Optional. - DNSServers []net.IP `json:"dns_server,omitempty"` - // DNSSearch is a set of DNS search domains that will be used in the - // container's resolv.conf, replacing the host's DNS search domains - // which are used by default. - // Conflicts with UseImageResolvConf. - // Optional. - DNSSearch []string `json:"dns_search,omitempty"` - // DNSOptions is a set of DNS options that will be used in the - // container's resolv.conf, replacing the host's DNS options which are - // used by default. - // Conflicts with UseImageResolvConf. - // Optional. - DNSOptions []string `json:"dns_option,omitempty"` - // HostAdd is a set of hosts which will be added to the container's - // /etc/hosts file. - // Conflicts with UseImageHosts. - // Optional. - HostAdd []string `json:"hostadd,omitempty"` - // NetworkOptions are additional options for each network - // Optional. - NetworkOptions map[string][]string `json:"network_options,omitempty"` - // PublishExposedPorts will publish ports specified in the image to - // random unused ports (guaranteed to be above 1024) on the host. - // This is based on ports set in Expose below, and any ports specified - // by the Image (if one is given). - // Only available if NetNS is set to Bridge or Slirp. - PublishExposedPorts bool `json:"publish_image_ports,omitempty"` - // UseImageResolvConf indicates that resolv.conf should not be managed - // by Podman, but instead sourced from the image. - // Conflicts with DNSServer, DNSSearch, DNSOption. - UseImageResolvConf bool `json:"use_image_resolve_conf,omitempty"` - // UseImageHosts indicates that /etc/hosts should not be managed by - // Podman, and instead sourced from the image. - // Conflicts with HostAdd. - UseImageHosts bool `json:"use_image_hosts,omitempty"` -} - -// ContainerResourceConfig contains information on container resource limits. -type ContainerResourceConfig struct { - // ResourceLimits are resource limits to apply to the container., - // Can only be set as root on cgroups v1 systems, but can be set as - // rootless as well for cgroups v2. - // Optional. - ResourceLimits *spec.LinuxResources `json:"resource_limits,omitempty"` - // Rlimits are POSIX rlimits to apply to the container. - // Optional. - Rlimits []spec.POSIXRlimit `json:"r_limits,omitempty"` - // OOMScoreAdj adjusts the score used by the OOM killer to determine - // processes to kill for the container's process. - // Optional. - OOMScoreAdj *int `json:"oom_score_adj,omitempty"` - // Weight per cgroup per device, can override BlkioWeight - WeightDevice map[string]spec.LinuxWeightDevice `json:"weightDevice,omitempty"` - // IO read rate limit per cgroup per device, bytes per second - ThrottleReadBpsDevice map[string]spec.LinuxThrottleDevice `json:"throttleReadBpsDevice,omitempty"` - // IO write rate limit per cgroup per device, bytes per second - ThrottleWriteBpsDevice map[string]spec.LinuxThrottleDevice `json:"throttleWriteBpsDevice,omitempty"` - // IO read rate limit per cgroup per device, IO per second - ThrottleReadIOPSDevice map[string]spec.LinuxThrottleDevice `json:"throttleReadIOPSDevice,omitempty"` - // IO write rate limit per cgroup per device, IO per second - ThrottleWriteIOPSDevice map[string]spec.LinuxThrottleDevice `json:"throttleWriteIOPSDevice,omitempty"` -} - -// ContainerHealthCheckConfig describes a container healthcheck with attributes -// like command, retries, interval, start period, and timeout. -type ContainerHealthCheckConfig struct { - // HealthConfig *manifest.Schema2HealthConfig `json:"healthconfig,omitempty"` -} - -// SpecGenerator creates an OCI spec and Libpod configuration options to create -// a container based on the given configuration. -// swagger:model SpecGenerator -type SpecGenerator struct { - ContainerHealthCheckConfig - ContainerBasicConfig - ContainerStorageConfig - ContainerNetworkConfig - ContainerSecurityConfig - ContainerResourceConfig - ContainerCgroupConfig -} - -// NamedVolume holds information about a named volume that will be mounted into -// the container. -type NamedVolume struct { - // Name is the name of the named volume to be mounted. May be empty. - // If empty, a new named volume with a pseudorandomly generated name - // will be mounted at the given destination. - Name string - // Destination to mount the named volume within the container. Must be - // an absolute path. Path will be created if it does not exist. - Dest string - // Options are options that the named volume will be mounted with. - Options []string -} - -// OverlayVolume holds information about a overlay volume that will be mounted into -// the container. -type OverlayVolume struct { - // Destination is the absolute path where the mount will be placed in the container. - Destination string `json:"destination"` - // Source specifies the source path of the mount. - Source string `json:"source,omitempty"` -} - -// PortMapping is one or more ports that will be mapped into the container. -type PortMapping struct { - // HostIP is the IP that we will bind to on the host. - // If unset, assumed to be 0.0.0.0 (all interfaces). - HostIP string `json:"host_ip,omitempty"` - // ContainerPort is the port number that will be exposed from the - // container. - // Mandatory. - ContainerPort uint16 `json:"container_port"` - // HostPort is the port number that will be forwarded from the host into - // the container. - // If omitted, a random port on the host (guaranteed to be over 1024) - // will be assigned. - HostPort uint16 `json:"host_port,omitempty"` - // Range is the number of ports that will be forwarded, starting at - // HostPort and ContainerPort and counting up. - // This is 1-indexed, so 1 is assumed to be a single port (only the - // Hostport:Containerport mapping will be added), 2 is two ports (both - // Hostport:Containerport and Hostport+1:Containerport+1), etc. - // If unset, assumed to be 1 (a single port). - // Both hostport + range and containerport + range must be less than - // 65536. - Range uint16 `json:"range,omitempty"` - // Protocol is the protocol forward. - // Must be either "tcp", "udp", and "sctp", or some combination of these - // separated by commas. - // If unset, assumed to be TCP. - Protocol string `json:"protocol,omitempty"` -} - -// taken from https://github.com/containers/podman/blob/master/pkg/specgen/namespaces.go - -type NamespaceMode string - -const ( - // Default indicates the spec generator should determine - // a sane default - Default NamespaceMode = "default" - // Host means the the namespace is derived from - // the host - Host NamespaceMode = "host" - // Path is the path to a namespace - Path NamespaceMode = "path" - // FromContainer means namespace is derived from a - // different container - FromContainer NamespaceMode = "container" - // FromPod indicates the namespace is derived from a pod - FromPod NamespaceMode = "pod" - // Private indicates the namespace is private - Private NamespaceMode = "private" - // NoNetwork indicates no network namespace should - // be joined. loopback should still exists - NoNetwork NamespaceMode = "none" - // Bridge indicates that a CNI network stack - // should be used - Bridge NamespaceMode = "bridge" - // Slirp indicates that a slirp4netns network stack should - // be used - Slirp NamespaceMode = "slirp4netns" - // KeepId indicates a user namespace to keep the owner uid inside - // of the namespace itself - KeepID NamespaceMode = "keep-id" - // KeepId indicates to automatically create a user namespace - Auto NamespaceMode = "auto" - // DefaultKernelNamespaces is a comma-separated list of default kernel - // namespaces. - DefaultKernelNamespaces = "cgroup,ipc,net,uts" -) - -// Namespace describes the namespace -type Namespace struct { - NSMode NamespaceMode `json:"nsmode,omitempty"` - Value string `json:"string,omitempty"` -} diff --git a/api/container_inspect.go b/api/container_inspect.go index 24e995c..4be69de 100644 --- a/api/container_inspect.go +++ b/api/container_inspect.go @@ -6,7 +6,6 @@ import ( "fmt" "io/ioutil" "net/http" - "time" ) // ContainerInspect data takes a name or ID of a container returns the inspection data @@ -35,698 +34,3 @@ func (c *API) ContainerInspect(ctx context.Context, name string) (InspectContain return inspectData, nil } - -// ------------------------------------------------------------------------------------------------------- -// structs copied from https://github.com/containers/podman/blob/master/libpod/define/container_inspect.go -// -// some unused parts are modified/commented out to not pull -// more dependencies and also to overcome some json unmarshall/version problems -// -// some fields are reordert to make the linter happy (bytes maligned complains) -// ------------------------------------------------------------------------------------------------------- - -// InspectContainerConfig holds further data about how a container was initially -// configured. -type InspectContainerConfig struct { - // Container hostname - Hostname string `json:"Hostname"` - // Container domain name - unused at present - DomainName string `json:"Domainname"` - // User the container was launched with - User string `json:"User"` - // Container environment variables - Env []string `json:"Env"` - // Container command - Cmd []string `json:"Cmd"` - // Container image - Image string `json:"Image"` - // Unused, at present. I've never seen this field populated. - Volumes map[string]struct{} `json:"Volumes"` - // Container working directory - WorkingDir string `json:"WorkingDir"` - // Container entrypoint - Entrypoint string `json:"Entrypoint"` - // On-build arguments - presently unused. More of Buildah's domain. - OnBuild *string `json:"OnBuild"` - // Container labels - Labels map[string]string `json:"Labels"` - // Container annotations - Annotations map[string]string `json:"Annotations"` - // Container stop signal - StopSignal uint `json:"StopSignal"` - // Configured healthcheck for the container - //Healthcheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"` - // CreateCommand is the full command plus arguments of the process the - // container has been created with. - CreateCommand []string `json:"CreateCommand,omitempty"` - // Timezone is the timezone inside the container. - // Local means it has the same timezone as the host machine - Timezone string `json:"Timezone,omitempty"` - // Umask is the umask inside the container. - Umask string `json:"Umask,omitempty"` - // SystemdMode is whether the container is running in systemd mode. In - // systemd mode, the container configuration is customized to optimize - // running systemd in the container. - SystemdMode bool `json:"SystemdMode,omitempty"` - // Unused, at present - AttachStdin bool `json:"AttachStdin"` - // Unused, at present - AttachStdout bool `json:"AttachStdout"` - // Unused, at present - AttachStderr bool `json:"AttachStderr"` - // Whether the container creates a TTY - Tty bool `json:"Tty"` - // Whether the container leaves STDIN open - OpenStdin bool `json:"OpenStdin"` - // Whether STDIN is only left open once. - // Presently not supported by Podman, unused. - StdinOnce bool `json:"StdinOnce"` -} - -// InspectRestartPolicy holds information about the container's restart policy. -type InspectRestartPolicy struct { - // Name contains the container's restart policy. - // Allowable values are "no" or "" (take no action), - // "on-failure" (restart on non-zero exit code, with an optional max - // retry count), and "always" (always restart on container stop, unless - // explicitly requested by API). - // Note that this is NOT actually a name of any sort - the poor naming - // is for Docker compatibility. - Name string `json:"Name"` - // MaximumRetryCount is the maximum number of retries allowed if the - // "on-failure" restart policy is in use. Not used if "on-failure" is - // not set. - MaximumRetryCount uint `json:"MaximumRetryCount"` -} - -// InspectLogConfig holds information about a container's configured log driver -// and is presently unused. It is retained for Docker compatibility. -type InspectLogConfig struct { - Type string `json:"Type"` - Config map[string]string `json:"Config"` //idk type, TODO -} - -// InspectBlkioWeightDevice holds information about the relative weight -// of an individual device node. Weights are used in the I/O scheduler to give -// relative priority to some accesses. -type InspectBlkioWeightDevice struct { - // Path is the path to the device this applies to. - Path string `json:"Path"` - // Weight is the relative weight the scheduler will use when scheduling - // I/O. - Weight uint16 `json:"Weight"` -} - -// InspectBlkioThrottleDevice holds information about a speed cap for a device -// node. This cap applies to a specific operation (read, write, etc) on the given -// node. -type InspectBlkioThrottleDevice struct { - // Path is the path to the device this applies to. - Path string `json:"Path"` - // Rate is the maximum rate. It is in either bytes per second or iops - // per second, determined by where it is used - documentation will - // indicate which is appropriate. - Rate uint64 `json:"Rate"` -} - -// InspectUlimit is a ulimit that will be applied to the container. -type InspectUlimit struct { - // Name is the name (type) of the ulimit. - Name string `json:"Name"` - // Soft is the soft limit that will be applied. - Soft uint64 `json:"Soft"` - // Hard is the hard limit that will be applied. - Hard uint64 `json:"Hard"` -} - -// InspectDevice is a single device that will be mounted into the container. -type InspectDevice struct { - // PathOnHost is the path of the device on the host. - PathOnHost string `json:"PathOnHost"` - // PathInContainer is the path of the device within the container. - PathInContainer string `json:"PathInContainer"` - // CgroupPermissions is the permissions of the mounted device. - // Presently not populated. - // TODO. - CgroupPermissions string `json:"CgroupPermissions"` -} - -// InspectHostPort provides information on a port on the host that a container's -// port is bound to. -type InspectHostPort struct { - // IP on the host we are bound to. "" if not specified (binding to all - // IPs). - HostIP string `json:"HostIp"` - // Port on the host we are bound to. No special formatting - just an - // integer stuffed into a string. - HostPort string `json:"HostPort"` -} - -// InspectMount provides a record of a single mount in a container. It contains -// fields for both named and normal volumes. Only user-specified volumes will be -// included, and tmpfs volumes are not included even if the user specified them. -type InspectMount struct { - // Whether the mount is a volume or bind mount. Allowed values are - // "volume" and "bind". - Type string `json:"Type"` - // The name of the volume. Empty for bind mounts. - Name string `json:"Name,omitempty"` - // The source directory for the volume. - Source string `json:"Source"` - // The destination directory for the volume. Specified as a path within - // the container, as it would be passed into the OCI runtime. - Destination string `json:"Destination"` - // The driver used for the named volume. Empty for bind mounts. - Driver string `json:"Driver"` - // Contains SELinux :z/:Z mount options. Unclear what, if anything, else - // goes in here. - Mode string `json:"Mode"` - // All remaining mount options. Additional data, not present in the - // original output. - Options []string `json:"Options"` - // Whether the volume is read-write - RW bool `json:"RW"` - // Mount propagation for the mount. Can be empty if not specified, but - // is always printed - no omitempty. - Propagation string `json:"Propagation"` -} - -// InspectContainerState provides a detailed record of a container's current -// state. It is returned as part of InspectContainerData. -// As with InspectContainerData, many portions of this struct are matched to -// Docker, but here we see more fields that are unused (nonsensical in the -// context of Libpod). -type InspectContainerState struct { - OciVersion string `json:"OciVersion"` - Status string `json:"Status"` - Running bool `json:"Running"` - Paused bool `json:"Paused"` - Restarting bool `json:"Restarting"` // TODO - OOMKilled bool `json:"OOMKilled"` - Dead bool `json:"Dead"` - Pid int `json:"Pid"` - ConmonPid int `json:"ConmonPid,omitempty"` - ExitCode int32 `json:"ExitCode"` - Error string `json:"Error"` // TODO - StartedAt time.Time `json:"StartedAt"` - FinishedAt time.Time `json:"FinishedAt"` - Healthcheck HealthCheckResults `json:"Healthcheck,omitempty"` -} - -// HealthCheckResults describes the results/logs from a healthcheck -type HealthCheckResults struct { - // Status healthy or unhealthy - Status string `json:"Status"` - // FailingStreak is the number of consecutive failed healthchecks - FailingStreak int `json:"FailingStreak"` - // Log describes healthcheck attempts and results - Log []HealthCheckLog `json:"Log"` -} - -// HealthCheckLog describes the results of a single healthcheck -type HealthCheckLog struct { - // Start time as string - Start string `json:"Start"` - // End time as a string - End string `json:"End"` - // Exitcode is 0 or 1 - ExitCode int `json:"ExitCode"` - // Output is the stdout/stderr from the healthcheck command - Output string `json:"Output"` -} - -// InspectContainerHostConfig holds information used when the container was -// created. -// It's very much a Docker-specific struct, retained (mostly) as-is for -// compatibility. We fill individual fields as best as we can, inferring as much -// as possible from the spec and container config. -// Some things cannot be inferred. These will be populated by spec annotations -// (if available). -// Field names are fixed for compatibility and cannot be changed. -// As such, silence lint warnings about them. -//nolint -type InspectContainerHostConfig struct { - // Binds contains an array of user-added mounts. - // Both volume mounts and named volumes are included. - // Tmpfs mounts are NOT included. - // In 'docker inspect' this is separated into 'Binds' and 'Mounts' based - // on how a mount was added. We do not make this distinction and do not - // include a Mounts field in inspect. - // Format: :[:] - Binds []string `json:"Binds"` - // CgroupMode is the configuration of the container's cgroup namespace. - // Populated as follows: - // private - a cgroup namespace has been created - // host - No cgroup namespace created - // container: - Using another container's cgroup namespace - // ns: - A path to a cgroup namespace has been specified - CgroupMode string `json:"CgroupMode"` - // ContainerIDFile is a file created during container creation to hold - // the ID of the created container. - // This is not handled within libpod and is stored in an annotation. - ContainerIDFile string `json:"ContainerIDFile"` - // LogConfig contains information on the container's logging backend - LogConfig *InspectLogConfig `json:"LogConfig"` - // NetworkMode is the configuration of the container's network - // namespace. - // Populated as follows: - // default - A network namespace is being created and configured via CNI - // none - A network namespace is being created, not configured via CNI - // host - No network namespace created - // container: - Using another container's network namespace - // ns: - A path to a network namespace has been specified - NetworkMode string `json:"NetworkMode"` - // PortBindings contains the container's port bindings. - // It is formatted as map[string][]InspectHostPort. - // The string key here is formatted as / - // and represents the container port. A single container port may be - // bound to multiple host ports (on different IPs). - PortBindings map[string][]InspectHostPort `json:"PortBindings"` - // RestartPolicy contains the container's restart policy. - RestartPolicy *InspectRestartPolicy `json:"RestartPolicy"` - // AutoRemove is whether the container will be automatically removed on - // exiting. - // It is not handled directly within libpod and is stored in an - // annotation. - AutoRemove bool `json:"AutoRemove"` - // VolumeDriver is presently unused and is retained for Docker - // compatibility. - VolumeDriver string `json:"VolumeDriver"` - // VolumesFrom is a list of containers which this container uses volumes - // from. This is not handled directly within libpod and is stored in an - // annotation. - // It is formatted as an array of container names and IDs. - VolumesFrom []string `json:"VolumesFrom"` - // CapAdd is a list of capabilities added to the container. - // It is not directly stored by Libpod, and instead computed from the - // capabilities listed in the container's spec, compared against a set - // of default capabilities. - CapAdd []string `json:"CapAdd"` - // CapDrop is a list of capabilities removed from the container. - // It is not directly stored by libpod, and instead computed from the - // capabilities listed in the container's spec, compared against a set - // of default capabilities. - CapDrop []string `json:"CapDrop"` - // Dns is a list of DNS nameservers that will be added to the - // container's resolv.conf - Dns []string `json:"Dns"` - // DnsOptions is a list of DNS options that will be set in the - // container's resolv.conf - DnsOptions []string `json:"DnsOptions"` - // DnsSearch is a list of DNS search domains that will be set in the - // container's resolv.conf - DnsSearch []string `json:"DnsSearch"` - // ExtraHosts contains hosts that will be aded to the container's - // /etc/hosts. - ExtraHosts []string `json:"ExtraHosts"` - // GroupAdd contains groups that the user inside the container will be - // added to. - GroupAdd []string `json:"GroupAdd"` - // IpcMode represents the configuration of the container's IPC - // namespace. - // Populated as follows: - // "" (empty string) - Default, an IPC namespace will be created - // host - No IPC namespace created - // container: - Using another container's IPC namespace - // ns: - A path to an IPC namespace has been specified - IpcMode string `json:"IpcMode"` - // Cgroup contains the container's cgroup. It is presently not - // populated. - // TODO. - Cgroup string `json:"Cgroup"` - // Cgroups contains the container's CGroup mode. - // Allowed values are "default" (container is creating CGroups) and - // "disabled" (container is not creating CGroups). - // This is Libpod-specific and not included in `docker inspect`. - Cgroups string `json:"Cgroups"` - // Links is unused, and provided purely for Docker compatibility. - Links []string `json:"Links"` - // OOMScoreAdj is an adjustment that will be made to the container's OOM - // score. - OomScoreAdj int `json:"OomScoreAdj"` - // PidMode represents the configuration of the container's PID - // namespace. - // Populated as follows: - // "" (empty string) - Default, a PID namespace will be created - // host - No PID namespace created - // container: - Using another container's PID namespace - // ns: - A path to a PID namespace has been specified - PidMode string `json:"PidMode"` - // Privileged indicates whether the container is running with elevated - // privileges. - // This has a very specific meaning in the Docker sense, so it's very - // difficult to decode from the spec and config, and so is stored as an - // annotation. - Privileged bool `json:"Privileged"` - // PublishAllPorts indicates whether image ports are being published. - // This is not directly stored in libpod and is saved as an annotation. - PublishAllPorts bool `json:"PublishAllPorts"` - // ReadonlyRootfs is whether the container will be mounted read-only. - ReadonlyRootfs bool `json:"ReadonlyRootfs"` - // SecurityOpt is a list of security-related options that are set in the - // container. - SecurityOpt []string `json:"SecurityOpt"` - // Tmpfs is a list of tmpfs filesystems that will be mounted into the - // container. - // It is a map of destination path to options for the mount. - Tmpfs map[string]string `json:"Tmpfs"` - // UTSMode represents the configuration of the container's UID - // namespace. - // Populated as follows: - // "" (empty string) - Default, a UTS namespace will be created - // host - no UTS namespace created - // container: - Using another container's UTS namespace - // ns: - A path to a UTS namespace has been specified - UTSMode string `json:"UTSMode"` - // UsernsMode represents the configuration of the container's user - // namespace. - // When running rootless, a user namespace is created outside of libpod - // to allow some privileged operations. This will not be reflected here. - // Populated as follows: - // "" (empty string) - No user namespace will be created - // private - The container will be run in a user namespace - // container: - Using another container's user namespace - // ns: - A path to a user namespace has been specified - // TODO Rootless has an additional 'keep-id' option, presently not - // reflected here. - UsernsMode string `json:"UsernsMode"` - // ShmSize is the size of the container's SHM device. - ShmSize int64 `json:"ShmSize"` - // Runtime is provided purely for Docker compatibility. - // It is set unconditionally to "oci" as Podman does not presently - // support non-OCI runtimes. - Runtime string `json:"Runtime"` - // ConsoleSize is an array of 2 integers showing the size of the - // container's console. - // It is only set if the container is creating a terminal. - // TODO. - ConsoleSize []uint `json:"ConsoleSize"` - // Isolation is presently unused and provided solely for Docker - // compatibility. - Isolation string `json:"Isolation"` - // CpuShares indicates the CPU resources allocated to the container. - // It is a relative weight in the scheduler for assigning CPU time - // versus other CGroups. - CpuShares uint64 `json:"CpuShares"` - // Memory indicates the memory resources allocated to the container. - // This is the limit (in bytes) of RAM the container may use. - Memory int64 `json:"Memory"` - // NanoCpus indicates number of CPUs allocated to the container. - // It is an integer where one full CPU is indicated by 1000000000 (one - // billion). - // Thus, 2.5 CPUs (fractional portions of CPUs are allowed) would be - // 2500000000 (2.5 billion). - // In 'docker inspect' this is set exclusively of two further options in - // the output (CpuPeriod and CpuQuota) which are both used to implement - // this functionality. - // We can't distinguish here, so if CpuQuota is set to the default of - // 100000, we will set both CpuQuota, CpuPeriod, and NanoCpus. If - // CpuQuota is not the default, we will not set NanoCpus. - NanoCpus int64 `json:"NanoCpus"` - // CgroupParent is the CGroup parent of the container. - // Only set if not default. - CgroupParent string `json:"CgroupParent"` - // BlkioWeight indicates the I/O resources allocated to the container. - // It is a relative weight in the scheduler for assigning I/O time - // versus other CGroups. - BlkioWeight uint16 `json:"BlkioWeight"` - // BlkioWeightDevice is an array of I/O resource priorities for - // individual device nodes. - // Unfortunately, the spec only stores the device's Major/Minor numbers - // and not the path, which is used here. - // Fortunately, the kernel provides an interface for retrieving the path - // of a given node by major:minor at /sys/dev/. However, the exact path - // in use may not be what was used in the original CLI invocation - - // though it is guaranteed that the device node will be the same, and - // using the given path will be functionally identical. - BlkioWeightDevice []InspectBlkioWeightDevice `json:"BlkioWeightDevice"` - // BlkioDeviceReadBps is an array of I/O throttle parameters for - // individual device nodes. - // This specifically sets read rate cap in bytes per second for device - // nodes. - // As with BlkioWeightDevice, we pull the path from /sys/dev, and we - // don't guarantee the path will be identical to the original (though - // the node will be). - BlkioDeviceReadBps []InspectBlkioThrottleDevice `json:"BlkioDeviceReadBps"` - // BlkioDeviceWriteBps is an array of I/O throttle parameters for - // individual device nodes. - // this specifically sets write rate cap in bytes per second for device - // nodes. - // as with BlkioWeightDevice, we pull the path from /sys/dev, and we - // don't guarantee the path will be identical to the original (though - // the node will be). - BlkioDeviceWriteBps []InspectBlkioThrottleDevice `json:"BlkioDeviceWriteBps"` - // BlkioDeviceReadIOps is an array of I/O throttle parameters for - // individual device nodes. - // This specifically sets the read rate cap in iops per second for - // device nodes. - // As with BlkioWeightDevice, we pull the path from /sys/dev, and we - // don't guarantee the path will be identical to the original (though - // the node will be). - BlkioDeviceReadIOps []InspectBlkioThrottleDevice `json:"BlkioDeviceReadIOps"` - // BlkioDeviceWriteIOps is an array of I/O throttle parameters for - // individual device nodes. - // This specifically sets the write rate cap in iops per second for - // device nodes. - // As with BlkioWeightDevice, we pull the path from /sys/dev, and we - // don't guarantee the path will be identical to the original (though - // the node will be). - BlkioDeviceWriteIOps []InspectBlkioThrottleDevice `json:"BlkioDeviceWriteIOps"` - // CpuPeriod is the length of a CPU period in microseconds. - // It relates directly to CpuQuota. - CpuPeriod uint64 `json:"CpuPeriod"` - // CpuPeriod is the amount of time (in microseconds) that a container - // can use the CPU in every CpuPeriod. - CpuQuota int64 `json:"CpuQuota"` - // CpuRealtimePeriod is the length of time (in microseconds) of the CPU - // realtime period. If set to 0, no time will be allocated to realtime - // tasks. - CpuRealtimePeriod uint64 `json:"CpuRealtimePeriod"` - // CpuRealtimeRuntime is the length of time (in microseconds) allocated - // for realtime tasks within every CpuRealtimePeriod. - CpuRealtimeRuntime int64 `json:"CpuRealtimeRuntime"` - // CpusetCpus is the is the set of CPUs that the container will execute - // on. Formatted as `0-3` or `0,2`. Default (if unset) is all CPUs. - CpusetCpus string `json:"CpusetCpus"` - // CpusetMems is the set of memory nodes the container will use. - // Formatted as `0-3` or `0,2`. Default (if unset) is all memory nodes. - CpusetMems string `json:"CpusetMems"` - // Devices is a list of device nodes that will be added to the - // container. - // These are stored in the OCI spec only as type, major, minor while we - // display the host path. We convert this with /sys/dev, but we cannot - // guarantee that the host path will be identical - only that the actual - // device will be. - Devices []InspectDevice `json:"Devices"` - // DiskQuota is the maximum amount of disk space the container may use - // (in bytes). - // Presently not populated. - // TODO. - DiskQuota uint64 `json:"DiskQuota"` - // KernelMemory is the maximum amount of memory the kernel will devote - // to the container. - KernelMemory int64 `json:"KernelMemory"` - // MemoryReservation is the reservation (soft limit) of memory available - // to the container. Soft limits are warnings only and can be exceeded. - MemoryReservation int64 `json:"MemoryReservation"` - // MemorySwap is the total limit for all memory available to the - // container, including swap. 0 indicates that there is no limit to the - // amount of memory available. - MemorySwap int64 `json:"MemorySwap"` - // MemorySwappiness is the willingness of the kernel to page container - // memory to swap. It is an integer from 0 to 100, with low numbers - // being more likely to be put into swap. - // -1, the default, will not set swappiness and use the system defaults. - MemorySwappiness int64 `json:"MemorySwappiness"` - // OomKillDisable indicates whether the kernel OOM killer is disabled - // for the container. - OomKillDisable bool `json:"OomKillDisable"` - // Init indicates whether the container has an init mounted into it. - Init bool `json:"Init,omitempty"` - // PidsLimit is the maximum number of PIDs what may be created within - // the container. 0, the default, indicates no limit. - PidsLimit int64 `json:"PidsLimit"` - // Ulimits is a set of ulimits that will be set within the container. - Ulimits []InspectUlimit `json:"Ulimits"` - // CpuCount is Windows-only and not presently implemented. - CpuCount uint64 `json:"CpuCount"` - // CpuPercent is Windows-only and not presently implemented. - CpuPercent uint64 `json:"CpuPercent"` - // IOMaximumIOps is Windows-only and not presently implemented. - IOMaximumIOps uint64 `json:"IOMaximumIOps"` - // IOMaximumBandwidth is Windows-only and not presently implemented. - IOMaximumBandwidth uint64 `json:"IOMaximumBandwidth"` -} - -// InspectBasicNetworkConfig holds basic configuration information (e.g. IP -// addresses, MAC address, subnet masks, etc) that are common for all networks -// (both additional and main). -type InspectBasicNetworkConfig struct { - // EndpointID is unused, maintained exclusively for compatibility. - EndpointID string `json:"EndpointID"` - // Gateway is the IP address of the gateway this network will use. - Gateway string `json:"Gateway"` - // IPAddress is the IP address for this network. - IPAddress string `json:"IPAddress"` - // IPPrefixLen is the length of the subnet mask of this network. - IPPrefixLen int `json:"IPPrefixLen"` - // SecondaryIPAddresses is a list of extra IP Addresses that the - // container has been assigned in this network. - SecondaryIPAddresses []string `json:"SecondaryIPAddresses,omitempty"` - // IPv6Gateway is the IPv6 gateway this network will use. - IPv6Gateway string `json:"IPv6Gateway"` - // GlobalIPv6Address is the global-scope IPv6 Address for this network. - GlobalIPv6Address string `json:"GlobalIPv6Address"` - // GlobalIPv6PrefixLen is the length of the subnet mask of this network. - GlobalIPv6PrefixLen int `json:"GlobalIPv6PrefixLen"` - // SecondaryIPv6Addresses is a list of extra IPv6 Addresses that the - // container has been assigned in this networ. - SecondaryIPv6Addresses []string `json:"SecondaryIPv6Addresses,omitempty"` - // MacAddress is the MAC address for the interface in this network. - MacAddress string `json:"MacAddress"` - // AdditionalMacAddresses is a set of additional MAC Addresses beyond - // the first. CNI may configure more than one interface for a single - // network, which can cause this. - AdditionalMacAddresses []string `json:"AdditionalMACAddresses,omitempty"` -} - -// InspectAdditionalNetwork holds information about non-default CNI networks the -// container has been connected to. -// As with InspectNetworkSettings, many fields are unused and maintained only -// for compatibility with Docker. -type InspectAdditionalNetwork struct { - InspectBasicNetworkConfig - - // Name of the network we're connecting to. - NetworkID string `json:"NetworkID,omitempty"` - // DriverOpts is presently unused and maintained exclusively for - // compatibility. - DriverOpts map[string]string `json:"DriverOpts"` - // IPAMConfig is presently unused and maintained exclusively for - // compatibility. - IPAMConfig map[string]string `json:"IPAMConfig"` - // Links is presently unused and maintained exclusively for - // compatibility. - Links []string `json:"Links"` -} - -// InspectNetworkSettings holds information about the network settings of the -// container. -// Many fields are maintained only for compatibility with `docker inspect` and -// are unused within Libpod. -type InspectNetworkSettings struct { - InspectBasicNetworkConfig - - Bridge string `json:"Bridge"` - SandboxID string `json:"SandboxID"` - HairpinMode bool `json:"HairpinMode"` - LinkLocalIPv6Address string `json:"LinkLocalIPv6Address"` - LinkLocalIPv6PrefixLen int `json:"LinkLocalIPv6PrefixLen"` - Ports map[string][]InspectHostPort `json:"Ports"` - SandboxKey string `json:"SandboxKey"` - // Networks contains information on non-default CNI networks this - // container has joined. - // It is a map of network name to network information. - Networks map[string]*InspectAdditionalNetwork `json:"Networks,omitempty"` -} - -// InspectContainerData provides a detailed record of a container's configuration -// and state as viewed by Libpod. -// Large portions of this structure are defined such that the output is -// compatible with `docker inspect` JSON, but additional fields have been added -// as required to share information not in the original output. -type InspectContainerData struct { - State *InspectContainerState `json:"State"` - Mounts []InspectMount `json:"Mounts"` - NetworkSettings *InspectNetworkSettings `json:"NetworkSettings"` //TODO - Config *InspectContainerConfig `json:"Config"` - HostConfig *InspectContainerHostConfig `json:"HostConfig"` - ID string `json:"Id"` - // FIXME can not parse date/time: "Created": "2020-07-05 11:32:38.541987006 -0400 -0400", - //Created time.Time `json:"Created"` - Path string `json:"Path"` - Args []string `json:"Args"` - Image string `json:"Image"` - ImageName string `json:"ImageName"` - Rootfs string `json:"Rootfs"` - Pod string `json:"Pod"` - ResolvConfPath string `json:"ResolvConfPath"` - HostnamePath string `json:"HostnamePath"` - HostsPath string `json:"HostsPath"` - StaticDir string `json:"StaticDir"` - OCIConfigPath string `json:"OCIConfigPath,omitempty"` - OCIRuntime string `json:"OCIRuntime,omitempty"` - LogPath string `json:"LogPath"` - LogTag string `json:"LogTag"` - ConmonPidFile string `json:"ConmonPidFile"` - Name string `json:"Name"` - Driver string `json:"Driver"` - MountLabel string `json:"MountLabel"` - ProcessLabel string `json:"ProcessLabel"` - AppArmorProfile string `json:"AppArmorProfile"` - EffectiveCaps []string `json:"EffectiveCaps"` - BoundingCaps []string `json:"BoundingCaps"` - ExecIDs []string `json:"ExecIDs"` - Dependencies []string `json:"Dependencies"` - ExitCommand []string `json:"ExitCommand"` - Namespace string `json:"Namespace"` - //GraphDriver *driver.Data `json:"GraphDriver"` - SizeRw *int64 `json:"SizeRw,omitempty"` - SizeRootFs int64 `json:"SizeRootFs,omitempty"` - RestartCount int32 `json:"RestartCount"` - IsInfra bool `json:"IsInfra"` -} - -// InspectExecSession contains information about a given exec session. -type InspectExecSession struct { - // ProcessConfig contains information about the exec session's process. - ProcessConfig *InspectExecProcess `json:"ProcessConfig"` - // ContainerID is the ID of the container this exec session is attached - // to. - ContainerID string `json:"ContainerID"` - // DetachKeys are the detach keys used by the exec session. - // If set to "" the default keys are being used. - // Will show "" if no detach keys are set. - DetachKeys string `json:"DetachKeys"` - // ID is the ID of the exec session. - ID string `json:"ID"` - // ExitCode is the exit code of the exec session. Will be set to 0 if - // the exec session has not yet exited. - ExitCode int `json:"ExitCode"` - // Pid is the PID of the exec session's process. - // Will be set to 0 if the exec session is not running. - Pid int `json:"Pid"` - // CanRemove is legacy and used purely for compatibility reasons. - // Will always be set to true, unless the exec session is running. - CanRemove bool `json:"CanRemove"` - // OpenStderr is whether the container's STDERR stream will be attached. - // Always set to true if the exec session created a TTY. - OpenStderr bool `json:"OpenStderr"` - // OpenStdin is whether the container's STDIN stream will be attached - // to. - OpenStdin bool `json:"OpenStdin"` - // OpenStdout is whether the container's STDOUT stream will be attached. - // Always set to true if the exec session created a TTY. - OpenStdout bool `json:"OpenStdout"` - // Running is whether the exec session is running. - Running bool `json:"Running"` -} - -// InspectExecProcess contains information about the process in a given exec -// session. -type InspectExecProcess struct { - // Arguments are the arguments to the entrypoint command of the exec - // session. - Arguments []string `json:"arguments"` - // Entrypoint is the entrypoint for the exec session (the command that - // will be executed in the container). - // FIXME: was string instead of []string ?? - Entrypoint []string `json:"entrypoint"` - // Privileged is whether the exec session will be started with elevated - // privileges. - Privileged bool `json:"privileged"` - // Tty is whether the exec session created a terminal. - Tty bool `json:"tty"` - // User is the user the exec session was started as. - User string `json:"user"` -} diff --git a/api/container_stats.go b/api/container_stats.go index 7b913c2..f50b14c 100644 --- a/api/container_stats.go +++ b/api/container_stats.go @@ -7,7 +7,6 @@ import ( "fmt" "io/ioutil" "net/http" - "time" ) var ContainerNotFound = errors.New("No such Container") @@ -46,147 +45,3 @@ func (c *API) ContainerStats(ctx context.Context, name string) (Stats, error) { return stats, nil } - -// ------------------------------------------------------------------------------------------------------- -// structs loosly copied from https://github.com/containers/podman/blob/master/pkg/api/handlers/compat/types.go -// and https://github.com/moby/moby/blob/master/api/types/stats.go -// some unused parts are modified/commented out to not pull -// more dependencies and also to overcome some json unmarshall/version problems -// -// some fields are reordert to make the linter happy (bytes maligned complains) -// ------------------------------------------------------------------------------------------------------- -// - -// CPUStats aggregates and wraps all CPU related info of container -type CPUStats struct { - // CPU Usage. Linux and Windows. - CPUUsage CPUUsage `json:"cpu_usage"` - - // System Usage. Linux only. - SystemUsage uint64 `json:"system_cpu_usage,omitempty"` - - // Online CPUs. Linux only. - OnlineCPUs uint32 `json:"online_cpus,omitempty"` - - // Usage of CPU in %. Linux only. - CPU float64 `json:"cpu"` - - // Throttling Data. Linux only. - ThrottlingData ThrottlingData `json:"throttling_data,omitempty"` -} - -// Stats is Ultimate struct aggregating all types of stats of one container -type Stats struct { - // Common stats - Read time.Time `json:"read"` - PreRead time.Time `json:"preread"` - - // Linux specific stats, not populated on Windows. - PidsStats PidsStats `json:"pids_stats,omitempty"` - BlkioStats BlkioStats `json:"blkio_stats,omitempty"` - - // Windows specific stats, not populated on Linux. - // NumProcs uint32 `json:"num_procs"` - // StorageStats docker.StorageStats `json:"storage_stats,omitempty"` - - // Shared stats - CPUStats CPUStats `json:"cpu_stats,omitempty"` - PreCPUStats CPUStats `json:"precpu_stats,omitempty"` // "Pre"="Previous" - MemoryStats MemoryStats `json:"memory_stats,omitempty"` -} - -// ThrottlingData stores CPU throttling stats of one running container. -// Not used on Windows. -type ThrottlingData struct { - // Number of periods with throttling active - Periods uint64 `json:"periods"` - // Number of periods when the container hits its throttling limit. - ThrottledPeriods uint64 `json:"throttled_periods"` - // Aggregate time the container was throttled for in nanoseconds. - ThrottledTime uint64 `json:"throttled_time"` -} - -// CPUUsage stores All CPU stats aggregated since container inception. -type CPUUsage struct { - // Total CPU time consumed. - // Units: nanoseconds (Linux) - // Units: 100's of nanoseconds (Windows) - TotalUsage uint64 `json:"total_usage"` - - // Total CPU time consumed per core (Linux). Not used on Windows. - // Units: nanoseconds. - PercpuUsage []uint64 `json:"percpu_usage,omitempty"` - - // Time spent by tasks of the cgroup in kernel mode (Linux). - // Time spent by all container processes in kernel mode (Windows). - // Units: nanoseconds (Linux). - // Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers. - UsageInKernelmode uint64 `json:"usage_in_kernelmode"` - - // Time spent by tasks of the cgroup in user mode (Linux). - // Time spent by all container processes in user mode (Windows). - // Units: nanoseconds (Linux). - // Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers - UsageInUsermode uint64 `json:"usage_in_usermode"` -} - -// PidsStats contains the stats of a container's pids -type PidsStats struct { - // Current is the number of pids in the cgroup - Current uint64 `json:"current,omitempty"` - // Limit is the hard limit on the number of pids in the cgroup. - // A "Limit" of 0 means that there is no limit. - Limit uint64 `json:"limit,omitempty"` -} - -// BlkioStatEntry is one small entity to store a piece of Blkio stats -// Not used on Windows. -type BlkioStatEntry struct { - Major uint64 `json:"major"` - Minor uint64 `json:"minor"` - Op string `json:"op"` - Value uint64 `json:"value"` -} - -// BlkioStats stores All IO service stats for data read and write. -// This is a Linux specific structure as the differences between expressing -// block I/O on Windows and Linux are sufficiently significant to make -// little sense attempting to morph into a combined structure. -type BlkioStats struct { - // number of bytes transferred to and from the block device - IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"` - IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive"` - IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive"` - IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive"` - IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive"` - IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive"` - IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive"` - SectorsRecursive []BlkioStatEntry `json:"sectors_recursive"` -} - -// MemoryStats aggregates all memory stats since container inception on Linux. -// Windows returns stats for commit and private working set only. -type MemoryStats struct { - // Linux Memory Stats - - // current res_counter usage for memory - Usage uint64 `json:"usage,omitempty"` - // maximum usage ever recorded. - MaxUsage uint64 `json:"max_usage,omitempty"` - // TODO(vishh): Export these as stronger types. - // all the stats exported via memory.stat. - Stats map[string]uint64 `json:"stats,omitempty"` - // number of times memory usage hits limits. - Failcnt uint64 `json:"failcnt,omitempty"` - Limit uint64 `json:"limit,omitempty"` - - // Windows Memory Stats - // See https://technet.microsoft.com/en-us/magazine/ff382715.aspx - - // committed bytes - Commit uint64 `json:"commitbytes,omitempty"` - // peak committed bytes - CommitPeak uint64 `json:"commitpeakbytes,omitempty"` - // private working set - PrivateWorkingSet uint64 `json:"privateworkingset,omitempty"` -} diff --git a/api/structs.go b/api/structs.go new file mode 100644 index 0000000..4c9ef09 --- /dev/null +++ b/api/structs.go @@ -0,0 +1,1516 @@ +package api + +import ( + "net" + "syscall" + "time" + + spec "github.com/opencontainers/runtime-spec/specs-go" +) + +// ------------------------------------------------------------------------------------------------------- +// structs copied from https://github.com/containers/podman/blob/master/pkg/specgen/specgen.go +// +// some unused parts are modified/commented out to not pull +// more dependencies and also to overcome some json unmarshall/version problems +// +// some fields are reordert to make the linter happy (bytes maligned complains) +// ------------------------------------------------------------------------------------------------------- + +// LogConfig describes the logging characteristics for a container +type LogConfig struct { + // LogDriver is the container's log driver. + // Optional. + Driver string `json:"driver,omitempty"` + // LogPath is the path the container's logs will be stored at. + // Only available if LogDriver is set to "json-file" or "k8s-file". + // Optional. + Path string `json:"path,omitempty"` + // A set of options to accompany the log driver. + // Optional. + Options map[string]string `json:"options,omitempty"` +} + +// ContainerBasicConfig contains the basic parts of a container. +type ContainerBasicConfig struct { + // Name is the name the container will be given. + // If no name is provided, one will be randomly generated. + // Optional. + Name string `json:"name,omitempty"` + // Pod is the ID of the pod the container will join. + // Optional. + Pod string `json:"pod,omitempty"` + // Entrypoint is the container's entrypoint. + // If not given and Image is specified, this will be populated by the + // image's configuration. + // Optional. + Entrypoint []string `json:"entrypoint,omitempty"` + // Command is the container's command. + // If not given and Image is specified, this will be populated by the + // image's configuration. + // Optional. + Command []string `json:"command,omitempty"` + // Env is a set of environment variables that will be set in the + // container. + // Optional. + Env map[string]string `json:"env,omitempty"` + // Labels are key-value pairs that are used to add metadata to + // containers. + // Optional. + Labels map[string]string `json:"labels,omitempty"` + // Annotations are key-value options passed into the container runtime + // that can be used to trigger special behavior. + // Optional. + Annotations map[string]string `json:"annotations,omitempty"` + // StopSignal is the signal that will be used to stop the container. + // Must be a non-zero integer below SIGRTMAX. + // If not provided, the default, SIGTERM, will be used. + // Will conflict with Systemd if Systemd is set to "true" or "always". + // Optional. + StopSignal *syscall.Signal `json:"stop_signal,omitempty"` + // LogConfiguration describes the logging for a container including + // driver, path, and options. + // Optional + LogConfiguration *LogConfig `json:"log_configuration,omitempty"` + // ConmonPidFile is a path at which a PID file for Conmon will be + // placed. + // If not given, a default location will be used. + // Optional. + ConmonPidFile string `json:"conmon_pid_file,omitempty"` + // RestartPolicy is the container's restart policy - an action which + // will be taken when the container exits. + // If not given, the default policy, which does nothing, will be used. + // Optional. + RestartPolicy string `json:"restart_policy,omitempty"` + // OCIRuntime is the name of the OCI runtime that will be used to create + // the container. + // If not specified, the default will be used. + // Optional. + OCIRuntime string `json:"oci_runtime,omitempty"` + // Systemd is whether the container will be started in systemd mode. + // Valid options are "true", "false", and "always". + // "true" enables this mode only if the binary run in the container is + // /sbin/init or systemd. "always" unconditionally enables systemd mode. + // "false" unconditionally disables systemd mode. + // If enabled, mounts and stop signal will be modified. + // If set to "always" or set to "true" and conditionally triggered, + // conflicts with StopSignal. + // If not specified, "false" will be assumed. + // Optional. + Systemd string `json:"systemd,omitempty"` + // Determine how to handle the NOTIFY_SOCKET - do we participate or pass it through + // "container" - let the OCI runtime deal with it, advertise conmon's MAINPID + // "conmon-only" - advertise conmon's MAINPID, send READY when started, don't pass to OCI + // "ignore" - unset NOTIFY_SOCKET + SdNotifyMode string `json:"sdnotifyMode,omitempty"` + // Namespace is the libpod namespace the container will be placed in. + // Optional. + Namespace string `json:"namespace,omitempty"` + + // PidNS is the container's PID namespace. + // It defaults to private. + // Mandatory. + PidNS Namespace `json:"pidns,omitempty"` + + // UtsNS is the container's UTS namespace. + // It defaults to private. + // Must be set to Private to set Hostname. + // Mandatory. + UtsNS Namespace `json:"utsns,omitempty"` + + // Hostname is the container's hostname. If not set, the hostname will + // not be modified (if UtsNS is not private) or will be set to the + // container ID (if UtsNS is private). + // Conflicts with UtsNS if UtsNS is not set to private. + // Optional. + Hostname string `json:"hostname,omitempty"` + // Sysctl sets kernel parameters for the container + Sysctl map[string]string `json:"sysctl,omitempty"` + // ContainerCreateCommand is the command that was used to create this + // container. + // This will be shown in the output of Inspect() on the container, and + // may also be used by some tools that wish to recreate the container + // (e.g. `podman generate systemd --new`). + // Optional. + ContainerCreateCommand []string `json:"containerCreateCommand,omitempty"` + // Timezone is the timezone inside the container. + // Local means it has the same timezone as the host machine + Timezone string `json:"timezone,omitempty"` + // PreserveFDs is a number of additional file descriptors (in addition + // to 0, 1, 2) that will be passed to the executed process. The total FDs + // passed will be 3 + PreserveFDs. + // set tags as `json:"-"` for not supported remote + PreserveFDs uint `json:"-"` + // StopTimeout is a timeout between the container's stop signal being + // sent and SIGKILL being sent. + // If not provided, the default will be used. + // If 0 is used, stop signal will not be sent, and SIGKILL will be sent + // instead. + // Optional. + StopTimeout *uint `json:"stop_timeout,omitempty"` + // RestartRetries is the number of attempts that will be made to restart + // the container. + // Only available when RestartPolicy is set to "on-failure". + // Optional. + RestartRetries *uint `json:"restart_tries,omitempty"` + // Remove indicates if the container should be removed once it has been started + // and exits + Remove bool `json:"remove,omitempty"` + // Terminal is whether the container will create a PTY. + // Optional. + Terminal bool `json:"terminal,omitempty"` + // Stdin is whether the container will keep its STDIN open. + Stdin bool `json:"stdin,omitempty"` +} + +// ContainerStorageConfig contains information on the storage configuration of a +// container. +type ContainerStorageConfig struct { + // Image is the image the container will be based on. The image will be + // used as the container's root filesystem, and its environment vars, + // volumes, and other configuration will be applied to the container. + // Conflicts with Rootfs. + // At least one of Image or Rootfs must be specified. + Image string `json:"image"` + // Rootfs is the path to a directory that will be used as the + // container's root filesystem. No modification will be made to the + // directory, it will be directly mounted into the container as root. + // Conflicts with Image. + // At least one of Image or Rootfs must be specified. + Rootfs string `json:"rootfs,omitempty"` + // ImageVolumeMode indicates how image volumes will be created. + // Supported modes are "ignore" (do not create), "tmpfs" (create as + // tmpfs), and "anonymous" (create as anonymous volumes). + // The default if unset is anonymous. + // Optional. + ImageVolumeMode string `json:"image_volume_mode,omitempty"` + // VolumesFrom is a set of containers whose volumes will be added to + // this container. The name or ID of the container must be provided, and + // may optionally be followed by a : and then one or more + // comma-separated options. Valid options are 'ro', 'rw', and 'z'. + // Options will be used for all volumes sourced from the container. + VolumesFrom []string `json:"volumes_from,omitempty"` + // Init specifies that an init binary will be mounted into the + // container, and will be used as PID1. + Init bool `json:"init,omitempty"` + // InitPath specifies the path to the init binary that will be added if + // Init is specified above. If not specified, the default set in the + // Libpod config will be used. Ignored if Init above is not set. + // Optional. + InitPath string `json:"init_path,omitempty"` + // Mounts are mounts that will be added to the container. + // These will supersede Image Volumes and VolumesFrom volumes where + // there are conflicts. + // Optional. + Mounts []spec.Mount `json:"mounts,omitempty"` + // Volumes are named volumes that will be added to the container. + // These will supersede Image Volumes and VolumesFrom volumes where + // there are conflicts. + // Optional. + Volumes []*NamedVolume `json:"volumes,omitempty"` + // Overlay volumes are named volumes that will be added to the container. + // Optional. + OverlayVolumes []*OverlayVolume `json:"overlay_volumes,omitempty"` + // Devices are devices that will be added to the container. + // Optional. + Devices []spec.LinuxDevice `json:"devices,omitempty"` + // IpcNS is the container's IPC namespace. + // Default is private. + // Conflicts with ShmSize if not set to private. + // Mandatory. + IpcNS Namespace `json:"ipcns,omitempty"` + + // ShmSize is the size of the tmpfs to mount in at /dev/shm, in bytes. + // Conflicts with ShmSize if IpcNS is not private. + // Optional. + ShmSize *int64 `json:"shm_size,omitempty"` + // WorkDir is the container's working directory. + // If unset, the default, /, will be used. + // Optional. + WorkDir string `json:"work_dir,omitempty"` + // RootfsPropagation is the rootfs propagation mode for the container. + // If not set, the default of rslave will be used. + // Optional. + RootfsPropagation string `json:"rootfs_propagation,omitempty"` +} + +// ContainerSecurityConfig is a container's security features, including +// SELinux, Apparmor, and Seccomp. +type ContainerSecurityConfig struct { + // User is the user the container will be run as. + // Can be given as a UID or a username; if a username, it will be + // resolved within the container, using the container's /etc/passwd. + // If unset, the container will be run as root. + // Optional. + User string `json:"user,omitempty"` + // Groups are a list of supplemental groups the container's user will + // be granted access to. + // Optional. + Groups []string `json:"groups,omitempty"` + // CapAdd are capabilities which will be added to the container. + // Conflicts with Privileged. + // Optional. + CapAdd []string `json:"cap_add,omitempty"` + // CapDrop are capabilities which will be removed from the container. + // Conflicts with Privileged. + // Optional. + CapDrop []string `json:"cap_drop,omitempty"` + // SelinuxProcessLabel is the process label the container will use. + // If SELinux is enabled and this is not specified, a label will be + // automatically generated if not specified. + // Optional. + SelinuxOpts []string `json:"selinux_opts,omitempty"` + // ApparmorProfile is the name of the Apparmor profile the container + // will use. + // Optional. + ApparmorProfile string `json:"apparmor_profile,omitempty"` + // SeccompPolicy determines which seccomp profile gets applied + // the container. valid values: empty,default,image + SeccompPolicy string `json:"seccomp_policy,omitempty"` + // SeccompProfilePath is the path to a JSON file containing the + // container's Seccomp profile. + // If not specified, no Seccomp profile will be used. + // Optional. + SeccompProfilePath string `json:"seccomp_profile_path,omitempty"` + // Umask is the umask the init process of the container will be run with. + Umask string `json:"umask,omitempty"` + // ProcOpts are the options used for the proc mount. + ProcOpts []string `json:"procfs_opts,omitempty"` + // Privileged is whether the container is privileged. + // Privileged does the following: + // - Adds all devices on the system to the container. + // - Adds all capabilities to the container. + // - Disables Seccomp, SELinux, and Apparmor confinement. + // (Though SELinux can be manually re-enabled). + // TODO: this conflicts with things. + // TODO: this does more. + Privileged bool `json:"privileged,omitempty"` + // NoNewPrivileges is whether the container will set the no new + // privileges flag on create, which disables gaining additional + // privileges (e.g. via setuid) in the container. + NoNewPrivileges bool `json:"no_new_privileges,omitempty"` + // UserNS is the container's user namespace. + // It defaults to host, indicating that no user namespace will be + // created. + // If set to private, IDMappings must be set. + // Mandatory. + // UserNS Namespace `json:"userns,omitempty"` + + // IDMappings are UID and GID mappings that will be used by user + // namespaces. + // Required if UserNS is private. + // IDMappings *storage.IDMappingOptions `json:"idmappings,omitempty"` + // ReadOnlyFilesystem indicates that everything will be mounted + + // as read-only + ReadOnlyFilesystem bool `json:"read_only_filesystem,omitempty"` +} + +// ContainerCgroupConfig contains configuration information about a container's +// cgroups. +type ContainerCgroupConfig struct { + // CgroupNS is the container's cgroup namespace. + // It defaults to private. + // Mandatory. + CgroupNS Namespace `json:"cgroupns,omitempty"` + + // CgroupsMode sets a policy for how cgroups will be created in the + // container, including the ability to disable creation entirely. + CgroupsMode string `json:"cgroups_mode,omitempty"` + // CgroupParent is the container's CGroup parent. + // If not set, the default for the current cgroup driver will be used. + // Optional. + CgroupParent string `json:"cgroup_parent,omitempty"` +} + +// ContainerNetworkConfig contains information on a container's network +// configuration. +type ContainerNetworkConfig struct { + // NetNS is the configuration to use for the container's network + // namespace. + // Mandatory. + NetNS Namespace `json:"netns,omitempty"` + + // StaticIP is the a IPv4 address of the container. + // Only available if NetNS is set to Bridge. + // Optional. + StaticIP *net.IP `json:"static_ip,omitempty"` + // StaticIPv6 is a static IPv6 address to set in the container. + // Only available if NetNS is set to Bridge. + // Optional. + StaticIPv6 *net.IP `json:"static_ipv6,omitempty"` + // StaticMAC is a static MAC address to set in the container. + // Only available if NetNS is set to bridge. + // Optional. + StaticMAC *net.HardwareAddr `json:"static_mac,omitempty"` + // PortBindings is a set of ports to map into the container. + // Only available if NetNS is set to bridge or slirp. + // Optional. + PortMappings []PortMapping `json:"portmappings,omitempty"` + // Expose is a number of ports that will be forwarded to the container + // if PublishExposedPorts is set. + // Expose is a map of uint16 (port number) to a string representing + // protocol. Allowed protocols are "tcp", "udp", and "sctp", or some + // combination of the three separated by commas. + // If protocol is set to "" we will assume TCP. + // Only available if NetNS is set to Bridge or Slirp, and + // PublishExposedPorts is set. + // Optional. + Expose map[uint16]string `json:"expose,omitempty"` + // CNINetworks is a list of CNI networks to join the container to. + // If this list is empty, the default CNI network will be joined + // instead. If at least one entry is present, we will not join the + // default network (unless it is part of this list). + // Only available if NetNS is set to bridge. + // Optional. + CNINetworks []string `json:"cni_networks,omitempty"` + // DNSServers is a set of DNS servers that will be used in the + // container's resolv.conf, replacing the host's DNS Servers which are + // used by default. + // Conflicts with UseImageResolvConf. + // Optional. + DNSServers []net.IP `json:"dns_server,omitempty"` + // DNSSearch is a set of DNS search domains that will be used in the + // container's resolv.conf, replacing the host's DNS search domains + // which are used by default. + // Conflicts with UseImageResolvConf. + // Optional. + DNSSearch []string `json:"dns_search,omitempty"` + // DNSOptions is a set of DNS options that will be used in the + // container's resolv.conf, replacing the host's DNS options which are + // used by default. + // Conflicts with UseImageResolvConf. + // Optional. + DNSOptions []string `json:"dns_option,omitempty"` + // HostAdd is a set of hosts which will be added to the container's + // /etc/hosts file. + // Conflicts with UseImageHosts. + // Optional. + HostAdd []string `json:"hostadd,omitempty"` + // NetworkOptions are additional options for each network + // Optional. + NetworkOptions map[string][]string `json:"network_options,omitempty"` + // PublishExposedPorts will publish ports specified in the image to + // random unused ports (guaranteed to be above 1024) on the host. + // This is based on ports set in Expose below, and any ports specified + // by the Image (if one is given). + // Only available if NetNS is set to Bridge or Slirp. + PublishExposedPorts bool `json:"publish_image_ports,omitempty"` + // UseImageResolvConf indicates that resolv.conf should not be managed + // by Podman, but instead sourced from the image. + // Conflicts with DNSServer, DNSSearch, DNSOption. + UseImageResolvConf bool `json:"use_image_resolve_conf,omitempty"` + // UseImageHosts indicates that /etc/hosts should not be managed by + // Podman, and instead sourced from the image. + // Conflicts with HostAdd. + UseImageHosts bool `json:"use_image_hosts,omitempty"` +} + +// ContainerResourceConfig contains information on container resource limits. +type ContainerResourceConfig struct { + // ResourceLimits are resource limits to apply to the container., + // Can only be set as root on cgroups v1 systems, but can be set as + // rootless as well for cgroups v2. + // Optional. + ResourceLimits *spec.LinuxResources `json:"resource_limits,omitempty"` + // Rlimits are POSIX rlimits to apply to the container. + // Optional. + Rlimits []spec.POSIXRlimit `json:"r_limits,omitempty"` + // OOMScoreAdj adjusts the score used by the OOM killer to determine + // processes to kill for the container's process. + // Optional. + OOMScoreAdj *int `json:"oom_score_adj,omitempty"` + // Weight per cgroup per device, can override BlkioWeight + WeightDevice map[string]spec.LinuxWeightDevice `json:"weightDevice,omitempty"` + // IO read rate limit per cgroup per device, bytes per second + ThrottleReadBpsDevice map[string]spec.LinuxThrottleDevice `json:"throttleReadBpsDevice,omitempty"` + // IO write rate limit per cgroup per device, bytes per second + ThrottleWriteBpsDevice map[string]spec.LinuxThrottleDevice `json:"throttleWriteBpsDevice,omitempty"` + // IO read rate limit per cgroup per device, IO per second + ThrottleReadIOPSDevice map[string]spec.LinuxThrottleDevice `json:"throttleReadIOPSDevice,omitempty"` + // IO write rate limit per cgroup per device, IO per second + ThrottleWriteIOPSDevice map[string]spec.LinuxThrottleDevice `json:"throttleWriteIOPSDevice,omitempty"` +} + +// ContainerHealthCheckConfig describes a container healthcheck with attributes +// like command, retries, interval, start period, and timeout. +type ContainerHealthCheckConfig struct { + // HealthConfig *manifest.Schema2HealthConfig `json:"healthconfig,omitempty"` +} + +// SpecGenerator creates an OCI spec and Libpod configuration options to create +// a container based on the given configuration. +// swagger:model SpecGenerator +type SpecGenerator struct { + ContainerHealthCheckConfig + ContainerBasicConfig + ContainerStorageConfig + ContainerNetworkConfig + ContainerSecurityConfig + ContainerResourceConfig + ContainerCgroupConfig +} + +// NamedVolume holds information about a named volume that will be mounted into +// the container. +type NamedVolume struct { + // Name is the name of the named volume to be mounted. May be empty. + // If empty, a new named volume with a pseudorandomly generated name + // will be mounted at the given destination. + Name string + // Destination to mount the named volume within the container. Must be + // an absolute path. Path will be created if it does not exist. + Dest string + // Options are options that the named volume will be mounted with. + Options []string +} + +// OverlayVolume holds information about a overlay volume that will be mounted into +// the container. +type OverlayVolume struct { + // Destination is the absolute path where the mount will be placed in the container. + Destination string `json:"destination"` + // Source specifies the source path of the mount. + Source string `json:"source,omitempty"` +} + +// PortMapping is one or more ports that will be mapped into the container. +type PortMapping struct { + // HostIP is the IP that we will bind to on the host. + // If unset, assumed to be 0.0.0.0 (all interfaces). + HostIP string `json:"host_ip,omitempty"` + // ContainerPort is the port number that will be exposed from the + // container. + // Mandatory. + ContainerPort uint16 `json:"container_port"` + // HostPort is the port number that will be forwarded from the host into + // the container. + // If omitted, a random port on the host (guaranteed to be over 1024) + // will be assigned. + HostPort uint16 `json:"host_port,omitempty"` + // Range is the number of ports that will be forwarded, starting at + // HostPort and ContainerPort and counting up. + // This is 1-indexed, so 1 is assumed to be a single port (only the + // Hostport:Containerport mapping will be added), 2 is two ports (both + // Hostport:Containerport and Hostport+1:Containerport+1), etc. + // If unset, assumed to be 1 (a single port). + // Both hostport + range and containerport + range must be less than + // 65536. + Range uint16 `json:"range,omitempty"` + // Protocol is the protocol forward. + // Must be either "tcp", "udp", and "sctp", or some combination of these + // separated by commas. + // If unset, assumed to be TCP. + Protocol string `json:"protocol,omitempty"` +} + +// taken from https://github.com/containers/podman/blob/master/pkg/specgen/namespaces.go + +type NamespaceMode string + +const ( + // Default indicates the spec generator should determine + // a sane default + Default NamespaceMode = "default" + // Host means the the namespace is derived from + // the host + Host NamespaceMode = "host" + // Path is the path to a namespace + Path NamespaceMode = "path" + // FromContainer means namespace is derived from a + // different container + FromContainer NamespaceMode = "container" + // FromPod indicates the namespace is derived from a pod + FromPod NamespaceMode = "pod" + // Private indicates the namespace is private + Private NamespaceMode = "private" + // NoNetwork indicates no network namespace should + // be joined. loopback should still exists + NoNetwork NamespaceMode = "none" + // Bridge indicates that a CNI network stack + // should be used + Bridge NamespaceMode = "bridge" + // Slirp indicates that a slirp4netns network stack should + // be used + Slirp NamespaceMode = "slirp4netns" + // KeepId indicates a user namespace to keep the owner uid inside + // of the namespace itself + KeepID NamespaceMode = "keep-id" + // KeepId indicates to automatically create a user namespace + Auto NamespaceMode = "auto" + // DefaultKernelNamespaces is a comma-separated list of default kernel + // namespaces. + DefaultKernelNamespaces = "cgroup,ipc,net,uts" +) + +// Namespace describes the namespace +type Namespace struct { + NSMode NamespaceMode `json:"nsmode,omitempty"` + Value string `json:"string,omitempty"` +} + +// ------------------------------------------------------------------------------------------------------- +// structs copied from https://github.com/containers/podman/blob/master/libpod/define/container_inspect.go +// +// some unused parts are modified/commented out to not pull +// more dependencies and also to overcome some json unmarshall/version problems +// +// some fields are reordert to make the linter happy (bytes maligned complains) +// ------------------------------------------------------------------------------------------------------- + +// InspectContainerConfig holds further data about how a container was initially +// configured. +type InspectContainerConfig struct { + // Container hostname + Hostname string `json:"Hostname"` + // Container domain name - unused at present + DomainName string `json:"Domainname"` + // User the container was launched with + User string `json:"User"` + // Container environment variables + Env []string `json:"Env"` + // Container command + Cmd []string `json:"Cmd"` + // Container image + Image string `json:"Image"` + // Unused, at present. I've never seen this field populated. + Volumes map[string]struct{} `json:"Volumes"` + // Container working directory + WorkingDir string `json:"WorkingDir"` + // Container entrypoint + Entrypoint string `json:"Entrypoint"` + // On-build arguments - presently unused. More of Buildah's domain. + OnBuild *string `json:"OnBuild"` + // Container labels + Labels map[string]string `json:"Labels"` + // Container annotations + Annotations map[string]string `json:"Annotations"` + // Container stop signal + StopSignal uint `json:"StopSignal"` + // Configured healthcheck for the container + //Healthcheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"` + // CreateCommand is the full command plus arguments of the process the + // container has been created with. + CreateCommand []string `json:"CreateCommand,omitempty"` + // Timezone is the timezone inside the container. + // Local means it has the same timezone as the host machine + Timezone string `json:"Timezone,omitempty"` + // Umask is the umask inside the container. + Umask string `json:"Umask,omitempty"` + // SystemdMode is whether the container is running in systemd mode. In + // systemd mode, the container configuration is customized to optimize + // running systemd in the container. + SystemdMode bool `json:"SystemdMode,omitempty"` + // Unused, at present + AttachStdin bool `json:"AttachStdin"` + // Unused, at present + AttachStdout bool `json:"AttachStdout"` + // Unused, at present + AttachStderr bool `json:"AttachStderr"` + // Whether the container creates a TTY + Tty bool `json:"Tty"` + // Whether the container leaves STDIN open + OpenStdin bool `json:"OpenStdin"` + // Whether STDIN is only left open once. + // Presently not supported by Podman, unused. + StdinOnce bool `json:"StdinOnce"` +} + +// InspectRestartPolicy holds information about the container's restart policy. +type InspectRestartPolicy struct { + // Name contains the container's restart policy. + // Allowable values are "no" or "" (take no action), + // "on-failure" (restart on non-zero exit code, with an optional max + // retry count), and "always" (always restart on container stop, unless + // explicitly requested by API). + // Note that this is NOT actually a name of any sort - the poor naming + // is for Docker compatibility. + Name string `json:"Name"` + // MaximumRetryCount is the maximum number of retries allowed if the + // "on-failure" restart policy is in use. Not used if "on-failure" is + // not set. + MaximumRetryCount uint `json:"MaximumRetryCount"` +} + +// InspectLogConfig holds information about a container's configured log driver +// and is presently unused. It is retained for Docker compatibility. +type InspectLogConfig struct { + Type string `json:"Type"` + Config map[string]string `json:"Config"` //idk type, TODO +} + +// InspectBlkioWeightDevice holds information about the relative weight +// of an individual device node. Weights are used in the I/O scheduler to give +// relative priority to some accesses. +type InspectBlkioWeightDevice struct { + // Path is the path to the device this applies to. + Path string `json:"Path"` + // Weight is the relative weight the scheduler will use when scheduling + // I/O. + Weight uint16 `json:"Weight"` +} + +// InspectBlkioThrottleDevice holds information about a speed cap for a device +// node. This cap applies to a specific operation (read, write, etc) on the given +// node. +type InspectBlkioThrottleDevice struct { + // Path is the path to the device this applies to. + Path string `json:"Path"` + // Rate is the maximum rate. It is in either bytes per second or iops + // per second, determined by where it is used - documentation will + // indicate which is appropriate. + Rate uint64 `json:"Rate"` +} + +// InspectUlimit is a ulimit that will be applied to the container. +type InspectUlimit struct { + // Name is the name (type) of the ulimit. + Name string `json:"Name"` + // Soft is the soft limit that will be applied. + Soft uint64 `json:"Soft"` + // Hard is the hard limit that will be applied. + Hard uint64 `json:"Hard"` +} + +// InspectDevice is a single device that will be mounted into the container. +type InspectDevice struct { + // PathOnHost is the path of the device on the host. + PathOnHost string `json:"PathOnHost"` + // PathInContainer is the path of the device within the container. + PathInContainer string `json:"PathInContainer"` + // CgroupPermissions is the permissions of the mounted device. + // Presently not populated. + // TODO. + CgroupPermissions string `json:"CgroupPermissions"` +} + +// InspectHostPort provides information on a port on the host that a container's +// port is bound to. +type InspectHostPort struct { + // IP on the host we are bound to. "" if not specified (binding to all + // IPs). + HostIP string `json:"HostIp"` + // Port on the host we are bound to. No special formatting - just an + // integer stuffed into a string. + HostPort string `json:"HostPort"` +} + +// InspectMount provides a record of a single mount in a container. It contains +// fields for both named and normal volumes. Only user-specified volumes will be +// included, and tmpfs volumes are not included even if the user specified them. +type InspectMount struct { + // Whether the mount is a volume or bind mount. Allowed values are + // "volume" and "bind". + Type string `json:"Type"` + // The name of the volume. Empty for bind mounts. + Name string `json:"Name,omitempty"` + // The source directory for the volume. + Source string `json:"Source"` + // The destination directory for the volume. Specified as a path within + // the container, as it would be passed into the OCI runtime. + Destination string `json:"Destination"` + // The driver used for the named volume. Empty for bind mounts. + Driver string `json:"Driver"` + // Contains SELinux :z/:Z mount options. Unclear what, if anything, else + // goes in here. + Mode string `json:"Mode"` + // All remaining mount options. Additional data, not present in the + // original output. + Options []string `json:"Options"` + // Whether the volume is read-write + RW bool `json:"RW"` + // Mount propagation for the mount. Can be empty if not specified, but + // is always printed - no omitempty. + Propagation string `json:"Propagation"` +} + +// InspectContainerState provides a detailed record of a container's current +// state. It is returned as part of InspectContainerData. +// As with InspectContainerData, many portions of this struct are matched to +// Docker, but here we see more fields that are unused (nonsensical in the +// context of Libpod). +type InspectContainerState struct { + OciVersion string `json:"OciVersion"` + Status string `json:"Status"` + Running bool `json:"Running"` + Paused bool `json:"Paused"` + Restarting bool `json:"Restarting"` // TODO + OOMKilled bool `json:"OOMKilled"` + Dead bool `json:"Dead"` + Pid int `json:"Pid"` + ConmonPid int `json:"ConmonPid,omitempty"` + ExitCode int32 `json:"ExitCode"` + Error string `json:"Error"` // TODO + StartedAt time.Time `json:"StartedAt"` + FinishedAt time.Time `json:"FinishedAt"` + Healthcheck HealthCheckResults `json:"Healthcheck,omitempty"` +} + +// HealthCheckResults describes the results/logs from a healthcheck +type HealthCheckResults struct { + // Status healthy or unhealthy + Status string `json:"Status"` + // FailingStreak is the number of consecutive failed healthchecks + FailingStreak int `json:"FailingStreak"` + // Log describes healthcheck attempts and results + Log []HealthCheckLog `json:"Log"` +} + +// HealthCheckLog describes the results of a single healthcheck +type HealthCheckLog struct { + // Start time as string + Start string `json:"Start"` + // End time as a string + End string `json:"End"` + // Exitcode is 0 or 1 + ExitCode int `json:"ExitCode"` + // Output is the stdout/stderr from the healthcheck command + Output string `json:"Output"` +} + +// InspectContainerHostConfig holds information used when the container was +// created. +// It's very much a Docker-specific struct, retained (mostly) as-is for +// compatibility. We fill individual fields as best as we can, inferring as much +// as possible from the spec and container config. +// Some things cannot be inferred. These will be populated by spec annotations +// (if available). +// Field names are fixed for compatibility and cannot be changed. +// As such, silence lint warnings about them. +//nolint +type InspectContainerHostConfig struct { + // Binds contains an array of user-added mounts. + // Both volume mounts and named volumes are included. + // Tmpfs mounts are NOT included. + // In 'docker inspect' this is separated into 'Binds' and 'Mounts' based + // on how a mount was added. We do not make this distinction and do not + // include a Mounts field in inspect. + // Format: :[:] + Binds []string `json:"Binds"` + // CgroupMode is the configuration of the container's cgroup namespace. + // Populated as follows: + // private - a cgroup namespace has been created + // host - No cgroup namespace created + // container: - Using another container's cgroup namespace + // ns: - A path to a cgroup namespace has been specified + CgroupMode string `json:"CgroupMode"` + // ContainerIDFile is a file created during container creation to hold + // the ID of the created container. + // This is not handled within libpod and is stored in an annotation. + ContainerIDFile string `json:"ContainerIDFile"` + // LogConfig contains information on the container's logging backend + LogConfig *InspectLogConfig `json:"LogConfig"` + // NetworkMode is the configuration of the container's network + // namespace. + // Populated as follows: + // default - A network namespace is being created and configured via CNI + // none - A network namespace is being created, not configured via CNI + // host - No network namespace created + // container: - Using another container's network namespace + // ns: - A path to a network namespace has been specified + NetworkMode string `json:"NetworkMode"` + // PortBindings contains the container's port bindings. + // It is formatted as map[string][]InspectHostPort. + // The string key here is formatted as / + // and represents the container port. A single container port may be + // bound to multiple host ports (on different IPs). + PortBindings map[string][]InspectHostPort `json:"PortBindings"` + // RestartPolicy contains the container's restart policy. + RestartPolicy *InspectRestartPolicy `json:"RestartPolicy"` + // AutoRemove is whether the container will be automatically removed on + // exiting. + // It is not handled directly within libpod and is stored in an + // annotation. + AutoRemove bool `json:"AutoRemove"` + // VolumeDriver is presently unused and is retained for Docker + // compatibility. + VolumeDriver string `json:"VolumeDriver"` + // VolumesFrom is a list of containers which this container uses volumes + // from. This is not handled directly within libpod and is stored in an + // annotation. + // It is formatted as an array of container names and IDs. + VolumesFrom []string `json:"VolumesFrom"` + // CapAdd is a list of capabilities added to the container. + // It is not directly stored by Libpod, and instead computed from the + // capabilities listed in the container's spec, compared against a set + // of default capabilities. + CapAdd []string `json:"CapAdd"` + // CapDrop is a list of capabilities removed from the container. + // It is not directly stored by libpod, and instead computed from the + // capabilities listed in the container's spec, compared against a set + // of default capabilities. + CapDrop []string `json:"CapDrop"` + // Dns is a list of DNS nameservers that will be added to the + // container's resolv.conf + Dns []string `json:"Dns"` + // DnsOptions is a list of DNS options that will be set in the + // container's resolv.conf + DnsOptions []string `json:"DnsOptions"` + // DnsSearch is a list of DNS search domains that will be set in the + // container's resolv.conf + DnsSearch []string `json:"DnsSearch"` + // ExtraHosts contains hosts that will be aded to the container's + // /etc/hosts. + ExtraHosts []string `json:"ExtraHosts"` + // GroupAdd contains groups that the user inside the container will be + // added to. + GroupAdd []string `json:"GroupAdd"` + // IpcMode represents the configuration of the container's IPC + // namespace. + // Populated as follows: + // "" (empty string) - Default, an IPC namespace will be created + // host - No IPC namespace created + // container: - Using another container's IPC namespace + // ns: - A path to an IPC namespace has been specified + IpcMode string `json:"IpcMode"` + // Cgroup contains the container's cgroup. It is presently not + // populated. + // TODO. + Cgroup string `json:"Cgroup"` + // Cgroups contains the container's CGroup mode. + // Allowed values are "default" (container is creating CGroups) and + // "disabled" (container is not creating CGroups). + // This is Libpod-specific and not included in `docker inspect`. + Cgroups string `json:"Cgroups"` + // Links is unused, and provided purely for Docker compatibility. + Links []string `json:"Links"` + // OOMScoreAdj is an adjustment that will be made to the container's OOM + // score. + OomScoreAdj int `json:"OomScoreAdj"` + // PidMode represents the configuration of the container's PID + // namespace. + // Populated as follows: + // "" (empty string) - Default, a PID namespace will be created + // host - No PID namespace created + // container: - Using another container's PID namespace + // ns: - A path to a PID namespace has been specified + PidMode string `json:"PidMode"` + // Privileged indicates whether the container is running with elevated + // privileges. + // This has a very specific meaning in the Docker sense, so it's very + // difficult to decode from the spec and config, and so is stored as an + // annotation. + Privileged bool `json:"Privileged"` + // PublishAllPorts indicates whether image ports are being published. + // This is not directly stored in libpod and is saved as an annotation. + PublishAllPorts bool `json:"PublishAllPorts"` + // ReadonlyRootfs is whether the container will be mounted read-only. + ReadonlyRootfs bool `json:"ReadonlyRootfs"` + // SecurityOpt is a list of security-related options that are set in the + // container. + SecurityOpt []string `json:"SecurityOpt"` + // Tmpfs is a list of tmpfs filesystems that will be mounted into the + // container. + // It is a map of destination path to options for the mount. + Tmpfs map[string]string `json:"Tmpfs"` + // UTSMode represents the configuration of the container's UID + // namespace. + // Populated as follows: + // "" (empty string) - Default, a UTS namespace will be created + // host - no UTS namespace created + // container: - Using another container's UTS namespace + // ns: - A path to a UTS namespace has been specified + UTSMode string `json:"UTSMode"` + // UsernsMode represents the configuration of the container's user + // namespace. + // When running rootless, a user namespace is created outside of libpod + // to allow some privileged operations. This will not be reflected here. + // Populated as follows: + // "" (empty string) - No user namespace will be created + // private - The container will be run in a user namespace + // container: - Using another container's user namespace + // ns: - A path to a user namespace has been specified + // TODO Rootless has an additional 'keep-id' option, presently not + // reflected here. + UsernsMode string `json:"UsernsMode"` + // ShmSize is the size of the container's SHM device. + ShmSize int64 `json:"ShmSize"` + // Runtime is provided purely for Docker compatibility. + // It is set unconditionally to "oci" as Podman does not presently + // support non-OCI runtimes. + Runtime string `json:"Runtime"` + // ConsoleSize is an array of 2 integers showing the size of the + // container's console. + // It is only set if the container is creating a terminal. + // TODO. + ConsoleSize []uint `json:"ConsoleSize"` + // Isolation is presently unused and provided solely for Docker + // compatibility. + Isolation string `json:"Isolation"` + // CpuShares indicates the CPU resources allocated to the container. + // It is a relative weight in the scheduler for assigning CPU time + // versus other CGroups. + CpuShares uint64 `json:"CpuShares"` + // Memory indicates the memory resources allocated to the container. + // This is the limit (in bytes) of RAM the container may use. + Memory int64 `json:"Memory"` + // NanoCpus indicates number of CPUs allocated to the container. + // It is an integer where one full CPU is indicated by 1000000000 (one + // billion). + // Thus, 2.5 CPUs (fractional portions of CPUs are allowed) would be + // 2500000000 (2.5 billion). + // In 'docker inspect' this is set exclusively of two further options in + // the output (CpuPeriod and CpuQuota) which are both used to implement + // this functionality. + // We can't distinguish here, so if CpuQuota is set to the default of + // 100000, we will set both CpuQuota, CpuPeriod, and NanoCpus. If + // CpuQuota is not the default, we will not set NanoCpus. + NanoCpus int64 `json:"NanoCpus"` + // CgroupParent is the CGroup parent of the container. + // Only set if not default. + CgroupParent string `json:"CgroupParent"` + // BlkioWeight indicates the I/O resources allocated to the container. + // It is a relative weight in the scheduler for assigning I/O time + // versus other CGroups. + BlkioWeight uint16 `json:"BlkioWeight"` + // BlkioWeightDevice is an array of I/O resource priorities for + // individual device nodes. + // Unfortunately, the spec only stores the device's Major/Minor numbers + // and not the path, which is used here. + // Fortunately, the kernel provides an interface for retrieving the path + // of a given node by major:minor at /sys/dev/. However, the exact path + // in use may not be what was used in the original CLI invocation - + // though it is guaranteed that the device node will be the same, and + // using the given path will be functionally identical. + BlkioWeightDevice []InspectBlkioWeightDevice `json:"BlkioWeightDevice"` + // BlkioDeviceReadBps is an array of I/O throttle parameters for + // individual device nodes. + // This specifically sets read rate cap in bytes per second for device + // nodes. + // As with BlkioWeightDevice, we pull the path from /sys/dev, and we + // don't guarantee the path will be identical to the original (though + // the node will be). + BlkioDeviceReadBps []InspectBlkioThrottleDevice `json:"BlkioDeviceReadBps"` + // BlkioDeviceWriteBps is an array of I/O throttle parameters for + // individual device nodes. + // this specifically sets write rate cap in bytes per second for device + // nodes. + // as with BlkioWeightDevice, we pull the path from /sys/dev, and we + // don't guarantee the path will be identical to the original (though + // the node will be). + BlkioDeviceWriteBps []InspectBlkioThrottleDevice `json:"BlkioDeviceWriteBps"` + // BlkioDeviceReadIOps is an array of I/O throttle parameters for + // individual device nodes. + // This specifically sets the read rate cap in iops per second for + // device nodes. + // As with BlkioWeightDevice, we pull the path from /sys/dev, and we + // don't guarantee the path will be identical to the original (though + // the node will be). + BlkioDeviceReadIOps []InspectBlkioThrottleDevice `json:"BlkioDeviceReadIOps"` + // BlkioDeviceWriteIOps is an array of I/O throttle parameters for + // individual device nodes. + // This specifically sets the write rate cap in iops per second for + // device nodes. + // As with BlkioWeightDevice, we pull the path from /sys/dev, and we + // don't guarantee the path will be identical to the original (though + // the node will be). + BlkioDeviceWriteIOps []InspectBlkioThrottleDevice `json:"BlkioDeviceWriteIOps"` + // CpuPeriod is the length of a CPU period in microseconds. + // It relates directly to CpuQuota. + CpuPeriod uint64 `json:"CpuPeriod"` + // CpuPeriod is the amount of time (in microseconds) that a container + // can use the CPU in every CpuPeriod. + CpuQuota int64 `json:"CpuQuota"` + // CpuRealtimePeriod is the length of time (in microseconds) of the CPU + // realtime period. If set to 0, no time will be allocated to realtime + // tasks. + CpuRealtimePeriod uint64 `json:"CpuRealtimePeriod"` + // CpuRealtimeRuntime is the length of time (in microseconds) allocated + // for realtime tasks within every CpuRealtimePeriod. + CpuRealtimeRuntime int64 `json:"CpuRealtimeRuntime"` + // CpusetCpus is the is the set of CPUs that the container will execute + // on. Formatted as `0-3` or `0,2`. Default (if unset) is all CPUs. + CpusetCpus string `json:"CpusetCpus"` + // CpusetMems is the set of memory nodes the container will use. + // Formatted as `0-3` or `0,2`. Default (if unset) is all memory nodes. + CpusetMems string `json:"CpusetMems"` + // Devices is a list of device nodes that will be added to the + // container. + // These are stored in the OCI spec only as type, major, minor while we + // display the host path. We convert this with /sys/dev, but we cannot + // guarantee that the host path will be identical - only that the actual + // device will be. + Devices []InspectDevice `json:"Devices"` + // DiskQuota is the maximum amount of disk space the container may use + // (in bytes). + // Presently not populated. + // TODO. + DiskQuota uint64 `json:"DiskQuota"` + // KernelMemory is the maximum amount of memory the kernel will devote + // to the container. + KernelMemory int64 `json:"KernelMemory"` + // MemoryReservation is the reservation (soft limit) of memory available + // to the container. Soft limits are warnings only and can be exceeded. + MemoryReservation int64 `json:"MemoryReservation"` + // MemorySwap is the total limit for all memory available to the + // container, including swap. 0 indicates that there is no limit to the + // amount of memory available. + MemorySwap int64 `json:"MemorySwap"` + // MemorySwappiness is the willingness of the kernel to page container + // memory to swap. It is an integer from 0 to 100, with low numbers + // being more likely to be put into swap. + // -1, the default, will not set swappiness and use the system defaults. + MemorySwappiness int64 `json:"MemorySwappiness"` + // OomKillDisable indicates whether the kernel OOM killer is disabled + // for the container. + OomKillDisable bool `json:"OomKillDisable"` + // Init indicates whether the container has an init mounted into it. + Init bool `json:"Init,omitempty"` + // PidsLimit is the maximum number of PIDs what may be created within + // the container. 0, the default, indicates no limit. + PidsLimit int64 `json:"PidsLimit"` + // Ulimits is a set of ulimits that will be set within the container. + Ulimits []InspectUlimit `json:"Ulimits"` + // CpuCount is Windows-only and not presently implemented. + CpuCount uint64 `json:"CpuCount"` + // CpuPercent is Windows-only and not presently implemented. + CpuPercent uint64 `json:"CpuPercent"` + // IOMaximumIOps is Windows-only and not presently implemented. + IOMaximumIOps uint64 `json:"IOMaximumIOps"` + // IOMaximumBandwidth is Windows-only and not presently implemented. + IOMaximumBandwidth uint64 `json:"IOMaximumBandwidth"` +} + +// InspectBasicNetworkConfig holds basic configuration information (e.g. IP +// addresses, MAC address, subnet masks, etc) that are common for all networks +// (both additional and main). +type InspectBasicNetworkConfig struct { + // EndpointID is unused, maintained exclusively for compatibility. + EndpointID string `json:"EndpointID"` + // Gateway is the IP address of the gateway this network will use. + Gateway string `json:"Gateway"` + // IPAddress is the IP address for this network. + IPAddress string `json:"IPAddress"` + // IPPrefixLen is the length of the subnet mask of this network. + IPPrefixLen int `json:"IPPrefixLen"` + // SecondaryIPAddresses is a list of extra IP Addresses that the + // container has been assigned in this network. + SecondaryIPAddresses []string `json:"SecondaryIPAddresses,omitempty"` + // IPv6Gateway is the IPv6 gateway this network will use. + IPv6Gateway string `json:"IPv6Gateway"` + // GlobalIPv6Address is the global-scope IPv6 Address for this network. + GlobalIPv6Address string `json:"GlobalIPv6Address"` + // GlobalIPv6PrefixLen is the length of the subnet mask of this network. + GlobalIPv6PrefixLen int `json:"GlobalIPv6PrefixLen"` + // SecondaryIPv6Addresses is a list of extra IPv6 Addresses that the + // container has been assigned in this networ. + SecondaryIPv6Addresses []string `json:"SecondaryIPv6Addresses,omitempty"` + // MacAddress is the MAC address for the interface in this network. + MacAddress string `json:"MacAddress"` + // AdditionalMacAddresses is a set of additional MAC Addresses beyond + // the first. CNI may configure more than one interface for a single + // network, which can cause this. + AdditionalMacAddresses []string `json:"AdditionalMACAddresses,omitempty"` +} + +// InspectAdditionalNetwork holds information about non-default CNI networks the +// container has been connected to. +// As with InspectNetworkSettings, many fields are unused and maintained only +// for compatibility with Docker. +type InspectAdditionalNetwork struct { + InspectBasicNetworkConfig + + // Name of the network we're connecting to. + NetworkID string `json:"NetworkID,omitempty"` + // DriverOpts is presently unused and maintained exclusively for + // compatibility. + DriverOpts map[string]string `json:"DriverOpts"` + // IPAMConfig is presently unused and maintained exclusively for + // compatibility. + IPAMConfig map[string]string `json:"IPAMConfig"` + // Links is presently unused and maintained exclusively for + // compatibility. + Links []string `json:"Links"` +} + +// InspectNetworkSettings holds information about the network settings of the +// container. +// Many fields are maintained only for compatibility with `docker inspect` and +// are unused within Libpod. +type InspectNetworkSettings struct { + InspectBasicNetworkConfig + + Bridge string `json:"Bridge"` + SandboxID string `json:"SandboxID"` + HairpinMode bool `json:"HairpinMode"` + LinkLocalIPv6Address string `json:"LinkLocalIPv6Address"` + LinkLocalIPv6PrefixLen int `json:"LinkLocalIPv6PrefixLen"` + Ports map[string][]InspectHostPort `json:"Ports"` + SandboxKey string `json:"SandboxKey"` + // Networks contains information on non-default CNI networks this + // container has joined. + // It is a map of network name to network information. + Networks map[string]*InspectAdditionalNetwork `json:"Networks,omitempty"` +} + +// InspectContainerData provides a detailed record of a container's configuration +// and state as viewed by Libpod. +// Large portions of this structure are defined such that the output is +// compatible with `docker inspect` JSON, but additional fields have been added +// as required to share information not in the original output. +type InspectContainerData struct { + State *InspectContainerState `json:"State"` + Mounts []InspectMount `json:"Mounts"` + NetworkSettings *InspectNetworkSettings `json:"NetworkSettings"` //TODO + Config *InspectContainerConfig `json:"Config"` + HostConfig *InspectContainerHostConfig `json:"HostConfig"` + ID string `json:"Id"` + // FIXME can not parse date/time: "Created": "2020-07-05 11:32:38.541987006 -0400 -0400", + //Created time.Time `json:"Created"` + Path string `json:"Path"` + Args []string `json:"Args"` + Image string `json:"Image"` + ImageName string `json:"ImageName"` + Rootfs string `json:"Rootfs"` + Pod string `json:"Pod"` + ResolvConfPath string `json:"ResolvConfPath"` + HostnamePath string `json:"HostnamePath"` + HostsPath string `json:"HostsPath"` + StaticDir string `json:"StaticDir"` + OCIConfigPath string `json:"OCIConfigPath,omitempty"` + OCIRuntime string `json:"OCIRuntime,omitempty"` + LogPath string `json:"LogPath"` + LogTag string `json:"LogTag"` + ConmonPidFile string `json:"ConmonPidFile"` + Name string `json:"Name"` + Driver string `json:"Driver"` + MountLabel string `json:"MountLabel"` + ProcessLabel string `json:"ProcessLabel"` + AppArmorProfile string `json:"AppArmorProfile"` + EffectiveCaps []string `json:"EffectiveCaps"` + BoundingCaps []string `json:"BoundingCaps"` + ExecIDs []string `json:"ExecIDs"` + Dependencies []string `json:"Dependencies"` + ExitCommand []string `json:"ExitCommand"` + Namespace string `json:"Namespace"` + //GraphDriver *driver.Data `json:"GraphDriver"` + SizeRw *int64 `json:"SizeRw,omitempty"` + SizeRootFs int64 `json:"SizeRootFs,omitempty"` + RestartCount int32 `json:"RestartCount"` + IsInfra bool `json:"IsInfra"` +} + +// InspectExecSession contains information about a given exec session. +type InspectExecSession struct { + // ProcessConfig contains information about the exec session's process. + ProcessConfig *InspectExecProcess `json:"ProcessConfig"` + // ContainerID is the ID of the container this exec session is attached + // to. + ContainerID string `json:"ContainerID"` + // DetachKeys are the detach keys used by the exec session. + // If set to "" the default keys are being used. + // Will show "" if no detach keys are set. + DetachKeys string `json:"DetachKeys"` + // ID is the ID of the exec session. + ID string `json:"ID"` + // ExitCode is the exit code of the exec session. Will be set to 0 if + // the exec session has not yet exited. + ExitCode int `json:"ExitCode"` + // Pid is the PID of the exec session's process. + // Will be set to 0 if the exec session is not running. + Pid int `json:"Pid"` + // CanRemove is legacy and used purely for compatibility reasons. + // Will always be set to true, unless the exec session is running. + CanRemove bool `json:"CanRemove"` + // OpenStderr is whether the container's STDERR stream will be attached. + // Always set to true if the exec session created a TTY. + OpenStderr bool `json:"OpenStderr"` + // OpenStdin is whether the container's STDIN stream will be attached + // to. + OpenStdin bool `json:"OpenStdin"` + // OpenStdout is whether the container's STDOUT stream will be attached. + // Always set to true if the exec session created a TTY. + OpenStdout bool `json:"OpenStdout"` + // Running is whether the exec session is running. + Running bool `json:"Running"` +} + +// InspectExecProcess contains information about the process in a given exec +// session. +type InspectExecProcess struct { + // Arguments are the arguments to the entrypoint command of the exec + // session. + Arguments []string `json:"arguments"` + // Entrypoint is the entrypoint for the exec session (the command that + // will be executed in the container). + // FIXME: was string instead of []string ?? + Entrypoint []string `json:"entrypoint"` + // Privileged is whether the exec session will be started with elevated + // privileges. + Privileged bool `json:"privileged"` + // Tty is whether the exec session created a terminal. + Tty bool `json:"tty"` + // User is the user the exec session was started as. + User string `json:"user"` +} + +// ------------------------------------------------------------------------------------------------------- +// structs loosly copied from https://github.com/containers/podman/blob/master/pkg/api/handlers/compat/types.go +// and https://github.com/moby/moby/blob/master/api/types/stats.go +// some unused parts are modified/commented out to not pull +// more dependencies and also to overcome some json unmarshall/version problems +// +// some fields are reordert to make the linter happy (bytes maligned complains) +// ------------------------------------------------------------------------------------------------------- +// + +// CPUStats aggregates and wraps all CPU related info of container +type CPUStats struct { + // CPU Usage. Linux and Windows. + CPUUsage CPUUsage `json:"cpu_usage"` + + // System Usage. Linux only. + SystemUsage uint64 `json:"system_cpu_usage,omitempty"` + + // Online CPUs. Linux only. + OnlineCPUs uint32 `json:"online_cpus,omitempty"` + + // Usage of CPU in %. Linux only. + CPU float64 `json:"cpu"` + + // Throttling Data. Linux only. + ThrottlingData ThrottlingData `json:"throttling_data,omitempty"` +} + +// Stats is Ultimate struct aggregating all types of stats of one container +type Stats struct { + // Common stats + Read time.Time `json:"read"` + PreRead time.Time `json:"preread"` + + // Linux specific stats, not populated on Windows. + PidsStats PidsStats `json:"pids_stats,omitempty"` + BlkioStats BlkioStats `json:"blkio_stats,omitempty"` + + // Windows specific stats, not populated on Linux. + // NumProcs uint32 `json:"num_procs"` + // StorageStats docker.StorageStats `json:"storage_stats,omitempty"` + + // Shared stats + CPUStats CPUStats `json:"cpu_stats,omitempty"` + PreCPUStats CPUStats `json:"precpu_stats,omitempty"` // "Pre"="Previous" + MemoryStats MemoryStats `json:"memory_stats,omitempty"` +} + +// ThrottlingData stores CPU throttling stats of one running container. +// Not used on Windows. +type ThrottlingData struct { + // Number of periods with throttling active + Periods uint64 `json:"periods"` + // Number of periods when the container hits its throttling limit. + ThrottledPeriods uint64 `json:"throttled_periods"` + // Aggregate time the container was throttled for in nanoseconds. + ThrottledTime uint64 `json:"throttled_time"` +} + +// CPUUsage stores All CPU stats aggregated since container inception. +type CPUUsage struct { + // Total CPU time consumed. + // Units: nanoseconds (Linux) + // Units: 100's of nanoseconds (Windows) + TotalUsage uint64 `json:"total_usage"` + + // Total CPU time consumed per core (Linux). Not used on Windows. + // Units: nanoseconds. + PercpuUsage []uint64 `json:"percpu_usage,omitempty"` + + // Time spent by tasks of the cgroup in kernel mode (Linux). + // Time spent by all container processes in kernel mode (Windows). + // Units: nanoseconds (Linux). + // Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers. + UsageInKernelmode uint64 `json:"usage_in_kernelmode"` + + // Time spent by tasks of the cgroup in user mode (Linux). + // Time spent by all container processes in user mode (Windows). + // Units: nanoseconds (Linux). + // Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers + UsageInUsermode uint64 `json:"usage_in_usermode"` +} + +// PidsStats contains the stats of a container's pids +type PidsStats struct { + // Current is the number of pids in the cgroup + Current uint64 `json:"current,omitempty"` + // Limit is the hard limit on the number of pids in the cgroup. + // A "Limit" of 0 means that there is no limit. + Limit uint64 `json:"limit,omitempty"` +} + +// BlkioStatEntry is one small entity to store a piece of Blkio stats +// Not used on Windows. +type BlkioStatEntry struct { + Major uint64 `json:"major"` + Minor uint64 `json:"minor"` + Op string `json:"op"` + Value uint64 `json:"value"` +} + +// BlkioStats stores All IO service stats for data read and write. +// This is a Linux specific structure as the differences between expressing +// block I/O on Windows and Linux are sufficiently significant to make +// little sense attempting to morph into a combined structure. +type BlkioStats struct { + // number of bytes transferred to and from the block device + IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"` + IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive"` + IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive"` + IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive"` + IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive"` + IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive"` + IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive"` + SectorsRecursive []BlkioStatEntry `json:"sectors_recursive"` +} + +// MemoryStats aggregates all memory stats since container inception on Linux. +// Windows returns stats for commit and private working set only. +type MemoryStats struct { + // Linux Memory Stats + + // current res_counter usage for memory + Usage uint64 `json:"usage,omitempty"` + // maximum usage ever recorded. + MaxUsage uint64 `json:"max_usage,omitempty"` + // TODO(vishh): Export these as stronger types. + // all the stats exported via memory.stat. + Stats map[string]uint64 `json:"stats,omitempty"` + // number of times memory usage hits limits. + Failcnt uint64 `json:"failcnt,omitempty"` + Limit uint64 `json:"limit,omitempty"` + + // Windows Memory Stats + // See https://technet.microsoft.com/en-us/magazine/ff382715.aspx + + // committed bytes + Commit uint64 `json:"commitbytes,omitempty"` + // peak committed bytes + CommitPeak uint64 `json:"commitpeakbytes,omitempty"` + // private working set + PrivateWorkingSet uint64 `json:"privateworkingset,omitempty"` +} + +// ------------------------------------------------------------------------------------------------------- +// structs copied from https://github.com/containers/podman/blob/master/libpod/define/info.go +// +// some unused parts are modified/commented out to not pull more dependencies +// +// some fields are reordert to make the linter happy (bytes maligned complains) +// ------------------------------------------------------------------------------------------------------- + +// Info is the overall struct that describes the host system +// running libpod/podman +type Info struct { + Host *HostInfo `json:"host"` + Store *StoreInfo `json:"store"` + Registries map[string]interface{} `json:"registries"` + Version Version `json:"version"` +} + +//HostInfo describes the libpod host +type HostInfo struct { + Arch string `json:"arch"` + BuildahVersion string `json:"buildahVersion"` + CgroupManager string `json:"cgroupManager"` + CGroupsVersion string `json:"cgroupVersion"` + Conmon *ConmonInfo `json:"conmon"` + CPUs int `json:"cpus"` + Distribution DistributionInfo `json:"distribution"` + EventLogger string `json:"eventLogger"` + Hostname string `json:"hostname"` + // IDMappings IDMappings `json:"idMappings,omitempty"` + Kernel string `json:"kernel"` + MemFree int64 `json:"memFree"` + MemTotal int64 `json:"memTotal"` + OCIRuntime *OCIRuntimeInfo `json:"ociRuntime"` + OS string `json:"os"` + RemoteSocket *RemoteSocket `json:"remoteSocket,omitempty"` + Rootless bool `json:"rootless"` + RuntimeInfo map[string]interface{} `json:"runtimeInfo,omitempty"` + Slirp4NetNS SlirpInfo `json:"slirp4netns,omitempty"` + SwapFree int64 `json:"swapFree"` + SwapTotal int64 `json:"swapTotal"` + Uptime string `json:"uptime"` + Linkmode string `json:"linkmode"` +} + +// RemoteSocket describes information about the API socket +type RemoteSocket struct { + Path string `json:"path,omitempty"` + Exists bool `json:"exists,omitempty"` +} + +// SlirpInfo describes the slirp executable that +// is being being used. +type SlirpInfo struct { + Executable string `json:"executable"` + Package string `json:"package"` + Version string `json:"version"` +} + +// IDMappings describe the GID and UID mappings +// type IDMappings struct { +// GIDMap []idtools.IDMap `json:"gidmap"` +// UIDMap []idtools.IDMap `json:"uidmap"` +// } + +// DistributionInfo describes the host distribution +// for libpod +type DistributionInfo struct { + Distribution string `json:"distribution"` + Version string `json:"version"` +} + +// ConmonInfo describes the conmon executable being used +type ConmonInfo struct { + Package string `json:"package"` + Path string `json:"path"` + Version string `json:"version"` +} + +// OCIRuntimeInfo describes the runtime (crun or runc) being +// used with podman +type OCIRuntimeInfo struct { + Name string `json:"name"` + Package string `json:"package"` + Path string `json:"path"` + Version string `json:"version"` +} + +// StoreInfo describes the container storage and its +// attributes +type StoreInfo struct { + ConfigFile string `json:"configFile"` + ContainerStore ContainerStore `json:"containerStore"` + GraphDriverName string `json:"graphDriverName"` + GraphOptions map[string]interface{} `json:"graphOptions"` + GraphRoot string `json:"graphRoot"` + GraphStatus map[string]string `json:"graphStatus"` + ImageStore ImageStore `json:"imageStore"` + RunRoot string `json:"runRoot"` + VolumePath string `json:"volumePath"` +} + +// ImageStore describes the image store. Right now only the number +// of images present +type ImageStore struct { + Number int `json:"number"` +} + +// ContainerStore describes the quantity of containers in the +// store by status +type ContainerStore struct { + Number int `json:"number"` + Paused int `json:"paused"` + Running int `json:"running"` + Stopped int `json:"stopped"` +} + +// Version is an output struct for API +type Version struct { + APIVersion string + Version string + GoVersion string + GitCommit string + BuiltTime string + Built int64 + OsArch string +} diff --git a/api/system_info.go b/api/system_info.go index fa3e9a0..67412ca 100644 --- a/api/system_info.go +++ b/api/system_info.go @@ -37,130 +37,3 @@ func (c *API) SystemInfo(ctx context.Context) (Info, error) { return infoData, nil } - -// ------------------------------------------------------------------------------------------------------- -// structs copied from https://github.com/containers/podman/blob/master/libpod/define/info.go -// -// some unused parts are modified/commented out to not pull more dependencies -// -// some fields are reordert to make the linter happy (bytes maligned complains) -// ------------------------------------------------------------------------------------------------------- - -// Info is the overall struct that describes the host system -// running libpod/podman -type Info struct { - Host *HostInfo `json:"host"` - Store *StoreInfo `json:"store"` - Registries map[string]interface{} `json:"registries"` - Version Version `json:"version"` -} - -//HostInfo describes the libpod host -type HostInfo struct { - Arch string `json:"arch"` - BuildahVersion string `json:"buildahVersion"` - CgroupManager string `json:"cgroupManager"` - CGroupsVersion string `json:"cgroupVersion"` - Conmon *ConmonInfo `json:"conmon"` - CPUs int `json:"cpus"` - Distribution DistributionInfo `json:"distribution"` - EventLogger string `json:"eventLogger"` - Hostname string `json:"hostname"` - // IDMappings IDMappings `json:"idMappings,omitempty"` - Kernel string `json:"kernel"` - MemFree int64 `json:"memFree"` - MemTotal int64 `json:"memTotal"` - OCIRuntime *OCIRuntimeInfo `json:"ociRuntime"` - OS string `json:"os"` - RemoteSocket *RemoteSocket `json:"remoteSocket,omitempty"` - Rootless bool `json:"rootless"` - RuntimeInfo map[string]interface{} `json:"runtimeInfo,omitempty"` - Slirp4NetNS SlirpInfo `json:"slirp4netns,omitempty"` - SwapFree int64 `json:"swapFree"` - SwapTotal int64 `json:"swapTotal"` - Uptime string `json:"uptime"` - Linkmode string `json:"linkmode"` -} - -// RemoteSocket describes information about the API socket -type RemoteSocket struct { - Path string `json:"path,omitempty"` - Exists bool `json:"exists,omitempty"` -} - -// SlirpInfo describes the slirp executable that -// is being being used. -type SlirpInfo struct { - Executable string `json:"executable"` - Package string `json:"package"` - Version string `json:"version"` -} - -// IDMappings describe the GID and UID mappings -// type IDMappings struct { -// GIDMap []idtools.IDMap `json:"gidmap"` -// UIDMap []idtools.IDMap `json:"uidmap"` -// } - -// DistributionInfo describes the host distribution -// for libpod -type DistributionInfo struct { - Distribution string `json:"distribution"` - Version string `json:"version"` -} - -// ConmonInfo describes the conmon executable being used -type ConmonInfo struct { - Package string `json:"package"` - Path string `json:"path"` - Version string `json:"version"` -} - -// OCIRuntimeInfo describes the runtime (crun or runc) being -// used with podman -type OCIRuntimeInfo struct { - Name string `json:"name"` - Package string `json:"package"` - Path string `json:"path"` - Version string `json:"version"` -} - -// StoreInfo describes the container storage and its -// attributes -type StoreInfo struct { - ConfigFile string `json:"configFile"` - ContainerStore ContainerStore `json:"containerStore"` - GraphDriverName string `json:"graphDriverName"` - GraphOptions map[string]interface{} `json:"graphOptions"` - GraphRoot string `json:"graphRoot"` - GraphStatus map[string]string `json:"graphStatus"` - ImageStore ImageStore `json:"imageStore"` - RunRoot string `json:"runRoot"` - VolumePath string `json:"volumePath"` -} - -// ImageStore describes the image store. Right now only the number -// of images present -type ImageStore struct { - Number int `json:"number"` -} - -// ContainerStore describes the quantity of containers in the -// store by status -type ContainerStore struct { - Number int `json:"number"` - Paused int `json:"paused"` - Running int `json:"running"` - Stopped int `json:"stopped"` -} - -// Version is an output struct for API -type Version struct { - APIVersion string - Version string - GoVersion string - GitCommit string - BuiltTime string - Built int64 - OsArch string -} From 4e201baffa783bd1f5c0cdb3341ca9791b599567 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sun, 15 Nov 2020 11:29:29 +0100 Subject: [PATCH 30/31] Added a ClientConfig struct with default values Moved api.NewClient to driver.SetConfig() --- api/api.go | 50 +++++++++++++++++++++++++++++--------------------- driver.go | 13 +++++++------ driver_test.go | 8 ++++++++ 3 files changed, 44 insertions(+), 27 deletions(-) diff --git a/api/api.go b/api/api.go index b0088a6..94c4d60 100644 --- a/api/api.go +++ b/api/api.go @@ -19,41 +19,49 @@ type API struct { logger hclog.Logger } -func NewClient(logger hclog.Logger) *API { +type ClientConfig struct { + SocketPath string + HttpTimeout time.Duration +} + +func DefaultClientConfig() ClientConfig { + cfg := ClientConfig{ + HttpTimeout: 60 * time.Second, + } + uid := os.Getuid() + // are we root? + if uid == 0 { + cfg.SocketPath = "unix:/run/podman/podman.sock" + } else { + // not? then let's try the default per-user socket location + cfg.SocketPath = fmt.Sprintf("unix:/run/user/%d/podman/podman.sock", uid) + } + return cfg +} + +func NewClient(logger hclog.Logger, config ClientConfig) *API { ac := &API{ logger: logger, } - ac.SetSocketPath(DefaultSocketPath()) - return ac -} -func (c *API) SetSocketPath(baseUrl string) { - c.logger.Debug("http baseurl", "url", baseUrl) - c.httpClient = &http.Client{ - Timeout: 60 * time.Second, + baseUrl := config.SocketPath + ac.logger.Debug("http baseurl", "url", baseUrl) + ac.httpClient = &http.Client{ + Timeout: config.HttpTimeout, } if strings.HasPrefix(baseUrl, "unix:") { - c.baseUrl = "http://u" + ac.baseUrl = "http://u" path := strings.TrimPrefix(baseUrl, "unix:") - c.httpClient.Transport = &http.Transport{ + ac.httpClient.Transport = &http.Transport{ DialContext: func(_ context.Context, _, _ string) (net.Conn, error) { return net.Dial("unix", path) }, } } else { - c.baseUrl = baseUrl + ac.baseUrl = baseUrl } -} -// DefaultSocketPath returns the default unix domain socket path for root or non-root users -func DefaultSocketPath() string { - uid := os.Getuid() - // are we root? - if uid == 0 { - return "unix:/run/podman/podman.sock" - } - // not? then let's try the default per-user socket location - return fmt.Sprintf("unix:/run/user/%d/podman/podman.sock", uid) + return ac } func (c *API) Do(req *http.Request) (*http.Response, error) { diff --git a/driver.go b/driver.go index e1ae038..feef777 100644 --- a/driver.go +++ b/driver.go @@ -124,7 +124,6 @@ func NewPodmanDriver(logger hclog.Logger) drivers.DriverPlugin { ctx: ctx, signalShutdown: cancel, logger: logger.Named(pluginName), - podman: api.NewClient(logger), } } @@ -145,22 +144,24 @@ func (d *Driver) ConfigSchema() (*hclspec.Spec, error) { // is an encoded configuration from the plugin block of the client config. // The second, AgentConfig, is the Nomad agent's configuration which is given to all plugins. func (d *Driver) SetConfig(cfg *base.Config) error { - var config PluginConfig + var pluginConfig PluginConfig if len(cfg.PluginConfig) != 0 { - if err := base.MsgPackDecode(cfg.PluginConfig, &config); err != nil { + if err := base.MsgPackDecode(cfg.PluginConfig, &pluginConfig); err != nil { return err } } - d.config = &config + d.config = &pluginConfig if cfg.AgentConfig != nil { d.nomadConfig = cfg.AgentConfig.Driver } - if config.SocketPath != "" { - d.podman.SetSocketPath(config.SocketPath) + clientConfig := api.DefaultClientConfig() + if pluginConfig.SocketPath != "" { + clientConfig.SocketPath = pluginConfig.SocketPath } + d.podman = api.NewClient(d.logger, clientConfig) return nil } diff --git a/driver_test.go b/driver_test.go index 4a62510..6a73699 100644 --- a/driver_test.go +++ b/driver_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/nomad/helper/testlog" "github.com/hashicorp/nomad/helper/uuid" "github.com/hashicorp/nomad/nomad/structs" + "github.com/hashicorp/nomad/plugins/base" "github.com/hashicorp/nomad/plugins/drivers" dtestutil "github.com/hashicorp/nomad/plugins/drivers/testutils" tu "github.com/hashicorp/nomad/testutil" @@ -67,7 +68,14 @@ func podmanDriverHarness(t *testing.T, cfg map[string]interface{}) *dtestutil.Dr logger.SetLevel(hclog.Info) } + baseConfig := base.Config{} + pluginConfig := PluginConfig{} + if err := base.MsgPackEncode(&baseConfig.PluginConfig, &pluginConfig); err != nil { + t.Error("Unable to encode plugin config", err) + } + d := NewPodmanDriver(logger).(*Driver) + d.SetConfig(&baseConfig) d.buildFingerprint() d.config.Volumes.Enabled = true if enforce, err := ioutil.ReadFile("/sys/fs/selinux/enforce"); err == nil { From f52f9ee104ee0a5e0eeb47124108302d5472455a Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 16 Nov 2020 20:39:06 +0100 Subject: [PATCH 31/31] Review #51 --- api/container_create.go | 1 - api/container_start.go | 1 + api/system_info.go | 3 --- config.go | 6 ------ driver.go | 8 -------- driver_test.go | 6 ------ handle.go | 8 -------- main.go | 6 ------ state.go | 6 ------ 9 files changed, 1 insertion(+), 44 deletions(-) diff --git a/api/container_create.go b/api/container_create.go index dce2c67..c694ff7 100644 --- a/api/container_create.go +++ b/api/container_create.go @@ -18,7 +18,6 @@ func (c *API) ContainerCreate(ctx context.Context, create SpecGenerator) (Contai if err != nil { return response, err } - // fmt.Println(string(jsonString)) res, err := c.Post(ctx, "/v1.0.0/libpod/containers/create", bytes.NewBuffer(jsonString)) if err != nil { diff --git a/api/container_start.go b/api/container_start.go index 2b930b0..cedf324 100644 --- a/api/container_start.go +++ b/api/container_start.go @@ -24,6 +24,7 @@ func (c *API) ContainerStart(ctx context.Context, name string) error { } // wait max 10 seconds for running state + // TODO: make timeout configurable timeout, cancel := context.WithTimeout(ctx, time.Second*10) defer cancel() diff --git a/api/system_info.go b/api/system_info.go index 67412ca..4eec9b1 100644 --- a/api/system_info.go +++ b/api/system_info.go @@ -13,9 +13,6 @@ func (c *API) SystemInfo(ctx context.Context) (Info, error) { var infoData Info - // the libpod/info endpoint seems to have some trouble - // using "compat" endpoint and minimal struct - // until podman returns proper data. res, err := c.Get(ctx, "/v1.0.0/libpod/info") if err != nil { return infoData, err diff --git a/config.go b/config.go index 66deac0..9a0c386 100644 --- a/config.go +++ b/config.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package main import ( diff --git a/driver.go b/driver.go index feef777..1e9df34 100644 --- a/driver.go +++ b/driver.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package main import ( @@ -326,7 +320,6 @@ func BuildContainerName(cfg *drivers.TaskConfig) string { // StartTask creates and starts a new Container based on the given TaskConfig. func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error) { - // d.logger.Warn("Env1", "env1", cfg.Env) if _, ok := d.tasks.Get(cfg.ID); ok { return nil, nil, fmt.Errorf("task with ID %q already started", cfg.ID) @@ -487,7 +480,6 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive } createOpts.ContainerNetworkConfig.PortMappings = publishedPorts } - // ------------------------------------------------------------------------------------------- containerID := "" recoverRunningContainer := false diff --git a/driver_test.go b/driver_test.go index 6a73699..eeb1e64 100644 --- a/driver_test.go +++ b/driver_test.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package main import ( diff --git a/handle.go b/handle.go index 3c588bd..b793005 100644 --- a/handle.go +++ b/handle.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package main import ( @@ -206,8 +200,6 @@ func (h *TaskHandle) runContainerMonitor() { // fall into the "TaskStateExited" case h.logger.Debug("Could not get container stats, unknown error", "err", fmt.Sprintf("%#v", statsErr)) continue - // } else { - // h.logger.Trace("Container stats", "container", h.containerID, "stats", containerStats) } h.stateLock.Lock() diff --git a/main.go b/main.go index 71bf712..41cc118 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package main import ( diff --git a/state.go b/state.go index aff2fde..bef9d61 100644 --- a/state.go +++ b/state.go @@ -1,9 +1,3 @@ -/* -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - package main import (