connectivity

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2018 License: Apache-2.0 Imports: 9 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 {
	*http.Client
	// contains filtered or unexported fields
}

Client is a simple wrapper for http.Client

func NewHTTPClient

func NewHTTPClient(url string) *Client

NewHTTPClient returns a client that communicates over ip using a 30 second timeout

func NewHTTPClientWithTimeout

func NewHTTPClientWithTimeout(url string, timeout time.Duration) *Client

NewHTTPClientWithTimeout returns a client that communicates over ip

func NewHTTPSClient

func NewHTTPSClient(url string, transport http.RoundTripper) *Client

NewHTTPSClient returns a new https client

func NewHTTPSClientWithTimeout

func NewHTTPSClientWithTimeout(url string, transport http.RoundTripper, timeout time.Duration) *Client

NewHTTPSClientWithTimeout returns a client that communicates over ip with tls :

func NewSocketClient

func NewSocketClient(filename string) *Client

NewSocketClient returns a client that communicates over a unix socket using a 30 second connect timeout

func NewSocketClientWithTimeout

func NewSocketClientWithTimeout(filename string, timeout time.Duration) *Client

NewSocketClientWithTimeout returns a client that communicates over a unix file socket

func (*Client) DoJSON

func (client *Client) DoJSON(r *Request) error

DoJSON action on path. payload and response are expected to be structs that decode/encode from/to json Example action=POST, path=/VolumeDriver.Create ... Tries 3 times to get data from the server

type Request

type Request struct {
	//Action to take, ie: GET, POST, PUT, PATCH, DELETE
	Action string
	//Path is the URI
	Path string
	//Payload to send (may be nil)
	Payload interface{}
	//Response to marshal into (may be nil)
	Response interface{}
	//ResponseError to marshal error into (may be nil)
	ResponseError interface{}
}

Request encapsulates a request to the Do* family of functions

Jump to

Keyboard shortcuts

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