Documentation
¶
Index ¶
- type CharmHubClient
- type CharmHubRepository
- func (c *CharmHubRepository) DownloadCharm(charmName string, requestedOrigin corecharm.Origin, archivePath string) (corecharm.CharmArchive, corecharm.Origin, error)
- func (c *CharmHubRepository) GetDownloadURL(charmName string, requestedOrigin corecharm.Origin) (*url.URL, corecharm.Origin, error)
- func (c *CharmHubRepository) GetEssentialMetadata(reqs ...corecharm.MetadataRequest) ([]corecharm.EssentialMetadata, error)
- func (c *CharmHubRepository) ListResources(charmName string, origin corecharm.Origin) ([]charmresource.Resource, error)
- func (c *CharmHubRepository) ResolveForDeploy(arg corecharm.CharmID) (corecharm.ResolvedDataForDeploy, error)
- func (c *CharmHubRepository) ResolveResources(resources []charmresource.Resource, id corecharm.CharmID) ([]charmresource.Resource, error)
- func (c *CharmHubRepository) ResolveWithPreferredChannel(charmName string, argOrigin corecharm.Origin) (*charm.URL, corecharm.Origin, []corecharm.Platform, error)
- type Logger
- type Method
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CharmHubClient ¶
type CharmHubClient interface { DownloadAndRead(ctx context.Context, resourceURL *url.URL, archivePath string, options ...charmhub.DownloadOption) (*charm.CharmArchive, error) ListResourceRevisions(ctx context.Context, charm, resource string) ([]transport.ResourceRevision, error) Refresh(ctx context.Context, config charmhub.RefreshConfig) ([]transport.RefreshResponse, error) }
CharmHubClient describes the API exposed by the charmhub client.
type CharmHubRepository ¶
type CharmHubRepository struct {
// contains filtered or unexported fields
}
CharmHubRepository provides an API for charm-related operations using charmhub.
func NewCharmHubRepository ¶
func NewCharmHubRepository(logger Logger, chClient CharmHubClient) *CharmHubRepository
NewCharmHubRepository returns a new repository instance using the provided charmhub client.
func (*CharmHubRepository) DownloadCharm ¶
func (c *CharmHubRepository) DownloadCharm(charmName string, requestedOrigin corecharm.Origin, archivePath string) (corecharm.CharmArchive, corecharm.Origin, error)
DownloadCharm retrieves specified charm from the store and saves its contents to the specified path.
func (*CharmHubRepository) GetDownloadURL ¶
func (c *CharmHubRepository) GetDownloadURL(charmName string, requestedOrigin corecharm.Origin) (*url.URL, corecharm.Origin, error)
GetDownloadURL returns the url from which to download the CharmHub charm/bundle defined by the provided charm name and origin. An updated charm origin is also returned with the ID and hash for the charm to be downloaded. If the provided charm origin has no ID, it is assumed that the charm is being installed, not refreshed.
func (*CharmHubRepository) GetEssentialMetadata ¶
func (c *CharmHubRepository) GetEssentialMetadata(reqs ...corecharm.MetadataRequest) ([]corecharm.EssentialMetadata, error)
GetEssentialMetadata resolves each provided MetadataRequest and returns back a slice with the results. The results include the minimum set of metadata that is required for deploying each charm.
func (*CharmHubRepository) ListResources ¶
func (c *CharmHubRepository) ListResources(charmName string, origin corecharm.Origin) ([]charmresource.Resource, error)
ListResources returns the resources for a given charm and origin.
func (*CharmHubRepository) ResolveForDeploy ¶
func (c *CharmHubRepository) ResolveForDeploy(arg corecharm.CharmID) (corecharm.ResolvedDataForDeploy, error)
ResolveForDeploy combines ResolveWithPreferredChannel, GetEssentialMetadata and best effort for repositoryResources into 1 call for server side charm deployment. Reducing the number of required calls to a repository.
func (*CharmHubRepository) ResolveResources ¶
func (c *CharmHubRepository) ResolveResources(resources []charmresource.Resource, id corecharm.CharmID) ([]charmresource.Resource, error)
ResolveResources looks at the provided charmhub and backend (already downloaded) resources to determine which to use. Provided (uploaded) take precedence. If charmhub has a newer resource than the back end, use that.
func (*CharmHubRepository) ResolveWithPreferredChannel ¶
func (c *CharmHubRepository) ResolveWithPreferredChannel(charmName string, argOrigin corecharm.Origin) (*charm.URL, corecharm.Origin, []corecharm.Platform, error)
ResolveWithPreferredChannel defines a way using the given charm name and charm origin (platform and channel) to locate a matching charm against the Charmhub API.
type Method ¶
type Method string
Method describes the method for requesting the charm using the RefreshAPI.
const ( // MethodRevision utilizes an install action by the revision only. A // channel must be in the origin, however it's not used in this request, // but saved in the origin for future use. MethodRevision Method = "revision" // MethodChannel utilizes an install action by the channel only. MethodChannel Method = "channel" // MethodID utilizes an refresh action by the id, revision and // channel (falls back to latest/stable if channel is not found). MethodID Method = "id" )