...

Package credentials

import "github.com/aliyun/credentials-go/credentials"
Overview
Index
Subdirectories

Overview ▾

Index ▾

Constants
type AccessKeyCredential
    func (a *AccessKeyCredential) GetAccessKeyId() (*string, error)
    func (a *AccessKeyCredential) GetAccessKeySecret() (*string, error)
    func (a *AccessKeyCredential) GetBearerToken() *string
    func (s *AccessKeyCredential) GetCredential() (*CredentialModel, error)
    func (a *AccessKeyCredential) GetSecurityToken() (*string, error)
    func (a *AccessKeyCredential) GetType() *string
type BearerTokenCredential
    func (b *BearerTokenCredential) GetAccessKeyId() (*string, error)
    func (b *BearerTokenCredential) GetAccessKeySecret() (*string, error)
    func (b *BearerTokenCredential) GetBearerToken() *string
    func (s *BearerTokenCredential) GetCredential() (*CredentialModel, error)
    func (b *BearerTokenCredential) GetSecurityToken() (*string, error)
    func (b *BearerTokenCredential) GetType() *string
type Config
    func (s Config) GoString() string
    func (s *Config) SetAccessKeyId(v string) *Config
    func (s *Config) SetAccessKeySecret(v string) *Config
    func (s *Config) SetBearerToken(v string) *Config
    func (s *Config) SetConnectTimeout(v int) *Config
    func (s *Config) SetHost(v string) *Config
    func (s *Config) SetOIDCProviderArn(v string) *Config
    func (s *Config) SetOIDCTokenFilePath(v string) *Config
    func (s *Config) SetPolicy(v string) *Config
    func (s *Config) SetPrivateKeyFile(v string) *Config
    func (s *Config) SetProxy(v string) *Config
    func (s *Config) SetPublicKeyId(v string) *Config
    func (s *Config) SetRoleArn(v string) *Config
    func (s *Config) SetRoleName(v string) *Config
    func (s *Config) SetRoleSessionExpiration(v int) *Config
    func (s *Config) SetRoleSessionName(v string) *Config
    func (s *Config) SetSTSEndpoint(v string) *Config
    func (s *Config) SetSecurityToken(v string) *Config
    func (s *Config) SetSessionExpiration(v int) *Config
    func (s *Config) SetTimeout(v int) *Config
    func (s *Config) SetType(v string) *Config
    func (s *Config) SetURLCredential(v string) *Config
    func (s Config) String() string
type Credential
    func NewCredential(config *Config) (credential Credential, err error)
type CredentialModel
    func (s CredentialModel) GoString() string
    func (s *CredentialModel) SetAccessKeyId(v string) *CredentialModel
    func (s *CredentialModel) SetAccessKeySecret(v string) *CredentialModel
    func (s *CredentialModel) SetBearerToken(v string) *CredentialModel
    func (s *CredentialModel) SetSecurityToken(v string) *CredentialModel
    func (s *CredentialModel) SetType(v string) *CredentialModel
    func (s CredentialModel) String() string
type EcsRAMRoleCredential
    func (e *EcsRAMRoleCredential) GetAccessKeyId() (*string, error)
    func (e *EcsRAMRoleCredential) GetAccessKeySecret() (*string, error)
    func (e *EcsRAMRoleCredential) GetBearerToken() *string
    func (e *EcsRAMRoleCredential) GetCredential() (*CredentialModel, error)
    func (e *EcsRAMRoleCredential) GetSecurityToken() (*string, error)
    func (e *EcsRAMRoleCredential) GetType() *string
type OIDCCredential
    func (r *OIDCCredential) GetAccessKeyId() (*string, error)
    func (r *OIDCCredential) GetAccessKeySecret() (*string, error)
    func (r *OIDCCredential) GetBearerToken() *string
    func (e *OIDCCredential) GetCredential() (*CredentialModel, error)
    func (r *OIDCCredential) GetOIDCToken(OIDCTokenFilePath string) *string
    func (r *OIDCCredential) GetSecurityToken() (*string, error)
    func (r *OIDCCredential) GetType() *string
type OIDCResponse
type OIDCcredentialsInResponse
type Provider
type RAMRoleArnCredential
    func (r *RAMRoleArnCredential) GetAccessKeyId() (*string, error)
    func (r *RAMRoleArnCredential) GetAccessKeySecret() (*string, error)
    func (r *RAMRoleArnCredential) GetBearerToken() *string
    func (e *RAMRoleArnCredential) GetCredential() (*CredentialModel, error)
    func (r *RAMRoleArnCredential) GetSecurityToken() (*string, error)
    func (r *RAMRoleArnCredential) GetType() *string
