mirror of
https://github.com/containers/podman
synced 2024-10-20 17:23:30 +00:00
CreatePod args now PodCreate structure
Signed-off-by: haircommander <pehunt@redhat.com> Closes: #1275 Approved by: mheon
This commit is contained in:
parent
a51eb1e70f
commit
309a2a15ae
|
@ -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).
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
|
Loading…
Reference in a new issue