Documentation ¶
Index ¶
Constants ¶
const ( ENVAccessKeyID = "ALIBABA_CLOUD_ACCESS_KEY_ID" ENVAccessKeySecret = "ALIBABA_CLOUD_ACCESS_KEY_SECRET" ENVCredentialFile = "ALIBABA_CLOUD_CREDENTIALS_FILE" ENVEcsMetadata = "ALIBABA_CLOUD_ECS_METADATA" PATHCredentialFile = "~/.alibabacloud/credentials" )
Environmental virables that may be used by the provider
Variables ¶
var DefaultChain = NewProviderChain(defaultproviders)
var HookGet = func(fn func(string) (int, []byte, error)) func(string) (int, []byte, error) {
return fn
}
var ProviderEnv = new(EnvProvider)
var ProviderInstance = new(InstanceCredentialsProvider)
var ProviderProfile = NewProfileProvider()
Functions ¶
func GetHomePath ¶
func GetHomePath() string
GetHomePath return home directory according to the system. if the environmental virables does not exist, will return empty
Types ¶
type EnvProvider ¶
type EnvProvider struct{}
func (*EnvProvider) Resolve ¶
func (p *EnvProvider) Resolve() (auth.Credential, error)
type InstanceCredentialsProvider ¶
type InstanceCredentialsProvider struct{}
func (*InstanceCredentialsProvider) Resolve ¶
func (p *InstanceCredentialsProvider) Resolve() (auth.Credential, error)
type ProfileProvider ¶
type ProfileProvider struct {
Profile string
}
func (*ProfileProvider) Resolve ¶
func (p *ProfileProvider) Resolve() (auth.Credential, error)
Resolve implements the Provider interface when credential type is rsa_key_pair, the content of private_key file must be able to be parsed directly into the required string that NewRsaKeyPairCredential function needed
type Provider ¶
type Provider interface {
Resolve() (auth.Credential, error)
}
When you want to customize the provider, you only need to implement the method of the interface.
func NewEnvProvider ¶
func NewEnvProvider() Provider
func NewInstanceCredentialsProvider ¶
func NewInstanceCredentialsProvider() Provider
func NewProfileProvider ¶
NewProfileProvider receive zero or more parameters, when length of name is 0, the value of field Profile will be "default", and when there are multiple inputs, the function will take the first one and discard the other values.
func NewProviderChain ¶
type ProviderChain ¶
type ProviderChain struct {
Providers []Provider
}
func (*ProviderChain) Resolve ¶
func (p *ProviderChain) Resolve() (auth.Credential, error)