Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewCharmStoreClient = func(client *httpbakery.Client, csURL string) *csclient.Client {
	return csclient.New(csclient.Params{
		URL:          csURL,
		BakeryClient: client,
	})
}

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, series string) (*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, series string) (*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 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, charmRepoFn CharmRepoFunc) *CharmAdaptor

NewCharmAdaptor returns a CharmAdaptor.

func (*CharmAdaptor) GetBundle

func (c *CharmAdaptor) GetBundle(bundleURL *charm.URL, 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) (*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, string) (commoncharm.Origin, error)
	AddCharmWithAuthorization(*charm.URL, commoncharm.Origin, *macaroon.Macaroon, bool, string) (commoncharm.Origin, error)
	CheckCharmPlacement(string, *charm.URL) error
}

CharmAdder defines a subset of the api client needed to add a charm.

type CharmRepoFunc

type CharmRepoFunc = func() (CharmrepoForDeploy, error)

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 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)
}

CharmsAPI is functionality needed by the CharmAdapter from the Charms API.

type MacaroonGetter

type MacaroonGetter interface {
	Get(endpoint string, extra interface{}) error
}

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.

Directories

Path Synopsis
mocks Package mocks is a generated GoMock package.