Documentation ¶
Index ¶
- Constants
- Variables
- func BoolPtr(v bool) *bool
- func BoolPtrs(vals []bool) []*bool
- func Float64Ptr(v float64) *float64
- func Float64Ptrs(vals []float64) []*float64
- func Int64Ptr(v int64) *int64
- func Int64Ptrs(vals []int64) []*int64
- func IntPtr(v int) *int
- func IntPtrs(vals []int) []*int
- func Sign(s, secretKey, method string) string
- func StringPtr(v string) *string
- func StringPtrs(vals []string) []*string
- func StringValues(ptrs []*string) []string
- func Uint64Ptr(v uint64) *uint64
- func Uint64Ptrs(vals []uint64) []*uint64
- func UintPtr(v uint) *uint
- func UintPtrs(vals []uint) []*uint
- type Client
- func (c *Client) GetCredential() CredentialIface
- func (c *Client) GetRegion() string
- func (c *Client) Init(region string) *Client
- func (c *Client) Send(request tchttp.Request, response tchttp.Response) (err error)
- func (c *Client) SendOctetStream(request tchttp.Request, response tchttp.Response) (err error)
- func (c *Client) WithCredential(cred CredentialIface) *Client
- func (c *Client) WithDebug(flag bool) *Client
- func (c *Client) WithHttpTransport(transport http.RoundTripper) *Client
- func (c *Client) WithLogger(logger Logger) *Client
- func (c *Client) WithProfile(clientProfile *profile.ClientProfile) *Client
- func (c *Client) WithProvider(provider Provider) (*Client, error)
- func (c *Client) WithRequestClient(rc string) *Client
- func (c *Client) WithSecretId(secretId, secretKey string) *Client
- func (c *Client) WithSignatureMethod(method string) *Client
- type Credential
- type CredentialIface
- type CvmRoleCredential
- type CvmRoleProvider
- type EnvProvider
- type Logger
- type OIDCRoleArnProvider
- type ProfileProvider
- type Provider
- type ProviderChain
- type RoleArnCredential
- type RoleArnProvider
Constants ¶
const ( StateClosed state = iota StateHalfOpen StateOpen )
These constants are states of CircuitBreaker.
const ( SHA256 = "HmacSHA256" SHA1 = "HmacSHA1" )
const (
EnvCredentialFile = "TENCENTCLOUD_CREDENTIALS_FILE"
)
const ExpiredTimeout = 300
Variables ¶
var DefaultHttpClient *http.Client
Functions ¶
func Float64Ptr ¶
func Float64Ptrs ¶
func StringPtrs ¶
func StringValues ¶
func Uint64Ptrs ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithProviders ¶ added in v1.0.216
NewClientWithProviders build client with your custom providers; If you don't specify the providers, it will use the DefaultProviderChain to find credential
func NewClientWithSecretId ¶
func NewCommonClient ¶ added in v1.0.192
func NewCommonClient(cred CredentialIface, region string, clientProfile *profile.ClientProfile) (c *Client)
func (*Client) GetCredential ¶ added in v1.0.361
func (c *Client) GetCredential() CredentialIface
func (*Client) SendOctetStream ¶ added in v1.0.210
SendOctetStream Invoke API with application/octet-stream content-type.
Note:
- only specific API can be invoked in such manner.
- only TC3-HMAC-SHA256 signature method can be specified.
- only POST request method can be specified
- the request Must be a CommonRequest and called SetOctetStreamParameters
func (*Client) WithCredential ¶
func (c *Client) WithCredential(cred CredentialIface) *Client
func (*Client) WithHttpTransport ¶
func (c *Client) WithHttpTransport(transport http.RoundTripper) *Client
func (*Client) WithLogger ¶ added in v1.0.636
func (*Client) WithProfile ¶
func (c *Client) WithProfile(clientProfile *profile.ClientProfile) *Client
func (*Client) WithProvider ¶ added in v1.0.216
WithProvider use specify provider to get a credential and use it to build a client
func (*Client) WithRequestClient ¶ added in v1.0.499
func (*Client) WithSecretId ¶
func (*Client) WithSignatureMethod ¶
type Credential ¶
func NewCredential ¶
func NewCredential(secretId, secretKey string) *Credential
func NewTokenCredential ¶
func NewTokenCredential(secretId, secretKey, token string) *Credential
func (*Credential) GetCredential ¶ added in v1.0.829
func (c *Credential) GetCredential() (string, string, string)
func (*Credential) GetSecretId ¶ added in v1.0.216
func (c *Credential) GetSecretId() string
func (*Credential) GetSecretKey ¶ added in v1.0.216
func (c *Credential) GetSecretKey() string
func (*Credential) GetToken ¶ added in v1.0.216
func (c *Credential) GetToken() string
type CredentialIface ¶ added in v1.0.216
type CvmRoleCredential ¶ added in v1.0.216
type CvmRoleCredential struct {
// contains filtered or unexported fields
}
func (*CvmRoleCredential) GetCredential ¶ added in v1.0.829
func (c *CvmRoleCredential) GetCredential() (string, string, string)
func (*CvmRoleCredential) GetSecretId ¶ added in v1.0.216
func (c *CvmRoleCredential) GetSecretId() string
func (*CvmRoleCredential) GetSecretKey ¶ added in v1.0.216
func (c *CvmRoleCredential) GetSecretKey() string
func (*CvmRoleCredential) GetToken ¶ added in v1.0.216
func (c *CvmRoleCredential) GetToken() string
type CvmRoleProvider ¶ added in v1.0.216
type CvmRoleProvider struct {
// contains filtered or unexported fields
}
func DefaultCvmRoleProvider ¶ added in v1.0.216
func DefaultCvmRoleProvider() *CvmRoleProvider
DefaultCvmRoleProvider will auto get the cvm role name by accessing the metadata api more info please lookup: https://cloud.tencent.com/document/product/213/4934
func NewCvmRoleProvider ¶ added in v1.0.216
func NewCvmRoleProvider(roleName string) *CvmRoleProvider
NewCvmRoleProvider need you to specify the roleName of the cvm currently in use
func (*CvmRoleProvider) GetCredential ¶ added in v1.0.216
func (r *CvmRoleProvider) GetCredential() (CredentialIface, error)
type EnvProvider ¶ added in v1.0.216
type EnvProvider struct {
// contains filtered or unexported fields
}
func DefaultEnvProvider ¶ added in v1.0.216
func DefaultEnvProvider() *EnvProvider
DefaultEnvProvider return a default provider The default environment variable name are TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY
func NewEnvProvider ¶ added in v1.0.216
func NewEnvProvider(secretIdEnvName, secretKeyEnvName string) *EnvProvider
NewEnvProvider uses the name of the environment variable you specified to get the credentials
func (*EnvProvider) GetCredential ¶ added in v1.0.216
func (p *EnvProvider) GetCredential() (CredentialIface, error)
type Logger ¶ added in v1.0.636
type Logger interface {
Printf(format string, args ...interface{})
}
type OIDCRoleArnProvider ¶ added in v1.0.486
type OIDCRoleArnProvider struct { Endpoint string // contains filtered or unexported fields }
func DefaultTkeOIDCRoleArnProvider ¶ added in v1.0.486
func DefaultTkeOIDCRoleArnProvider() (*OIDCRoleArnProvider, error)
DefaultTkeOIDCRoleArnProvider returns a OIDCRoleArnProvider with some default options:
- providerId will be environment var TKE_PROVIDER_ID
- webIdentityToken will be the content of file specified by env TKE_WEB_IDENTITY_TOKEN_FILE
- roleArn will be env TKE_ROLE_ARN
- roleSessionName will be "tencentcloud-go-sdk-" + timestamp
- durationSeconds will be 7200s
func NewOIDCRoleArnProvider ¶ added in v1.0.486
func NewOIDCRoleArnProvider(region, providerId, webIdentityToken, roleArn, roleSessionName string, durationSeconds int64) *OIDCRoleArnProvider
func (*OIDCRoleArnProvider) GetCredential ¶ added in v1.0.486
func (r *OIDCRoleArnProvider) GetCredential() (CredentialIface, error)
type ProfileProvider ¶ added in v1.0.216
type ProfileProvider struct { }
func DefaultProfileProvider ¶ added in v1.0.216
func DefaultProfileProvider() *ProfileProvider
DefaultProfileProvider return a default Profile provider profile path :
- The value of the environment variable TENCENTCLOUD_CREDENTIALS_FILE
- linux: ~/.tencentcloud/credentials windows: \c:\Users\NAME\.tencentcloud\credentials
func (*ProfileProvider) GetCredential ¶ added in v1.0.216
func (p *ProfileProvider) GetCredential() (CredentialIface, error)
type Provider ¶ added in v1.0.216
type Provider interface { // GetCredential get the credential interface GetCredential() (CredentialIface, error) }
Provider provide credential to build client.
Now there are four kinds provider:
EnvProvider : get credential from your Variable environment ProfileProvider : get credential from your profile CvmRoleProvider : get credential from your cvm role RoleArnProvider : get credential from your role arn
func DefaultProviderChain ¶ added in v1.0.216
func DefaultProviderChain() Provider
DefaultProviderChain returns a default provider chain and try to get credentials in the following order:
- Environment variable
- Profile
- CvmRole
If you want to customize the search order, please use the function NewProviderChain
func NewProviderChain ¶ added in v1.0.216
NewProviderChain returns a provider chain in your custom order
type ProviderChain ¶ added in v1.0.216
type ProviderChain struct {
Providers []Provider
}
func (*ProviderChain) GetCredential ¶ added in v1.0.216
func (c *ProviderChain) GetCredential() (CredentialIface, error)
type RoleArnCredential ¶ added in v1.0.216
type RoleArnCredential struct {
// contains filtered or unexported fields
}
func (*RoleArnCredential) GetCredential ¶ added in v1.0.829
func (c *RoleArnCredential) GetCredential() (string, string, string)
func (*RoleArnCredential) GetSecretId ¶ added in v1.0.216
func (c *RoleArnCredential) GetSecretId() string
func (*RoleArnCredential) GetSecretKey ¶ added in v1.0.216
func (c *RoleArnCredential) GetSecretKey() string
func (*RoleArnCredential) GetToken ¶ added in v1.0.216
func (c *RoleArnCredential) GetToken() string
type RoleArnProvider ¶ added in v1.0.216
type RoleArnProvider struct {
// contains filtered or unexported fields
}
func DefaultRoleArnProvider ¶ added in v1.0.216
func DefaultRoleArnProvider(secretId, secretKey, roleArn string) *RoleArnProvider
DefaultRoleArnProvider returns a RoleArnProvider that use some default options:
- roleSessionName will be "tencentcloud-go-sdk-" + timestamp
- durationSeconds will be 7200s
func NewRoleArnProvider ¶ added in v1.0.216
func NewRoleArnProvider(secretId, secretKey, roleArn, sessionName string, duration int64) *RoleArnProvider
func (*RoleArnProvider) GetCredential ¶ added in v1.0.216
func (r *RoleArnProvider) GetCredential() (CredentialIface, error)
Source Files ¶
- circuit_breaker.go
- client.go
- clienttoken.go
- common_client.go
- credentials.go
- cvm_role_credential.go
- cvm_role_provider.go
- env_provider.go
- ini.go
- log.go
- netretry.go
- oidc_role_arn_provider.go
- profile_provider.go
- provider.go
- provider_chain.go
- ratelimitretry.go
- role_arn_credential.go
- role_arn_provider.go
- section.go
- sign.go
- types.go
- value.go