sdk

package
v0.0.0-...-5458e1c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 NewClient

func NewClient() (client *Client, err error)

NewClient return SDK client

func NewClientWithAccessKey

func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error)

NewClientWithAccessKey create client with accessKeyId and accessKeySecret

func NewClientWithEcsRamRole

func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error)

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 NewClientWithRRSA

func NewClientWithRRSA(regionId, roleARN, oidcProviderARN, oidcTokenFilePath, roleSessionName string) (client *Client, err error)

NewClientWithRRSA create client with RRSA on ECS

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

func NewClientWithStsRoleNameOnEcs(regionId string, roleName string) (client *Client, err error)

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

func (client *Client) AddAsyncTask(task func()) (err error)

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

func (client *Client) EnableAsync(routinePoolSize, maxTaskQueueSize int)

EnableAsync enable async task queue

func (*Client) GetConfig

func (client *Client) GetConfig() *Config

GetConfig return client config

func (*Client) Init

func (client *Client) Init() (err error)

Init not support yet

func (*Client) InitClientConfig

func (client *Client) InitClientConfig() (config *Config)

InitClientConfig init client config

func (*Client) InitWithAccessKey

func (client *Client) InitWithAccessKey(regionId, accessKeyId, accessKeySecret string) (err error)

InitWithAccessKey need accessKeyId and accessKeySecret

func (*Client) InitWithEcsRamRole

func (client *Client) InitWithEcsRamRole(regionId, roleName string) (err error)

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) InitWithRRSA

func (client *Client) InitWithRRSA(regionId, roleARN, oidcProviderARN, oidcTokenFilePath, roleSessionName string) (err error)

InitWithRRSA need regionId,roleARN,oidcProviderARN,oidcTokenFilePath and roleSessionName

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

func (*Client) Shutdown

func (client *Client) Shutdown()

Shutdown destruction of client

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 NewConfig

func NewConfig() (config *Config)

NewConfig returns client config

func (*Config) WithAutoRetry

func (c *Config) WithAutoRetry(isAutoRetry bool) *Config

WithAutoRetry set client with retry

func (*Config) WithDebug

func (c *Config) WithDebug(isDebug bool) *Config

WithDebug set client debug mode

func (*Config) WithEnableAsync

func (c *Config) WithEnableAsync(isEnableAsync bool) *Config

WithEnableAsync enable client async option

func (*Config) WithGoRoutinePoolSize

func (c *Config) WithGoRoutinePoolSize(goRoutinePoolSize int) *Config

WithGoRoutinePoolSize set client go routine pool size

func (*Config) WithHttpTransport

func (c *Config) WithHttpTransport(httpTransport *http.Transport) *Config

WithHttpTransport set client custom http transport

func (*Config) WithMaxRetryTime

func (c *Config) WithMaxRetryTime(maxRetryTime int) *Config

WithMaxRetryTime set client with max retry times

func (*Config) WithMaxTaskQueueSize

func (c *Config) WithMaxTaskQueueSize(maxTaskQueueSize int) *Config

WithMaxTaskQueueSize set client max task queue size

func (*Config) WithTimeout

func (c *Config) WithTimeout(timeout time.Duration) *Config

WithTimeout set client timeout

func (*Config) WithUserAgent

func (c *Config) WithUserAgent(userAgent string) *Config

WithUserAgent set client user agent

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL