client

package
v0.0.0-...-cef01b0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(host string, version string) (*Client, error)

func NewDriverClient

func NewDriverClient(driverName string) (*Client, error)

func (*Client) Delete

func (c *Client) Delete() *Request

func (*Client) Get

func (c *Client) Get() *Request

func (*Client) Post

func (c *Client) Post() *Request

func (*Client) Put

func (c *Client) Put() *Request

func (*Client) Status

func (c *Client) Status() (*Status, error)

func (*Client) VolumeDriver

func (c *Client) VolumeDriver() volume.VolumeDriver

type Request

type Request struct {
	// contains filtered or unexported fields
}

Request is contructed iteratively by the client and finally dispatched. A REST endpoint is accessed with the following convention: base_url/<version>/<resource>/[<instance>]

func NewRequest

func NewRequest(client *http.Client, base *url.URL, verb string, version string) *Request

NewRequest instance

func (*Request) Body

func (r *Request) Body(v interface{}) *Request

Body sets the request Body.

func (*Request) Do

func (r *Request) Do() *Response

Do executes the request and returns a Response.

func (*Request) Instance

func (r *Request) Instance(instance string) *Request

Instance specifies the instance of the resource to be accessed.

func (*Request) QueryOption

func (r *Request) QueryOption(key string, value string) *Request

QueryOption adds specified options to query.

func (*Request) QueryOptionLabel

func (r *Request) QueryOptionLabel(key string, labels map[string]string) *Request

QueryOptionLabel adds specified label to query.

func (*Request) Resource

func (r *Request) Resource(resource string) *Request

Resource specifies the resource to be accessed.

func (*Request) SetHeader

func (r *Request) SetHeader(key, value string) *Request

SetHeader adds specified header values to query.

func (*Request) Timeout

func (r *Request) Timeout(d time.Duration) *Request

Timeout makes the request use the given duration as a timeout. Sets the "timeout" parameter.

func (*Request) URL

func (r *Request) URL() *url.URL

URL returns the current working URL.

func (*Request) UsePath

func (r *Request) UsePath(path string) *Request

UsePath use the specified path and don't build up a request.

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response is a representation of HTTP response received from the server.

func (Response) Body

func (r Response) Body() ([]byte, error)

Body return http body, valid only if there is no error

func (Response) Error

func (r Response) Error() error

Error executing the request.

func (Response) StatusCode

func (r Response) StatusCode() int

StatusCode HTTP status code returned.

func (Response) Unmarshal

func (r Response) Unmarshal(v interface{}) error

Unmarshal result into obj

type Status

type Status struct {
	Message   string
	ErrorCode int
}

Status upon error, attempts to parse the body of a response into a meaningful status.

Jump to

Keyboard shortcuts

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