type RsaKeyPairCredential
    func (r *RsaKeyPairCredential) GetAccessKeyId() (*string, error)
    func (r *RsaKeyPairCredential) GetAccessKeySecret() (*string, error)
    func (r *RsaKeyPairCredential) GetBearerToken() *string
    func (e *RsaKeyPairCredential) GetCredential() (*CredentialModel, error)
    func (r *RsaKeyPairCredential) GetSecurityToken() (*string, error)
    func (r *RsaKeyPairCredential) GetType() *string
type StsTokenCredential
    func (s *StsTokenCredential) GetAccessKeyId() (*string, error)
    func (s *StsTokenCredential) GetAccessKeySecret() (*string, error)
    func (s *StsTokenCredential) GetBearerToken() *string
    func (s *StsTokenCredential) GetCredential() (*CredentialModel, error)
    func (s *StsTokenCredential) GetSecurityToken() (*string, error)
    func (s *StsTokenCredential) GetType() *string
type URLCredential
    func (e *URLCredential) GetAccessKeyId() (*string, error)
    func (e *URLCredential) GetAccessKeySecret() (*string, error)
    func (e *URLCredential) GetBearerToken() *string
    func (e *URLCredential) GetCredential() (*CredentialModel, error)
    func (e *URLCredential) GetSecurityToken() (*string, error)
    func (e *URLCredential) GetType() *string
type URLResponse

Package files

access_key_credential.go bearer_token_credential.go credential.go credential_model.go credential_updater.go ecs_ram_role.go env_provider.go instance_provider.go oidc_credential.go oidc_credential_provider.go profile_provider.go provider.go provider_chain.go rsa_key_pair_credential.go session_credential.go sts_credential.go sts_role_arn_credential.go uri_credential.go

Constants

const (
    // EnvVarAccessKeyId is a name of ALIBABA_CLOUD_ACCESS_KEY_Id
    EnvVarAccessKeyId    = "ALIBABA_CLOUD_ACCESS_KEY_Id"
    EnvVarAccessKeyIdNew = "ALIBABA_CLOUD_ACCESS_KEY_ID"
    // EnvVarAccessKeySecret is a name of ALIBABA_CLOUD_ACCESS_KEY_SECRET
    EnvVarAccessKeySecret = "ALIBABA_CLOUD_ACCESS_KEY_SECRET"
)

Environmental virables that may be used by the provider

const (
    ENVCredentialFile  = "ALIBABA_CLOUD_CREDENTIALS_FILE"
    ENVEcsMetadata     = "ALIBABA_CLOUD_ECS_METADATA"
    PATHCredentialFile = "~/.alibabacloud/credentials"
    ENVRoleArn         = "ALIBABA_CLOUD_ROLE_ARN"
    ENVOIDCProviderArn = "ALIBABA_CLOUD_OIDC_PROVIDER_ARN"
    ENVOIDCTokenFile   = "ALIBABA_CLOUD_OIDC_TOKEN_FILE"
    ENVRoleSessionName = "ALIBABA_CLOUD_ROLE_SESSION_NAME"
)

type AccessKeyCredential

AccessKeyCredential is a kind of credential

type AccessKeyCredential struct {
    AccessKeyId     string
    AccessKeySecret string
}

func (*AccessKeyCredential) GetAccessKeyId

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

GetAccessKeyId reutrns AccessKeyCreential's AccessKeyId

func (*AccessKeyCredential) GetAccessKeySecret

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

GetAccessSecret reutrns AccessKeyCreential's AccessKeySecret

func (*AccessKeyCredential) GetBearerToken

func (a *AccessKeyCredential) GetBearerToken() *string

GetBearerToken is useless for AccessKeyCreential

func (*AccessKeyCredential) GetCredential

func (s *AccessKeyCredential) GetCredential() (*CredentialModel, error)

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

BearerTokenCredential is a kind of credential

type BearerTokenCredential struct {
    BearerToken string
}

func (*BearerTokenCredential) GetAccessKeyId

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

GetAccessKeyId is useless for BearerTokenCredential

func (*BearerTokenCredential) GetAccessKeySecret

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

GetAccessSecret is useless for BearerTokenCredential

func (*BearerTokenCredential) GetBearerToken

func (b *BearerTokenCredential) GetBearerToken() *string

GetBearerToken reutrns BearerTokenCredential's BearerToken

func (*BearerTokenCredential) GetCredential

func (s *BearerTokenCredential) GetCredential() (*CredentialModel, error)

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 Config

Config is important when call NewCredential

