aws

package
v5.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConstMetadataKMSARN              = "x-kms-arn"
	ConstMetadataEncryptionAlgorithm = "x-encryption-algorithm"
	ConstMetadataContentKey          = "x-content-key"
	ConstEncryptionAlgorithm         = "AES-GCM-256"
)

Variables

View Source
var DefaultMaxMessages int64 = 10
View Source
var ErrTooManyMessageToDelete = fmt.Errorf("too many message in receiptHandlerMap(should be less that 10)")

Functions

func GetDefaultAWSConfig

func GetDefaultAWSConfig() *aws.Config

func GetQueueURL

func GetQueueURL(ctx context.Context, logger log.Log, queueName string, sqsClient *sqs.Client) (*string, error)

func NewKMSClientWithConfig

func NewKMSClientWithConfig(awsConfig aws.Config) *kms.Client

func NewS3ClientWithConfig

func NewS3ClientWithConfig(awsConfig aws.Config) *s3.Client

func NewSNSClientWithConfig

func NewSNSClientWithConfig(awsConfig *aws.Config) *sns.Client

func NewSQSClientWithConfig

func NewSQSClientWithConfig(awsConfig aws.Config) *sqs.Client

func NewSecretManagerClientWithSession

func NewSecretManagerClientWithSession(awsConfig aws.Config) *secretsmanager.Client

func SetDefaultAWSConfig

func SetDefaultAWSConfig(defaultConfig aws.Config, t Tracer)

Types

type BatchQueueMessage

type BatchQueueMessage struct {
	ID                     *string
	Message                *utils.Message
	Attribute              map[string]any
	MessageDeduplicationID *string
	MessageGroupID         *string
}

type KMS

type KMS struct {
	*kms.Client
	// contains filtered or unexported fields
}

func GetDefaultKMSClient

func GetDefaultKMSClient(logger log.Log, keyArn string) *KMS

func NewKMSClient

func NewKMSClient(logger log.Log, client *kms.Client, keyArn string) *KMS

func (*KMS) Decrypt

func (k *KMS) Decrypt(ctx context.Context, cipherBlob []byte) (plainText []byte, err error)

func (*KMS) Encrypt

func (k *KMS) Encrypt(ctx context.Context, plainText []byte) (cipherBlob []byte, err error)

type PIITempFile

type PIITempFile struct {
	Request     *v4.PresignedHTTPRequest `json:"req"`
	ExpiresAt   time.Time                `json:"expiresAt"`
	ContentType *string                  `json:"contentType"`
}

type S3

type S3 struct {
	*s3.Client
	*s3.PresignClient
	// contains filtered or unexported fields
}

func GetDefaultS3Client

func GetDefaultS3Client(logger log.Log) *S3

func NewS3Client

func NewS3Client(client *s3.Client, logger log.Log) *S3

func (*S3) GetFile

func (s *S3) GetFile(ctx context.Context, s3Bucket, s3Key, localFilePath string) error

func (*S3) GetObject

func (s *S3) GetObject(ctx context.Context, s3Bucket, s3Key string) (*s3.GetObjectOutput, error)

func (*S3) PresignGetObject

func (s *S3) PresignGetObject(ctx context.Context, s3Bucket, s3Key string, expireTimeInSeconds int64) (*v4.PresignedHTTPRequest, error)

func (*S3) PresignPutObject

func (s *S3) PresignPutObject(ctx context.Context, s3Bucket, s3Key string, expireTimeInSeconds int64) (*v4.PresignedHTTPRequest, error)

func (*S3) PutFile

func (s *S3) PutFile(ctx context.Context, s3Bucket, s3Key, localFilPath string) (*s3.PutObjectOutput, error)

func (*S3) PutObject

func (s *S3) PutObject(ctx context.Context, s3Bucket, s3Key string, body io.Reader, mimeType string, metadata map[string]string) (*s3.PutObjectOutput, error)

type S3Crypto

type S3Crypto struct {
	*S3
	// contains filtered or unexported fields
}

func GetDefaultS3CryptoClient

func GetDefaultS3CryptoClient(logger log.Log, keyArn string) *S3Crypto

