Documentation ¶
Index ¶
- Constants
- func GenTLSConfig(key, cert, ca string) (*tls.Config, error)
- func NewHTTPClient(u *url.URL, tlsConfig *tls.Config, dialTimeout time.Duration) *http.Client
- func ParseHost(host string) (*url.URL, string, string, error)
- type APIClient
- func (client *APIClient) BaseURL() string
- func (client *APIClient) GetAPIPath(path string, query url.Values) string
- func (client *APIClient) PeerCreate(ctx context.Context, request *types.PeerCreateRequest) (peerCreateResponse *types.PeerCreateResponse, err error)
- func (client *APIClient) PeerDelete(ctx context.Context, id string) error
- func (client *APIClient) PeerInfo(ctx context.Context, id string) (peerInfoResponse *types.PeerInfo, err error)
- func (client *APIClient) PeerList(ctx context.Context, id string) (peersInfoResponse []*types.PeerInfo, err error)
- func (client *APIClient) Ping(ctx context.Context) (string, error)
- func (client *APIClient) PreheatCreate(ctx context.Context, config *types.PreheatCreateRequest) (preheatCreateResponse *types.PreheatCreateResponse, err error)
- func (client *APIClient) PreheatInfo(ctx context.Context, id string) (preheatInfoResponse *types.PreheatInfo, err error)
- func (client *APIClient) PreheatList(ctx context.Context, id string) ([]*types.PreheatInfo, error)
- func (client *APIClient) TaskCreate(ctx context.Context, request *types.TaskCreateRequest) (taskCreateResponse *types.TaskCreateResponse, err error)
- func (client *APIClient) TaskDelete(ctx context.Context, id string) error
- func (client *APIClient) TaskInfo(ctx context.Context, id string) (taskInfoResponse *types.TaskInfo, err error)
- func (client *APIClient) TaskUpdate(ctx context.Context, id string, config *types.TaskUpdateRequest) error
- func (client *APIClient) UpdateClientVersion(v string)
- type CommonAPIClient
- type PeerAPIClient
- type PreheatAPIClient
- type RespError
- type Response
- type TLSConfig
- type TaskAPIClient
Constants ¶
const ( // UnixScheme is a scheme for unix. UnixScheme = "unix" // TCPScheme is a scheme for TCP. TCPScheme = "tcp" // HTTPScheme is a scheme for HTTP. HTTPScheme = "http" // HTTPSScheme is a scheme for HTTPS. HTTPSScheme = "https" )
Variables ¶
This section is empty.
Functions ¶
func GenTLSConfig ¶
GenTLSConfig returns a TLS config object according to inputting parameters.
func NewHTTPClient ¶
NewHTTPClient creates a http client using url and tlsconfig.
Types ¶
type APIClient ¶
APIClient is an API client that performs all operations. against a server
func (*APIClient) GetAPIPath ¶
GetAPIPath returns the versioned request path to call the api. It appends the query parameters to the path if they are not empty.
func (*APIClient) PeerCreate ¶
func (client *APIClient) PeerCreate(ctx context.Context, request *types.PeerCreateRequest) (peerCreateResponse *types.PeerCreateResponse, err error)
PeerCreate creates a peer node in supernode.
func (*APIClient) PeerDelete ¶
PeerDelete deletes the specified peer in supernode.
func (*APIClient) PeerInfo ¶
func (client *APIClient) PeerInfo(ctx context.Context, id string) (peerInfoResponse *types.PeerInfo, err error)
PeerInfo gets detailed information of a peer in supernode.
func (*APIClient) PeerList ¶
func (client *APIClient) PeerList(ctx context.Context, id string) (peersInfoResponse []*types.PeerInfo, err error)
PeerList lists detailed information of all peers in supernode.
func (*APIClient) PreheatCreate ¶
func (client *APIClient) PreheatCreate(ctx context.Context, config *types.PreheatCreateRequest) (preheatCreateResponse *types.PreheatCreateResponse, err error)
PreheatCreate creates a preheat task.
func (*APIClient) PreheatInfo ¶
func (client *APIClient) PreheatInfo(ctx context.Context, id string) (preheatInfoResponse *types.PreheatInfo, err error)
PreheatInfo gets detailed information of a preheat task.
func (*APIClient) PreheatList ¶
PreheatList lists detailed information of preheat tasks.
func (*APIClient) TaskCreate ¶ added in v1.0.0
func (client *APIClient) TaskCreate(ctx context.Context, request *types.TaskCreateRequest) (taskCreateResponse *types.TaskCreateResponse, err error)
TaskCreate creates a task in supernode.
func (*APIClient) TaskDelete ¶ added in v0.4.3
TaskDelete deletes the specified task in supernode.
func (*APIClient) TaskInfo ¶ added in v0.4.3
func (client *APIClient) TaskInfo(ctx context.Context, id string) (taskInfoResponse *types.TaskInfo, err error)
TaskInfo gets detailed information of a task in supernode.
func (*APIClient) TaskUpdate ¶ added in v0.4.3
func (client *APIClient) TaskUpdate(ctx context.Context, id string, config *types.TaskUpdateRequest) error
TaskUpdate updates a task in supernode.
func (*APIClient) UpdateClientVersion ¶
UpdateClientVersion sets client version new value.
type CommonAPIClient ¶
type CommonAPIClient interface { PreheatAPIClient PeerAPIClient TaskAPIClient }
CommonAPIClient defines common methods of api client.
func NewAPIClient ¶
func NewAPIClient(host string, tls TLSConfig) (CommonAPIClient, error)
NewAPIClient initializes a new API client for the given host.
type PeerAPIClient ¶ added in v1.0.1
type PeerAPIClient interface { PeerCreate(ctx context.Context, request *types.PeerCreateRequest) (peerCreateResponse *types.PeerCreateResponse, err error) PeerDelete(ctx context.Context, id string) error PeerInfo(ctx context.Context, id string) (peerInfoResponse *types.PeerInfo, err error) PeerList(ctx context.Context, id string) (peersInfoResponse []*types.PeerInfo, err error) }
PeerAPIClient defines methods of peer related client.
type PreheatAPIClient ¶
type PreheatAPIClient interface { PreheatCreate(ctx context.Context, request *types.PreheatCreateRequest) (preheatCreateResponse *types.PreheatCreateResponse, err error) PreheatInfo(ctx context.Context, id string) (preheatInfoResponse *types.PreheatInfo, err error) }
PreheatAPIClient defines methods of Container client.
type RespError ¶
type RespError struct {
// contains filtered or unexported fields
}
RespError defines the response error.
type Response ¶
type Response struct { StatusCode int Status string Body io.ReadCloser }
Response wraps the http.Response and other states.
type TLSConfig ¶
type TLSConfig struct { CA string `json:"tlscacert,omitempty"` Cert string `json:"tlscert,omitempty"` Key string `json:"tlskey,omitempty"` VerifyRemote bool `json:"tlsverify,omitempty"` ManagerWhiteList string `json:"manager-whitelist,omitempty"` }
TLSConfig contains information of TLS which users can specify.
type TaskAPIClient ¶ added in v1.0.1
type TaskAPIClient interface { TaskCreate(ctx context.Context, request *types.TaskCreateRequest) (taskCreateResponse *types.TaskCreateResponse, err error) TaskDelete(ctx context.Context, id string) error TaskInfo(ctx context.Context, id string) (taskInfoResponse *types.TaskInfo, err error) TaskUpdate(ctx context.Context, id string, config *types.TaskUpdateRequest) error }
TaskAPIClient defines methods of task related client.