aws

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Coalesce added in v1.15.0

func Coalesce(values ...string) string

Coalesce is a helper function to return the first non-empty string from the inputs This helps us to migrate away from the deprecated duplicate aws auth profile metadata fields in Dapr 1.17.

func GetConfig added in v1.15.0

func GetConfig(opts Options) *aws.Config

func GetConfigV2 added in v1.15.0

func GetConfigV2(accessKey string, secretKey string, sessionToken string, region string, endpoint string) (awsv2.Config, error)

Types

type Clients added in v1.15.0

type Clients struct {
	Dynamo *DynamoDBClients

	Secret         *SecretManagerClients
	ParameterStore *ParameterStoreClients
	// contains filtered or unexported fields
}

type DeprecatedKafkaIAM added in v1.15.0

type DeprecatedKafkaIAM struct {
	Region         string `json:"awsRegion" mapstructure:"awsRegion"`
	AccessKey      string `json:"awsAccessKey" mapstructure:"awsAccessKey"`
	SecretKey      string `json:"awsSecretKey" mapstructure:"awsSecretKey"`
	SessionToken   string `json:"awsSessionToken" mapstructure:"awsSessionToken"`
	IamRoleArn     string `json:"awsIamRoleArn" mapstructure:"awsIamRoleArn"`
	StsSessionName string `json:"awsStsSessionName" mapstructure:"awsStsSessionName"`
}

TODO: Delete in Dapr 1.17 so we can move all IAM fields to use the defaults of: accessKey and secretKey and region as noted in the docs, and Options struct above.

type DeprecatedPostgresIAM added in v1.15.0

type DeprecatedPostgresIAM struct {
	// Access key to use for accessing PostgreSQL.
	AccessKey string `json:"awsAccessKey" mapstructure:"awsAccessKey"`
	// Secret key to use for accessing PostgreSQL.
	SecretKey string `json:"awsSecretKey" mapstructure:"awsSecretKey"`
}

TODO: Delete in Dapr 1.17 so we can move all IAM fields to use the defaults of: accessKey and secretKey and region as noted in the docs, and Options struct above.

type DynamoDBClients added in v1.15.0

type DynamoDBClients struct {
	DynamoDB dynamodbiface.DynamoDBAPI
}

func (*DynamoDBClients) New added in v1.15.0

func (c *DynamoDBClients) New(session *session.Session)

type EnvironmentSettings added in v1.14.0

type EnvironmentSettings struct {
	Metadata map[string]string
}

func NewEnvironmentSettings added in v1.14.0

func NewEnvironmentSettings(md map[string]string) (EnvironmentSettings, error)

NewEnvironmentSettings returns a new EnvironmentSettings configured for a given AWS resource.

type KafkaClients added in v1.15.0

type KafkaClients struct {
	ConsumerGroup sarama.ConsumerGroup
	Producer      sarama.SyncProducer
	// contains filtered or unexported fields
}

func (*KafkaClients) New added in v1.15.0

func (c *KafkaClients) New(session *session.Session, tokenProvider *mskTokenProvider) error

type KafkaOptions added in v1.15.0

type KafkaOptions struct {
	Config          *sarama.Config
	ConsumerGroup   string
	Brokers         []string
	MaxMessageBytes int
}

type KinesisClients added in v1.15.0

type KinesisClients struct {
	Kinesis     kinesisiface.KinesisAPI
	Region      string
	Credentials *credentials.Credentials
}

func (*KinesisClients) New added in v1.15.0

func (c *KinesisClients) New(session *session.Session)

func (*KinesisClients) Stream added in v1.15.0

func (c *KinesisClients) Stream(ctx context.Context, streamName string) (*string, error)

func (*KinesisClients) WorkerCfg added in v1.15.0

func (c *KinesisClients) WorkerCfg(ctx context.Context, stream, consumer, mode string) *config.KinesisClientLibConfiguration

type MockDynamoDB added in v1.15.0

