Documentation
¶
Overview ¶
Package charms provides a client for accessing the charms API.
Index ¶
- Variables
- func NewS3CharmDownloader(charmGetter CharmGetter, apiCaller base.APICaller) *downloader.Downloader
- type CharmGetter
- type CharmPutter
- type CharmToResolve
- type Client
- func (c *Client) AddCharm(ctx context.Context, curl *charm.URL, origin apicharm.Origin, force bool) (apicharm.Origin, error)
- func (c *Client) CheckCharmPlacement(ctx context.Context, applicationName string, curl *charm.URL) error
- func (c *Client) GetDownloadInfo(ctx context.Context, curl *charm.URL, origin apicharm.Origin) (DownloadInfo, error)
- func (c *Client) ListCharmResources(ctx context.Context, curl string, origin apicharm.Origin) ([]charmresource.Resource, error)
- func (c *Client) ResolveCharms(ctx context.Context, charms []CharmToResolve) ([]ResolvedCharm, error)
- type DownloadInfo
- type LocalCharmClient
- type Option
- type ResolvedCharm
- type S3CharmOpener
Constants ¶
This section is empty.
Variables ¶
var WithTracer = base.WithTracer
WithTracer returns an Option that configures the Client to use the supplied tracer.
Functions ¶
func NewS3CharmDownloader ¶
func NewS3CharmDownloader(charmGetter CharmGetter, apiCaller base.APICaller) *downloader.Downloader
NewS3CharmDownloader returns a new charm downloader that wraps a s3Caller client for the provided endpoint.
Types ¶
type CharmGetter ¶
type CharmGetter interface { // GetCharm returns an io.ReadCloser for the specified object within the // specified bucket. GetCharm(ctx context.Context, modelUUID, charmName string) (io.ReadCloser, error) }
CharmGetter defines a way to get charms from a bucket.
type CharmPutter ¶
type CharmPutter interface {
PutCharm(ctx context.Context, modelUUID, charmRef, curl string, body io.Reader) (string, error)
}
CharmPutter uploads a local charm blob to the controller
type CharmToResolve ¶
CharmToResolve holds the charm url and it's channel to be resolved.
type Client ¶
type Client struct { base.ClientFacade *commoncharms.CharmInfoClient // contains filtered or unexported fields }
Client allows access to the charms API endpoint.
func NewClient ¶
func NewClient(st base.APICallCloser, options ...Option) *Client
NewClient creates a new client for accessing the charms API.
func (*Client) AddCharm ¶
func (c *Client) AddCharm(ctx context.Context, curl *charm.URL, origin apicharm.Origin, force bool) (apicharm.Origin, error)
AddCharm adds the given charm URL (which must include revision) to the model, if it does not exist yet. Local charms are not supported, only charm store and charm hub URLs. See also AddLocalCharm().
If the AddCharm API call fails because of an authorization error when retrieving the charm from the charm store, an error satisfying params.IsCodeUnauthorized will be returned.
func (*Client) CheckCharmPlacement ¶
func (c *Client) CheckCharmPlacement(ctx context.Context, applicationName string, curl *charm.URL) error
CheckCharmPlacement checks to see if a charm can be placed into the application. If the application doesn't exist then it is considered fine to be placed there.
func (*Client) GetDownloadInfo ¶
func (c *Client) GetDownloadInfo(ctx context.Context, curl *charm.URL, origin apicharm.Origin) (DownloadInfo, error)
GetDownloadInfo will get a download information from the given charm URL using the appropriate charm store.
func (*Client) ListCharmResources ¶
func (c *Client) ListCharmResources(ctx context.Context, curl string, origin apicharm.Origin) ([]charmresource.Resource, error)
ListCharmResources returns a list of associated resources for a given charm.
func (*Client) ResolveCharms ¶
func (c *Client) ResolveCharms(ctx context.Context, charms []CharmToResolve) ([]ResolvedCharm, error)
ResolveCharms resolves the given charm URLs with an optionally specified preferred channel.
type DownloadInfo ¶
DownloadInfo holds the URL and Origin for a charm that requires downloading on the client side. This is mainly for bundles as we don't resolve bundles on the server.
type LocalCharmClient ¶
type LocalCharmClient struct { base.ClientFacade // contains filtered or unexported fields }
LocalCharmClient allows access to the API endpoints required to add a local charm
func NewLocalCharmClient ¶
func NewLocalCharmClient(st base.APICallCloser) (*LocalCharmClient, error)
NewLocalCharmClient creates a client which can be used to upload local charms to the server
func (*LocalCharmClient) AddLocalCharm ¶
func (c *LocalCharmClient) AddLocalCharm(curl *charm.URL, ch charm.Charm, force bool, agentVersion version.Number) (*charm.URL, error)
AddLocalCharm prepares the given charm with a local: schema in its URL, and uploads it via the API server, returning the assigned charm URL.
type ResolvedCharm ¶
type ResolvedCharm struct { URL *charm.URL Origin apicharm.Origin SupportedBases []corebase.Base Error error }
ResolvedCharm holds resolved charm data.
type S3CharmOpener ¶
type S3CharmOpener interface {
OpenCharm(req downloader.Request) (io.ReadCloser, error)
}
CharmOpener provides the OpenCharm method.
func NewS3CharmOpener ¶
func NewS3CharmOpener(charmGetter CharmGetter, apiCaller base.APICaller) S3CharmOpener
NewS3CharmOpener returns a charm opener for the specified s3Caller.