aws

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 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

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

func GetConfig(opts Options) *aws.Config

func GetConfigV2

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

Types

type Clients

type Clients struct {
	Dynamo *DynamoDBClients

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

type DeprecatedKafkaIAM

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

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

type DynamoDBClients struct {
	DynamoDB dynamodbiface.DynamoDBAPI
}

func (*DynamoDBClients) New

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

type EnvironmentSettings

type EnvironmentSettings struct {
	Metadata map[string]string
}

func NewEnvironmentSettings

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

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

type KafkaClients

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

func (*KafkaClients) New

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

type KafkaOptions

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

type KinesisClients

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

func (*KinesisClients) New

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

func (*KinesisClients) Stream

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

func (*KinesisClients) WorkerCfg

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

type MockDynamoDB

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

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

func (*MockDynamoDB) DeleteItemWithContext

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

func (*MockDynamoDB) GetItemWithContext

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

func (*MockDynamoDB) PutItemWithContext

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

func (*MockDynamoDB) TransactWriteItemsWithContext

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

type MockParameterStore

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

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

func (*MockParameterStore) GetParameterWithContext

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

type Options

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

type ParameterStoreClients struct {
	Store ssmiface.SSMAPI
}

func (*ParameterStoreClients) New

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

type Provider

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

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

type S3Clients

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

func (*S3Clients) New

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

type SecretManagerClients

type SecretManagerClients struct {
	Manager secretsmanageriface.SecretsManagerAPI
}

func (*SecretManagerClients) New

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

type SesClients

type SesClients struct {
	Ses *ses.SES
}

func (*SesClients) New

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

type SnsClients

type SnsClients struct {
	Sns *sns.SNS
}

func (*SnsClients) New

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

type SnsSqsClients

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

func (*SnsSqsClients) New

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

type SqsClients

type SqsClients struct {
	Sqs sqsiface.SQSAPI
}

func (*SqsClients) New

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

func (*SqsClients) QueueURL

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

type StaticAuth

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

func (*StaticAuth) Close

func (a *StaticAuth) Close() error

func (*StaticAuth) DynamoDB

func (a *StaticAuth) DynamoDB() *DynamoDBClients

func (*StaticAuth) Kafka

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

func (*StaticAuth) Kinesis

func (a *StaticAuth) Kinesis() *KinesisClients

func (*StaticAuth) ParameterStore

func (a *StaticAuth) ParameterStore() *ParameterStoreClients

func (*StaticAuth) S3

func (a *StaticAuth) S3() *S3Clients

func (*StaticAuth) SecretManager

func (a *StaticAuth) SecretManager() *SecretManagerClients

func (*StaticAuth) Ses

func (a *StaticAuth) Ses() *SesClients

func (*StaticAuth) Sns

func (a *StaticAuth) Sns() *SnsClients

func (*StaticAuth) SnsSqs

func (a *StaticAuth) SnsSqs() *SnsSqsClients

func (*StaticAuth) Sqs

func (a *StaticAuth) Sqs() *SqsClients

func (*StaticAuth) UpdatePostgres

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

func (*StaticAuth) WithMockClients

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