func NewS3CryptoClient

func NewS3CryptoClient(s3Client *S3, kms *KMS, logger log.Log) *S3Crypto

func (*S3Crypto) GetFile

func (s *S3Crypto) GetFile(ctx context.Context, s3Bucket, s3Key, localFilePath string) error

func (*S3Crypto) GetFileCache

func (s *S3Crypto) GetFileCache(ctx context.Context, s3Bucket, s3Key, tempPathPart string) (*PIITempFile, error)

func (*S3Crypto) GetObject

func (s *S3Crypto) GetObject(ctx context.Context, s3Bucket, s3Key string) ([]byte, error)

func (*S3Crypto) PutFile

func (s *S3Crypto) PutFile(ctx context.Context, s3Bucket, s3Key, localFilPath string) error

func (*S3Crypto) PutObject

func (s *S3Crypto) PutObject(ctx context.Context, s3Bucket, s3Key string, body io.Reader, mimeType string) error

type SNS

type SNS struct {
	*sns.Client
	// contains filtered or unexported fields
}

func GetDefaultSNSClient

func GetDefaultSNSClient(logger log.Log) *SNS

func NewSNSClient

func NewSNSClient(logger log.Log, client *sns.Client) *SNS

func (*SNS) GenerateAttribute

func (s *SNS) GenerateAttribute(ctx context.Context, attribute map[string]any) map[string]types.MessageAttributeValue

func (*SNS) Publish

func (s *SNS) Publish(ctx context.Context, topicArn, subject *string, payload *utils.Message, attributes map[string]any) (*sns.PublishOutput, error)

type SQS

type SQS struct {
	*sqs.Client
	// contains filtered or unexported fields
}

func GetDefaultSQSClient

func GetDefaultSQSClient(logger log.Log, queueURL string) *SQS

func NewSQSClient

func NewSQSClient(logger log.Log, client *sqs.Client, queueURL string) *SQS

func (*SQS) DeleteMessage

func (s *SQS) DeleteMessage(ctx context.Context, receiptHandler *string) (*sqs.DeleteMessageOutput, error)

func (*SQS) DeleteMessageBatch

func (s *SQS) DeleteMessageBatch(ctx context.Context, receiptHandlerMap map[string]*string) (*sqs.DeleteMessageBatchOutput, error)

func (*SQS) GenerateAttribute

func (s *SQS) GenerateAttribute(ctx context.Context, attribute map[string]any) map[string]types.MessageAttributeValue

func (*SQS) IsFIFO

func (s *SQS) IsFIFO() bool

func (*SQS) ReceiveMessage

func (s *SQS) ReceiveMessage(ctx context.Context, timeoutInSeconds int32, maxNumberOfMessages int32, waitTimeInSeconds int32) (*sqs.ReceiveMessageOutput, error)

func (*SQS) SendMessage

func (s *SQS) SendMessage(ctx context.Context, message *utils.Message, attribute map[string]any, delayInSeconds int32) (*sqs.SendMessageOutput, error)

func (*SQS) SendMessageBatch

func (s *SQS) SendMessageBatch(ctx context.Context, messageList []*BatchQueueMessage, delayInSeconds int32) (*sqs.SendMessageBatchOutput, error)

func (*SQS) SendMessageFIFO

func (s *SQS) SendMessageFIFO(ctx context.Context, message *utils.Message, attribute map[string]any, delayInSeconds int32, messageDeduplicationID, messageGroupID *string) (*sqs.SendMessageOutput, error)

type SecretManager

type SecretManager struct {
	*secretsmanager.Client
	// contains filtered or unexported fields
}

func GetDefaultSecretManagerClient

func GetDefaultSecretManagerClient(logger log.Log) *SecretManager

func NewSecretManagerClient

func NewSecretManagerClient(logger log.Log, client *secretsmanager.Client) *SecretManager

func (*SecretManager) GetSecret

func (s *SecretManager) GetSecret(ctx context.Context, secretArn string) (map[string]interface{}, error)

type Tracer

type Tracer interface {
	AWS(*aws.Config)
}

Jump to

Keyboard shortcuts

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