type MockDynamoDB struct {
	GetItemWithContextFn            func(ctx context.Context, input *dynamodb.GetItemInput, op ...request.Option) (*dynamodb.GetItemOutput, error)
	PutItemWithContextFn            func(ctx context.Context, input *dynamodb.PutItemInput, op ...request.Option) (*dynamodb.PutItemOutput, error)
	DeleteItemWithContextFn         func(ctx context.Context, input *dynamodb.DeleteItemInput, op ...request.Option) (*dynamodb.DeleteItemOutput, error)
	BatchWriteItemWithContextFn     func(ctx context.Context, input *dynamodb.BatchWriteItemInput, op ...request.Option) (*dynamodb.BatchWriteItemOutput, error)
	TransactWriteItemsWithContextFn func(aws.Context, *dynamodb.TransactWriteItemsInput, ...request.Option) (*dynamodb.TransactWriteItemsOutput, error)
	dynamodbiface.DynamoDBAPI
}

func (*MockDynamoDB) BatchWriteItemWithContext added in v1.15.0

func (m *MockDynamoDB) BatchWriteItemWithContext(ctx context.Context, input *dynamodb.BatchWriteItemInput, op ...request.Option) (*dynamodb.BatchWriteItemOutput, error)

func (*MockDynamoDB) DeleteItemWithContext added in v1.15.0

func (m *MockDynamoDB) DeleteItemWithContext(ctx context.Context, input *dynamodb.DeleteItemInput, op ...request.Option) (*dynamodb.DeleteItemOutput, error)

func (*MockDynamoDB) GetItemWithContext added in v1.15.0

func (m *MockDynamoDB) GetItemWithContext(ctx context.Context, input *dynamodb.GetItemInput, op ...request.Option) (*dynamodb.GetItemOutput, error)

func (*MockDynamoDB) PutItemWithContext added in v1.15.0

func (m *MockDynamoDB) PutItemWithContext(ctx context.Context, input *dynamodb.PutItemInput, op ...request.Option) (*dynamodb.PutItemOutput, error)

func (*MockDynamoDB) TransactWriteItemsWithContext added in v1.15.0

func (m *MockDynamoDB) TransactWriteItemsWithContext(ctx context.Context, input *dynamodb.TransactWriteItemsInput, op ...request.Option) (*dynamodb.TransactWriteItemsOutput, error)

type MockParameterStore added in v1.15.0

type MockParameterStore struct {
	GetParameterFn       func(context.Context, *ssm.GetParameterInput, ...request.Option) (*ssm.GetParameterOutput, error)
	DescribeParametersFn func(context.Context, *ssm.DescribeParametersInput, ...request.Option) (*ssm.DescribeParametersOutput, error)
	ssmiface.SSMAPI
}

func (*MockParameterStore) DescribeParametersWithContext added in v1.15.0

func (m *MockParameterStore) DescribeParametersWithContext(ctx context.Context, input *ssm.DescribeParametersInput, option ...request.Option) (*ssm.DescribeParametersOutput, error)

func (*MockParameterStore) GetParameterWithContext added in v1.15.0

func (m *MockParameterStore) GetParameterWithContext(ctx context.Context, input *ssm.GetParameterInput, option ...request.Option) (*ssm.GetParameterOutput, error)

type MockSecretManager added in v1.15.0

func (*MockSecretManager) GetSecretValueWithContext added in v1.15.0

type Options added in v1.15.0

type Options struct {
	Logger     logger.Logger
	Properties map[string]string

	PoolConfig       *pgxpool.Config `json:"poolConfig" mapstructure:"poolConfig"`
	ConnectionString string          `json:"connectionString" mapstructure:"connectionString"`

	// TODO: in Dapr 1.17 rm the alias on regions as we rm the aws prefixed one.
	// Docs have it just as region, but most metadata fields show the aws prefix...
	Region        string `json:"region" mapstructure:"region" mapstructurealiases:"awsRegion"`
	AccessKey     string `json:"accessKey" mapstructure:"accessKey"`
	SecretKey     string `json:"secretKey" mapstructure:"secretKey"`
	SessionName   string `json:"sessionName" mapstructure:"sessionName"`
	AssumeRoleARN string `json:"assumeRoleArn" mapstructure:"assumeRoleArn"`
	SessionToken  string `json:"sessionToken" mapstructure:"sessionToken"`

	Endpoint string
}

type ParameterStoreClients added in v1.15.0

type ParameterStoreClients struct {
	Store ssmiface.SSMAPI
}

func (*ParameterStoreClients) New added in v1.15.0

func (c *ParameterStoreClients) New(session *session.Session)

