summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/varlink/io.podman.varlink16
-rw-r--r--pkg/varlinkapi/pods.go14
2 files changed, 19 insertions, 11 deletions
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index abbaf1b07..3d4a8fa84 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -334,6 +334,13 @@ type ListPodContainerInfo (
status: string
)
+# PodCreate is an input structure for creating pods.
+type PodCreate (
+ name: string,
+ cgroupParent: string,
+ labels: [string]string
+)
+
# ListPodData is the returned struct for an individual pod
type ListPodData (
id: string,
@@ -634,16 +641,17 @@ method ExportImage(name: string, destination: string, compress: bool, tags: []st
# ~~~
method PullImage(name: string) -> (id: string)
-# CreatePod creates a new empty pod. It takes name and cgroup_parent args as strings, and a labels map
+# CreatePod creates a new empty pod. It uses a [PodCreate](#PodCreate) type for input.
# On success, the ID of the newly created pod will be returned.
# #### Example
# ~~~
-# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"name": "test"}'
+# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"name": "test"}}'
# {
-# "pod": "8759dafbc0a4dc3bcfb57eeb72e4331eb73c5cc09ab968e65ce45b9ad5c4b6bb"
+# "pod": "b05dee7bd4ccfee688099fe1588a7a898d6ddd6897de9251d4671c9b0feacb2a"
# }
+#
# ~~~
-method CreatePod(name: string, cgroup_parent: string, labels: [string]string) -> (pod: string)
+method CreatePod(create: PodCreate) -> (pod: string)
# ListPods returns a list of pods in no particular order. They are
# returned as an array of ListPodData structs. See also [GetPod](#GetPod).
diff --git a/pkg/varlinkapi/pods.go b/pkg/varlinkapi/pods.go
index be5e3614c..a987574b2 100644
--- a/pkg/varlinkapi/pods.go
+++ b/pkg/varlinkapi/pods.go
@@ -10,16 +10,16 @@ import (
)
// CreatePod ...
-func (i *LibpodAPI) CreatePod(call iopodman.VarlinkCall, name, cgroupParent string, labels map[string]string) error {
+func (i *LibpodAPI) CreatePod(call iopodman.VarlinkCall, create iopodman.PodCreate) error {
var options []libpod.PodCreateOption
- if cgroupParent != "" {
- options = append(options, libpod.WithPodCgroupParent(cgroupParent))
+ if create.CgroupParent != "" {
+ options = append(options, libpod.WithPodCgroupParent(create.CgroupParent))
}
- if len(labels) > 0 {
- options = append(options, libpod.WithPodLabels(labels))
+ if len(create.Labels) > 0 {
+ options = append(options, libpod.WithPodLabels(create.Labels))
}
- if name != "" {
- options = append(options, libpod.WithPodName(name))
+ if create.Name != "" {
+ options = append(options, libpod.WithPodName(create.Name))
}
options = append(options, libpod.WithPodCgroups())