sdk

package
v0.0.0-...-432dbe7 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultUserAgent = fmt.Sprintf("lansexiongdi (%s; %s) Golang/%s Core/%s", runtime.GOOS, runtime.GOARCH, strings.Trim(runtime.Version(), "go"), Version)
View Source
var Version = "1.0.0"

Version this value will be replaced while build: -ldflags="-X sdk.version=x.x.x"

Functions

func Timeout

func Timeout(connectTimeout time.Duration) func(cxt context.Context, net, addr string) (c net.Conn, err error)

func TransToString

func TransToString(object interface{}) string

Types

type Client

type Client struct {
	EndpointMap  map[string]string
	EndpointType string
	Network      string
	Domain       string
	Scheme       string
	// contains filtered or unexported fields
}

Client the type Client

func NewClientWithAccessKey

func NewClientWithAccessKey(secretKey string, scheme string, domain string) (client *Client, err error)

func (*Client) AppendUserAgent

func (client *Client) AppendUserAgent(key, value string)

func (*Client) BuildRequestWithSigner

func (client *Client) BuildRequestWithSigner(request requests.AcsRequest, signer auth.Signer) (err error)

func (*Client) CloseLogger

func (client *Client) CloseLogger()

func (*Client) DoAction

func (client *Client) DoAction(request requests.AcsRequest, response responses.AcsResponse) (err error)

func (*Client) DoActionWithSigner

func (client *Client) DoActionWithSigner(request requests.AcsRequest, response responses.AcsResponse, signer auth.Signer) (err error)

func (*Client) GetConfig

func (client *Client) GetConfig() *Config

func (*Client) GetConnectTimeout

func (client *Client) GetConnectTimeout() time.Duration

func (*Client) GetHTTPSInsecure

func (client *Client) GetHTTPSInsecure() bool

func (*Client) GetHttpProxy

func (client *Client) GetHttpProxy() string

func (*Client) GetHttpsProxy

func (client *Client) GetHttpsProxy() string

func (*Client) GetLogger

func (client *Client) GetLogger() *Logger

func (*Client) GetLoggerMsg

func (client *Client) GetLoggerMsg() string

func (*Client) GetNoProxy

func (client *Client) GetNoProxy() string

func (*Client) GetReadTimeout

func (client *Client) GetReadTimeout() time.Duration

func (*Client) GetSigner

func (client *Client) GetSigner() auth.Signer

func (*Client) GetTemplate

func (client *Client) GetTemplate() string

func (*Client) Init

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

func (*Client) InitClientConfig

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

func (*Client) InitWithAccessKey

func (client *Client) InitWithAccessKey(secretKey string) (err error)

func (*Client) InitWithOptions

func (client *Client) InitWithOptions(config *Config, credential auth.Credential) (err error)

func (*Client) OpenLogger

func (client *Client) OpenLogger()

func (*Client) ProcessCommonRequest

func (client *Client) ProcessCommonRequest(request *requests.CommonRequest) (response *responses.CommonResponse, err error)

func (*Client) SetConnectTimeout

func (client *Client) SetConnectTimeout(connectTimeout time.Duration)

func (*Client) SetEndpointRules

func (client *Client) SetEndpointRules(endpointMap map[string]string, endpointType string, netWork string)

func (*Client) SetHTTPSInsecure

func (client *Client) SetHTTPSInsecure(isInsecure bool)

func (*Client) SetHttpProxy

func (client *Client) SetHttpProxy(httpProxy string)

func (*Client) SetHttpsProxy

func (client *Client) SetHttpsProxy(httpsProxy string)

func (*Client) SetLogger

func (client *Client) SetLogger(level string, channel string, out io.Writer, template string)

func (*Client) SetNoProxy

func (client *Client) SetNoProxy(noProxy string)

func (*Client) SetReadTimeout

func (client *Client) SetReadTimeout(readTimeout time.Duration)

func (*Client) SetSigner

func (client *Client) SetSigner(signer auth.Signer)

func (*Client) SetTemplate

func (client *Client) SetTemplate(template string)

func (*Client) SetTransport

func (client *Client) SetTransport(transport http.RoundTripper)

func (*Client) Shutdown

func (client *Client) Shutdown()

type Config

type Config struct {
	AutoRetry         bool              `default:"false"`
	MaxRetryTime      int               `default:"3"`
	UserAgent         string            `default:""`
	Debug             bool              `default:"false"`
	HttpTransport     *http.Transport   `default:""`
	Transport         http.RoundTripper `default:""`
	EnableAsync       bool              `default:"false"`
	MaxTaskQueueSize  int               `default:"1000"`
	GoRoutinePoolSize int               `default:"5"`
	Scheme            string            `default:"HTTP"`
	Timeout           time.Duration
}

func NewConfig

func NewConfig() (config *Config)

func (*Config) WithAutoRetry

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

func (*Config) WithDebug

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

func (*Config) WithEnableAsync

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

func (*Config) WithGoRoutinePoolSize

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

func (*Config) WithHttpTransport

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

func (*Config) WithMaxRetryTime

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

func (*Config) WithMaxTaskQueueSize

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

func (*Config) WithScheme

func (c *Config) WithScheme(scheme string) *Config

func (*Config) WithTimeout

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

func (*Config) WithUserAgent

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

type Logger

type Logger struct {
	*log.Logger
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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