juju: github.com/wallyworld/juju/resource/context Index | Files | Directories

package context

import "github.com/wallyworld/juju/resource/context"


Package Files

context.go utils.go


const HookContextFacade = "ResourcesHookContext"

HookContextFacade is the name of the API facade for resources in the uniter.

type APIClient Uses

type APIClient interface {
    // GetResource returns the resource info and content for the given
    // name (and unit-implied application).
    GetResource(resourceName string) (resource.Resource, io.ReadCloser, error)

APIClient exposes the uniter API functionality needed for resources.

type Context Uses

type Context struct {
    // contains filtered or unexported fields

Content is the resources portion of a uniter hook context.

func NewContextAPI Uses

func NewContextAPI(apiClient APIClient, dataDir string) *Context

NewContextAPI returns a new Content for the given API client and data dir.

func (*Context) Download Uses

func (c *Context) Download(name string) (string, error)

Download downloads the named resource and returns the path to which it was downloaded. If the resource does not exist or has not been uploaded yet then errors.NotFound is returned.

Note that the downloaded file is checked for correctness.

func (*Context) Flush Uses

func (c *Context) Flush() error

Flush implements hooks.Context.

type FingerprintMatcher Uses

type FingerprintMatcher struct {
    // Open opens the identified file. It defaults to os.Open.
    Open func(filename string) (io.ReadCloser, error)

    // GenerateFingerprint produces the fingerprint that corresponds
    // to the content of the provided reader. It defaults to
    // charmresource.GenerateFingerprint.
    GenerateFingerprint func(io.Reader) (charmresource.Fingerprint, error)

FingerprintMatcher supports verifying a file's fingerprint.

func (FingerprintMatcher) FingerprintMatches Uses

func (fpm FingerprintMatcher) FingerprintMatches(filename string, expected charmresource.Fingerprint) (bool, error)

FingerprintMatches determines whether or not the identified file's fingerprint matches the expected fingerprint.



Package context imports 9 packages (graph). Updated 2020-05-23. Refresh now. Tools for package owners.