provider

package
v1.63.32 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 13 Imported by: 241

Documentation

Index

Constants

View Source
const (
	// Deprecated: don't use it outside of this project
	ENVAccessKeyID = "ALIBABA_CLOUD_ACCESS_KEY_ID"
	// Deprecated: don't use it outside of this project
	ENVAccessKeySecret = "ALIBABA_CLOUD_ACCESS_KEY_SECRET"
	// Deprecated: don't use it outside of this project
	ENVCredentialFile = "ALIBABA_CLOUD_CREDENTIALS_FILE"
	// Deprecated: don't use it outside of this project
	ENVEcsMetadata = "ALIBABA_CLOUD_ECS_METADATA"
)

Environmental virables that may be used by the provider

Variables

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()

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

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)

Jump to

Keyboard shortcuts

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