Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the public API facade for resources.
func NewFacadeV2 ¶
NewFacadeV2 creates a public API facade for resources. It is used for API registration.
func NewResourcesAPI ¶
func NewResourcesAPI(backend Backend, factory func(*charm.URL) (NewCharmRepository, error)) (*API, error)
NewResourcesAPI returns a new resources API facade.
func (*API) AddPendingResources ¶
func (a *API) AddPendingResources(args params.AddPendingResourcesArgsV2) (params.AddPendingResourcesResult, error)
AddPendingResources adds the provided resources (info) to the Juju model in a pending state, meaning they are not available until resolved. Handles CharmHub, CharmStore and Local charms.
func (*API) ListResources ¶
func (a *API) ListResources(args params.ListResourcesArgs) (params.ResourcesResults, error)
ListResources returns the list of resources for the given application.
type APIv1 ¶
type APIv1 struct {
*API
}
func (*APIv1) AddPendingResources ¶
func (a *APIv1) AddPendingResources(args params.AddPendingResourcesArgs) (params.AddPendingResourcesResult, error)
AddPendingResources adds the provided resources (info) to the Juju model in a pending state, meaning they are not available until resolved. Only CharmStore and Local charms are handled, therefore the channel is equivalent to risk in new style channels.
type Backend ¶
type Backend interface {
// ListResources returns the resources for the given application.
ListResources(application string) (resource.ApplicationResources, error)
// AddPendingResource adds the resource to the data backend in a
// "pending" state. It will stay pending (and unavailable) until
// it is resolved. The returned ID is used to identify the pending
// resources when resolving it.
AddPendingResource(applicationID, userID string, chRes charmresource.Resource) (string, error)
}
Backend is the functionality of Juju's state needed for the resources API.
type CharmHub ¶
type CharmHub interface {
ListResourceRevisions(ctx context.Context, charm, resource string) ([]transport.ResourceRevision, error)
Refresh(ctx context.Context, config charmhub.RefreshConfig) ([]transport.RefreshResponse, error)
}
type CharmID ¶
type CharmID struct {
// URL is the url of the charm.
URL *charm.URL
// Origin holds the original source of a charm, including it's channel.
Origin corecharm.Origin
// 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 in a charm repository.
type CharmStore ¶
type CharmStore interface {
// ListResources composes, for each of the identified charms, the
// list of details for each of the charm's resources. Those details
// are those associated with the specific charm revision. They
// include the resource's metadata and revision.
ListResources([]charmstore.CharmID) ([][]charmresource.Resource, error)
// ResourceInfo returns the metadata for the given resource.
ResourceInfo(charmstore.ResourceRequest) (charmresource.Resource, error)
}
CharmStore exposes the functionality of the charm store as needed here.
type NewCharmRepository ¶
type NewCharmRepository interface {
ResolveResources(resources []charmresource.Resource, id CharmID) ([]charmresource.Resource, error)
}