Documentation
¶
Index ¶
- type Service
- func (s Service) AllCloudImageMetadata(ctx context.Context) ([]cloudimagemetadata.Metadata, error)
- func (s Service) DeleteMetadataWithImageID(ctx context.Context, imageID string) error
- func (s Service) FindMetadata(ctx context.Context, criteria cloudimagemetadata.MetadataFilter) (map[string][]cloudimagemetadata.Metadata, error)
- func (s Service) SaveMetadata(ctx context.Context, metadata []cloudimagemetadata.Metadata) error
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides the API for working with cloud image metadata
func NewService ¶
NewService creates a new instance of Service using the provided State.
func (Service) AllCloudImageMetadata ¶
AllCloudImageMetadata retrieves all cloud image metadata from the state and returns them as a list.
func (Service) DeleteMetadataWithImageID ¶
DeleteMetadataWithImageID removes all the metadata associated with the given imageID from the state. It returns a errors.EmptyImageID if the provided imageID is empty.
func (Service) FindMetadata ¶
func (s Service) FindMetadata(ctx context.Context, criteria cloudimagemetadata.MetadataFilter) (map[string][]cloudimagemetadata.Metadata, error)
FindMetadata retrieves a map of image metadata grouped by the source based on the provided filter criteria.
func (Service) SaveMetadata ¶
SaveMetadata saves the provided cloud image metadata if non-empty and valid. It returns a errors.NotValid if at least one of the inputs are invalid.
type State ¶
type State interface { // SaveMetadata saves a list of cloud image metadata to the state. SaveMetadata(ctx context.Context, metadata []cloudimagemetadata.Metadata) error // DeleteMetadataWithImageID removes the metadata associated with the given imageID from the state. DeleteMetadataWithImageID(ctx context.Context, imageID string) error // FindMetadata retrieves a list of cloud image metadata based on the provided criteria. // It returns the matched metadata or a [github.com/juju/juju/domain/cloudimagemetadata/errors.NotFound] error // if there are not one. FindMetadata(ctx context.Context, criteria cloudimagemetadata.MetadataFilter) ([]cloudimagemetadata.Metadata, error) // AllCloudImageMetadata retrieves all cloud image metadata from the state and returns them as a list. AllCloudImageMetadata(ctx context.Context) ([]cloudimagemetadata.Metadata, error) // SupportedArchitectures returns a set of strings representing the architectures supported by the cloud images. SupportedArchitectures(ctx context.Context) set.Strings }
State is an interface of the persistence layer for managing cloud image metadata