profile

package
v3.0.1190+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExponentialBackoff

func ExponentialBackoff(index int) time.Duration

Types

type ClientProfile

type ClientProfile struct {
	HttpProfile *HttpProfile
	// SignMethod specifies the signing algorithm used for request signatures.
	// Valid options: "HmacSHA1", "HmacSHA256", "TC3-HMAC-SHA256".
	// Default value is "TC3-HMAC-SHA256".
	SignMethod string

	// UnsignedPayload indicates whether the payload is unsigned.
	UnsignedPayload bool

	// Language specifies the language of the client profile.
	// Valid options: "zh-CN" (Chinese), "en-US" (English).
	// Default value is "zh-CN".
	Language string

	// Debug enables or disables debug output for client operations.
	Debug bool

	// DisableRegionBreaker determines whether to enable the Regional auto switch.
	// The SDK uses ap-guangzhou.tencentcloudapi.com as the default backup endpoint.
	// You can override this by specifying the BackupEndpoint.
	DisableRegionBreaker bool

	// BackupEndPoint specifies an alternative endpoint to use by region breaker.
	// Deprecated: Use BackupEndpoint instead.
	BackupEndPoint string
	BackupEndpoint string

	// NetworkFailureMaxRetries defines the maximum number of retries when a network failure occurs.
	NetworkFailureMaxRetries int
	// NetworkFailureRetryDuration is a function that determines the retry duration between network failure retries.
	NetworkFailureRetryDuration DurationFunc

	// RateLimitExceededMaxRetries defines the maximum number of retries when rate limit is exceeded.
	RateLimitExceededMaxRetries int
	// RateLimitExceededRetryDuration is a function that determines the retry duration between rate limit exceeded retries.
	RateLimitExceededRetryDuration DurationFunc

	// Configure this client to retry or not when a connectivity problem is encountered.
	// This differs from NetworkFailureMaxRetries that it will retry regardless of any request.
	// NetworkFailureMaxRetries only retry request with field "ClientToken".
	UnsafeRetryOnConnectionFailure bool
}

func NewClientProfile

func NewClientProfile() *ClientProfile

type DurationFunc

type DurationFunc func(index int) time.Duration

func ConstantDurationFunc

func ConstantDurationFunc(duration time.Duration) DurationFunc

type HttpProfile

type HttpProfile struct {
	// ReqMethod specifies the HTTP request method (e.g., "GET", "POST").
	// Default: "POST".
	ReqMethod string

	// ReqTimeout defines the request timeout in seconds.
	// This determines how long the client will wait for a response before timing out.
	// Default: 60 seconds.
	ReqTimeout int

	// Deprecated: Use Scheme instead.
	Protocol string
	// Scheme specifies the protocol scheme to use for the request (e.g., "HTTP", "HTTPS").
	// Default: "HTTPS".
	Scheme string

	// RootDomain specifies the root domain for the API request.
	// This is often used as a base for constructing the full API endpoint.
	// Default: "".
	RootDomain string

	// Endpoint specifies the specific API endpoint to which the request is sent.
	// This can be a full URL or a domain name, depending on the service.
	// Default: "".
	Endpoint string

	ApigwEndpoint string

	// Proxy specifies the URL of a proxy server to use for the requests.
	// If set, all requests will be routed through this proxy.
	// Default: "".
	Proxy string
}

HttpProfile encapsulates the configuration for HTTP requests. It defines settings such as the request method, timeout, scheme, and endpoints.

func NewHttpProfile

func NewHttpProfile() *HttpProfile

NewHttpProfile creates and initializes a new HttpProfile with default values. This function provides a convenient way to obtain a HttpProfile instance with sensible defaults, which can then be customized as needed.

Jump to

Keyboard shortcuts

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