mirror of
https://github.com/containers/podman.git
synced 2025-07-24 07:58:04 +08:00
bindings: images uses entities/types
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -18,11 +18,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/buildah/define"
|
"github.com/containers/buildah/define"
|
||||||
"github.com/containers/image/v5/types"
|
imageTypes "github.com/containers/image/v5/types"
|
||||||
ldefine "github.com/containers/podman/v4/libpod/define"
|
ldefine "github.com/containers/podman/v4/libpod/define"
|
||||||
"github.com/containers/podman/v4/pkg/auth"
|
"github.com/containers/podman/v4/pkg/auth"
|
||||||
"github.com/containers/podman/v4/pkg/bindings"
|
"github.com/containers/podman/v4/pkg/bindings"
|
||||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
"github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
"github.com/containers/podman/v4/pkg/util"
|
"github.com/containers/podman/v4/pkg/util"
|
||||||
"github.com/containers/storage/pkg/fileutils"
|
"github.com/containers/storage/pkg/fileutils"
|
||||||
"github.com/containers/storage/pkg/ioutils"
|
"github.com/containers/storage/pkg/ioutils"
|
||||||
@ -50,7 +50,7 @@ type BuildResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build creates an image using a containerfile reference
|
// Build creates an image using a containerfile reference
|
||||||
func Build(ctx context.Context, containerFiles []string, options entities.BuildOptions) (*entities.BuildReport, error) {
|
func Build(ctx context.Context, containerFiles []string, options types.BuildOptions) (*types.BuildReport, error) {
|
||||||
if options.CommonBuildOpts == nil {
|
if options.CommonBuildOpts == nil {
|
||||||
options.CommonBuildOpts = new(define.CommonBuildOptions)
|
options.CommonBuildOpts = new(define.CommonBuildOptions)
|
||||||
}
|
}
|
||||||
@ -255,9 +255,9 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch options.SkipUnusedStages {
|
switch options.SkipUnusedStages {
|
||||||
case types.OptionalBoolTrue:
|
case imageTypes.OptionalBoolTrue:
|
||||||
params.Set("skipunusedstages", "1")
|
params.Set("skipunusedstages", "1")
|
||||||
case types.OptionalBoolFalse:
|
case imageTypes.OptionalBoolFalse:
|
||||||
params.Set("skipunusedstages", "0")
|
params.Set("skipunusedstages", "0")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,9 +342,9 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
|
|||||||
params.Set("pullpolicy", options.PullPolicy.String())
|
params.Set("pullpolicy", options.PullPolicy.String())
|
||||||
|
|
||||||
switch options.CommonBuildOpts.IdentityLabel {
|
switch options.CommonBuildOpts.IdentityLabel {
|
||||||
case types.OptionalBoolTrue:
|
case imageTypes.OptionalBoolTrue:
|
||||||
params.Set("identitylabel", "1")
|
params.Set("identitylabel", "1")
|
||||||
case types.OptionalBoolFalse:
|
case imageTypes.OptionalBoolFalse:
|
||||||
params.Set("identitylabel", "0")
|
params.Set("identitylabel", "0")
|
||||||
}
|
}
|
||||||
if options.Quiet {
|
if options.Quiet {
|
||||||
@ -416,7 +416,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
|
|||||||
} else {
|
} else {
|
||||||
headers, err = auth.MakeXRegistryConfigHeader(options.SystemContext, "", "")
|
headers, err = auth.MakeXRegistryConfigHeader(options.SystemContext, "", "")
|
||||||
}
|
}
|
||||||
if options.SystemContext.DockerInsecureSkipTLSVerify == types.OptionalBoolTrue {
|
if options.SystemContext.DockerInsecureSkipTLSVerify == imageTypes.OptionalBoolTrue {
|
||||||
params.Set("tlsVerify", "false")
|
params.Set("tlsVerify", "false")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -618,7 +618,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
|
|||||||
// even when the server quit but it seems desirable to
|
// even when the server quit but it seems desirable to
|
||||||
// distinguish a proper build from a transient EOF.
|
// distinguish a proper build from a transient EOF.
|
||||||
case <-response.Request.Context().Done():
|
case <-response.Request.Context().Done():
|
||||||
return &entities.BuildReport{ID: id, SaveFormat: saveFormat}, nil
|
return &types.BuildReport{ID: id, SaveFormat: saveFormat}, nil
|
||||||
default:
|
default:
|
||||||
// non-blocking select
|
// non-blocking select
|
||||||
}
|
}
|
||||||
@ -632,7 +632,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
|
|||||||
if errors.Is(err, io.EOF) && id != "" {
|
if errors.Is(err, io.EOF) && id != "" {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
return &entities.BuildReport{ID: id, SaveFormat: saveFormat}, fmt.Errorf("decoding stream: %w", err)
|
return &types.BuildReport{ID: id, SaveFormat: saveFormat}, fmt.Errorf("decoding stream: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
@ -645,12 +645,12 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
|
|||||||
case s.Error != nil:
|
case s.Error != nil:
|
||||||
// If there's an error, return directly. The stream
|
// If there's an error, return directly. The stream
|
||||||
// will be closed on return.
|
// will be closed on return.
|
||||||
return &entities.BuildReport{ID: id, SaveFormat: saveFormat}, errors.New(s.Error.Message)
|
return &types.BuildReport{ID: id, SaveFormat: saveFormat}, errors.New(s.Error.Message)
|
||||||
default:
|
default:
|
||||||
return &entities.BuildReport{ID: id, SaveFormat: saveFormat}, errors.New("failed to parse build results stream, unexpected input")
|
return &types.BuildReport{ID: id, SaveFormat: saveFormat}, errors.New("failed to parse build results stream, unexpected input")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &entities.BuildReport{ID: id, SaveFormat: saveFormat}, nil
|
return &types.BuildReport{ID: id, SaveFormat: saveFormat}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
|
func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
|
||||||
|
@ -10,11 +10,11 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
imageTypes "github.com/containers/image/v5/types"
|
imageTypes "github.com/containers/image/v5/types"
|
||||||
"github.com/containers/podman/v4/pkg/api/handlers/types"
|
handlersTypes "github.com/containers/podman/v4/pkg/api/handlers/types"
|
||||||
"github.com/containers/podman/v4/pkg/auth"
|
"github.com/containers/podman/v4/pkg/auth"
|
||||||
"github.com/containers/podman/v4/pkg/bindings"
|
"github.com/containers/podman/v4/pkg/bindings"
|
||||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
|
||||||
"github.com/containers/podman/v4/pkg/domain/entities/reports"
|
"github.com/containers/podman/v4/pkg/domain/entities/reports"
|
||||||
|
"github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Exists a lightweight way to determine if an image exists in local storage. It returns a
|
// Exists a lightweight way to determine if an image exists in local storage. It returns a
|
||||||
@ -35,11 +35,11 @@ func Exists(ctx context.Context, nameOrID string, options *ExistsOptions) (bool,
|
|||||||
|
|
||||||
// List returns a list of images in local storage. The all boolean and filters parameters are optional
|
// List returns a list of images in local storage. The all boolean and filters parameters are optional
|
||||||
// ways to alter the image query.
|
// ways to alter the image query.
|
||||||
func List(ctx context.Context, options *ListOptions) ([]*entities.ImageSummary, error) {
|
func List(ctx context.Context, options *ListOptions) ([]*types.ImageSummary, error) {
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = new(ListOptions)
|
options = new(ListOptions)
|
||||||
}
|
}
|
||||||
var imageSummary []*entities.ImageSummary
|
var imageSummary []*types.ImageSummary
|
||||||
conn, err := bindings.GetClient(ctx)
|
conn, err := bindings.GetClient(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -59,7 +59,7 @@ func List(ctx context.Context, options *ListOptions) ([]*entities.ImageSummary,
|
|||||||
|
|
||||||
// Get performs an image inspect. To have the on-disk size of the image calculated, you can
|
// Get performs an image inspect. To have the on-disk size of the image calculated, you can
|
||||||
// use the optional size parameter.
|
// use the optional size parameter.
|
||||||
func GetImage(ctx context.Context, nameOrID string, options *GetOptions) (*entities.ImageInspectReport, error) {
|
func GetImage(ctx context.Context, nameOrID string, options *GetOptions) (*types.ImageInspectReport, error) {
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = new(GetOptions)
|
options = new(GetOptions)
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ func GetImage(ctx context.Context, nameOrID string, options *GetOptions) (*entit
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
inspectedData := entities.ImageInspectReport{}
|
inspectedData := types.ImageInspectReport{}
|
||||||
response, err := conn.DoRequest(ctx, nil, http.MethodGet, "/images/%s/json", params, nil, nameOrID)
|
response, err := conn.DoRequest(ctx, nil, http.MethodGet, "/images/%s/json", params, nil, nameOrID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &inspectedData, err
|
return &inspectedData, err
|
||||||
@ -82,11 +82,11 @@ func GetImage(ctx context.Context, nameOrID string, options *GetOptions) (*entit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tree retrieves a "tree" based representation of the given image
|
// Tree retrieves a "tree" based representation of the given image
|
||||||
func Tree(ctx context.Context, nameOrID string, options *TreeOptions) (*entities.ImageTreeReport, error) {
|
func Tree(ctx context.Context, nameOrID string, options *TreeOptions) (*types.ImageTreeReport, error) {
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = new(TreeOptions)
|
options = new(TreeOptions)
|
||||||
}
|
}
|
||||||
var report entities.ImageTreeReport
|
var report types.ImageTreeReport
|
||||||
conn, err := bindings.GetClient(ctx)
|
conn, err := bindings.GetClient(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -105,12 +105,12 @@ func Tree(ctx context.Context, nameOrID string, options *TreeOptions) (*entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// History returns the parent layers of an image.
|
// History returns the parent layers of an image.
|
||||||
func History(ctx context.Context, nameOrID string, options *HistoryOptions) ([]*types.HistoryResponse, error) {
|
func History(ctx context.Context, nameOrID string, options *HistoryOptions) ([]*handlersTypes.HistoryResponse, error) {
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = new(HistoryOptions)
|
options = new(HistoryOptions)
|
||||||
}
|
}
|
||||||
_ = options
|
_ = options
|
||||||
var history []*types.HistoryResponse
|
var history []*handlersTypes.HistoryResponse
|
||||||
conn, err := bindings.GetClient(ctx)
|
conn, err := bindings.GetClient(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -124,8 +124,8 @@ func History(ctx context.Context, nameOrID string, options *HistoryOptions) ([]*
|
|||||||
return history, response.Process(&history)
|
return history, response.Process(&history)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Load(ctx context.Context, r io.Reader) (*entities.ImageLoadReport, error) {
|
func Load(ctx context.Context, r io.Reader) (*types.ImageLoadReport, error) {
|
||||||
var report entities.ImageLoadReport
|
var report types.ImageLoadReport
|
||||||
conn, err := bindings.GetClient(ctx)
|
conn, err := bindings.GetClient(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -242,11 +242,11 @@ func Untag(ctx context.Context, nameOrID, tag, repo string, options *UntagOption
|
|||||||
// Import adds the given image to the local image store. This can be done by file and the given reader
|
// Import adds the given image to the local image store. This can be done by file and the given reader
|
||||||
// or via the url parameter. Additional metadata can be associated with the image by using the changes and
|
// or via the url parameter. Additional metadata can be associated with the image by using the changes and
|
||||||
// message parameters. The image can also be tagged given a reference. One of url OR r must be provided.
|
// message parameters. The image can also be tagged given a reference. One of url OR r must be provided.
|
||||||
func Import(ctx context.Context, r io.Reader, options *ImportOptions) (*entities.ImageImportReport, error) {
|
func Import(ctx context.Context, r io.Reader, options *ImportOptions) (*types.ImageImportReport, error) {
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = new(ImportOptions)
|
options = new(ImportOptions)
|
||||||
}
|
}
|
||||||
var report entities.ImageImportReport
|
var report types.ImageImportReport
|
||||||
if r != nil && options.URL != nil {
|
if r != nil && options.URL != nil {
|
||||||
return nil, errors.New("url and r parameters cannot be used together")
|
return nil, errors.New("url and r parameters cannot be used together")
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ func Import(ctx context.Context, r io.Reader, options *ImportOptions) (*entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search is the binding for libpod's v2 endpoints for Search images.
|
// Search is the binding for libpod's v2 endpoints for Search images.
|
||||||
func Search(ctx context.Context, term string, options *SearchOptions) ([]entities.ImageSearchReport, error) {
|
func Search(ctx context.Context, term string, options *SearchOptions) ([]types.ImageSearchReport, error) {
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = new(SearchOptions)
|
options = new(SearchOptions)
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ func Search(ctx context.Context, term string, options *SearchOptions) ([]entitie
|
|||||||
}
|
}
|
||||||
defer response.Body.Close()
|
defer response.Body.Close()
|
||||||
|
|
||||||
results := []entities.ImageSearchReport{}
|
results := []types.ImageSearchReport{}
|
||||||
if err := response.Process(&results); err != nil {
|
if err := response.Process(&results); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,10 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/containers/image/v5/types"
|
imgTypes "github.com/containers/image/v5/types"
|
||||||
"github.com/containers/podman/v4/pkg/auth"
|
"github.com/containers/podman/v4/pkg/auth"
|
||||||
"github.com/containers/podman/v4/pkg/bindings"
|
"github.com/containers/podman/v4/pkg/bindings"
|
||||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
"github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
"github.com/containers/podman/v4/pkg/errorhandling"
|
"github.com/containers/podman/v4/pkg/errorhandling"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ func Pull(ctx context.Context, rawImage string, options *PullOptions) ([]string,
|
|||||||
params.Set("tlsVerify", strconv.FormatBool(!options.GetSkipTLSVerify()))
|
params.Set("tlsVerify", strconv.FormatBool(!options.GetSkipTLSVerify()))
|
||||||
}
|
}
|
||||||
|
|
||||||
header, err := auth.MakeXRegistryAuthHeader(&types.SystemContext{AuthFilePath: options.GetAuthfile()}, options.GetUsername(), options.GetPassword())
|
header, err := auth.MakeXRegistryAuthHeader(&imgTypes.SystemContext{AuthFilePath: options.GetAuthfile()}, options.GetUsername(), options.GetPassword())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ func Pull(ctx context.Context, rawImage string, options *PullOptions) ([]string,
|
|||||||
var pullErrors []error
|
var pullErrors []error
|
||||||
LOOP:
|
LOOP:
|
||||||
for {
|
for {
|
||||||
var report entities.ImagePullReport
|
var report types.ImagePullReport
|
||||||
if err := dec.Decode(&report); err != nil {
|
if err := dec.Decode(&report); err != nil {
|
||||||
if errors.Is(err, io.EOF) {
|
if errors.Is(err, io.EOF) {
|
||||||
break
|
break
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
imageTypes "github.com/containers/image/v5/types"
|
imageTypes "github.com/containers/image/v5/types"
|
||||||
"github.com/containers/podman/v4/pkg/auth"
|
"github.com/containers/podman/v4/pkg/auth"
|
||||||
"github.com/containers/podman/v4/pkg/bindings"
|
"github.com/containers/podman/v4/pkg/bindings"
|
||||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
"github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Push is the binding for libpod's endpoints for push images. Note that
|
// Push is the binding for libpod's endpoints for push images. Note that
|
||||||
@ -69,7 +69,7 @@ func Push(ctx context.Context, source string, destination string, options *PushO
|
|||||||
dec := json.NewDecoder(response.Body)
|
dec := json.NewDecoder(response.Body)
|
||||||
LOOP:
|
LOOP:
|
||||||
for {
|
for {
|
||||||
var report entities.ImagePushStream
|
var report types.ImagePushStream
|
||||||
if err := dec.Decode(&report); err != nil {
|
if err := dec.Decode(&report); err != nil {
|
||||||
if errors.Is(err, io.EOF) {
|
if errors.Is(err, io.EOF) {
|
||||||
break
|
break
|
||||||
|
@ -4,19 +4,19 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/containers/podman/v4/pkg/api/handlers/types"
|
handlersTypes "github.com/containers/podman/v4/pkg/api/handlers/types"
|
||||||
"github.com/containers/podman/v4/pkg/bindings"
|
"github.com/containers/podman/v4/pkg/bindings"
|
||||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
"github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
"github.com/containers/podman/v4/pkg/errorhandling"
|
"github.com/containers/podman/v4/pkg/errorhandling"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Remove removes one or more images from the local storage. Use optional force option to remove an
|
// Remove removes one or more images from the local storage. Use optional force option to remove an
|
||||||
// image, even if it's used by containers.
|
// image, even if it's used by containers.
|
||||||
func Remove(ctx context.Context, images []string, options *RemoveOptions) (*entities.ImageRemoveReport, []error) {
|
func Remove(ctx context.Context, images []string, options *RemoveOptions) (*types.ImageRemoveReport, []error) {
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = new(RemoveOptions)
|
options = new(RemoveOptions)
|
||||||
}
|
}
|
||||||
var report types.LibpodImagesRemoveReport
|
var report handlersTypes.LibpodImagesRemoveReport
|
||||||
conn, err := bindings.GetClient(ctx)
|
conn, err := bindings.GetClient(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, []error{err}
|
return nil, []error{err}
|
||||||
|
@ -3,7 +3,7 @@ package images
|
|||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
buildahDefine "github.com/containers/buildah/define"
|
"github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RemoveOptions are optional options for image removal
|
// RemoveOptions are optional options for image removal
|
||||||
@ -226,9 +226,7 @@ type PullOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BuildOptions are optional options for building images
|
// BuildOptions are optional options for building images
|
||||||
type BuildOptions struct {
|
type BuildOptions = types.BuildOptions
|
||||||
buildahDefine.BuildOptions
|
|
||||||
}
|
|
||||||
|
|
||||||
// ExistsOptions are optional options for checking if an image exists
|
// ExistsOptions are optional options for checking if an image exists
|
||||||
//
|
//
|
||||||
|
@ -3,15 +3,13 @@ package entities
|
|||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/containers/common/pkg/config"
|
"github.com/containers/common/pkg/config"
|
||||||
"github.com/containers/image/v5/manifest"
|
"github.com/containers/image/v5/manifest"
|
||||||
"github.com/containers/image/v5/signature/signer"
|
"github.com/containers/image/v5/signature/signer"
|
||||||
"github.com/containers/image/v5/types"
|
"github.com/containers/image/v5/types"
|
||||||
encconfig "github.com/containers/ocicrypt/config"
|
encconfig "github.com/containers/ocicrypt/config"
|
||||||
"github.com/containers/podman/v4/pkg/inspect"
|
entitiesTypes "github.com/containers/podman/v4/pkg/domain/entities/types"
|
||||||
"github.com/containers/podman/v4/pkg/trust"
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
@ -54,37 +52,7 @@ func (i *Image) Id() string { //nolint:revive,stylecheck
|
|||||||
}
|
}
|
||||||
|
|
||||||
// swagger:model LibpodImageSummary
|
// swagger:model LibpodImageSummary
|
||||||
type ImageSummary struct {
|
type ImageSummary = entitiesTypes.ImageSummary
|
||||||
ID string `json:"Id"`
|
|
||||||
ParentId string //nolint:revive,stylecheck
|
|
||||||
RepoTags []string
|
|
||||||
RepoDigests []string
|
|
||||||
Created int64
|
|
||||||
Size int64
|
|
||||||
SharedSize int
|
|
||||||
VirtualSize int64
|
|
||||||
Labels map[string]string
|
|
||||||
Containers int
|
|
||||||
ReadOnly bool `json:",omitempty"`
|
|
||||||
Dangling bool `json:",omitempty"`
|
|
||||||
|
|
||||||
// Podman extensions
|
|
||||||
Names []string `json:",omitempty"`
|
|
||||||
Digest string `json:",omitempty"`
|
|
||||||
History []string `json:",omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *ImageSummary) Id() string { //nolint:revive,stylecheck
|
|
||||||
return i.ID
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *ImageSummary) IsReadOnly() bool {
|
|
||||||
return i.ReadOnly
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *ImageSummary) IsDangling() bool {
|
|
||||||
return i.Dangling
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageRemoveOptions can be used to alter image removal.
|
// ImageRemoveOptions can be used to alter image removal.
|
||||||
type ImageRemoveOptions struct {
|
type ImageRemoveOptions struct {
|
||||||
@ -102,30 +70,12 @@ type ImageRemoveOptions struct {
|
|||||||
|
|
||||||
// ImageRemoveReport is the response for removing one or more image(s) from storage
|
// ImageRemoveReport is the response for removing one or more image(s) from storage
|
||||||
// and images what was untagged vs actually removed.
|
// and images what was untagged vs actually removed.
|
||||||
type ImageRemoveReport struct {
|
type ImageRemoveReport = entitiesTypes.ImageRemoveReport
|
||||||
// Deleted images.
|
|
||||||
Deleted []string `json:",omitempty"`
|
|
||||||
// Untagged images. Can be longer than Deleted.
|
|
||||||
Untagged []string `json:",omitempty"`
|
|
||||||
// ExitCode describes the exit codes as described in the `podman rmi`
|
|
||||||
// man page.
|
|
||||||
ExitCode int
|
|
||||||
}
|
|
||||||
|
|
||||||
type ImageHistoryOptions struct{}
|
type ImageHistoryOptions struct{}
|
||||||
|
|
||||||
type ImageHistoryLayer struct {
|
type ImageHistoryLayer = entitiesTypes.ImageHistoryLayer
|
||||||
ID string `json:"id"`
|
type ImageHistoryReport = entitiesTypes.ImageHistoryReport
|
||||||
Created time.Time `json:"created,omitempty"`
|
|
||||||
CreatedBy string `json:",omitempty"`
|
|
||||||
Tags []string `json:"tags,omitempty"`
|
|
||||||
Size int64 `json:"size"`
|
|
||||||
Comment string `json:"comment,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ImageHistoryReport struct {
|
|
||||||
Layers []ImageHistoryLayer
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImagePullOptions are the arguments for pulling images.
|
// ImagePullOptions are the arguments for pulling images.
|
||||||
type ImagePullOptions struct {
|
type ImagePullOptions struct {
|
||||||
@ -166,16 +116,7 @@ type ImagePullOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ImagePullReport is the response from pulling one or more images.
|
// ImagePullReport is the response from pulling one or more images.
|
||||||
type ImagePullReport struct {
|
type ImagePullReport = entitiesTypes.ImagePullReport
|
||||||
// Stream used to provide output from c/image
|
|
||||||
Stream string `json:"stream,omitempty"`
|
|
||||||
// Error contains text of errors from c/image
|
|
||||||
Error string `json:"error,omitempty"`
|
|
||||||
// Images contains the ID's of the images pulled
|
|
||||||
Images []string `json:"images,omitempty"`
|
|
||||||
// ID contains image id (retained for backwards compatibility)
|
|
||||||
ID string `json:"id,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImagePushOptions are the arguments for pushing images.
|
// ImagePushOptions are the arguments for pushing images.
|
||||||
type ImagePushOptions struct {
|
type ImagePushOptions struct {
|
||||||
@ -261,14 +202,7 @@ type ImagePushReport struct {
|
|||||||
|
|
||||||
// ImagePushStream is the response from pushing an image. Only used in the
|
// ImagePushStream is the response from pushing an image. Only used in the
|
||||||
// remote API.
|
// remote API.
|
||||||
type ImagePushStream struct {
|
type ImagePushStream = entitiesTypes.ImagePushStream
|
||||||
// ManifestDigest is the digest of the manifest of the pushed image.
|
|
||||||
ManifestDigest string `json:"manifestdigest,omitempty"`
|
|
||||||
// Stream used to provide push progress
|
|
||||||
Stream string `json:"stream,omitempty"`
|
|
||||||
// Error contains text of errors from pushing
|
|
||||||
Error string `json:"error,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageSearchOptions are the arguments for searching images.
|
// ImageSearchOptions are the arguments for searching images.
|
||||||
type ImageSearchOptions struct {
|
type ImageSearchOptions struct {
|
||||||
@ -296,22 +230,7 @@ type ImageSearchOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ImageSearchReport is the response from searching images.
|
// ImageSearchReport is the response from searching images.
|
||||||
type ImageSearchReport struct {
|
type ImageSearchReport = entitiesTypes.ImageSearchReport
|
||||||
// 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 repository tag
|
|
||||||
Tag string
|
|
||||||
}
|
|
||||||
|
|
||||||
// Image List Options
|
// Image List Options
|
||||||
type ImageListOptions struct {
|
type ImageListOptions struct {
|
||||||
@ -329,9 +248,7 @@ type ImageTagOptions struct{}
|
|||||||
type ImageUntagOptions struct{}
|
type ImageUntagOptions struct{}
|
||||||
|
|
||||||
// ImageInspectReport is the data when inspecting an image.
|
// ImageInspectReport is the data when inspecting an image.
|
||||||
type ImageInspectReport struct {
|
type ImageInspectReport = entitiesTypes.ImageInspectReport
|
||||||
*inspect.ImageData
|
|
||||||
}
|
|
||||||
|
|
||||||
type ImageLoadOptions struct {
|
type ImageLoadOptions struct {
|
||||||
Input string
|
Input string
|
||||||
@ -339,9 +256,7 @@ type ImageLoadOptions struct {
|
|||||||
SignaturePolicy string
|
SignaturePolicy string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImageLoadReport struct {
|
type ImageLoadReport = entitiesTypes.ImageLoadReport
|
||||||
Names []string
|
|
||||||
}
|
|
||||||
|
|
||||||
type ImageImportOptions struct {
|
type ImageImportOptions struct {
|
||||||
Architecture string
|
Architecture string
|
||||||
@ -356,9 +271,7 @@ type ImageImportOptions struct {
|
|||||||
SourceIsURL bool
|
SourceIsURL bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImageImportReport struct {
|
type ImageImportReport = entitiesTypes.ImageImportReport
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageSaveOptions provide options for saving images.
|
// ImageSaveOptions provide options for saving images.
|
||||||
type ImageSaveOptions struct {
|
type ImageSaveOptions struct {
|
||||||
@ -413,9 +326,7 @@ type ImageTreeOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ImageTreeReport provides results from ImageEngine.Tree()
|
// ImageTreeReport provides results from ImageEngine.Tree()
|
||||||
type ImageTreeReport struct {
|
type ImageTreeReport = entitiesTypes.ImageTreeReport
|
||||||
Tree string // TODO: Refactor move presentation work out of server
|
|
||||||
}
|
|
||||||
|
|
||||||
// ShowTrustOptions are the cli options for showing trust
|
// ShowTrustOptions are the cli options for showing trust
|
||||||
type ShowTrustOptions struct {
|
type ShowTrustOptions struct {
|
||||||
@ -426,12 +337,7 @@ type ShowTrustOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ShowTrustReport describes the results of show trust
|
// ShowTrustReport describes the results of show trust
|
||||||
type ShowTrustReport struct {
|
type ShowTrustReport = entitiesTypes.ShowTrustReport
|
||||||
Raw []byte
|
|
||||||
SystemRegistriesDirPath string
|
|
||||||
JSONOutput []byte
|
|
||||||
Policies []*trust.Policy
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTrustOptions describes the CLI options for setting trust
|
// SetTrustOptions describes the CLI options for setting trust
|
||||||
type SetTrustOptions struct {
|
type SetTrustOptions struct {
|
||||||
@ -466,18 +372,10 @@ type ImageUnmountOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ImageMountReport describes the response from image mount
|
// ImageMountReport describes the response from image mount
|
||||||
type ImageMountReport struct {
|
type ImageMountReport = entitiesTypes.ImageMountReport
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
Name string
|
|
||||||
Repositories []string
|
|
||||||
Path string
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageUnmountReport describes the response from umounting an image
|
// ImageUnmountReport describes the response from umounting an image
|
||||||
type ImageUnmountReport struct {
|
type ImageUnmountReport = entitiesTypes.ImageUnmountReport
|
||||||
Err error
|
|
||||||
Id string //nolint:revive,stylecheck
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LocalFarmImageBuilderName = "(local)"
|
LocalFarmImageBuilderName = "(local)"
|
||||||
@ -485,10 +383,4 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// FarmInspectReport describes the response from farm inspect
|
// FarmInspectReport describes the response from farm inspect
|
||||||
type FarmInspectReport struct {
|
type FarmInspectReport = entitiesTypes.FarmInspectReport
|
||||||
NativePlatforms []string
|
|
||||||
EmulatedPlatforms []string
|
|
||||||
OS string
|
|
||||||
Arch string
|
|
||||||
Variant string
|
|
||||||
}
|
|
||||||
|
@ -2,9 +2,7 @@ package entities
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"os"
|
|
||||||
|
|
||||||
buildahDefine "github.com/containers/buildah/define"
|
|
||||||
"github.com/containers/common/libnetwork/types"
|
"github.com/containers/common/libnetwork/types"
|
||||||
"github.com/containers/podman/v4/libpod/define"
|
"github.com/containers/podman/v4/libpod/define"
|
||||||
"github.com/containers/podman/v4/libpod/events"
|
"github.com/containers/podman/v4/libpod/events"
|
||||||
@ -103,33 +101,13 @@ type EventsOptions struct {
|
|||||||
type ContainerCreateResponse = entitiesTypes.ContainerCreateResponse
|
type ContainerCreateResponse = entitiesTypes.ContainerCreateResponse
|
||||||
|
|
||||||
// BuildOptions describe the options for building container images.
|
// BuildOptions describe the options for building container images.
|
||||||
type BuildOptions struct {
|
type BuildOptions = entitiesTypes.BuildOptions
|
||||||
buildahDefine.BuildOptions
|
|
||||||
ContainerFiles []string
|
|
||||||
FarmBuildOptions
|
|
||||||
// Files that need to be closed after the build
|
|
||||||
// so need to pass this to the main build functions
|
|
||||||
LogFileToClose *os.File
|
|
||||||
TmpDirToClose string
|
|
||||||
}
|
|
||||||
|
|
||||||
// BuildReport is the image-build report.
|
// BuildReport is the image-build report.
|
||||||
type BuildReport struct {
|
type BuildReport = entitiesTypes.BuildReport
|
||||||
// ID of the image.
|
|
||||||
ID string
|
|
||||||
// Format to save the image in
|
|
||||||
SaveFormat string
|
|
||||||
}
|
|
||||||
|
|
||||||
// FarmBuildOptions describes the options for building container images on farm nodes
|
// FarmBuildOptions describes the options for building container images on farm nodes
|
||||||
type FarmBuildOptions struct {
|
type FarmBuildOptions = entitiesTypes.FarmBuildOptions
|
||||||
// Cleanup removes built images from farm nodes on success
|
|
||||||
Cleanup bool
|
|
||||||
// Authfile is the path to the file holding registry credentials
|
|
||||||
Authfile string
|
|
||||||
// SkipTLSVerify skips tls verification when set to true
|
|
||||||
SkipTLSVerify bool
|
|
||||||
}
|
|
||||||
|
|
||||||
type IDOrNameResponse struct {
|
type IDOrNameResponse struct {
|
||||||
// The Id or Name of an object
|
// The Id or Name of an object
|
||||||
|
151
pkg/domain/entities/types/images.go
Normal file
151
pkg/domain/entities/types/images.go
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/podman/v4/pkg/inspect"
|
||||||
|
"github.com/containers/podman/v4/pkg/trust"
|
||||||
|
)
|
||||||
|
|
||||||
|
// swagger:model LibpodImageSummary
|
||||||
|
type ImageSummary struct {
|
||||||
|
ID string `json:"Id"`
|
||||||
|
ParentId string //nolint:revive,stylecheck
|
||||||
|
RepoTags []string
|
||||||
|
RepoDigests []string
|
||||||
|
Created int64
|
||||||
|
Size int64
|
||||||
|
SharedSize int
|
||||||
|
VirtualSize int64
|
||||||
|
Labels map[string]string
|
||||||
|
Containers int
|
||||||
|
ReadOnly bool `json:",omitempty"`
|
||||||
|
Dangling bool `json:",omitempty"`
|
||||||
|
|
||||||
|
// Podman extensions
|
||||||
|
Names []string `json:",omitempty"`
|
||||||
|
Digest string `json:",omitempty"`
|
||||||
|
History []string `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *ImageSummary) Id() string { //nolint:revive,stylecheck
|
||||||
|
return i.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *ImageSummary) IsReadOnly() bool {
|
||||||
|
return i.ReadOnly
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *ImageSummary) IsDangling() bool {
|
||||||
|
return i.Dangling
|
||||||
|
}
|
||||||
|
|
||||||
|
type ImageInspectReport struct {
|
||||||
|
*inspect.ImageData
|
||||||
|
}
|
||||||
|
|
||||||
|
type ImageTreeReport struct {
|
||||||
|
Tree string // TODO: Refactor move presentation work out of server
|
||||||
|
}
|
||||||
|
|
||||||
|
type ImageLoadReport struct {
|
||||||
|
Names []string
|
||||||
|
}
|
||||||
|
|
||||||
|
type ImageImportReport struct {
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageSearchReport is the response from searching images.
|
||||||
|
type ImageSearchReport 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 repository tag
|
||||||
|
Tag string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ShowTrustReport describes the results of show trust
|
||||||
|
type ShowTrustReport struct {
|
||||||
|
Raw []byte
|
||||||
|
SystemRegistriesDirPath string
|
||||||
|
JSONOutput []byte
|
||||||
|
Policies []*trust.Policy
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageMountReport describes the response from image mount
|
||||||
|
type ImageMountReport struct {
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
Name string
|
||||||
|
Repositories []string
|
||||||
|
Path string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageUnmountReport describes the response from umounting an image
|
||||||
|
type ImageUnmountReport struct {
|
||||||
|
Err error
|
||||||
|
Id string //nolint:revive,stylecheck
|
||||||
|
}
|
||||||
|
|
||||||
|
// FarmInspectReport describes the response from farm inspect
|
||||||
|
type FarmInspectReport struct {
|
||||||
|
NativePlatforms []string
|
||||||
|
EmulatedPlatforms []string
|
||||||
|
OS string
|
||||||
|
Arch string
|
||||||
|
Variant string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageRemoveReport is the response for removing one or more image(s) from storage
|
||||||
|
// and images what was untagged vs actually removed.
|
||||||
|
type ImageRemoveReport struct {
|
||||||
|
// Deleted images.
|
||||||
|
Deleted []string `json:",omitempty"`
|
||||||
|
// Untagged images. Can be longer than Deleted.
|
||||||
|
Untagged []string `json:",omitempty"`
|
||||||
|
// ExitCode describes the exit codes as described in the `podman rmi`
|
||||||
|
// man page.
|
||||||
|
ExitCode int
|
||||||
|
}
|
||||||
|
|
||||||
|
type ImageHistoryLayer struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Created time.Time `json:"created,omitempty"`
|
||||||
|
CreatedBy string `json:",omitempty"`
|
||||||
|
Tags []string `json:"tags,omitempty"`
|
||||||
|
Size int64 `json:"size"`
|
||||||
|
Comment string `json:"comment,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ImageHistoryReport struct {
|
||||||
|
Layers []ImageHistoryLayer
|
||||||
|
}
|
||||||
|
|
||||||
|
type ImagePullReport struct {
|
||||||
|
// Stream used to provide output from c/image
|
||||||
|
Stream string `json:"stream,omitempty"`
|
||||||
|
// Error contains text of errors from c/image
|
||||||
|
Error string `json:"error,omitempty"`
|
||||||
|
// Images contains the ID's of the images pulled
|
||||||
|
Images []string `json:"images,omitempty"`
|
||||||
|
// ID contains image id (retained for backwards compatibility)
|
||||||
|
ID string `json:"id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ImagePushStream struct {
|
||||||
|
// ManifestDigest is the digest of the manifest of the pushed image.
|
||||||
|
ManifestDigest string `json:"manifestdigest,omitempty"`
|
||||||
|
// Stream used to provide push progress
|
||||||
|
Stream string `json:"stream,omitempty"`
|
||||||
|
// Error contains text of errors from pushing
|
||||||
|
Error string `json:"error,omitempty"`
|
||||||
|
}
|
@ -1,6 +1,12 @@
|
|||||||
// copied from github.com/docker/docker/api/types
|
// copied from github.com/docker/docker/api/types
|
||||||
package types
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
buildahDefine "github.com/containers/buildah/define"
|
||||||
|
)
|
||||||
|
|
||||||
// ComponentVersion describes the version information for a specific component.
|
// ComponentVersion describes the version information for a specific component.
|
||||||
type ComponentVersion struct {
|
type ComponentVersion struct {
|
||||||
Name string
|
Name string
|
||||||
@ -42,3 +48,32 @@ type ContainerCreateResponse struct {
|
|||||||
// required: true
|
// required: true
|
||||||
Warnings []string `json:"Warnings"`
|
Warnings []string `json:"Warnings"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FarmBuildOptions describes the options for building container images on farm nodes
|
||||||
|
type FarmBuildOptions struct {
|
||||||
|
// Cleanup removes built images from farm nodes on success
|
||||||
|
Cleanup bool
|
||||||
|
// Authfile is the path to the file holding registry credentials
|
||||||
|
Authfile string
|
||||||
|
// SkipTLSVerify skips tls verification when set to true
|
||||||
|
SkipTLSVerify bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildOptions describe the options for building container images.
|
||||||
|
type BuildOptions struct {
|
||||||
|
buildahDefine.BuildOptions
|
||||||
|
ContainerFiles []string
|
||||||
|
FarmBuildOptions
|
||||||
|
// Files that need to be closed after the build
|
||||||
|
// so need to pass this to the main build functions
|
||||||
|
LogFileToClose *os.File
|
||||||
|
TmpDirToClose string
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildReport is the image-build report.
|
||||||
|
type BuildReport struct {
|
||||||
|
// ID of the image.
|
||||||
|
ID string
|
||||||
|
// Format to save the image in
|
||||||
|
SaveFormat string
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user