Documentation ¶
Index ¶
- func NewBearerAuthRoundTrippers(username string, pass string, nextRT http.RoundTripper) http.RoundTripper
- func NewTLSConfig(opts *TLSOptions) (*tls.Config, error)
- type Client
- func (c *Client) APIVersion(ver string) *Client
- func (c *Client) BlockVolumeInfo(hostvolume, blockname string) (*api.BlockVolumeInfoResponse, error)
- func (c *Client) CreateBlockVolume(hostvolume, blockname string, req *api.BlockVolumeCreateReq) (*api.BlockVolumeCreateResp, error)
- func (c *Client) DeleteBlockVolume(hostvolume, blockname string, req *api.BlockVolumeDeleteReq) error
- func (c *Client) Do(reqBody interface{}, successV interface{}) error
- func (c *Client) ListBlockVolumes(hostvolume string) (*api.BlockVolumeListResponse, error)
- func (c *Client) Path(path string) *Client
- func (c *Client) Verb(method string) *Client
- type ErrorResponse
- type GlusterBlockClient
- type OptFuncs
- type TLSOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBearerAuthRoundTrippers ¶
func NewBearerAuthRoundTrippers(username string, pass string, nextRT http.RoundTripper) http.RoundTripper
NewBearerAuthRoundTrippers applies a Authorization header to a request with value set as bearer token formed using given username and password. It wraps a http Roundtripper
func NewTLSConfig ¶
func NewTLSConfig(opts *TLSOptions) (*tls.Config, error)
NewTLSConfig returns TLS configuration meant to be used by Gluster-Block rest client
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is concrete instance implementing the GlusterBlockClient interface
func NewClientWithOpts ¶
NewClientWithOpts initializes a default GlusterBlockClient with host addr set as provided baseURL. It takes functors to modify its members while creating.
func (*Client) APIVersion ¶
APIVersion sets api version for a request
func (*Client) BlockVolumeInfo ¶
func (c *Client) BlockVolumeInfo(hostvolume, blockname string) (*api.BlockVolumeInfoResponse, error)
BlockVolumeInfo gives info about a given block volume
func (*Client) CreateBlockVolume ¶
func (c *Client) CreateBlockVolume(hostvolume, blockname string, req *api.BlockVolumeCreateReq) (*api.BlockVolumeCreateResp, error)
CreateBlockVolume creates a block volume
func (*Client) DeleteBlockVolume ¶
func (c *Client) DeleteBlockVolume(hostvolume, blockname string, req *api.BlockVolumeDeleteReq) error
DeleteBlockVolume deletes a block volume
func (*Client) Do ¶
Do sends an HTTP request and decode the response in successV if status code lies in [200,400). An error is returned if server responds with error or status code does not lies in [200,400)
func (*Client) ListBlockVolumes ¶
func (c *Client) ListBlockVolumes(hostvolume string) (*api.BlockVolumeListResponse, error)
ListBlockVolumes will list all block volumes present in given hosting volume
type ErrorResponse ¶
ErrorResponse embeds server error response schema with returned http status code It implements `error` interface
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
Error returns json representation of ErrorResponse
type GlusterBlockClient ¶
type GlusterBlockClient interface { CreateBlockVolume(hostvolume string, blockname string, req *api.BlockVolumeCreateReq) (*api.BlockVolumeCreateResp, error) DeleteBlockVolume(hostvolume string, blockname string, req *api.BlockVolumeDeleteReq) error ListBlockVolumes(hostvolume string) (*api.BlockVolumeListResponse, error) BlockVolumeInfo(hostvolume string, blockname string) (*api.BlockVolumeInfoResponse, error) }
GlusterBlockClient is an interface for all block operations method
type OptFuncs ¶
OptFuncs receives a Client and overrides its members It will set the optional parameter of Client while creating
func WithHTTPClient ¶
WithHTTPClient overrides http Client with specified one.
func WithTLSConfig ¶
func WithTLSConfig(tlsOpts *TLSOptions) OptFuncs
WithTLSConfig applies tls config to underlying http.Client Transport
func WithTimeOut ¶
WithTimeOut overrides Client timeout with specified one
type TLSOptions ¶
TLSOptions holds the TLS configurations information needed to create Gluster-Block rest client .