type Config struct {
    Type                  *string  `json:"type"`
    AccessKeyId           *string  `json:"access_key_id"`
    AccessKeySecret       *string  `json:"access_key_secret"`
    OIDCProviderArn       *string  `json:"oidc_provider_arn"`
    OIDCTokenFilePath     *string  `json:"oidc_token"`
    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"`
    InAdvanceScale        *float64 `json:"inAdvanceScale"`
    Url                   *string  `json:"url"`
    STSEndpoint           *string  `json:"sts_endpoint"`
    ExternalId            *string  `json:"external_id"`
}

func (Config) GoString

func (s Config) GoString() string

func (*Config) SetAccessKeyId

func (s *Config) SetAccessKeyId(v string) *Config

func (*Config) SetAccessKeySecret

func (s *Config) SetAccessKeySecret(v string) *Config

func (*Config) SetBearerToken

func (s *Config) SetBearerToken(v string) *Config

func (*Config) SetConnectTimeout

func (s *Config) SetConnectTimeout(v int) *Config

func (*Config) SetHost

func (s *Config) SetHost(v string) *Config

func (*Config) SetOIDCProviderArn

func (s *Config) SetOIDCProviderArn(v string) *Config

func (*Config) SetOIDCTokenFilePath

func (s *Config) SetOIDCTokenFilePath(v string) *Config

func (*Config) SetPolicy

func (s *Config) SetPolicy(v string) *Config

func (*Config) SetPrivateKeyFile

func (s *Config) SetPrivateKeyFile(v string) *Config

func (*Config) SetProxy

func (s *Config) SetProxy(v string) *Config

func (*Config) SetPublicKeyId

func (s *Config) SetPublicKeyId(v string) *Config

func (*Config) SetRoleArn

func (s *Config) SetRoleArn(v string) *Config

func (*Config) SetRoleName

func (s *Config) SetRoleName(v string) *Config

func (*Config) SetRoleSessionExpiration

func (s *Config) SetRoleSessionExpiration(v int) *Config

func (*Config) SetRoleSessionName

func (s *Config) SetRoleSessionName(v string) *Config

func (*Config) SetSTSEndpoint

func (s *Config) SetSTSEndpoint(v string) *Config

func (*Config) SetSecurityToken

func (s *Config) SetSecurityToken(v string) *Config

func (*Config) SetSessionExpiration

func (s *Config) SetSessionExpiration(v int) *Config

func (*Config) SetTimeout

func (s *Config) SetTimeout(v int) *Config

func (*Config) SetType

func (s *Config) SetType(v string) *Config

func (*Config) SetURLCredential

func (s *Config) SetURLCredential(v string) *Config

func (Config) String

func (s Config) String() string

type Credential

Credential is an interface for getting actual credential

type Credential interface {
    GetAccessKeyId() (*string, error)
    GetAccessKeySecret() (*string, error)
    GetSecurityToken() (*string, error)
    GetBearerToken() *string
    GetType() *string
    GetCredential() (*CredentialModel, error)
}

func NewCredential

