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, args, response interface{}) error
}
FacadeCaller exposes the raw API caller functionality needed here.
type HTTPClient ¶
type HTTPClient interface {
// Do sends the HTTP request 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(ctx context.Context, req *http.Request, resp interface{}) error
}
HTTPClient exposes the raw API HTTP caller functionality needed here.
type UnitFacadeClient ¶
type UnitFacadeClient struct {
FacadeCaller
HTTPClient
// contains filtered or unexported fields
}
UnitFacadeClient is an API client for the resources portion of the uniter facade.
func NewUnitFacadeClient ¶
func NewUnitFacadeClient(ctx context.Context, 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(ctx context.Context, 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.