awsds

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 18 Imported by: 34

Documentation

Index

Constants

View Source
const AllowedAuthProvidersEnvVarKeyName = "AWS_AUTH_AllowedAuthProviders"

AllowedAuthProvidersEnvVarKeyName is the string literal for the aws allowed auth providers environment variable key name

View Source
const AssumeRoleEnabledEnvVarKeyName = "AWS_AUTH_AssumeRoleEnabled"

AssumeRoleEnabledEnvVarKeyName is the string literal for the aws assume role enabled environment variable key name

Variables

This section is empty.

Functions

func GetSessionWithDefaultRegion added in v0.8.0

func GetSessionWithDefaultRegion(sessionCache *SessionCache, settings AWSDatasourceSettings) (*session.Session, error)

func GetUserAgentString added in v0.8.0

func GetUserAgentString(name string) string

GetUserAgentString returns an agent that can be parsed in server logs

func WithUserAgent added in v0.8.0

func WithUserAgent(sess *session.Session, name string)

Types

type AWSDatasourceSettings

type AWSDatasourceSettings struct {
	Profile       string   `json:"profile"`
	Region        string   `json:"region"`
	AuthType      AuthType `json:"authType"`
	AssumeRoleARN string   `json:"assumeRoleARN"`
	ExternalID    string   `json:"externalId"`

	// Override the client endpoint
	Endpoint string `json:"endpoint"`

	//go:deprecated Use Region instead
	DefaultRegion string `json:"defaultRegion"`

	// Loaded from DecryptedSecureJSONData (not the json object)
	AccessKey    string `json:"-"`
	SecretKey    string `json:"-"`
	SessionToken string `json:"-"`
}

DatasourceSettings holds basic connection info

func (*AWSDatasourceSettings) Load

LoadSettings will read and validate Settings from the DataSourceConfg

type AmazonSessionProvider

type AmazonSessionProvider func(region string, s AWSDatasourceSettings) (*session.Session, error)

AmazonSessionProvider will return a session (perhaps cached) for given region and settings

type AuthSettings added in v0.2.0

type AuthSettings struct {
	AllowedAuthProviders []string
	AssumeRoleEnabled    bool
}

AuthSettings defines whether certain auth types and provider can be used or not

func ReadAuthSettingsFromEnvironmentVariables added in v0.3.0

func ReadAuthSettingsFromEnvironmentVariables() *AuthSettings

type AuthType

type AuthType int
const (
	AuthTypeDefault AuthType = iota
	AuthTypeSharedCreds
	AuthTypeKeys
	AuthTypeEC2IAMRole
)

func ToAuthType added in v0.3.0

func ToAuthType(authType string) AuthType

func (*AuthType) MarshalJSON

func (at *AuthType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (AuthType) String

func (at AuthType) String() string

func (*AuthType) UnmarshalJSON

func (at *AuthType) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type SessionCache

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

SessionCache cache sessions for a while

func NewSessionCache

func NewSessionCache() *SessionCache

NewSessionCache creates a new session cache using the default settings loaded from environment variables

func (*SessionCache) GetSession

func (sc *SessionCache) GetSession(region string, s AWSDatasourceSettings) (*session.Session, error)

GetSession returns a session from the config and possible region overrides -- implements AmazonSessionProvider

Jump to

Keyboard shortcuts

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