Documentation ¶
Index ¶
- Constants
- Variables
- func CharmNotFound(url string) error
- func ComputedSeries(c charm.CharmMeta) (seriesSlice []string, _ error)
- func InvalidPath(path string) error
- func IsInvalidPathError(err error) bool
- func IsKubernetes(cm charm.CharmMeta) bool
- func IsUnsupportedSeriesError(err error) bool
- func MakeRiskOnlyChannel(risk string) charm.Channel
- func MustParseChannel(s string) charm.Channel
- func NewCharmAtPath(path, series string) (charm.Charm, *charm.URL, error)
- func NewCharmAtPathForceSeries(path, series string, force bool) (charm.Charm, *charm.URL, error)
- func NewUnsupportedSeriesError(requestedSeries string, supportedSeries []string) error
- type CharmArchive
- type EssentialMetadata
- type MetadataFormat
- type MetadataRequest
- type Origin
- type Platform
- type Repository
- type RepositoryFactory
- type Source
Constants ¶
const ( // DefaultChannelString represents the default track and risk if nothing // is found. DefaultChannelString = "latest/stable" )
Variables ¶
var ( // DefaultChannel represents the default track and risk. DefaultChannel = charm.Channel{ Track: "latest", Risk: charm.Stable, } // DefaultRiskChannel represents the default only risk channel. DefaultRiskChannel = charm.Channel{ Risk: charm.Stable, } )
Functions ¶
func CharmNotFound ¶
CharmNotFound returns an error indicating that the charm at the specified URL does not exist.
func ComputedSeries ¶
ComputedSeries of a charm, preserving legacy behavior. If the charm has no manifest, return series from the metadata. Otherwise return the series listed in the manifest Bases as channels.
func IsInvalidPathError ¶
func IsKubernetes ¶
func IsKubernetes(cm charm.CharmMeta) bool
IsKubernetes reports whether the given charm should be deployed to Kubernetes, that is, a v1 charm with series "kubernetes", or a v2 charm with containers specified.
func IsUnsupportedSeriesError ¶
IsUnsupportedSeriesError returns true if err is an UnsupportedSeriesError.
func MakeRiskOnlyChannel ¶
func MakeRiskOnlyChannel(risk string) charm.Channel
MakeRiskOnlyChannel creates a charm channel that is backwards compatible with old style charm store channels. This creates a risk aware channel only. No validation is performed on the risk and is just accepted as is.
func MustParseChannel ¶
func MustParseChannel(s string) charm.Channel
MustParseChannel parses a given string or returns a panic.
func NewCharmAtPath ¶
NewCharmAtPath returns the charm represented by this path, and a URL that describes it. If the series is empty, the charm's default series is used, if any. Otherwise, the series is validated against those the charm declares it supports.
func NewCharmAtPathForceSeries ¶
NewCharmAtPathForSeries returns the charm represented by this path, and a URL that describes it. If the series is empty, the charm's default series is used, if any. Otherwise, the series is validated against those the charm declares it supports. If force is true, then any series validation errors are ignored and the requested series is used regardless. Note though that is it still an error if the series is not specified and the charm does not define any.
func NewUnsupportedSeriesError ¶
NewUnsupportedSeriesError returns an error indicating that the requested series is not supported by a charm.
Types ¶
type CharmArchive ¶
type CharmArchive interface { charm.Charm Version() string LXDProfile() *charm.LXDProfile }
CharmArchive provides information about a downloaded charm archive.
type EssentialMetadata ¶
type EssentialMetadata struct { ResolvedOrigin Origin Meta *charm.Meta Manifest *charm.Manifest Config *charm.Config }
EssentialMetadata encapsulates the essential metadata required for deploying a particular charm.
type MetadataFormat ¶
type MetadataFormat int
MetadataFormat of the parsed charm.
const ( FormatUnknown MetadataFormat = iota FormatV1 MetadataFormat = iota FormatV2 MetadataFormat = iota )
MetadataFormat are the different versions of charm metadata supported.
func Format ¶
func Format(ch charm.CharmMeta) MetadataFormat
Format returns the metadata format for a given charm.
type MetadataRequest ¶
type MetadataRequest struct { CharmURL *charm.URL Origin Origin Macaroons macaroon.Slice }
MetadataRequest encapsulates the arguments for a charm essential metadata resolution request.
type Origin ¶
type Origin struct { Source Source Type string ID string Hash string // Users can request a revision to be installed instead of a channel, so // we should model that correctly here. Revision *int Channel *charm.Channel Platform Platform // InstanceKey is a unique string associated with the application. To // assist with keeping KPI data in charmhub, it must be the same for every // charmhub Refresh action related to an application. Create with the // charmhub.CreateInstanceKey method. LP: 1944582 InstanceKey string }
Origin holds the original source of a charm. Information about where the charm was installed from (charm-hub, charm-store, local) and any additional information we can utilise when making modelling decisions for upgrading or changing.
type Platform ¶
Platform describes the platform used to install the charm with.
func MakePlatform ¶
MakePlatform creates a core charm Platform from a set of component parts.
func MustParsePlatform ¶
MustParsePlatform parses a given string or returns a panic.
func ParsePlatform ¶
ParsePlatform parses a string representing a store platform. Serialized version of platform can be expected to conform to the following:
- Architecture is mandatory.
- OS is optional and can be dropped. Release is mandatory if OS wants to be displayed.
- Release is also optional.
To indicate something is missing `unknown` can be used in place.
Examples:
- `<arch>/<os>/<series>`
- `<arch>`
- `<arch>/<series>`
- `<arch>/unknown/<series>`
func ParsePlatformNormalize ¶
ParsePlatformNormalize parses a string presenting a store platform. The returned platform's architecture, os and series are normalized.
type Repository ¶
type Repository interface { // GetDownloadURL returns a url from which a charm can be downloaded // based on the given charm url and charm origin. A charm origin // updated with the ID and hash for the download is also returned. GetDownloadURL(*charm.URL, Origin, macaroon.Slice) (*url.URL, Origin, error) // DownloadCharm retrieves specified charm from the store and saves its // contents to the specified path. DownloadCharm(charmURL *charm.URL, requestedOrigin Origin, macaroons macaroon.Slice, archivePath string) (CharmArchive, Origin, error) // ResolveWithPreferredChannel verified that the charm with the requested // channel exists. If no channel is specified, the latests, most stable is // is used. It returns a charm URL which includes the most current revision, // if none was provided, a charm origin, and a slice of series supported by // this charm. ResolveWithPreferredChannel(*charm.URL, Origin, macaroon.Slice) (*charm.URL, Origin, []string, 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. GetEssentialMetadata(...MetadataRequest) ([]EssentialMetadata, error) // ListResources returns a list of resources associated with a given charm. ListResources(*charm.URL, Origin, macaroon.Slice) ([]charmresource.Resource, error) }
Repository describes an API for querying charm/bundle information and downloading them from a store.
type RepositoryFactory ¶
type RepositoryFactory interface {
GetCharmRepository(src Source) (Repository, error)
}
RepositoryFactory is a factory for charm Repositories.