Documentation ¶
Index ¶
- Variables
- type Client
- func NewClient() (client *Client, err error)
- func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error)
- func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error)
- func NewClientWithOptions(regionId string, config *Config, credential auth.Credential) (client *Client, err error)
- func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error)
- func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error)
- func NewClientWithStsRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error)
- func NewClientWithStsRoleNameOnEcs(regionId string, roleName string) (client *Client, err error)
- func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error)
- func (client *Client) AddAsyncTask(task func()) (err error)
- func (client *Client) BuildRequestWithSigner(request requests.AcsRequest, signer auth.Signer) (err error)
- func (client *Client) DoAction(request requests.AcsRequest, response responses.AcsResponse) (err error)
- func (client *Client) DoActionWithSigner(request requests.AcsRequest, response responses.AcsResponse, ...) (err error)
- func (client *Client) EnableAsync(routinePoolSize, maxTaskQueueSize int)
- func (client *Client) GetConfig() *Config
- func (client *Client) Init() (err error)
- func (client *Client) InitClientConfig() (config *Config)
- func (client *Client) InitWithAccessKey(regionId, accessKeyId, accessKeySecret string) (err error)
- func (client *Client) InitWithEcsRamRole(regionId, roleName string) (err error)
- func (client *Client) InitWithOptions(regionId string, config *Config, credential auth.Credential) (err error)
- func (client *Client) InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (err error)
- func (client *Client) InitWithRsaKeyPair(regionId, publicKeyId, privateKey string, sessionExpiration int) (err error)
- func (client *Client) InitWithStsToken(regionId, accessKeyId, accessKeySecret, securityToken string) (err error)
- func (client *Client) ProcessCommonRequest(request *requests.CommonRequest) (response *responses.CommonResponse, err error)
- func (client *Client) ProcessCommonRequestWithSigner(request *requests.CommonRequest, signerInterface interface{}) (response *responses.CommonResponse, err error)
- func (client *Client) Shutdown()
- type Config
- func (c *Config) WithAutoRetry(isAutoRetry bool) *Config
- func (c *Config) WithDebug(isDebug bool) *Config
- func (c *Config) WithEnableAsync(isEnableAsync bool) *Config
- func (c *Config) WithGoRoutinePoolSize(goRoutinePoolSize int) *Config
- func (c *Config) WithHttpTransport(httpTransport *http.Transport) *Config
- func (c *Config) WithMaxRetryTime(maxRetryTime int) *Config
- func (c *Config) WithMaxTaskQueueSize(maxTaskQueueSize int) *Config
- func (c *Config) WithTimeout(timeout time.Duration) *Config
- func (c *Config) WithUserAgent(userAgent string) *Config
Constants ¶
This section is empty.
Variables ¶
var Version = "0.0.1"
Version value will be replaced while build: -ldflags="-X sdk.version=x.x.x"
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is common SDK client
func NewClientWithAccessKey ¶
func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error)
NewClientWithAccessKey create client with accessKeyId and accessKeySecret
func NewClientWithEcsRamRole ¶
NewClientWithEcsRamRole create client with ramRole on ECS
func NewClientWithOptions ¶
func NewClientWithOptions(regionId string, config *Config, credential auth.Credential) (client *Client, err error)
NewClientWithOptions create client with options
func NewClientWithRamRoleArn ¶
func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error)
NewClientWithRamRoleArn create client with ramRoleArn
func NewClientWithRsaKeyPair ¶
func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error)
NewClientWithRsaKeyPair create client with key-pair
func NewClientWithStsRoleArn ¶
func NewClientWithStsRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error)
NewClientWithStsRoleArn is deprecated: Use NewClientWithRamRoleArn in this package instead.
func NewClientWithStsRoleNameOnEcs ¶
NewClientWithStsRoleNameOnEcs is deprecated: Use NewClientWithEcsRamRole in this package instead.
func NewClientWithStsToken ¶
func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error)
NewClientWithStsToken create client with stsToken
func (*Client) AddAsyncTask ¶
AddAsyncTask create async task only block when any one of the following occurs: 1. the asyncTaskQueue is full, increase the queue size to avoid this 2. Shutdown() in progressing, the client is being closed
func (*Client) BuildRequestWithSigner ¶
func (client *Client) BuildRequestWithSigner(request requests.AcsRequest, signer auth.Signer) (err error)
BuildRequestWithSigner build request signer
func (*Client) DoAction ¶
func (client *Client) DoAction(request requests.AcsRequest, response responses.AcsResponse) (err error)
DoAction do request to open api
func (*Client) DoActionWithSigner ¶
func (client *Client) DoActionWithSigner(request requests.AcsRequest, response responses.AcsResponse, signer auth.Signer) (err error)
DoActionWithSigner do action with signer
func (*Client) EnableAsync ¶
EnableAsync enable async task queue
func (*Client) InitClientConfig ¶
InitClientConfig init client config
func (*Client) InitWithAccessKey ¶
InitWithAccessKey need accessKeyId and accessKeySecret
func (*Client) InitWithEcsRamRole ¶
InitWithEcsRamRole need regionId and roleName
func (*Client) InitWithOptions ¶
func (client *Client) InitWithOptions(regionId string, config *Config, credential auth.Credential) (err error)
InitWithOptions provide options such as regionId and auth
func (*Client) InitWithRamRoleArn ¶
func (client *Client) InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (err error)
InitWithRamRoleArn need regionId,accessKeyId,accessKeySecret,roleArn and roleSessionName
func (*Client) InitWithRsaKeyPair ¶
func (client *Client) InitWithRsaKeyPair(regionId, publicKeyId, privateKey string, sessionExpiration int) (err error)
InitWithRsaKeyPair need key pair
func (*Client) InitWithStsToken ¶
func (client *Client) InitWithStsToken(regionId, accessKeyId, accessKeySecret, securityToken string) (err error)
InitWithStsToken need regionId,accessKeyId,accessKeySecret and securityToken
func (*Client) ProcessCommonRequest ¶
func (client *Client) ProcessCommonRequest(request *requests.CommonRequest) (response *responses.CommonResponse, err error)
ProcessCommonRequest do action with common request
func (*Client) ProcessCommonRequestWithSigner ¶
func (client *Client) ProcessCommonRequestWithSigner(request *requests.CommonRequest, signerInterface interface{}) (response *responses.CommonResponse, err error)
ProcessCommonRequestWithSigner do action with common request and singer
type Config ¶
type Config struct { AutoRetry bool `default:"true"` MaxRetryTime int `default:"3"` UserAgent string `default:""` Debug bool `default:"false"` Timeout time.Duration `default:"10000000000"` HttpTransport *http.Transport `default:""` EnableAsync bool `default:"false"` MaxTaskQueueSize int `default:"1000"` GoRoutinePoolSize int `default:"5"` Scheme string `default:"HTTP"` }
Config is SDK client options
func (*Config) WithAutoRetry ¶
WithAutoRetry set client with retry
func (*Config) WithEnableAsync ¶
WithEnableAsync enable client async option
func (*Config) WithGoRoutinePoolSize ¶
WithGoRoutinePoolSize set client go routine pool size
func (*Config) WithHttpTransport ¶
WithHttpTransport set client custom http transport
func (*Config) WithMaxRetryTime ¶
WithMaxRetryTime set client with max retry times
func (*Config) WithMaxTaskQueueSize ¶
WithMaxTaskQueueSize set client max task queue size
func (*Config) WithTimeout ¶
WithTimeout set client timeout
func (*Config) WithUserAgent ¶
WithUserAgent set client user agent