charmrepo.v1: gopkg.in/juju/charmrepo.v1 Index | Files | Directories

package charmrepo

import "gopkg.in/juju/charmrepo.v1"

Index

Package Files

charmstore.go legacy.go local.go params.go repo.go

Constants

const JujuMetadataHTTPHeader = "Juju-Metadata"

JujuMetadataHTTPHeader is the HTTP header name used to send Juju metadata attributes to the charm store.

Variables

var CacheDir string

CacheDir stores the charm cache directory path.

var LegacyStore = &LegacyCharmStore{BaseURL: "https://store.juju.ubuntu.com"}

func CharmNotFound Uses

func CharmNotFound(url string) error

func Latest Uses

func Latest(repo Interface, curl *charm.URL) (int, error)

Latest returns the latest revision of the charm referenced by curl, regardless of the revision set on each curl. This is a helper which calls the bulk method and unpacks a single result.

type CharmRevision Uses

type CharmRevision struct {
    Revision int
    Sha256   string
    Err      error
}

CharmRevision holds the revision number of a charm and any error encountered in retrieving it.

type CharmStore Uses

type CharmStore struct {
    // contains filtered or unexported fields
}

CharmStore is a repository Interface that provides access to the public Juju charm store.

func (*CharmStore) Get Uses

func (s *CharmStore) Get(curl *charm.URL) (charm.Charm, error)

Get implements Interface.Get.

func (*CharmStore) GetBundle Uses

func (s *CharmStore) GetBundle(curl *charm.URL) (charm.Bundle, error)

GetBundle implements Interface.GetBundle.

func (*CharmStore) Latest Uses

func (s *CharmStore) Latest(curls ...*charm.URL) ([]CharmRevision, error)

Latest implements Interface.Latest.

func (*CharmStore) Resolve Uses

func (s *CharmStore) Resolve(ref *charm.Reference) (*charm.URL, error)

Resolve implements Interface.Resolve.

func (*CharmStore) URL Uses

func (s *CharmStore) URL() string

URL returns the root endpoint URL of the charm store.

func (*CharmStore) WithJujuAttrs Uses

func (s *CharmStore) WithJujuAttrs(attrs map[string]string) Interface

WithJujuAttrs returns a repository Interface with the Juju metadata attributes set.

func (*CharmStore) WithTestMode Uses

func (s *CharmStore) WithTestMode() Interface

WithTestMode returns a repository Interface where test mode is enabled, meaning charm store download stats are not increased when charms are retrieved.

type EventResponse Uses

type EventResponse struct {
    Kind     string   `json:"kind"`
    Revision int      `json:"revision"` // Zero is valid. Can't omitempty.
    Digest   string   `json:"digest,omitempty"`
    Errors   []string `json:"errors,omitempty"`
    Warnings []string `json:"warnings,omitempty"`
    Time     string   `json:"time,omitempty"`
}

EventResponse is sent by the charm store in response to charm-event requests.

type InfoResponse Uses

type InfoResponse struct {
    CanonicalURL string   `json:"canonical-url,omitempty"`
    Revision     int      `json:"revision"` // Zero is valid. Can't omitempty.
    Sha256       string   `json:"sha256,omitempty"`
    Digest       string   `json:"digest,omitempty"`
    Errors       []string `json:"errors,omitempty"`
    Warnings     []string `json:"warnings,omitempty"`
}

InfoResponse is sent by the charm store in response to charm-info requests.

type Interface Uses

type Interface interface {
    // Get returns the charm referenced by curl.
    Get(curl *charm.URL) (charm.Charm, error)

    // GetBundle returns the bundle referenced by curl.
    GetBundle(curl *charm.URL) (charm.Bundle, error)

    // Latest returns the latest revision of the charms referenced by curls,
    // regardless of the revision set on each curl.
    Latest(curls ...*charm.URL) ([]CharmRevision, error)

    // Resolve resolves the series and revision of the given entity
    // reference. If the series is not specified, it may be resolved
    // by the charm store or rejected. After the series is resolved,
    // if the revision is not specified, it will be resolved to the latest
    // available revision for that series.
    Resolve(ref *charm.Reference) (*charm.URL, error)
}

Interface represents a charm repository (a collection of charms).

func InferRepository Uses

func InferRepository(ref *charm.Reference, charmStoreParams NewCharmStoreParams, localRepoPath string) (Interface, error)

InferRepository returns a charm repository inferred from the provided charm or bundle reference. Charm store references will use the provided parameters. Local references will use the provided path.

func LegacyInferRepository Uses

func LegacyInferRepository(ref *charm.Reference, localRepoPath string) (repo Interface, err error)

LegacyInferRepository returns a charm repository inferred from the provided charm or bundle reference. Local references will use the provided path.

func NewCharmStore Uses

func NewCharmStore(p NewCharmStoreParams) Interface

NewCharmStore creates and returns a charm store repository. The given parameters are used to instantiate the charm store.

The errors returned from the interface methods will preserve the causes returned from the underlying csclient methods.

func NewLocalRepository Uses

func NewLocalRepository(path string) (Interface, error)

NewLocalRepository creates and return a new local Juju repository pointing to the given local path.

type LegacyCharmStore Uses

