resourceadapters

package
v0.0.0-...-8ff1004 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeployResources

func DeployResources(
	applicationID string,
	chID charmstore.CharmID,
	csMac *macaroon.Macaroon,
	filesAndRevisions map[string]string,
	resources map[string]charmresource.Meta,
	conn base.APICallCloser,
) (ids map[string]string, err error)

DeployResources uploads the bytes for the given files to the server and creates pending resource metadata for the all resource mentioned in the metadata. It returns a map of resource name to pending resource IDs.

func NewAPIClient

func NewAPIClient(apiCaller base.APICallCloser) (*client.Client, error)

NewAPIClient is mostly a copy of the newClient code in component/all/resources.go. It lives here because it simplifies this code immensely.

func NewLatestCharmHandler

func NewLatestCharmHandler(st *state.State) (charmrevisionupdater.LatestCharmHandler, error)

NewLatestCharmHandler returns a LatestCharmHandler that uses the given Juju state.

func NewResourceOpener

func NewResourceOpener(st *corestate.State, unitName string) (opener resource.Opener, err error)

NewResourceOpener returns a new resource.Opener for the given unit.

The caller owns the State provided. It is the caller's responsibility to close it.

TODO(mjs): This is the entry point for a whole lot of untested shim code in this package. At some point this should be sorted out.

Types

type CSRetryClient

type CSRetryClient struct {
	ResourceClient
	// contains filtered or unexported fields
}

CSRetryClient is a wrapper around a Juju charm store client that retries GetResource() calls.

func (CSRetryClient) GetResource

GetResource returns a reader for the resource's data.

type DeployResourcesFunc

type DeployResourcesFunc func(
	applicationID string,
	chID charmstore.CharmID,
	csMac *macaroon.Macaroon,
	filesAndRevisions map[string]string,
	resources map[string]charmresource.Meta,
	conn base.APICallCloser,
) (ids map[string]string, err error)

DeployResourcesFunc is the function type of DeployResources.

type ResourceClient

type ResourceClient interface {
	GetResource(req charmstore.ResourceRequest) (data charmstore.ResourceData, err error)
}

ResourceClient defines a set of functionality that a client needs to define to support resources.

Jump to

Keyboard shortcuts

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