Documentation ¶
Index ¶
- Variables
- func JoinURL(api string, s ...string) (string, error)
- type Client
- func (c *Client) Create(url string, obj serializer.Object) error
- func (c *Client) Delete(url string, obj serializer.Object) error
- func (c *Client) Get(url string, obj serializer.Object) error
- func (c *Client) ListKeys(url string, obj serializer.Object) error
- func (c *Client) Update(url string, obj serializer.Object) error
- type Error
- type HTTPClient
- func (c *HTTPClient) Body(obj serializer.Object) *HTTPClient
- func (c *HTTPClient) DELETE() *HTTPClient
- func (c *HTTPClient) Do() *HTTPClient
- func (c *HTTPClient) Err() error
- func (c *HTTPClient) GET() *HTTPClient
- func (c *HTTPClient) Into(obj serializer.Object) error
- func (c *HTTPClient) JSONBody(obj serializer.Object) *HTTPClient
- func (c *HTTPClient) Method(method string) *HTTPClient
- func (c *HTTPClient) POST() *HTTPClient
- func (c *HTTPClient) PUT() *HTTPClient
- func (c *HTTPClient) Query(obj serializer.Object) *HTTPClient
- func (c *HTTPClient) RespCodeEqual(code int) bool
- func (c *HTTPClient) SetHeader(key, value string) *HTTPClient
- func (c *HTTPClient) StatusCode() int
- func (c *HTTPClient) TLS(ca, cert, key []byte) (*HTTPClient, error)
- func (c *HTTPClient) TLSConfig(tlsc *tls.Config) *HTTPClient
- func (c *HTTPClient) URL(rawurl string) *HTTPClient
Constants ¶
This section is empty.
Variables ¶
var ( // VolumePath is volume path url prefix VolumePath = "/volume" // StoragePath is storage path url prefix StoragePath = "/storage" )
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client connect to control server.
func NewWithTLS ¶
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.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is defined as client error.
func (Error) IsNotFound ¶
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 HTTPClientNew ¶
func HTTPClientNew() *HTTPClient
HTTPClientNew returns HTTPClient class object.
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) 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.