Documentation ¶
Overview ¶
Package ucloud is a package of utilities to setup ucloud sdk and improve using experience
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) AddHttpRequestHandler(h HttpRequestHandler) error
- func (c *Client) AddHttpResponseHandler(h HttpResponseHandler) error
- func (c *Client) AddRequestHandler(h RequestHandler) error
- func (c *Client) AddResponseHandler(h ResponseHandler) error
- func (c *Client) GenericInvoke(req request.GenericRequest) (response.GenericResponse, error)
- func (c *Client) GetConfig() *Config
- func (c *Client) GetCredential() *auth.Credential
- func (c *Client) GetLogger() log.Logger
- func (c *Client) GetMeta() ClientMeta
- func (c *Client) InvokeAction(action string, req request.Common, resp response.Common) error
- func (c *Client) InvokeActionWithPatcher(action string, req request.Common, resp response.Common, ...) error
- func (c *Client) NewGenericRequest() request.GenericRequest
- func (c *Client) SetHttpClient(httpClient http.Client) error
- func (c *Client) SetLogger(logger log.Logger)
- func (c *Client) SetTransport(transport stdhttp.RoundTripper)
- func (c *Client) SetupRequest(req request.Common) request.Common
- type ClientMeta
- type Config
- type HttpRequestHandler
- type HttpResponseHandler
- type RequestHandler
- type ResponseHandler
- type ServiceClient
Constants ¶
const Version = version.Version
Version is the version of sdk
Variables ¶
var ( String = request.String StringValue = request.StringValue Int = request.Int IntValue = request.IntValue Bool = request.Bool BoolValue = request.BoolValue Float64 = request.Float64 Float64Value = request.Float64Value TimeDuration = request.TimeDuration TimeDurationValue = request.TimeDurationValue )
var NewConfig = config.NewConfig
NewConfig will return a new client config with default options.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 客户端
func NewClient ¶
func NewClient(config *Config, credential *auth.Credential) *Client
NewClient will create an client of ucloud sdk
func NewClientWithMeta ¶ added in v0.10.1
func NewClientWithMeta(config *Config, credential *auth.Credential, meta ClientMeta) *Client
func (*Client) AddHttpRequestHandler ¶ added in v0.7.0
func (c *Client) AddHttpRequestHandler(h HttpRequestHandler) error
AddHttpRequestHandler will append a response handler to client
func (*Client) AddHttpResponseHandler ¶ added in v0.7.0
func (c *Client) AddHttpResponseHandler(h HttpResponseHandler) error
AddHttpResponseHandler will append a http response handler to client
func (*Client) AddRequestHandler ¶ added in v0.7.0
func (c *Client) AddRequestHandler(h RequestHandler) error
AddRequestHandler will append a response handler to client
func (*Client) AddResponseHandler ¶ added in v0.7.0
func (c *Client) AddResponseHandler(h ResponseHandler) error
AddResponseHandler will append a response handler to client
func (*Client) GenericInvoke ¶ added in v0.14.0
func (c *Client) GenericInvoke(req request.GenericRequest) (response.GenericResponse, error)
func (*Client) GetCredential ¶
func (c *Client) GetCredential() *auth.Credential
GetCredential will return the credential config of client.
func (*Client) GetMeta ¶ added in v0.10.1
func (c *Client) GetMeta() ClientMeta
GetMeta will return the meta data of client.
func (*Client) InvokeAction ¶
InvokeAction will do an action request from a request struct and set response value into res struct pointer
func (*Client) InvokeActionWithPatcher ¶
func (c *Client) InvokeActionWithPatcher(action string, req request.Common, resp response.Common, patches ...utils.Patch) error
InvokeActionWithPatcher will invoke action by patchers
func (*Client) NewGenericRequest ¶ added in v0.14.0
func (c *Client) NewGenericRequest() request.GenericRequest
func (*Client) SetHttpClient ¶ added in v0.7.0
SetHttpClient will setup a http client
func (*Client) SetTransport ¶ added in v0.22.0
func (c *Client) SetTransport(transport stdhttp.RoundTripper)
type ClientMeta ¶ added in v0.10.1
type ClientMeta struct {
Product string
}
type HttpRequestHandler ¶ added in v0.7.0
type HttpRequestHandler func(c *Client, req *http.HttpRequest) (*http.HttpRequest, error)
HttpRequestHandler receive http request and return a new http request
type HttpResponseHandler ¶ added in v0.8.4
type HttpResponseHandler func(c *Client, req *http.HttpRequest, resp *http.HttpResponse, err error) (*http.HttpResponse, error)
HttpResponseHandler receive http response and return a new http response
type RequestHandler ¶ added in v0.7.0
RequestHandler receive request and write data into this request memory area
type ResponseHandler ¶ added in v0.8.4
type ResponseHandler func(c *Client, req request.Common, resp response.Common, err error) (response.Common, error)
ResponseHandler receive response and write data into this response memory area
type ServiceClient ¶ added in v0.14.0
type ServiceClient interface { AddRequestHandler(h RequestHandler) error AddResponseHandler(h ResponseHandler) error AddHttpRequestHandler(h HttpRequestHandler) error AddHttpResponseHandler(h HttpResponseHandler) error }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package auth is the credential utilities of sdk
|
Package auth is the credential utilities of sdk |
Package uerr is the error definition of service and sdk
|
Package uerr is the error definition of service and sdk |
helpers
|
|
waiter
Package waiter is a helper package use for waiting remote state is transformed into target state.
|
Package waiter is a helper package use for waiting remote state is transformed into target state. |
Package log is the log utilities of sdk
|
Package log is the log utilities of sdk |
Package request is the request of service
|
Package request is the request of service |
Package response is the response of service
|
Package response is the response of service |
utest
|
|