View Source
const (
	PATHCredentialFile = "~/.alibabacloud/credentials"

    Environmental virables that may be used by the provider


    View Source
    var DefaultChain = NewProviderChain(defaultproviders)
    View Source
    var HookGet = func(fn func(string) (int, []byte, error)) func(string) (int, []byte, error) {
    	return fn
    View Source
    var ProviderEnv = new(EnvProvider)
    View Source
    var ProviderInstance = new(InstanceCredentialsProvider)
    View Source
    var ProviderProfile = NewProfileProvider()


    func GetHomePath

    func GetHomePath() string

      GetHomePath return home directory according to the system. if the environmental virables does not exist, will return empty


      type EnvProvider

      type EnvProvider struct{}

      func (*EnvProvider) Resolve

      func (p *EnvProvider) Resolve() (auth.Credential, error)

      type InstanceCredentialsProvider

      type InstanceCredentialsProvider struct{}

      func (*InstanceCredentialsProvider) Resolve

      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

          func NewProfileProvider(name ...string) Provider

            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

            func NewProviderChain(providers []Provider) Provider

            type ProviderChain

            type ProviderChain struct {
            	Providers []Provider

            func (*ProviderChain) Resolve

            func (p *ProviderChain) Resolve() (auth.Credential, error)