credentials

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: Apache-2.0 Imports: 16 Imported by: 146

Documentation

Index

Constants

View Source
const (
	// EnvVarAccessKeyID is a name of ALIBABA_CLOUD_ACCESS_KEY_ID
	EnvVarAccessKeyID = "ALIBABA_CLOUD_ACCESS_KEY_ID"
	// EnvVarAccessKeySecret is a name of ALIBABA_CLOUD_ACCESS_KEY_SECRET
	EnvVarAccessKeySecret = "ALIBABA_CLOUD_ACCESS_KEY_SECRET"
)
View Source
const (
	ENVCredentialFile  = "ALIBABA_CLOUD_CREDENTIALS_FILE"
	ENVEcsMetadata     = "ALIBABA_CLOUD_ECS_METADATA"
	PATHCredentialFile = "~/.alibabacloud/credentials"
)

Environmental virables that may be used by the provider

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessKeyCredential

type AccessKeyCredential struct {
	AccessKeyID     string
	AccessKeySecret string
}

AccessKeyCredential is a kind of credential

func (*AccessKeyCredential) GetAccessKeyID

func (a *AccessKeyCredential) GetAccessKeyID() (string, error)

GetAccessKeyID reutrns AccessKeyCreential's AccessKeyID

func (*AccessKeyCredential) GetAccessSecret

func (a *AccessKeyCredential) GetAccessSecret() (string, error)

GetAccessSecret reutrns AccessKeyCreential's AccessKeySecret

func (*AccessKeyCredential) GetBearerToken

func (a *AccessKeyCredential) GetBearerToken() string

GetBearerToken is useless for AccessKeyCreential

func (*AccessKeyCredential) GetSecurityToken

func (a *AccessKeyCredential) GetSecurityToken() (string, error)

GetSecurityToken is useless for AccessKeyCreential

func (*AccessKeyCredential) GetType

func (a *AccessKeyCredential) GetType() string

GetType reutrns AccessKeyCreential's type

type BearerTokenCredential

type BearerTokenCredential struct {
	BearerToken string
}

BearerTokenCredential is a kind of credential

func (*BearerTokenCredential) GetAccessKeyID

func (b *BearerTokenCredential) GetAccessKeyID() (string, error)

GetAccessKeyID is useless for BearerTokenCredential

func (*BearerTokenCredential) GetAccessSecret

func (b *BearerTokenCredential) GetAccessSecret() (string, error)

GetAccessSecret is useless for BearerTokenCredential

func (*BearerTokenCredential) GetBearerToken

func (b *BearerTokenCredential) GetBearerToken() string

GetBearerToken reutrns BearerTokenCredential's BearerToken

func (*BearerTokenCredential) GetSecurityToken

func (b *BearerTokenCredential) GetSecurityToken() (string, error)

GetSecurityToken is useless for BearerTokenCredential

func (*BearerTokenCredential) GetType

func (b *BearerTokenCredential) GetType() string

GetType reutrns BearerTokenCredential's type

type Configuration

type Configuration struct {
	Type                  string `json:"type"`
	AccessKeyID           string `json:"access_key_id"`
	AccessKeySecret       string `json:"access_key_secret"`
	RoleArn               string `json:"role_arn"`
	RoleSessionName       string `json:"role_session_name"`
	PublicKeyID           string `json:"public_key_id"`
	RoleName              string `json:"role_name"`
	SessionExpiration     int    `json:"session_expiration"`
	PrivateKeyFile        string `json:"private_key_file"`
	BearerToken           string `json:"bearer_token"`
	SecurityToken         string `json:"security_token"`
	RoleSessionExpiration int    `json:"role_session_expiratioon"`
	Policy                string `json:"policy"`
	Host                  string `json:"host"`
	Timeout               int    `json:"timeout"`
	ConnectTimeout        int    `json:"connect_timeout"`
	Proxy                 string `json:"proxy"`
}

Configuration is important when call NewCredential

type Credential

type Credential interface {
	GetAccessKeyID() (string, error)
	GetAccessSecret() (string, error)
	GetSecurityToken() (string, error)
	GetBearerToken() string
	GetType() string
}

Credential is an interface for getting actual credential

func NewCredential

func NewCredential(config *Configuration) (credential Credential, err error)

NewCredential return a credential according to the type in config. if config is nil, the function will use default provider chain to get credential. please see README.md for detail.

type EcsRAMRoleCredential

type EcsRAMRoleCredential struct {
	RoleName string
	// contains filtered or unexported fields
}

EcsRAMRoleCredential is a kind of credential

func (*EcsRAMRoleCredential) GetAccessKeyID

func (e *EcsRAMRoleCredential) GetAccessKeyID() (string, error)

GetAccessKeyID reutrns EcsRAMRoleCredential's AccessKeyID if AccessKeyID is not exist or out of date, the function will update it.

func (*EcsRAMRoleCredential) GetAccessSecret

