Documentation

Overview

    Package charms provides a client for accessing the charms API.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type CharmToResolve

    type CharmToResolve struct {
    	URL    *charm.URL
    	Origin apicharm.Origin
    }

      CharmToResolve holds the charm url and it's channel to be resolved.

      type Client

      type Client struct {
      	base.ClientFacade
      	*commoncharms.CharmsClient
      	// contains filtered or unexported fields
      }

        Client allows access to the charms API end point.

        func NewClient

        func NewClient(st base.APICallCloser) *Client

          NewClient creates a new client for accessing the charms API.

          func (*Client) AddCharm

          func (c *Client) AddCharm(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() in the client-side API.

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

            func (c *Client) AddCharmWithAuthorization(curl *charm.URL, origin apicharm.Origin, csMac *macaroon.Macaroon, force bool) (apicharm.Origin, error)

              AddCharmWithAuthorization is like AddCharm except it also provides the given charmstore macaroon for the juju server to use when obtaining the charm from the charm store or from charm hub. The macaroon is conventionally obtained from the /delegatable-macaroon endpoint in the charm store.

              If the AddCharmWithAuthorization API call fails because of an authorization error when retrieving the charm from the charm store, an error satisfying params.IsCodeUnauthorized will be returned. Force is used to overload any validation errors that could occur during a deploy

              func (*Client) CheckCharmPlacement

              func (c *Client) CheckCharmPlacement(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(curl *charm.URL, origin apicharm.Origin, mac *macaroon.Macaroon) (DownloadInfo, error)

                  GetDownloadInfo will get a download information from the given charm URL using the appropriate charm store.

                  func (*Client) IsMetered

                  func (c *Client) IsMetered(charmURL string) (bool, error)

                    IsMetered returns whether or not the charm is metered.

                    func (*Client) ListCharmResources

                    func (c *Client) ListCharmResources(curl *charm.URL, origin apicharm.Origin) ([]charmresource.Resource, error)

                      ListCharmResources returns a list of associated resources for a given charm.

                      func (*Client) ResolveCharms

                      func (c *Client) ResolveCharms(charms []CharmToResolve) ([]ResolvedCharm, error)

                        ResolveCharms resolves the given charm URLs with an optionally specified preferred channel. ResolveCharms is only supported in version 3 and above, it is expected that the consumer of the client is intended to handle the fallback.

                        type DownloadInfo

                        type DownloadInfo struct {
                        	URL    string
                        	Origin apicharm.Origin
                        }

                          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 ResolvedCharm

                          type ResolvedCharm struct {
                          	URL             *charm.URL
                          	Origin          apicharm.Origin
                          	SupportedSeries []string
                          	Error           error
                          }

                            ResolvedCharm holds resolved charm data.

                            Source Files