From fa223ecc386b23f937edbe315540dc02e5697bde Mon Sep 17 00:00:00 2001 From: Johan Brandhorst Date: Fri, 29 Nov 2019 10:42:00 +0000 Subject: [PATCH] WIP: Fix podman file uploads Blocked on https://github.com/containers/libpod/issues/4495 Fixes #12 --- go.mod | 2 +- go.sum | 3 +- runtimes/podman/file.go | 69 +- runtimes/podman/iopodman/iopodman.go | 2273 +++++++++++++++++++++++++- runtimes/podman/podman.go | 2 +- 5 files changed, 2275 insertions(+), 74 deletions(-) diff --git a/go.mod b/go.mod index 3b9a463..1ffacad 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/opencontainers/go-digest v1.0.0-rc1 // indirect github.com/opencontainers/image-spec v1.0.1 // indirect github.com/stretchr/testify v1.4.0 // indirect - github.com/varlink/go v0.0.0-20191018142704-4ecdbb8a36c2 + github.com/varlink/go v0.3.0 golang.org/x/net v0.0.0-20191014212845-da9a3fd4c582 // indirect golang.org/x/sync v0.0.0-20190423024810-112230192c58 golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0 // indirect diff --git a/go.sum b/go.sum index 4e36554..b372ac6 100644 --- a/go.sum +++ b/go.sum @@ -52,8 +52,9 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/varlink/go v0.0.0-20191018142704-4ecdbb8a36c2 h1:KcTzc0lm6PuIl9sAz5GMSGQyDhbJOa9NC3u69PVIc7Y= github.com/varlink/go v0.0.0-20191018142704-4ecdbb8a36c2/go.mod h1:DKg9Y2ctoNkesREGAEak58l+jOC6JU2aqZvUYs5DynU= +github.com/varlink/go v0.3.0 h1:7IDKK8X3W9qqgw7oisE2RgtdTOxBxDwX5RDm2qVoKT8= +github.com/varlink/go v0.3.0/go.mod h1:DKg9Y2ctoNkesREGAEak58l+jOC6JU2aqZvUYs5DynU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= diff --git a/runtimes/podman/file.go b/runtimes/podman/file.go index 2e5bfc3..80be3f5 100644 --- a/runtimes/podman/file.go +++ b/runtimes/podman/file.go @@ -4,56 +4,77 @@ import ( "context" "fmt" "io" - "os" "path/filepath" + "strings" "github.com/uw-labs/podrick" podman "github.com/uw-labs/podrick/runtimes/podman/iopodman" "github.com/varlink/go/varlink" ) -func uploadFiles(ctx context.Context, conn *varlink.Connection, cID string, files ...podrick.File) (err error) { - mountDir, err := podman.MountContainer().Call(ctx, conn, cID) - if err != nil { - return fmt.Errorf("failed to mount container filesystem: %w", err) - } - defer func() { - uErr := podman.UnmountContainer().Call(context.Background(), conn, cID, true) - if err == nil { - err = uErr - } - }() - +func uploadFiles(ctx context.Context, addr string, files ...podrick.File) (err error) { for _, f := range files { - err = uploadFile(ctx, mountDir, f) - if err != nil { - return fmt.Errorf("failed to upload file: %w", err) - } + uploadFile(ctx, addr, f) } return nil } -func uploadFile(ctx context.Context, mountDir string, file podrick.File) (err error) { +func uploadFile(ctx context.Context, addr string, file podrick.File) (err error) { path := filepath.Clean(file.Path) if !filepath.IsAbs(path) { return fmt.Errorf("file paths must be absolute: %q", file.Path) } - dest := filepath.Join(mountDir, path) - target, err := os.Create(dest) + //dest := filepath.Join(mountDir, path) + + fConn, err := varlink.NewConnection(ctx, addr) if err != nil { - return fmt.Errorf("failed to create file: %w", err) + return fmt.Errorf("failed to create new connection: %w", err) } defer func() { - cErr := target.Close() + cErr := fConn.Close() if err == nil { err = cErr } }() - _, err = io.Copy(target, file.Content) + + reply, err := podman.SendFile().Upgrade(ctx, fConn, "", int64(file.Size)) if err != nil { - return fmt.Errorf("failed to copy file contents: %w", err) + return fmt.Errorf("failed to start connection upgrade: %w", err) } + _, _, conn, err := reply(ctx) + if err != nil { + return fmt.Errorf("failed to upgrade connection: %w", err) + } + + w := writerCtx{ + WriterContext: conn, + ctx: ctx, + } + + _, err = io.Copy(w, file.Content) + if err != nil { + return fmt.Errorf("failed to upload file: %w", err) + } + + filename, err := conn.ReadBytes(ctx, ':') + if err != nil { + return fmt.Errorf("failed to read file name: %w", err) + } + + podman.LoadImage().Call(ctx, fConn) + + fmt.Println("Create file", strings.ReplaceAll(string(filename), ":", "")) + return nil } + +type writerCtx struct { + varlink.WriterContext + ctx context.Context +} + +func (w writerCtx) Write(in []byte) (int, error) { + return w.WriterContext.Write(w.ctx, in) +} diff --git a/runtimes/podman/iopodman/iopodman.go b/runtimes/podman/iopodman/iopodman.go index ce56580..3b621a9 100644 --- a/runtimes/podman/iopodman/iopodman.go +++ b/runtimes/podman/iopodman/iopodman.go @@ -861,6 +861,35 @@ func (m GetVersion_methods) Send(ctx context.Context, c *varlink.Connection, fla }, 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{} @@ -895,6 +924,25 @@ func (m GetInfo_methods) Send(ctx context.Context, c *varlink.Connection, flags }, 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{} @@ -929,6 +977,25 @@ func (m ListContainers_methods) Send(ctx context.Context, c *varlink.Connection, }, 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{} } @@ -965,6 +1032,29 @@ func (m Ps_methods) Send(ctx context.Context, c *varlink.Connection, flags uint6 }, 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{} } @@ -1001,6 +1091,29 @@ func (m GetContainersByStatus_methods) Send(ctx context.Context, c *varlink.Conn }, 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{} } @@ -1039,6 +1152,31 @@ func (m Top_methods) Send(ctx context.Context, c *varlink.Connection, flags uint }, 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{} @@ -1077,6 +1215,29 @@ func (m HealthCheckRun_methods) Send(ctx context.Context, c *varlink.Connection, }, 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 @@ -1117,6 +1278,29 @@ func (m GetContainer_methods) Send(ctx context.Context, c *varlink.Connection, f }, 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. @@ -1160,6 +1344,33 @@ func (m GetContainersByContext_methods) Send(ctx context.Context, c *varlink.Con }, 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{} @@ -1197,6 +1408,29 @@ func (m CreateContainer_methods) Send(ctx context.Context, c *varlink.Connection }, 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). @@ -1236,6 +1470,29 @@ func (m InspectContainer_methods) Send(ctx context.Context, c *varlink.Connectio }, 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) @@ -1290,6 +1547,31 @@ func (m ListContainerProcesses_methods) Send(ctx context.Context, c *varlink.Con }, 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 @@ -1330,6 +1612,29 @@ func (m GetContainerLogs_methods) Send(ctx context.Context, c *varlink.Connectio }, 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{} } @@ -1376,9 +1681,42 @@ func (m GetContainersLogs_methods) Send(ctx context.Context, c *varlink.Connecti }, 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 (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{} } @@ -1414,6 +1752,29 @@ func (m ListContainerChanges_methods) Send(ctx context.Context, c *varlink.Conne }, 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. @@ -1463,6 +1824,31 @@ func (m ExportContainer_methods) Send(ctx context.Context, c *varlink.Connection }, 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) @@ -1524,6 +1910,29 @@ func (m GetContainerStats_methods) Send(ctx context.Context, c *varlink.Connecti }, 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{} @@ -1564,6 +1973,29 @@ func (m GetContainerStatsWithHistory_methods) Send(ctx context.Context, c *varli }, 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). @@ -1603,6 +2035,29 @@ func (m StartContainer_methods) Send(ctx context.Context, c *varlink.Connection, }, 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) @@ -1652,6 +2107,31 @@ func (m StopContainer_methods) Send(ctx context.Context, c *varlink.Connection, }, 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 @@ -1694,6 +2174,29 @@ func (m InitContainer_methods) Send(ctx context.Context, c *varlink.Connection, }, 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 @@ -1736,6 +2239,31 @@ func (m RestartContainer_methods) Send(ctx context.Context, c *varlink.Connectio }, 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). @@ -1777,6 +2305,31 @@ func (m KillContainer_methods) Send(ctx context.Context, c *varlink.Connection, }, 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). @@ -1816,6 +2369,29 @@ func (m PauseContainer_methods) Send(ctx context.Context, c *varlink.Connection, }, 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). @@ -1855,6 +2431,29 @@ func (m UnpauseContainer_methods) Send(ctx context.Context, c *varlink.Connectio }, 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{} @@ -1893,13 +2492,36 @@ func (m Attach_methods) Send(ctx context.Context, c *varlink.Connection, flags u }, 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 { +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) @@ -1925,6 +2547,25 @@ func (m AttachControl_methods) Send(ctx context.Context, c *varlink.Connection, }, 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 @@ -1976,6 +2617,29 @@ func (m GetAttachSockets_methods) Send(ctx context.Context, c *varlink.Connectio }, 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. @@ -2017,6 +2681,31 @@ func (m WaitContainer_methods) Send(ctx context.Context, c *varlink.Connection, }, 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 @@ -2070,6 +2759,33 @@ func (m RemoveContainer_methods) Send(ctx context.Context, c *varlink.Connection }, 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, @@ -2120,6 +2836,31 @@ func (m EvictContainer_methods) Send(ctx context.Context, c *varlink.Connection, }, 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 @@ -2168,6 +2909,25 @@ func (m DeleteStoppedContainers_methods) Send(ctx context.Context, c *varlink.Co }, 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{} @@ -2202,6 +2962,25 @@ func (m ListImages_methods) Send(ctx context.Context, c *varlink.Connection, fla }, 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{} @@ -2240,6 +3019,29 @@ func (m GetImage_methods) Send(ctx context.Context, c *varlink.Connection, flags }, 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 @@ -2314,6 +3116,29 @@ func (m BuildImage_methods) Send(ctx context.Context, c *varlink.Connection, fla }, 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. @@ -2353,6 +3178,29 @@ func (m InspectImage_methods) Send(ctx context.Context, c *varlink.Connection, f }, 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. @@ -2392,6 +3240,29 @@ func (m HistoryImage_methods) Send(ctx context.Context, c *varlink.Connection, f }, 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) @@ -2441,28 +3312,61 @@ func (m PushImage_methods) Send(ctx context.Context, c *varlink.Connection, flag }, 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) { +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"` - Tagged string `json:"tagged"` + 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.Tagged = tagged_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 @@ -2481,6 +3385,31 @@ func (m TagImage_methods) Send(ctx context.Context, c *varlink.Connection, flags }, 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). @@ -2529,6 +3458,31 @@ func (m RemoveImage_methods) Send(ctx context.Context, c *varlink.Connection, fl }, 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. @@ -2572,6 +3526,33 @@ func (m SearchImages_methods) Send(ctx context.Context, c *varlink.Connection, f }, 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 @@ -2618,6 +3599,25 @@ func (m DeleteUnusedImages_methods) Send(ctx context.Context, c *varlink.Connect }, 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 @@ -2673,6 +3673,41 @@ func (m Commit_methods) Send(ctx context.Context, c *varlink.Connection, flags u }, 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{} @@ -2719,6 +3754,37 @@ func (m ImportImage_methods) Send(ctx context.Context, c *varlink.Connection, fl }, 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 @@ -2766,6 +3832,35 @@ func (m ExportImage_methods) Send(ctx context.Context, c *varlink.Connection, fl }, 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. @@ -2805,6 +3900,29 @@ func (m PullImage_methods) Send(ctx context.Context, c *varlink.Connection, flag }, 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 @@ -2854,6 +3972,29 @@ func (m CreatePod_methods) Send(ctx context.Context, c *varlink.Connection, flag }, 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 @@ -2931,6 +4072,25 @@ func (m ListPods_methods) Send(ctx context.Context, c *varlink.Connection, flags }, 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). @@ -2996,6 +4156,29 @@ func (m GetPod_methods) Send(ctx context.Context, c *varlink.Connection, flags u }, 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. @@ -3035,6 +4218,29 @@ func (m InspectPod_methods) Send(ctx context.Context, c *varlink.Connection, fla }, 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). @@ -3083,6 +4289,29 @@ func (m StartPod_methods) Send(ctx context.Context, c *varlink.Connection, flags }, 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 @@ -3134,6 +4363,31 @@ func (m StopPod_methods) Send(ctx context.Context, c *varlink.Connection, flags }, 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. @@ -3183,6 +4437,29 @@ func (m RestartPod_methods) Send(ctx context.Context, c *varlink.Connection, fla }, 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 @@ -3204,27 +4481,52 @@ func (m KillPod_methods) Call(ctx context.Context, c *varlink.Connection, name_i receive, err_ := m.Send(ctx, c, 0, name_in_, signal_in_) if err_ != nil { return - } - pod_out_, _, err_ = receive(ctx) - 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) Send(ctx context.Context, c *varlink.Connection, flags uint64, name_in_ string, signal_in_ int64) (func(ctx context.Context) (string, uint64, error), error) { +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.Send(ctx, "io.podman.KillPod", in, flags) + receive, err := c.Upgrade(ctx, "io.podman.KillPod", in) if err != nil { return nil, err } - return func(context.Context) (pod_out_ string, flags uint64, err error) { + return func(context.Context) (pod_out_ string, flags uint64, conn varlink.ReadWriterContext, err error) { var out struct { Pod string `json:"pod"` } - flags, err = receive(ctx, &out) + flags, conn, err = receive(ctx, &out) if err != nil { err = Dispatch_Error(err) return @@ -3283,6 +4585,29 @@ func (m PausePod_methods) Send(ctx context.Context, c *varlink.Connection, flags }, 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 @@ -3332,6 +4657,29 @@ func (m UnpausePod_methods) Send(ctx context.Context, c *varlink.Connection, fla }, 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. @@ -3384,6 +4732,31 @@ func (m RemovePod_methods) Send(ctx context.Context, c *varlink.Connection, flag }, 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{} } @@ -3424,6 +4797,33 @@ func (m TopPod_methods) Send(ctx context.Context, c *varlink.Connection, flags u }, 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) @@ -3490,6 +4890,31 @@ func (m GetPodStats_methods) Send(ctx context.Context, c *varlink.Connection, fl }, 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{} @@ -3527,6 +4952,29 @@ func (m GetPodsByStatus_methods) Send(ctx context.Context, c *varlink.Connection }, 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. @@ -3573,6 +5021,29 @@ func (m ImageExists_methods) Send(ctx context.Context, c *varlink.Connection, fl }, 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. @@ -3618,6 +5089,29 @@ func (m ContainerExists_methods) Send(ctx context.Context, c *varlink.Connection }, 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{} @@ -3662,6 +5156,35 @@ func (m ContainerCheckpoint_methods) Send(ctx context.Context, c *varlink.Connec }, 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. @@ -3705,6 +5228,33 @@ func (m ContainerRestore_methods) Send(ctx context.Context, c *varlink.Connectio }, 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{} @@ -3738,6 +5288,25 @@ func (m ContainerRunlabel_methods) Send(ctx context.Context, c *varlink.Connecti }, 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{} @@ -3752,17 +5321,36 @@ func (m ExecContainer_methods) Call(ctx context.Context, c *varlink.Connection, return } -func (m ExecContainer_methods) Send(ctx context.Context, c *varlink.Connection, flags uint64, opts_in_ ExecOpts) (func(ctx context.Context) (uint64, error), error) { +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.Send(ctx, "io.podman.ExecContainer", in, flags) + receive, err := c.Upgrade(ctx, "io.podman.ExecContainer", in) if err != nil { return nil, err } - return func(context.Context) (flags uint64, err error) { - flags, err = receive(ctx, nil) + 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 @@ -3815,6 +5403,25 @@ func (m ListContainerMounts_methods) Send(ctx context.Context, c *varlink.Connec }, 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 @@ -3859,6 +5466,29 @@ func (m MountContainer_methods) Send(ctx context.Context, c *varlink.Connection, }, 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 // ~~~ @@ -3899,6 +5529,27 @@ func (m UnmountContainer_methods) Send(ctx context.Context, c *varlink.Connectio }, 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{} @@ -3937,6 +5588,29 @@ func (m ImagesPrune_methods) Send(ctx context.Context, c *varlink.Connection, fl }, 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{} @@ -3977,6 +5651,31 @@ func (m GenerateKube_methods) Send(ctx context.Context, c *varlink.Connection, f }, 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{} @@ -4015,6 +5714,29 @@ func (m ContainerConfig_methods) Send(ctx context.Context, c *varlink.Connection }, 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{} @@ -4055,6 +5777,31 @@ func (m ContainerArtifacts_methods) Send(ctx context.Context, c *varlink.Connect }, 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{} @@ -4095,6 +5842,31 @@ func (m ContainerInspectData_methods) Send(ctx context.Context, c *varlink.Conne }, 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{} @@ -4133,6 +5905,29 @@ func (m ContainerStateData_methods) Send(ctx context.Context, c *varlink.Connect }, 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{} @@ -4171,6 +5966,29 @@ func (m PodStateData_methods) Send(ctx context.Context, c *varlink.Connection, f }, 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{} @@ -4208,6 +6026,29 @@ func (m CreateFromCC_methods) Send(ctx context.Context, c *varlink.Connection, f }, 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{} @@ -4245,6 +6086,29 @@ func (m Spec_methods) Send(ctx context.Context, c *varlink.Connection, flags uin }, 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{} @@ -4254,27 +6118,52 @@ func (m SendFile_methods) Call(ctx context.Context, c *varlink.Connection, type_ receive, err_ := m.Send(ctx, c, 0, type_in_, length_in_) if err_ != nil { return - } - file_handle_out_, _, err_ = receive(ctx) - 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) Send(ctx context.Context, c *varlink.Connection, flags uint64, type_in_ string, length_in_ int64) (func(ctx context.Context) (string, uint64, error), error) { +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.Send(ctx, "io.podman.SendFile", in, flags) + 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, err error) { + 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, err = receive(ctx, &out) + flags, conn, err = receive(ctx, &out) if err != nil { err = Dispatch_Error(err) return @@ -4323,6 +6212,31 @@ func (m ReceiveFile_methods) Send(ctx context.Context, c *varlink.Connection, fl }, 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{} @@ -4360,6 +6274,29 @@ func (m VolumeCreate_methods) Send(ctx context.Context, c *varlink.Connection, f }, 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{} @@ -4399,6 +6336,31 @@ func (m VolumeRemove_methods) Send(ctx context.Context, c *varlink.Connection, f }, 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{} @@ -4438,6 +6400,31 @@ func (m GetVolumes_methods) Send(ctx context.Context, c *varlink.Connection, fla }, 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 +} + // VolumesPrune removes unused volumes on the host type VolumesPrune_methods struct{} @@ -4473,6 +6460,27 @@ func (m VolumesPrune_methods) Send(ctx context.Context, c *varlink.Connection, f }, 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{} @@ -4510,6 +6518,29 @@ func (m ImageSave_methods) Send(ctx context.Context, c *varlink.Connection, flag }, 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. @@ -4553,6 +6584,33 @@ func (m GetPodsByContext_methods) Send(ctx context.Context, c *varlink.Connectio }, 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{} @@ -4596,6 +6654,35 @@ func (m LoadImage_methods) Send(ctx context.Context, c *varlink.Connection, flag }, 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{} @@ -4637,6 +6724,33 @@ func (m GetEvents_methods) Send(ctx context.Context, c *varlink.Connection, flag }, 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{} @@ -4674,6 +6788,29 @@ func (m Diff_methods) Send(ctx context.Context, c *varlink.Connection, flags uin }, 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{} @@ -4709,6 +6846,25 @@ func (m GetLayersMapWithImageInfo_methods) Send(ctx context.Context, c *varlink. }, 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{} @@ -4746,6 +6902,29 @@ func (m BuildImageHierarchyMap_methods) Send(ctx context.Context, c *varlink.Con }, 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 { diff --git a/runtimes/podman/podman.go b/runtimes/podman/podman.go index e3a1826..3fbe71d 100644 --- a/runtimes/podman/podman.go +++ b/runtimes/podman/podman.go @@ -102,7 +102,7 @@ func (r *Runtime) StartContainer(ctx context.Context, conf *podrick.ContainerCon }() if len(conf.Files) > 0 { - err = uploadFiles(ctx, r.conn, ctr.id, conf.Files...) + err = uploadFiles(ctx, r.address, conf.Files...) if err != nil { return nil, fmt.Errorf("failed to upload files to container: %w", err) }