juju: github.com/juju/juju/charmstore Index | Files

package charmstore

import "github.com/juju/juju/charmstore"

Index

Package Files

charmid.go client.go info.go jar.go latest.go

Constants

const MacaroonURI = "github.com/juju/juju"

MacaroonURI is use when register new Juju checkers with the bakery.

Variables

var MacaroonNamespace = checkers.NewNamespace(map[string]string{MacaroonURI: ""})

MacaroonNamespace is the namespace Juju uses for managing macaroons.

type CharmID Uses

type CharmID struct {
    // URL is the url of the charm.
    URL *charm.URL

    // Channel is the channel in which the charm was published.
    Channel csparams.Channel

    // Metadata is optional extra information about a particular model's
    // "in-theatre" use use of the charm.
    Metadata map[string]string
}

CharmID encapsulates data for identifying a unique charm from the charm store.

type CharmInfo Uses

type CharmInfo struct {
    // OriginalURL is charm URL, including its revision, for which we
    // queried the charm store.
    OriginalURL *charm.URL

    // Timestamp indicates when the info came from the charm store.
    Timestamp time.Time

    // LatestRevision identifies the most recent revision of the charm
    // that is available in the charm store.
    LatestRevision int

    // LatestResources is the list of resource info for each of the
    // charm's resources. This list is accurate as of the time that the
    // charm store handled the request for the charm info.
    LatestResources []resource.Resource
}

CharmInfo holds the information about a charm from the charm store. The info relates to the charm at a particular revision at the time the charm store handled the request. The resource revisions associated with the charm at that revision may change at any time. Note, however, that the set of resource names remains fixed for any given charm revision.

func (CharmInfo) LatestURL Uses

func (info CharmInfo) LatestURL() *charm.URL

LatestURL returns the charm URL for the latest revision of the charm.

type CharmInfoResult Uses

type CharmInfoResult struct {
    CharmInfo

    // Error indicates a problem retrieving or processing the info
    // for this charm.
    Error error
}

CharmInfoResult holds the result of a charm store request for info about a charm.

func LatestCharmInfo Uses

func LatestCharmInfo(client Client, charms []CharmID, metadata map[string]string) ([]CharmInfoResult, error)

LatestCharmInfo returns the most up-to-date information about each of the identified charms at their latest revision. The revisions in the provided URLs are ignored. The returned map indicates charm URLs where the macaroon has been updated. This updated macaroon should be stored for use in any further requests. Note that this map may be non-empty even if this method returns an error (and the macaroons should be stored).

type CharmRevision Uses

type CharmRevision struct {
    // Revision is newest revision for the charm.
    Revision int

    // Err holds any error that occurred while making the request.
    Err error
}

CharmRevision holds the data returned from the charmstore about the latest revision of a charm. Note that this may be different per channel.

type Client Uses

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

Client wraps charmrepo/csclient (the charm store's API client library) in a higher level API.

func NewCachingClient Uses

func NewCachingClient(cache MacaroonCache, server string) (Client, error)

NewCachingClient returns a Juju charm store client that stores and retrieves macaroons for calls in the given cache. The client will use server as the charmstore url.

func NewCustomClient Uses

func NewCustomClient(base csWrapper) Client

func NewCustomClientAtURL Uses

func NewCustomClientAtURL(bakeryClient *httpbakery.Client, server string) (Client, error)

NewCustomClientAtURL returns a juju charmstore client that relies on the passed-in httpbakery.Client to store and retrieve macaroons. If not nil, the client will use server as the charmstore url, otherwise it will default to the standard juju charmstore url.

func (Client) GetResource Uses

func (c Client) GetResource(req ResourceRequest) (data ResourceData, err error)

GetResource returns the data (bytes) and metadata for a resource from the charmstore.

func (Client) LatestRevisions Uses

func (c Client) LatestRevisions(charms []CharmID, modelMetadata map[string]string) ([]CharmRevision, error)

LatestRevisions returns the latest revisions of the given charms, using the given metadata.

func (Client) ListResources Uses

func (c Client) ListResources(charms []CharmID) ([][]resource.Resource, error)

ListResources returns a list of resources for each of the given charms.

func (Client) ResourceInfo Uses

func (c Client) ResourceInfo(req ResourceRequest) (resource.Resource, error)

ResourceInfo returns the metadata for the given resource from the charmstore.

type MacaroonCache Uses

type MacaroonCache interface {
    Set(*charm.URL, macaroon.Slice) error
    Get(*charm.URL) (macaroon.Slice, error)
}

MacaroonCache represents a value that can store and retrieve macaroons for charms. It is used when we are requesting data from the charmstore for private charms.

type ResourceData Uses

type ResourceData struct {
    // ReadCloser holds the bytes for the resource.
    io.ReadCloser

    // Resource holds the metadata for the resource.
    Resource resource.Resource
}

ResourceData represents the response from the charmstore about a request for resource bytes.

type ResourceRequest Uses

type ResourceRequest struct {
    // Charm is the URL of the charm for which we're requesting a resource.
    Charm *charm.URL

    // Channel is the channel from which to request the resource info.
    Channel csparams.Channel

    // Name is the name of the resource we're asking about.
    Name string

    // Revision is the specific revision of the resource we're asking about.
    Revision int
}

ResourceRequest is the data needed to request a resource from the charmstore.

Package charmstore imports 17 packages (graph) and is imported by 255 packages. Updated 2020-01-18. Refresh now. Tools for package owners.