Documentation ¶
Index ¶
- func AddCharmFromURL(client CharmAdder, curl *charm.URL, origin commoncharm.Origin, force bool) (*charm.URL, commoncharm.Origin, error)
- type BundleFactory
- type BundleRepoFunc
- type CharmAdaptor
- func (c *CharmAdaptor) GetBundle(url *charm.URL, origin commoncharm.Origin, path string) (charm.Bundle, error)
- func (c *CharmAdaptor) ResolveBundleURL(maybeBundle *charm.URL, preferredOrigin commoncharm.Origin) (*charm.URL, commoncharm.Origin, error)
- func (c *CharmAdaptor) ResolveCharm(url *charm.URL, preferredOrigin commoncharm.Origin, switchCharm bool) (*charm.URL, commoncharm.Origin, []base.Base, error)
- type CharmAdder
- type CharmsAPI
- type DownloadBundleClient
- type DownloadBundleClientFunc
- type ResolvedBundle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCharmFromURL ¶
func AddCharmFromURL(client CharmAdder, curl *charm.URL, origin commoncharm.Origin, force bool) (*charm.URL, commoncharm.Origin, error)
AddCharmFromURL calls the appropriate client API calls to add the given charm URL to state.
Types ¶
type BundleFactory ¶
type BundleFactory interface {
GetBundle(*charm.URL, commoncharm.Origin, string) (charm.Bundle, error)
}
BundleFactory represents a type for getting a bundle from a given url.
type BundleRepoFunc ¶
type BundleRepoFunc = func(*charm.URL) (BundleFactory, error)
BundleRepoFunc creates a bundle factory from a charm URL.
type CharmAdaptor ¶
type CharmAdaptor struct {
// contains filtered or unexported fields
}
CharmAdaptor handles prep work for deploying charms: resolving charms and bundles and getting bundle contents.
func NewCharmAdaptor ¶
func NewCharmAdaptor(charmsAPI CharmsAPI, downloadBundleClientFunc DownloadBundleClientFunc) *CharmAdaptor
NewCharmAdaptor returns a CharmAdaptor.
func (*CharmAdaptor) GetBundle ¶
func (c *CharmAdaptor) GetBundle(url *charm.URL, origin commoncharm.Origin, path string) (charm.Bundle, error)
GetBundle returns a bundle from a given charmstore path.
func (*CharmAdaptor) ResolveBundleURL ¶
func (c *CharmAdaptor) ResolveBundleURL(maybeBundle *charm.URL, preferredOrigin commoncharm.Origin) (*charm.URL, commoncharm.Origin, error)
ResolveBundleURL tries to interpret maybeBundle as a Charmhub bundle. If it turns out to be a bundle, the resolved URL and origin are returned. If it isn't but there wasn't a problem checking it, it returns a nil charm URL.
func (*CharmAdaptor) ResolveCharm ¶
func (c *CharmAdaptor) ResolveCharm(url *charm.URL, preferredOrigin commoncharm.Origin, switchCharm bool) (*charm.URL, commoncharm.Origin, []base.Base, error)
ResolveCharm tries to interpret url as a Charmhub charm and returns the resolved URL, origin and a slice of supported series.
type CharmAdder ¶
type CharmAdder interface { AddLocalCharm(*charm.URL, charm.Charm, bool) (*charm.URL, error) // not used in utils AddCharm(*charm.URL, commoncharm.Origin, bool) (commoncharm.Origin, error) CheckCharmPlacement(string, *charm.URL) error }
CharmAdder defines a subset of the charm client needed to add a charm.
type CharmsAPI ¶
type CharmsAPI interface { ResolveCharms(charms []apicharm.CharmToResolve) ([]apicharm.ResolvedCharm, error) GetDownloadInfo(curl *charm.URL, origin commoncharm.Origin) (apicharm.DownloadInfo, error) }
CharmsAPI is functionality needed by the CharmAdapter from the Charms API.
type DownloadBundleClient ¶
type DownloadBundleClient interface {
DownloadAndReadBundle(context.Context, *url.URL, string, ...charmhub.DownloadOption) (charm.Bundle, error)
}
DownloadBundleClient represents a way to download a bundle from a given resource URL.
type DownloadBundleClientFunc ¶
type DownloadBundleClientFunc = func() (DownloadBundleClient, error)
DownloadBundleClientFunc lazily construct a download bundle client.
type ResolvedBundle ¶
type ResolvedBundle struct {
// contains filtered or unexported fields
}
ResolvedBundle decorates a charm.Bundle instance with a type that implements the charm.BundleDataSource interface.
func NewResolvedBundle ¶
func NewResolvedBundle(b charm.Bundle) ResolvedBundle
func (ResolvedBundle) BasePath ¶
func (ResolvedBundle) BasePath() string
BasePath implements charm.BundleDataSource.
func (ResolvedBundle) Parts ¶
func (rb ResolvedBundle) Parts() []*charm.BundleDataPart
Parts implements charm.BundleDataSource.
func (ResolvedBundle) ResolveInclude ¶
func (ResolvedBundle) ResolveInclude(_ string) ([]byte, error)
ResolveInclude implements charm.BundleDataSource.