func NewCredential(config *Config) (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 CredentialModel

CredentialModel is a model

type CredentialModel struct {
    // accesskey id
    AccessKeyId *string `json:"accessKeyId,omitempty" xml:"accessKeyId,omitempty"`
    // accesskey secret
    AccessKeySecret *string `json:"accessKeySecret,omitempty" xml:"accessKeySecret,omitempty"`
    // security token
    SecurityToken *string `json:"securityToken,omitempty" xml:"securityToken,omitempty"`
    // bearer token
    BearerToken *string `json:"bearerToken,omitempty" xml:"bearerToken,omitempty"`
    // type
    Type *string `json:"type,omitempty" xml:"type,omitempty"`
}

func (CredentialModel) GoString

func (s CredentialModel) GoString() string

func (*CredentialModel) SetAccessKeyId

func (s *CredentialModel) SetAccessKeyId(v string) *CredentialModel

func (*CredentialModel) SetAccessKeySecret

func (s *CredentialModel) SetAccessKeySecret(v string) *CredentialModel

func (*CredentialModel) SetBearerToken

func (s *CredentialModel) SetBearerToken(v string) *CredentialModel

func (*CredentialModel) SetSecurityToken

func (s *CredentialModel) SetSecurityToken(v string) *CredentialModel

func (*CredentialModel) SetType

func (s *CredentialModel) SetType(v string) *CredentialModel

func (CredentialModel) String

func (s CredentialModel) String() string

type EcsRAMRoleCredential

EcsRAMRoleCredential is a kind of credential

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

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

func (e *EcsRAMRoleCredential) GetAccessKeySecret() (*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) GetCredential

func (e *EcsRAMRoleCredential) GetCredential() (*CredentialModel, error)

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 OIDCCredential

OIDCCredential is a kind of credentials

type OIDCCredential struct {
    AccessKeyId           string
    AccessKeySecret       string
    RoleArn               string
    OIDCProviderArn       string
    OIDCTokenFilePath     string
    Policy                string
    RoleSessionName       string
    RoleSessionExpiration int
    // contains filtered or unexported fields
}

func (*OIDCCredential) GetAccessKeyId

func (r *OIDCCredential) GetAccessKeyId() (*string, error)

GetAccessKeyId reutrns OIDCCredential's AccessKeyId if AccessKeyId is not exist or out of date, the function will update it.

func (*OIDCCredential) GetAccessKeySecret

func (r *OIDCCredential) GetAccessKeySecret() (*string, error)

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

func (*OIDCCredential) GetBearerToken

func (r *OIDCCredential) GetBearerToken() *string

GetBearerToken is useless OIDCCredential

func (*OIDCCredential) GetCredential

func (e *OIDCCredential) GetCredential() (*CredentialModel, error)

func (*OIDCCredential) GetOIDCToken

func (r *OIDCCredential) GetOIDCToken(OIDCTokenFilePath string) *string

func (*OIDCCredential) GetSecurityToken

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

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

func (*OIDCCredential) GetType

func (r *OIDCCredential) GetType() *string

GetType reutrns OIDCCredential's type

type OIDCResponse

type OIDCResponse struct {
    Credentials *credentialsInResponse `json:"Credentials" xml:"Credentials"`
}

type OIDCcredentialsInResponse

type OIDCcredentialsInResponse struct {
    AccessKeyId     string `json:"AccessKeyId" xml:"AccessKeyId"`
    AccessKeySecret string `json:"AccessKeySecret" xml:"AccessKeySecret"`
    SecurityToken   string `json:"SecurityToken" xml:"SecurityToken"`
    Expiration      string `json:"Expiration" xml:"Expiration"`
}

type Provider

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

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

type RAMRoleArnCredential

RAMRoleArnCredential is a kind of credentials

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

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

func (r *RAMRoleArnCredential) GetAccessKeySecret() (*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) GetCredential

func (e *RAMRoleArnCredential) GetCredential() (*CredentialModel, error)

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

RsaKeyPairCredential is a kind of credentials

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

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

func (r *RsaKeyPairCredential) GetAccessKeySecret() (*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) GetCredential

func (e *RsaKeyPairCredential) GetCredential() (*CredentialModel, error)

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

StsTokenCredential is a kind of credentials

type StsTokenCredential struct {
    AccessKeyId     string
    AccessKeySecret string
    SecurityToken   string
}

func (*StsTokenCredential) GetAccessKeyId

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

GetAccessKeyId reutrns StsTokenCredential's AccessKeyId

func (*StsTokenCredential) GetAccessKeySecret

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

GetAccessSecret reutrns StsTokenCredential's AccessKeySecret

func (*StsTokenCredential) GetBearerToken

func (s *StsTokenCredential) GetBearerToken() *string

GetBearerToken is useless StsTokenCredential

func (*StsTokenCredential) GetCredential

func (s *StsTokenCredential) GetCredential() (*CredentialModel, error)

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

type URLCredential

URLCredential is a kind of credential

type URLCredential struct {
    URL string
    // contains filtered or unexported fields
}

func (*URLCredential) GetAccessKeyId

func (e *URLCredential) GetAccessKeyId() (*string, error)

GetAccessKeyId reutrns URLCredential's AccessKeyId if AccessKeyId is not exist or out of date, the function will update it.

func (*URLCredential) GetAccessKeySecret

func (e *URLCredential) GetAccessKeySecret() (*string, error)

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

func (*URLCredential) GetBearerToken

func (e *URLCredential) GetBearerToken() *string

GetBearerToken is useless for URLCredential

func (*URLCredential) GetCredential

func (e *URLCredential) GetCredential() (*CredentialModel, error)

func (*URLCredential) GetSecurityToken

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

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

func (*URLCredential) GetType

func (e *URLCredential) GetType() *string

GetType reutrns URLCredential's type

type URLResponse

type URLResponse struct {
    AccessKeyId     string `json:"AccessKeyId" xml:"AccessKeyId"`
    AccessKeySecret string `json:"AccessKeySecret" xml:"AccessKeySecret"`
    SecurityToken   string `json:"SecurityToken" xml:"SecurityToken"`
    Expiration      string `json:"Expiration" xml:"Expiration"`
}

Subdirectories

Name Synopsis
..
request
response
utils