func (e *EcsRAMRoleCredential) GetAccessSecret() (string, error)

GetAccessSecret reutrns EcsRAMRoleCredential's AccessKeySecret if AccessKeySecret is not exist or out of date, the function will update it.

func (*EcsRAMRoleCredential) GetBearerToken

func (e *EcsRAMRoleCredential) GetBearerToken() string

GetBearerToken is useless for EcsRAMRoleCredential

func (*EcsRAMRoleCredential) GetSecurityToken

func (e *EcsRAMRoleCredential) GetSecurityToken() (string, error)

GetSecurityToken reutrns EcsRAMRoleCredential's SecurityToken if SecurityToken is not exist or out of date, the function will update it.

func (*EcsRAMRoleCredential) GetType

func (e *EcsRAMRoleCredential) GetType() string

GetType reutrns EcsRAMRoleCredential's type

type Provider

type Provider interface {
	// contains filtered or unexported methods
}

Provider will be implemented When you want to customize the provider.

type RAMRoleArnCredential

type RAMRoleArnCredential struct {
	AccessKeyID           string
	AccessKeySecret       string
	RoleArn               string
	RoleSessionName       string
	RoleSessionExpiration int
	Policy                string
	// contains filtered or unexported fields
}

RAMRoleArnCredential is a kind of credentials

func (*RAMRoleArnCredential) GetAccessKeyID

func (r *RAMRoleArnCredential) GetAccessKeyID() (string, error)

GetAccessKeyID reutrns RamRoleArnCredential's AccessKeyID if AccessKeyID is not exist or out of date, the function will update it.

func (*RAMRoleArnCredential) GetAccessSecret

func (r *RAMRoleArnCredential) GetAccessSecret() (string, error)

GetAccessSecret reutrns RamRoleArnCredential's AccessKeySecret if AccessKeySecret is not exist or out of date, the function will update it.

func (*RAMRoleArnCredential) GetBearerToken

func (r *RAMRoleArnCredential) GetBearerToken() string

GetBearerToken is useless RamRoleArnCredential

func (*RAMRoleArnCredential) GetSecurityToken

func (r *RAMRoleArnCredential) GetSecurityToken() (string, error)

GetSecurityToken reutrns RamRoleArnCredential's SecurityToken if SecurityToken is not exist or out of date, the function will update it.

func (*RAMRoleArnCredential) GetType

func (r *RAMRoleArnCredential) GetType() string

GetType reutrns RamRoleArnCredential's type

type RsaKeyPairCredential

type RsaKeyPairCredential struct {
	PrivateKey        string
	PublicKeyID       string
	SessionExpiration int
	// contains filtered or unexported fields
}

RsaKeyPairCredential is a kind of credentials

func (*RsaKeyPairCredential) GetAccessKeyID

func (r *RsaKeyPairCredential) GetAccessKeyID() (string, error)

GetAccessKeyID reutrns RsaKeyPairCredential's AccessKeyID if AccessKeyID is not exist or out of date, the function will update it.

func (*RsaKeyPairCredential) GetAccessSecret

func (r *RsaKeyPairCredential) GetAccessSecret() (string, error)

GetAccessSecret reutrns RsaKeyPairCredential's AccessKeySecret if AccessKeySecret is not exist or out of date, the function will update it.

func (*RsaKeyPairCredential) GetBearerToken

func (r *RsaKeyPairCredential) GetBearerToken() string

GetBearerToken is useless for RsaKeyPairCredential

func (*RsaKeyPairCredential) GetSecurityToken

func (r *RsaKeyPairCredential) GetSecurityToken() (string, error)

GetSecurityToken is useless RsaKeyPairCredential

func (*RsaKeyPairCredential) GetType

func (r *RsaKeyPairCredential) GetType() string

GetType reutrns RsaKeyPairCredential's type

type StsTokenCredential

type StsTokenCredential struct {
	AccessKeyID     string
	AccessKeySecret string
	SecurityToken   string
}

StsTokenCredential is a kind of credentials

func (*StsTokenCredential) GetAccessKeyID

func (s *StsTokenCredential) GetAccessKeyID() (string, error)

GetAccessKeyID reutrns StsTokenCredential's AccessKeyID

func (*StsTokenCredential) GetAccessSecret

func (s *StsTokenCredential) GetAccessSecret() (string, error)

GetAccessSecret reutrns StsTokenCredential's AccessKeySecret

func (*StsTokenCredential) GetBearerToken

func (s *StsTokenCredential) GetBearerToken() string

GetBearerToken is useless StsTokenCredential

func (*StsTokenCredential) GetSecurityToken

func (s *StsTokenCredential) GetSecurityToken() (string, error)

GetSecurityToken reutrns StsTokenCredential's SecurityToken

func (*StsTokenCredential) GetType

func (s *StsTokenCredential) GetType() string

GetType reutrns StsTokenCredential's type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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