resources

package
v0.0.0-...-b0bff92 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 17 Imported by: 0

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

func NewFacadeV2(ctx facade.Context) (*API, error)

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

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 NewFacadeV1

func NewFacadeV1(ctx facade.Context) (*APIv1, error)

func (*APIv1) AddPendingResources

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 Logger

type Logger interface {
	Debugf(string, ...interface{})
	Tracef(string, ...interface{})
	Errorf(string, ...interface{})
}

type NewCharmRepository

type NewCharmRepository interface {
	ResolveResources(resources []charmresource.Resource, id CharmID) ([]charmresource.Resource, error)
}

type ResourceClient

type ResourceClient interface {
	ResourceInfo(url *charm.URL, origin corecharm.Origin, name string, revision int) (charmresource.Resource, error)
}

ResourceClient requests the resource info for a given charm URL, charm Origin, resource name and resource revision.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL