service

package
v0.0.0-...-84dfa8d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2025 License: AGPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

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

func NewService(st State) *Service

NewService creates a new instance of Service using the provided State.

func (Service) AllCloudImageMetadata

func (s Service) AllCloudImageMetadata(ctx context.Context) ([]cloudimagemetadata.Metadata, error)

AllCloudImageMetadata retrieves all cloud image metadata from the state and returns them as a list.

func (Service) DeleteMetadataWithImageID

func (s Service) DeleteMetadataWithImageID(ctx context.Context, imageID string) error

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

FindMetadata retrieves a map of image metadata grouped by the source based on the provided filter criteria.

func (Service) SaveMetadata

func (s Service) SaveMetadata(ctx context.Context, metadata []cloudimagemetadata.Metadata) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL