Files
Valentin Rothberg 0f7d54b026 migrate Podman to containers/common/libimage
Migrate the Podman code base over to `common/libimage` which replaces
`libpod/image` and a lot of glue code entirely.

Note that I tried to leave bread crumbs for changed tests.

Miscellaneous changes:

 * Some errors yield different messages which required to alter some
   tests.

 * I fixed some pre-existing issues in the code.  Others were marked as
   `//TODO`s to prevent the PR from exploding.

 * The `NamesHistory` of an image is returned as is from the storage.
   Previously, we did some filtering which I think is undesirable.
   Instead we should return the data as stored in the storage.

 * Touched handlers use the ABI interfaces where possible.

 * Local image resolution: previously Podman would match "foo" on
   "myfoo".  This behaviour has been changed and Podman will now
   only match on repository boundaries such that "foo" would match
   "my/foo" but not "myfoo".  I consider the old behaviour to be a
   bug, at the very least an exotic corner case.

 * Futhermore, "foo:none" does *not* resolve to a local image "foo"
   without tag anymore.  It's a hill I am (almost) willing to die on.

 * `image prune` prints the IDs of pruned images.  Previously, in some
   cases, the names were printed instead.  The API clearly states ID,
   so we should stick to it.

 * Compat endpoint image removal with _force_ deletes the entire not
   only the specified tag.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-05-05 11:30:12 +02:00

195 lines
4.0 KiB
Go

package swagger
import (
"github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/pkg/api/handlers"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/inspect"
"github.com/docker/docker/api/types"
)
// History response
// swagger:response DocsHistory
type swagHistory struct {
// in:body
Body struct {
handlers.HistoryResponse
}
}
// Inspect response
// swagger:response DocsImageInspect
type swagImageInspect struct {
// in:body
Body struct {
handlers.ImageInspect
}
}
// Load response
// swagger:response DocsLibpodImagesLoadResponse
type swagLibpodImagesLoadResponse struct {
// in:body
Body entities.ImageLoadReport
}
// Import response
// swagger:response DocsLibpodImagesImportResponse
type swagLibpodImagesImportResponse struct {
// in:body
Body entities.ImageImportReport
}
// Pull response
// swagger:response DocsLibpodImagesPullResponse
type swagLibpodImagesPullResponse struct {
// in:body
Body handlers.LibpodImagesPullReport
}
// Remove response
// swagger:response DocsLibpodImagesRemoveResponse
type swagLibpodImagesRemoveResponse struct {
// in:body
Body handlers.LibpodImagesRemoveReport
}
// PlayKube response
// swagger:response DocsLibpodPlayKubeResponse
type swagLibpodPlayKubeResponse struct {
// in:body
Body entities.PlayKubeReport
}
// Delete response
// swagger:response DocsImageDeleteResponse
type swagImageDeleteResponse struct {
// in:body
Body []struct {
Untagged []string `json:"untagged"`
Deleted string `json:"deleted"`
}
}
// Search results
// swagger:response DocsSearchResponse
type swagSearchResponse struct {
// in:body
Body struct {
// Index is the image index (e.g., "docker.io" or "quay.io")
Index string
// Name is the canonical name of the image (e.g., "docker.io/library/alpine").
Name string
// Description of the image.
Description string
// Stars is the number of stars of the image.
Stars int
// Official indicates if it's an official image.
Official string
// Automated indicates if the image was created by an automated build.
Automated string
// Tag is the image tag
Tag string
}
}
// Inspect image
// swagger:response DocsLibpodInspectImageResponse
type swagLibpodInspectImageResponse struct {
// in:body
Body struct {
inspect.ImageData
}
}
// Prune containers
// swagger:response DocsContainerPruneReport
type swagContainerPruneReport struct {
// in: body
Body []handlers.ContainersPruneReport
}
// Prune containers
// swagger:response DocsLibpodPruneResponse
type swagLibpodContainerPruneReport struct {
// in: body
Body []handlers.LibpodContainersPruneReport
}
// Inspect container
// swagger:response DocsContainerInspectResponse
type swagContainerInspectResponse struct {
// in:body
Body struct {
types.ContainerJSON
}
}
// List processes in container
// swagger:response DocsContainerTopResponse
type swagContainerTopResponse struct {
// in:body
Body struct {
handlers.ContainerTopOKBody
}
}
// List processes in pod
// swagger:response DocsPodTopResponse
type swagPodTopResponse struct {
// in:body
Body struct {
handlers.PodTopOKBody
}
}
// List processes in pod
// swagger:response DocsPodStatsResponse
type swagPodStatsResponse struct {
// in:body
Body []*entities.PodStatsReport
}
// Inspect container
// swagger:response LibpodInspectContainerResponse
type swagLibpodInspectContainerResponse struct {
// in:body
Body struct {
define.InspectContainerData
}
}
// List pods
// swagger:response ListPodsResponse
type swagListPodsResponse struct {
// in:body
Body []entities.ListPodsReport
}
// Inspect pod
// swagger:response InspectPodResponse
type swagInspectPodResponse struct {
// in:body
Body struct {
define.InspectPodData
}
}
// Inspect volume
// swagger:response InspectVolumeResponse
type swagInspectVolumeResponse struct {
// in:body
Body struct {
define.InspectVolumeData
}
}
// Image tree response
// swagger:response LibpodImageTreeResponse
type swagImageTreeResponse struct {
// in:body
Body struct {
handlers.ImageTreeResponse
}
}