charms

package
v0.0.0-...-f88c608 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CharmArchiveEntry

func CharmArchiveEntry(charmPath, entryPath string) ([]byte, error)

CharmArchiveEntry retrieves the specified entry from the zip archive.

func CharmLocatorFromURL

func CharmLocatorFromURL(url string) (charm.CharmLocator, error)

CharmLocatorFromURL returns a CharmLocator using the charm name, revision and source (which is extracted from the schema) of the provided URL.

func ReadCharmFromStorage

func ReadCharmFromStorage(ctx context.Context, objectStore ReadObjectStore, dataDir, storagePath string) (string, error)

ReadCharmFromStorage fetches the charm at the specified path from the store and copies it to a temp directory in dataDir.

func ValidateCharmOrigin

func ValidateCharmOrigin(o *params.CharmOrigin) error

ValidateCharmOrigin validates the Source of the charm origin for args received in a facade. This may evolve over time to include more pieces.

Types

type ApplicationCharmInfoAPI

type ApplicationCharmInfoAPI struct {
	// contains filtered or unexported fields
}

ApplicationCharmInfoAPI implements the ApplicationCharmInfo endpoint.

func NewApplicationCharmInfoAPI

func NewApplicationCharmInfoAPI(modelTag names.ModelTag, service ApplicationService, authorizer facade.Authorizer) (*ApplicationCharmInfoAPI, error)

NewApplicationCharmInfoAPI provides the signature required for facade registration.

func (*ApplicationCharmInfoAPI) ApplicationCharmInfo

func (a *ApplicationCharmInfoAPI) ApplicationCharmInfo(ctx context.Context, args params.Entity) (params.Charm, error)

ApplicationCharmInfo fetches charm information for an application.

type ApplicationService

type ApplicationService interface {
	// GetApplicationIDByName returns a application ID by application name. It
	// returns an error if the application can not be found by the name.
	GetApplicationIDByName(ctx context.Context, name string) (coreapplication.ID, error)
	// GetCharmByApplicationID returns the charm for the specified application
	// ID.
	GetCharmByApplicationID(context.Context, coreapplication.ID) (charm.Charm, applicationcharm.CharmLocator, error)
}

ApplicationService is the interface that the ApplicationCharmInfoAPI requires to fetch charm information for an application.

type CharmInfoAPI

type CharmInfoAPI struct {
	// contains filtered or unexported fields
}

CharmInfoAPI implements the charms interface and is the concrete implementation of the CharmInfoAPI end point.

func NewCharmInfoAPI

func NewCharmInfoAPI(modelTag names.ModelTag, service CharmService, authorizer facade.Authorizer) (*CharmInfoAPI, error)

NewCharmInfoAPI provides the signature required for facade registration.

func (*CharmInfoAPI) CharmInfo

func (a *CharmInfoAPI) CharmInfo(ctx context.Context, args params.CharmURL) (params.Charm, error)

CharmInfo returns information about the requested charm.

type CharmService

type CharmService interface {
	// GetCharm returns the charm by name, source and revision. Calling this method
	// will return all the data associated with the charm. It is not expected to
	// call this method for all calls, instead use the move focused and specific
	// methods. That's because this method is very expensive to call. This is
	// implemented for the cases where all the charm data is needed; model
	// migration, charm export, etc.
	GetCharm(ctx context.Context, locator applicationcharm.CharmLocator) (charm.Charm, applicationcharm.CharmLocator, bool, error)
}

CharmService is the interface that the CharmInfoAPI requires to fetch charm information.

type ReadObjectStore

type ReadObjectStore interface {
	// Get returns an io.ReadCloser for data at path, namespaced to the
	// model.
	Get(context.Context, string) (io.ReadCloser, int64, error)
}

ReadObjectStore represents an object store that can only be read from.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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