type Provider added in v1.15.0

type Provider interface {
	S3() *S3Clients
	DynamoDB() *DynamoDBClients
	Sqs() *SqsClients
	Sns() *SnsClients
	SnsSqs() *SnsSqsClients
	SecretManager() *SecretManagerClients
	ParameterStore() *ParameterStoreClients
	Kinesis() *KinesisClients
	Ses() *SesClients
	Kafka(KafkaOptions) (*KafkaClients, error)

	// Postgres is an outlier to the others in the sense that we can update only it's config,
	// as we use a max connection time of 8 minutes.
	// This means that we can just update the config session credentials,
	// and then in 8 minutes it will update to a new session automatically for us.
	UpdatePostgres(context.Context, *pgxpool.Config)

	Close() error
}

func NewProvider added in v1.15.0

func NewProvider(ctx context.Context, opts Options, cfg *aws.Config) (Provider, error)

type S3Clients added in v1.15.0

type S3Clients struct {
	S3         *s3.S3
	Uploader   *s3manager.Uploader
	Downloader *s3manager.Downloader
}

func (*S3Clients) New added in v1.15.0

func (c *S3Clients) New(session *session.Session)

type SecretManagerClients added in v1.15.0

type SecretManagerClients struct {
	Manager secretsmanageriface.SecretsManagerAPI
}

func (*SecretManagerClients) New added in v1.15.0

func (c *SecretManagerClients) New(session *session.Session)

type SesClients added in v1.15.0

type SesClients struct {
	Ses *ses.SES
}

func (*SesClients) New added in v1.15.0

func (c *SesClients) New(session *session.Session)

type SnsClients added in v1.15.0

type SnsClients struct {
	Sns *sns.SNS
}

func (*SnsClients) New added in v1.15.0

func (c *SnsClients) New(session *session.Session)

type SnsSqsClients added in v1.15.0

type SnsSqsClients struct {
	Sns *sns.SNS
	Sqs *sqs.SQS
	Sts *sts.STS
}

func (*SnsSqsClients) New added in v1.15.0

func (c *SnsSqsClients) New(session *session.Session)

type SqsClients added in v1.15.0

type SqsClients struct {
	Sqs sqsiface.SQSAPI
}

func (*SqsClients) New added in v1.15.0

func (c *SqsClients) New(session *session.Session)

func (*SqsClients) QueueURL added in v1.15.0

func (c *SqsClients) QueueURL(ctx context.Context, queueName string) (*string, error)

type StaticAuth added in v1.15.0

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

func (*StaticAuth) Close added in v1.15.0

func (a *StaticAuth) Close() error

func (*StaticAuth) DynamoDB added in v1.15.0

func (a *StaticAuth) DynamoDB() *DynamoDBClients

func (*StaticAuth) Kafka added in v1.15.0

func (a *StaticAuth) Kafka(opts KafkaOptions) (*KafkaClients, error)

func (*StaticAuth) Kinesis added in v1.15.0

func (a *StaticAuth) Kinesis() *KinesisClients

func (*StaticAuth) ParameterStore added in v1.15.0

func (a *StaticAuth) ParameterStore() *ParameterStoreClients

func (*StaticAuth) S3 added in v1.15.0

func (a *StaticAuth) S3() *S3Clients

func (*StaticAuth) SecretManager added in v1.15.0

func (a *StaticAuth) SecretManager() *SecretManagerClients

func (*StaticAuth) Ses added in v1.15.0

func (a *StaticAuth) Ses() *SesClients

func (*StaticAuth) Sns added in v1.15.0

func (a *StaticAuth) Sns() *SnsClients

func (*StaticAuth) SnsSqs added in v1.15.0

func (a *StaticAuth) SnsSqs() *SnsSqsClients

func (*StaticAuth) Sqs added in v1.15.0

func (a *StaticAuth) Sqs() *SqsClients

func (*StaticAuth) UpdatePostgres added in v1.15.0

func (a *StaticAuth) UpdatePostgres(ctx context.Context, poolConfig *pgxpool.Config)

func (*StaticAuth) WithMockClients added in v1.15.0

func (a *StaticAuth) WithMockClients(clients *Clients)

This is to be used only for test purposes to inject mocked clients

Jump to

Keyboard shortcuts

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