client

package
v0.0.0-...-6cf1bc9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FacadeCaller

type FacadeCaller interface {
	// FacadeCall makes an API request.
	FacadeCall(request string, params, response interface{}) error
}

FacadeCaller exposes the raw API caller functionality needed here.

type HTTPClient

type HTTPClient interface {
	// Do sends the HTTP request/body and unpacks the response into
	// the provided "resp". If that is a **http.Response then it is
	// unpacked as-is. Otherwise it is unmarshaled from JSON.
	Do(req *http.Request, body io.ReadSeeker, resp interface{}) error
}

HTTPClient exposes the raw API HTTP caller functionality needed here.

type UnitFacadeClient

type UnitFacadeClient struct {
	FacadeCaller
	HTTPClient
}

UnitFacadeClient is an API client for the resources portion of the uniter facade.

func NewUnitFacadeClient

func NewUnitFacadeClient(facadeCaller FacadeCaller, httpClient UnitHTTPClient) *UnitFacadeClient

NewUnitFacadeClient creates a new API client for the resources portion of the uniter facade.

func (*UnitFacadeClient) GetResource

func (c *UnitFacadeClient) GetResource(resourceName string) (resource.Resource, io.ReadCloser, error)

GetResource opens the resource (metadata/blob), if it exists, via the HTTP API and returns it. If it does not exist or hasn't been uploaded yet then errors.NotFound is returned.

type UnitHTTPClient

type UnitHTTPClient interface {
	HTTPClient

	// Unit Returns the name of the unit for this client.
	Unit() string
}

UnitHTTPClient exposes the raw API HTTP caller functionality needed here.

func NewUnitHTTPClient

func NewUnitHTTPClient(client HTTPClient, unitName string) UnitHTTPClient

NewUnitHTTPClient wraps an HTTP client (a la httprequest.Client) with unit information. This allows rewriting of the URL to match the relevant unit.

Jump to

Keyboard shortcuts

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