client

package
v0.0.0-...-1b9e8c6 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// VolumePath is volume path url prefix
	VolumePath = "/volume"

	// StoragePath is storage path url prefix
	StoragePath = "/storage"
)

Functions

func JoinURL

func JoinURL(api string, s ...string) (string, error)

JoinURL is used to check "api" and join url.

Types

type Client

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

Client represents a client connect to control server.

func New

func New() *Client

New is used to initialize client class object.

func NewWithTLS

func NewWithTLS(tlsc *tls.Config) *Client

NewWithTLS is used to initialize client class object with tls.

func (*Client) Create

func (c *Client) Create(url string, obj serializer.Object) error

Create is used to create "obj" with url on control server.

func (*Client) Delete

func (c *Client) Delete(url string, obj serializer.Object) error

Delete is used to delete "obj" with url on control server.

func (*Client) Get

func (c *Client) Get(url string, obj serializer.Object) error

Get returns "obj" content with url on control server.

func (*Client) ListKeys

func (c *Client) ListKeys(url string, obj serializer.Object) error

ListKeys returns "obj" with url that contains labels or keys.

func (*Client) Update

func (c *Client) Update(url string, obj serializer.Object) error

Update is used to update "obj" with url on control server.

type Error

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

Error is defined as client error.

func (Error) Error

func (e Error) Error() string

Error returns client Error's error message.

func (Error) IsNotFound

func (e Error) IsNotFound() bool

IsNotFound will check the error is "StatusNotFound" or not.

type HTTPClient

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

HTTPClient represents a client connect to http server.

func DELETE

func DELETE() *HTTPClient

DELETE used to implement HTTPClient DELETE method.

func GET

func GET() *HTTPClient

GET used to implement HTTPClient GET method.

func HTTPClientNew

func HTTPClientNew() *HTTPClient

HTTPClientNew returns HTTPClient class object.

func POST

func POST() *HTTPClient

POST used to implement HTTPClient POST method.

func PUT

func PUT() *HTTPClient

PUT used to implement http PUT method.

func (*HTTPClient) Body

func (c *HTTPClient) Body(obj serializer.Object) *HTTPClient

Body is used to set body with map[string]string type, and then returns HTTPClient object.

func (*HTTPClient) DELETE

func (c *HTTPClient) DELETE() *HTTPClient

DELETE used to implement HTTPClient DELETE method and then returns HTTPClient

func (*HTTPClient) Do

func (c *HTTPClient) Do() *HTTPClient

Do used to deal http request and then returns HTTPClient object.

func (*HTTPClient) Err

func (c *HTTPClient) Err() error

Err returns HTTPClient's error.

func (*HTTPClient) GET

func (c *HTTPClient) GET() *HTTPClient

GET used to implement HTTPClient GET method and then returns HTTPClient

func (*HTTPClient) Into

func (c *HTTPClient) Into(obj serializer.Object) error

Into used to set obj into body.

func (*HTTPClient) JSONBody

func (c *HTTPClient) JSONBody(obj serializer.Object) *HTTPClient

JSONBody is used to set body with json format and then returns HTTPClient object.

func (*HTTPClient) Method

func (c *HTTPClient) Method(method string) *HTTPClient

Method used to implement HTTPClient method that specified by caller, and then returns HTTPClient object.

func (*HTTPClient) POST

func (c *HTTPClient) POST() *HTTPClient

POST used to implement HTTPClient POST method and then returns HTTPClient

func (*HTTPClient) PUT

func (c *HTTPClient) PUT() *HTTPClient

PUT used to implement HTTPClient PUT method and then returns HTTPClient

func (*HTTPClient) Query

func (c *HTTPClient) Query(obj serializer.Object) *HTTPClient

Query is used to set query and then returns HTTPClient object.

func (*HTTPClient) RespCodeEqual

func (c *HTTPClient) RespCodeEqual(code int) bool

RespCodeEqual check HTTPClient's code is equal with "code" or not.

func (*HTTPClient) SetHeader

func (c *HTTPClient) SetHeader(key, value string) *HTTPClient

SetHeader is used to set header and then returns HTTPClient object.

func (*HTTPClient) StatusCode

func (c *HTTPClient) StatusCode() int

StatusCode returns HTTPClient code.

func (*HTTPClient) TLS

func (c *HTTPClient) TLS(ca, cert, key []byte) (*HTTPClient, error)

TLS is used to set tls config with ca, cert and key.

func (*HTTPClient) TLSConfig

func (c *HTTPClient) TLSConfig(tlsc *tls.Config) *HTTPClient

TLSConfig is used to set tls config with specified config.

func (*HTTPClient) URL

func (c *HTTPClient) URL(rawurl string) *HTTPClient

URL is used to set url and then returns HTTPClient object.

Jump to

Keyboard shortcuts

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