type LegacyCharmStore struct {
    BaseURL string
    // contains filtered or unexported fields
}

LegacyCharmStore is a repository Interface that provides access to the legacy Juju charm store.

func (*LegacyCharmStore) BranchLocation Uses

func (s *LegacyCharmStore) BranchLocation(curl *charm.URL) string

BranchLocation returns the location for the branch holding the charm at curl.

func (*LegacyCharmStore) CharmURL Uses

func (s *LegacyCharmStore) CharmURL(location string) (*charm.URL, error)

CharmURL returns the charm URL for the branch at location.

func (*LegacyCharmStore) Event Uses

func (s *LegacyCharmStore) Event(curl *charm.URL, digest string) (*EventResponse, error)

Event returns details for a charm event in the charm store.

If digest is empty, the latest event is returned.

func (*LegacyCharmStore) Get Uses

func (s *LegacyCharmStore) Get(curl *charm.URL) (charm.Charm, error)

Get returns the charm referenced by curl. CacheDir must have been set, otherwise Get will panic.

func (*LegacyCharmStore) GetBundle Uses

func (s *LegacyCharmStore) GetBundle(curl *charm.URL) (charm.Bundle, error)

GetBundle is only defined for implementing Interface.

func (*LegacyCharmStore) Info Uses

func (s *LegacyCharmStore) Info(curls ...charm.Location) ([]*InfoResponse, error)

Info returns details for all the specified charms in the charm store.

func (*LegacyCharmStore) Latest Uses

func (s *LegacyCharmStore) Latest(curls ...*charm.URL) ([]CharmRevision, error)

Latest returns the latest revision of the charms referenced by curls, regardless of the revision set on each curl.

func (*LegacyCharmStore) Resolve Uses

func (s *LegacyCharmStore) Resolve(ref *charm.Reference) (*charm.URL, error)

Resolve canonicalizes charm URLs any implied series in the reference.

func (*LegacyCharmStore) WithAuthAttrs Uses

func (s *LegacyCharmStore) WithAuthAttrs(authAttrs string) Interface

WithAuthAttrs return a repository Interface with the authentication token list set. authAttrs is a list of attr=value pairs.

func (*LegacyCharmStore) WithJujuAttrs Uses

func (s *LegacyCharmStore) WithJujuAttrs(jujuAttrs string) Interface

WithJujuAttrs returns a repository Interface with the Juju metadata attributes set. jujuAttrs is a list of attr=value pairs.

func (*LegacyCharmStore) WithTestMode Uses

func (s *LegacyCharmStore) WithTestMode(testMode bool) Interface

WithTestMode returns a repository Interface where testMode is set to value passed to this method.

type LocalRepository Uses

type LocalRepository struct {
    Path string
}

LocalRepository represents a local directory containing subdirectories named after an Ubuntu series, each of which contains charms targeted for that series. For example:

/path/to/repository/oneiric/mongodb/
/path/to/repository/precise/mongodb.charm
/path/to/repository/precise/wordpress/

func (*LocalRepository) Get Uses

func (r *LocalRepository) Get(curl *charm.URL) (charm.Charm, error)

Get returns a charm matching curl, if one exists. If curl has a revision of -1, it returns the latest charm that matches curl. If multiple candidates satisfy the foregoing, the first one encountered will be returned.

func (*LocalRepository) GetBundle Uses

func (r *LocalRepository) GetBundle(curl *charm.URL) (charm.Bundle, error)

GetBundle implements Interface.GetBundle.

func (*LocalRepository) Latest Uses

func (r *LocalRepository) Latest(curls ...*charm.URL) ([]CharmRevision, error)

Latest implements Interface.Latest by finding the latest revision of each of the given charm URLs in the local repository.

func (*LocalRepository) Resolve Uses

func (r *LocalRepository) Resolve(ref *charm.Reference) (*charm.URL, error)

Resolve implements Interface.Resolve.

type NewCharmStoreParams Uses

type NewCharmStoreParams struct {
    // URL holds the root endpoint URL of the charm store,
    // with no trailing slash, not including the version.
    // For example https://api.jujucharms.com/charmstore
    // If empty, the default charm store client location is used.
    URL string

    // HTTPClient holds the HTTP client to use when making
    // requests to the store. If nil, httpbakery.NewHTTPClient will
    // be used.
    HTTPClient *http.Client

    // VisitWebPage is called when authorization requires that
    // the user visits a web page to authenticate themselves.
    // If nil, a default function that returns an error will be used.
    VisitWebPage func(url *url.URL) error
}

NewCharmStoreParams holds parameters for instantiating a new CharmStore.

type NotFoundError Uses

type NotFoundError struct {
    // contains filtered or unexported fields
}

NotFoundError represents an error indicating that the requested data wasn't found.

func (*NotFoundError) Error Uses

func (e *NotFoundError) Error() string

Directories

PathSynopsis
csclientThe csclient package provides access to the charm store API.
csclient/paramsThe params package holds types that are a part of the charm store's external contract - they will be marshalled (or unmarshalled) as JSON and delivered through the HTTP API.
migratebundle
testing

Package charmrepo imports 18 packages (graph) and is imported by 17 packages. Updated 2016-07-15. Refresh now. Tools for package owners.