mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-06 21:29:02 +00:00
client: refactor ListImages to return an error per machine
This commit is contained in:
1 parent
d36ff67409
commit
7bac40ae3e
3 files changed
+21
-11
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@@ -22,6 +24,14 @@ type MachineImages struct {
|
||||
ContainerdStore bool
|
||||
}
|
||||
|
||||
// Error returns a non-nil error if listing images on this machine failed.
|
||||
func (mi MachineImages) Error() error {
|
||||
if mi.Metadata != nil && mi.Metadata.Error != "" {
|
||||
return errors.New(mi.Metadata.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ImageFilter defines criteria to filter images in ListImages.
|
||||
type ImageFilter struct {
|
||||
// Machines filters images to those present on the specified machines (names or IDs).
|
||||
|
||||
Reference in new issue
Block a user