Documentation ¶
Index ¶
- Variables
- func AddCharmFromURL(client CharmAdder, curl *charm.URL, origin commoncharm.Origin, force bool) (*charm.URL, commoncharm.Origin, error)
- func AddCharmWithAuthorizationFromURL(client CharmAdder, cs MacaroonGetter, curl *charm.URL, ...) (*charm.URL, *macaroon.Macaroon, 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, []string, error)
- type CharmAdder
- type CharmStoreAdaptor
- type CharmStoreRepoFunc
- type CharmrepoForDeploy
- type CharmsAPI
- type DownloadBundleClient
- type DownloadBundleClientFunc
- type MacaroonGetter
- type ResolvedBundle
Constants ¶
This section is empty.
Variables ¶
var NewCharmStoreClient = func(client *httpbakery.Client, csURL string) *csclient.Client { return csclient.New(csclient.Params{ URL: csURL, BakeryClient: client, UserAgentValue: version.UserAgentVersion, }) }
NewCharmStoreClient is called to obtain a charm store client. It is defined as a variable so it can be changed for testing purposes.
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.
func AddCharmWithAuthorizationFromURL ¶
func AddCharmWithAuthorizationFromURL(client CharmAdder, cs MacaroonGetter, curl *charm.URL, origin commoncharm.Origin, force bool) (*charm.URL, *macaroon.Macaroon, commoncharm.Origin, error)
AddCharmWithAuthorizationFromURL calls the appropriate client API calls to add the given charm URL to state. For non-public charm URLs, this function also handles the macaroon authorization process using the given csClient. The resulting charm URL of the added charm is displayed on stdout.
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. This is done via the charmstore or the charms API depending on the API's version.
func NewCharmAdaptor ¶
func NewCharmAdaptor(charmsAPI CharmsAPI, charmStoreRepoFunc CharmStoreRepoFunc, 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 CharmStore or 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, []string, error)
ResolveCharm tries to interpret url as a CharmStore or CharmHub charm. If it turns out to be one of those charm types, the resolved URL, origin and a slice of supported series are returned. Resolving a CharmHub charm is only supported if the controller has a Charms API version of 3 or greater.
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) AddCharmWithAuthorization(*charm.URL, commoncharm.Origin, *macaroon.Macaroon, bool) (commoncharm.Origin, error) CheckCharmPlacement(string, *charm.URL) error }
CharmAdder defines a subset of the api client needed to add a charm.
type CharmStoreAdaptor ¶
type CharmStoreAdaptor struct { CharmrepoForDeploy MacaroonGetter }
func NewCharmStoreAdaptor ¶
func NewCharmStoreAdaptor(client *httpbakery.Client, csURL string) *CharmStoreAdaptor
NewCharmStoreAdaptor combines charm store functionality with the ability to get a macaroon.
type CharmStoreRepoFunc ¶
type CharmStoreRepoFunc = func() (CharmrepoForDeploy, error)
CharmStoreRepoFunc lazily creates a charm store repo.
type CharmrepoForDeploy ¶
type CharmrepoForDeploy interface { GetBundle(bundleURL *charm.URL, path string) (charm.Bundle, error) ResolveWithPreferredChannel(*charm.URL, csparams.Channel) (*charm.URL, csparams.Channel, []string, error) }
CharmrepoForDeploy is a stripped-down version of the gopkg.in/juju/charmrepo.v4 Interface interface. It is used by tests that embed a DeploySuiteBase.
type CharmsAPI ¶
type CharmsAPI interface { ResolveCharms(charms []apicharm.CharmToResolve) ([]apicharm.ResolvedCharm, error) GetDownloadInfo(curl *charm.URL, origin commoncharm.Origin, mac *macaroon.Macaroon) (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 MacaroonGetter ¶
MacaroonGetter defines a subset of a charmstore client, as required by different application commands.
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.