...

Package credproviders

import "go.mongodb.org/mongo-driver/internal/credproviders"
Overview
Index

Overview ▾

Index ▾

Constants
type AssumeRoleProvider
    func NewAssumeRoleProvider(httpClient *http.Client, expiryWindow time.Duration) *AssumeRoleProvider
    func (a *AssumeRoleProvider) IsExpired() bool
    func (a *AssumeRoleProvider) Retrieve() (credentials.Value, error)
    func (a *AssumeRoleProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
type AzureProvider
    func NewAzureProvider(httpClient *http.Client, expiryWindow time.Duration) *AzureProvider
    func (a *AzureProvider) IsExpired() bool
    func (a *AzureProvider) Retrieve() (credentials.Value, error)
    func (a *AzureProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
type EC2Provider
    func NewEC2Provider(httpClient *http.Client, expiryWindow time.Duration) *EC2Provider
    func (e *EC2Provider) IsExpired() bool
    func (e *EC2Provider) Retrieve() (credentials.Value, error)
    func (e *EC2Provider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
type ECSProvider
    func NewECSProvider(httpClient *http.Client, expiryWindow time.Duration) *ECSProvider
    func (e *ECSProvider) IsExpired() bool
    func (e *ECSProvider) Retrieve() (credentials.Value, error)
    func (e *ECSProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
type EnvProvider
    func NewEnvProvider() *EnvProvider
    func (e *EnvProvider) IsExpired() bool
    func (e *EnvProvider) Retrieve() (credentials.Value, error)
type EnvVar
    func (ev EnvVar) Get() string
type StaticProvider
    func (s *StaticProvider) IsExpired() bool
    func (s *StaticProvider) Retrieve() (credentials.Value, error)

Package files

assume_role_provider.go ec2_provider.go ecs_provider.go env_provider.go imds_provider.go static_provider.go

Constants

const (
    // AzureProviderName provides a name of Azure provider
    AzureProviderName = "AzureProvider"
)

type AssumeRoleProvider

An AssumeRoleProvider retrieves credentials for assume role with web identity.

type AssumeRoleProvider struct {
    AwsRoleArnEnv              EnvVar
    AwsWebIdentityTokenFileEnv EnvVar
    AwsRoleSessionNameEnv      EnvVar
    // contains filtered or unexported fields
}

func NewAssumeRoleProvider

func NewAssumeRoleProvider(httpClient *http.Client, expiryWindow time.Duration) *AssumeRoleProvider

NewAssumeRoleProvider returns a pointer to an assume role provider.

func (*AssumeRoleProvider) IsExpired

func (a *AssumeRoleProvider) IsExpired() bool

IsExpired returns true if the credentials are expired.

func (*AssumeRoleProvider) Retrieve

func (a *AssumeRoleProvider) Retrieve() (credentials.Value, error)

Retrieve retrieves the keys from the AWS service.

func (*AssumeRoleProvider) RetrieveWithContext

func (a *AssumeRoleProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)

RetrieveWithContext retrieves the keys from the AWS service.

type AzureProvider

An AzureProvider retrieves credentials from Azure IMDS.

type AzureProvider struct {
    // contains filtered or unexported fields
}

func NewAzureProvider

func NewAzureProvider(httpClient *http.Client, expiryWindow time.Duration) *AzureProvider

NewAzureProvider returns a pointer to an Azure credential provider.

func (*AzureProvider) IsExpired

func (a *AzureProvider) IsExpired() bool

IsExpired returns if the credentials have been retrieved.

func (*AzureProvider) Retrieve

func (a *AzureProvider) Retrieve() (credentials.Value, error)

Retrieve retrieves the keys from the Azure service.

func (*AzureProvider) RetrieveWithContext

func (a *AzureProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)

RetrieveWithContext retrieves the keys from the Azure service.

type EC2Provider

An EC2Provider retrieves credentials from EC2 metadata.

type EC2Provider struct {
    // contains filtered or unexported fields
}

func NewEC2Provider

func NewEC2Provider(httpClient *http.Client, expiryWindow time.Duration) *EC2Provider

NewEC2Provider returns a pointer to an EC2 credential provider.

func (*EC2Provider) IsExpired

func (e *EC2Provider) IsExpired() bool

IsExpired returns true if the credentials are expired.

func (*EC2Provider) Retrieve

func (e *EC2Provider) Retrieve() (credentials.Value, error)

Retrieve retrieves the keys from the AWS service.

func (*EC2Provider) RetrieveWithContext

func (e *EC2Provider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)

RetrieveWithContext retrieves the keys from the AWS service.

type ECSProvider

An ECSProvider retrieves credentials from ECS metadata.

type ECSProvider struct {
    AwsContainerCredentialsRelativeURIEnv EnvVar
    // contains filtered or unexported fields
}

func NewECSProvider

func NewECSProvider(httpClient *http.Client, expiryWindow time.Duration) *ECSProvider

NewECSProvider returns a pointer to an ECS credential provider.

func (*ECSProvider) IsExpired

func (e *ECSProvider) IsExpired() bool

IsExpired returns true if the credentials are expired.

func (*ECSProvider) Retrieve

func (e *ECSProvider) Retrieve() (credentials.Value, error)

Retrieve retrieves the keys from the AWS service.

func (*ECSProvider) RetrieveWithContext

func (e *ECSProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)

RetrieveWithContext retrieves the keys from the AWS service.

type EnvProvider

A EnvProvider retrieves credentials from the environment variables of the running process. Environment credentials never expire.

type EnvProvider struct {
    AwsAccessKeyIDEnv     EnvVar
    AwsSecretAccessKeyEnv EnvVar
    AwsSessionTokenEnv    EnvVar
    // contains filtered or unexported fields
}

func NewEnvProvider

func NewEnvProvider() *EnvProvider

NewEnvProvider returns a pointer to an ECS credential provider.

func (*EnvProvider) IsExpired

func (e *EnvProvider) IsExpired() bool

IsExpired returns true if the credentials have not been retrieved.

func (*EnvProvider) Retrieve

func (e *EnvProvider) Retrieve() (credentials.Value, error)

Retrieve retrieves the keys from the environment.

type EnvVar

EnvVar is an environment variable

type EnvVar string

func (EnvVar) Get

func (ev EnvVar) Get() string

Get retrieves the environment variable

type StaticProvider

A StaticProvider is a set of credentials which are set programmatically, and will never expire.

type StaticProvider struct {
    credentials.Value
    // contains filtered or unexported fields
}

func (*StaticProvider) IsExpired

func (s *StaticProvider) IsExpired() bool

IsExpired returns if the credentials are expired.

For StaticProvider, the credentials never expired.

func (*StaticProvider) Retrieve

func (s *StaticProvider) Retrieve() (credentials.Value, error)

Retrieve returns the credentials or error if the credentials are invalid.