varlink: Rename ContainerInList to Container

Container more clearly describes what the type represents.

Signed-off-by: Lars Karlitski <lars@karlitski.net>
This commit is contained in:
Lars Karlitski
2019-02-04 20:08:34 +01:00
parent 8a51b11058
commit 5a32518170
3 changed files with 16 additions and 16 deletions

View File

@ -56,8 +56,7 @@ type ImageSearch (
star_count: int
)
# ListContainerData is the returned struct for an individual container
type ListContainerData (
type Container (
id: string,
image: string,
imageid: string,
@ -401,14 +400,15 @@ method GetVersion() -> (
# build information of Podman, and system-wide registries.
method GetInfo() -> (info: PodmanInfo)
# ListContainers returns a list of containers in no particular order. There are
# returned as an array of ListContainerData structs. See also [GetContainer](#GetContainer).
method ListContainers() -> (containers: []ListContainerData)
# ListContainers returns information about all containers.
# See also [GetContainer](#GetContainer).
method ListContainers() -> (containers: []Container)
# GetContainer takes a name or ID of a container and returns single ListContainerData
# structure. A [ContainerNotFound](#ContainerNotFound) error will be returned if the container cannot be found.
# See also [ListContainers](ListContainers) and [InspectContainer](#InspectContainer).
method GetContainer(name: string) -> (container: ListContainerData)
# GetContainer returns information about a single container. If a container
# with the given id doesn't exist, a [ContainerNotFound](#ContainerNotFound)
# error will be returned. See also [ListContainers](ListContainers) and
# [InspectContainer](#InspectContainer).
method GetContainer(id: string) -> (container: Container)
# CreateContainer creates a new container from an image. It uses a [Create](#Create) type for input. The minimum
# input required for CreateContainer is an image name. If the image name is not found, an [ImageNotFound](#ImageNotFound)
@ -1050,7 +1050,7 @@ method VolumeRemove(options: VolumeRemoveOpts) -> (volumeNames: []string)
error ImageNotFound (id: string)
# ContainerNotFound means the container could not be found by the provided name or ID in local storage.
error ContainerNotFound (name: string)
error ContainerNotFound (id: string)
# NoContainerRunning means none of the containers requested are running in a command that requires a running container.
error NoContainerRunning ()

View File

@ -21,7 +21,7 @@ import (
// ListContainers ...
func (i *LibpodAPI) ListContainers(call iopodman.VarlinkCall) error {
var (
listContainers []iopodman.ListContainerData
listContainers []iopodman.Container
)
containers, err := i.Runtime.GetAllContainers()
@ -44,10 +44,10 @@ func (i *LibpodAPI) ListContainers(call iopodman.VarlinkCall) error {
}
// GetContainer ...
func (i *LibpodAPI) GetContainer(call iopodman.VarlinkCall, name string) error {
ctr, err := i.Runtime.LookupContainer(name)
func (i *LibpodAPI) GetContainer(call iopodman.VarlinkCall, id string) error {
ctr, err := i.Runtime.LookupContainer(id)
if err != nil {
return call.ReplyContainerNotFound(name)
return call.ReplyContainerNotFound(id)
}
opts := shared.PsOptions{
Namespace: true,

View File

@ -15,7 +15,7 @@ func getContext() context.Context {
return context.TODO()
}
func makeListContainer(containerID string, batchInfo shared.BatchContainerStruct) iopodman.ListContainerData {
func makeListContainer(containerID string, batchInfo shared.BatchContainerStruct) iopodman.Container {
var (
mounts []iopodman.ContainerMount
ports []iopodman.ContainerPortMappings
@ -56,7 +56,7 @@ func makeListContainer(containerID string, batchInfo shared.BatchContainerStruct
Ipc: ns.IPC,
}
lc := iopodman.ListContainerData{
lc := iopodman.Container{
Id: containerID,
Image: batchInfo.ConConfig.RootfsImageName,
Imageid: batchInfo.ConConfig.RootfsImageID,