mirror of https://github.com/containers/podman.git
varlink: Rename `ImageInList` to `Image`
Image more clearly describes what the type represents. Also, only include the image name in the `ImageNotFound` error returned by `GetImage()`, not the full error message. Signed-off-by: Lars Karlitski <lars@karlitski.net>
This commit is contained in:
parent
27baf9970e
commit
8a51b11058
|
|
@ -23,9 +23,7 @@ type VolumeRemoveOpts (
|
||||||
force: bool
|
force: bool
|
||||||
)
|
)
|
||||||
|
|
||||||
# ImageInList describes the structure that is returned in
|
type Image (
|
||||||
# ListImages.
|
|
||||||
type ImageInList (
|
|
||||||
id: string,
|
id: string,
|
||||||
parentId: string,
|
parentId: string,
|
||||||
repoTags: []string,
|
repoTags: []string,
|
||||||
|
|
@ -598,13 +596,13 @@ method RemoveContainer(name: string, force: bool) -> (container: string)
|
||||||
# ~~~
|
# ~~~
|
||||||
method DeleteStoppedContainers() -> (containers: []string)
|
method DeleteStoppedContainers() -> (containers: []string)
|
||||||
|
|
||||||
# ListImages returns an array of ImageInList structures which provide basic information about
|
# ListImages returns information about the images that are currently in storage.
|
||||||
# an image currently in storage. See also [InspectImage](InspectImage).
|
# See also [InspectImage](InspectImage).
|
||||||
method ListImages() -> (images: []ImageInList)
|
method ListImages() -> (images: []Image)
|
||||||
|
|
||||||
# GetImage returns a single image in an [ImageInList](#ImageInList) struct. You must supply an image name as a string.
|
# GetImage returns information about a single image in storage.
|
||||||
# If the image cannot be found, an [ImageNotFound](#ImageNotFound) error will be returned.
|
# If the image caGetImage returns be found, [ImageNotFound](#ImageNotFound) will be returned.
|
||||||
method GetImage(name: string) -> (image: ImageInList)
|
method GetImage(id: string) -> (image: Image)
|
||||||
|
|
||||||
# BuildImage takes a [BuildInfo](#BuildInfo) structure and builds an image. At a minimum, you must provide the
|
# BuildImage takes a [BuildInfo](#BuildInfo) structure and builds an image. At a minimum, you must provide the
|
||||||
# 'dockerfile' and 'tags' options in the BuildInfo structure. It will return a [BuildResponse](#BuildResponse) structure
|
# 'dockerfile' and 'tags' options in the BuildInfo structure. It will return a [BuildResponse](#BuildResponse) structure
|
||||||
|
|
@ -1049,7 +1047,7 @@ method VolumeRemove(options: VolumeRemoveOpts) -> (volumeNames: []string)
|
||||||
|
|
||||||
|
|
||||||
# ImageNotFound means the image could not be found by the provided name or ID in local storage.
|
# ImageNotFound means the image could not be found by the provided name or ID in local storage.
|
||||||
error ImageNotFound (name: string)
|
error ImageNotFound (id: string)
|
||||||
|
|
||||||
# ContainerNotFound means the container could not be found by the provided name or ID in local storage.
|
# ContainerNotFound means the container could not be found by the provided name or ID in local storage.
|
||||||
error ContainerNotFound (name: string)
|
error ContainerNotFound (name: string)
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ func (r *LocalRuntime) GetImages() ([]*ContainerImage, error) {
|
||||||
return newImages, nil
|
return newImages, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func imageInListToContainerImage(i iopodman.ImageInList, name string, runtime *LocalRuntime) (*ContainerImage, error) {
|
func imageInListToContainerImage(i iopodman.Image, name string, runtime *LocalRuntime) (*ContainerImage, error) {
|
||||||
created, err := time.ParseInLocation(time.RFC3339, i.Created, time.UTC)
|
created, err := time.ParseInLocation(time.RFC3339, i.Created, time.UTC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ func (i *LibpodAPI) ListImages(call iopodman.VarlinkCall) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred(fmt.Sprintf("unable to get list of images %q", err))
|
return call.ReplyErrorOccurred(fmt.Sprintf("unable to get list of images %q", err))
|
||||||
}
|
}
|
||||||
var imageList []iopodman.ImageInList
|
var imageList []iopodman.Image
|
||||||
for _, image := range images {
|
for _, image := range images {
|
||||||
labels, _ := image.Labels(getContext())
|
labels, _ := image.Labels(getContext())
|
||||||
containers, _ := image.Containers()
|
containers, _ := image.Containers()
|
||||||
|
|
@ -52,7 +52,7 @@ func (i *LibpodAPI) ListImages(call iopodman.VarlinkCall) error {
|
||||||
return call.ReplyErrorOccurred(err.Error())
|
return call.ReplyErrorOccurred(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
i := iopodman.ImageInList{
|
i := iopodman.Image{
|
||||||
Id: image.ID(),
|
Id: image.ID(),
|
||||||
ParentId: image.Parent,
|
ParentId: image.Parent,
|
||||||
RepoTags: image.Names(),
|
RepoTags: image.Names(),
|
||||||
|
|
@ -69,11 +69,11 @@ func (i *LibpodAPI) ListImages(call iopodman.VarlinkCall) error {
|
||||||
return call.ReplyListImages(imageList)
|
return call.ReplyListImages(imageList)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetImage returns a single image in the form of a ImageInList
|
// GetImage returns a single image in the form of a Image
|
||||||
func (i *LibpodAPI) GetImage(call iopodman.VarlinkCall, name string) error {
|
func (i *LibpodAPI) GetImage(call iopodman.VarlinkCall, id string) error {
|
||||||
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
|
newImage, err := i.Runtime.ImageRuntime().NewFromLocal(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyImageNotFound(err.Error())
|
return call.ReplyImageNotFound(id)
|
||||||
}
|
}
|
||||||
labels, err := newImage.Labels(getContext())
|
labels, err := newImage.Labels(getContext())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -92,7 +92,7 @@ func (i *LibpodAPI) GetImage(call iopodman.VarlinkCall, name string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
il := iopodman.ImageInList{
|
il := iopodman.Image{
|
||||||
Id: newImage.ID(),
|
Id: newImage.ID(),
|
||||||
ParentId: newImage.Parent,
|
ParentId: newImage.Parent,
|
||||||
RepoTags: newImage.Names(),
|
RepoTags: newImage.Names(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue