Documentation
¶
Index ¶
- Variables
- func ParseHost(host string) (string, string, string, error)
- type Client
- func (cli *Client) AddCustomHeader(name, value string)
- func (cli *Client) ClientVersion() string
- func (cli *Client) Delete(ctx context.Context, path string, query url.Values, ...) (*ServerResponse, error)
- func (cli *Client) Get(ctx context.Context, path string, query url.Values, ...) (*ServerResponse, error)
- func (cli *Client) Head(ctx context.Context, path string, query url.Values, ...) (*ServerResponse, error)
- func (cli *Client) Post(ctx context.Context, path string, query url.Values, obj interface{}, ...) (*ServerResponse, error)
- func (cli *Client) PostRaw(ctx context.Context, path string, query url.Values, body io.Reader, ...) (*ServerResponse, error)
- func (cli *Client) Put(ctx context.Context, path string, query url.Values, obj interface{}, ...) (*ServerResponse, error)
- func (cli *Client) PutRaw(ctx context.Context, path string, query url.Values, body io.Reader, ...) (*ServerResponse, error)
- func (cli *Client) RemoveCustomHeader(name string)
- func (cli *Client) UpdateClientVersion(v string)
- type ServerError
- type ServerResponse
Constants ¶
This section is empty.
Variables ¶
var ErrConnectionFailed = errors.New("Cannot connect to the server.")
ErrConnectionFailed is an error raised when the connection between the client and server failed.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the API client that performs all operations against a docker server.
func NewClient ¶
func NewClient(host string, version string, client *http.Client, httpHeaders map[string]string) (*Client, error)
NewClient initializes a new API client for the given host and API version. It won't send any version information if the version number is empty. It uses the given http client as transport. It also initializes the custom http headers to add to each request.
func (*Client) AddCustomHeader ¶
Add a custom header.
func (*Client) ClientVersion ¶
ClientVersion returns the version string associated with this instance of the Client.
func (*Client) Delete ¶
func (cli *Client) Delete(ctx context.Context, path string, query url.Values, headers map[string][]string) (*ServerResponse, error)
Delete sends an http request to the API server using the method DELETE
func (*Client) Get ¶
func (cli *Client) Get(ctx context.Context, path string, query url.Values, headers map[string][]string) (*ServerResponse, error)
Get sends an http request to the API server using the method GET.
func (*Client) Head ¶
func (cli *Client) Head(ctx context.Context, path string, query url.Values, headers map[string][]string) (*ServerResponse, error)
Head sends an http request to the API server using the method HEAD.
func (*Client) Post ¶
func (cli *Client) Post(ctx context.Context, path string, query url.Values, obj interface{}, headers map[string][]string) (*ServerResponse, error)
Post sends an http request to the API server using the method POST
func (*Client) Put ¶
func (cli *Client) Put(ctx context.Context, path string, query url.Values, obj interface{}, headers map[string][]string) (*ServerResponse, error)
Put sends an http request to the API server using the method PUT
func (*Client) RemoveCustomHeader ¶
Remove a custom header.
func (*Client) UpdateClientVersion ¶
UpdateClientVersion updates the version string associated with this instance of the Client.
type ServerError ¶
type ServerError struct {
// contains filtered or unexported fields
}
A error that contains error messages returned from API server.
func (ServerError) Error ¶
func (se ServerError) Error() string
func (ServerError) RawError ¶
func (se ServerError) RawError() []byte
func (ServerError) StatusCode ¶
func (se ServerError) StatusCode() int
type ServerResponse ¶
type ServerResponse struct { Body io.ReadCloser Header http.Header StatusCode int }
serverResponse is a wrapper for http API responses.
func (*ServerResponse) EnsureClosed ¶
func (response *ServerResponse) EnsureClosed()
Directories
¶
Path | Synopsis |
---|---|
cancellable
Package cancellable provides helper function to cancel http requests.
|
Package cancellable provides helper function to cancel http requests. |