aws

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const FifoQueueSuffix = ".fifo"

FifoQueueSuffix is the suffix used for FIFO (First-In-First-Out) queues in SQS.

View Source
const MAX_GET_OBJECT_BATCH_LIMIT int = 50
View Source
const MAX_OBJECT_PROCESSING_LIMIT int32 = 1000

Constants used for determining limits in S3 operations.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	AcClient awsAppConfigClientInterface
	// contains filtered or unexported fields
}

AppConfig provides AWS AppConfig service operations.

func (*AppConfig) FetchConfig

FetchConfig fetches a configuration from AWS AppConfig.

func (*AppConfig) GetCurrentConfiguration

func (a *AppConfig) GetCurrentConfiguration(uniqueConfigId string) (*appconfig.FetchConfigResult, error)

GetCurrentConfiguration returns the current configuration for a given uniqueConfigId.

func (*AppConfig) StopAllWatching

func (a *AppConfig) StopAllWatching()

StopAllWatching stops all active watchers.

func (*AppConfig) StopWatching

func (a *AppConfig) StopWatching(configID string) error

StopWatching stops watching a configuration.

func (*AppConfig) WatchConfig

func (a *AppConfig) WatchConfig(ctx context.Context, input *appconfig.WatchConfigInput, callback func(*appconfig.FetchConfigResult)) error

WatchConfig starts watching a configuration for changes.

type EmailService

type EmailService struct {
	SesClient awsSesClientInterface
}

func (*EmailService) SendRawEmail

func (s *EmailService) SendRawEmail(ctx context.Context, input *email.SendRawEmailInput) (*email.SendEmailResult, error)

SendRawEmail sends a raw email using AWS SES v2 with attachments and inline images.

func (*EmailService) SendSimpleEmail

func (s *EmailService) SendSimpleEmail(ctx context.Context, input *email.SendSimpleEmailInput) (*email.SendEmailResult, error)

SendSimpleEmail sends a basic email using AWS SES v2 with optional tracking pixel.

type MessageQueue

type MessageQueue struct {
	SqsClient awsSQSClientInterface
}

MessageQueue represents a message queue implementation specifically tailored for AWS's Simple Queue Service (SQS). It provides methods to interact with the SQS service, such as sending, receiving, deleting messages and fetching queue attributes.

func (MessageQueue) ChangeMessageVisibility

func (mq MessageQueue) ChangeMessageVisibility(ctx context.Context, queueUrl string, receiptHandle string, visibilityTimeoutSeconds int32) (*messagequeue.ChangeMessageVisibilityResult, error)

ChangeMessageVisibility updates the visibility timeout for a received SQS message.

func (MessageQueue) DeleteMessage

func (mq MessageQueue) DeleteMessage(ctx context.Context, queueUrl string, receiptHandle string) (*messagequeue.DeleteMessageResult, error)

DeleteMessage removes a message from an SQS queue identified by its URL.

Parameters:

  • queueUrl: The URL of the SQS queue from which the message should be deleted.
  • receiptHandle: A unique identifier associated with the act of receiving the message.

Returns:

  • A pointer to a DeleteMessageResult structure containing details related to the deletion operation.
  • An error object if any issues are encountered during the deletion process. Otherwise, nil.

func (MessageQueue) GetQueueAttributes

func (mq MessageQueue) GetQueueAttributes(ctx context.Context, queueUrl string) (*messagequeue.GetQueueAttributesResult, error)

GetQueueAttributes fetches the attributes of an SQS queue identified by its URL. It retrieves all available attributes for the given queue.

Parameters:

  • queueUrl: The URL of the SQS queue whose attributes are to be fetched.

Returns:

  • A pointer to a GetQueueAttributesResult structure containing the retrieved queue attributes.
  • An error object if any issues are encountered during the retrieval process. Otherwise, nil.

func (MessageQueue) ReceiveMessages

func (mq MessageQueue) ReceiveMessages(ctx context.Context, queueUrl string, maxItems int32) ([]*messagequeue.ReceiveMessageResult, error)

ReceiveMessages fetches messages from an SQS queue identified by its URL. It retrieves messages up to the specified maxItems limit.

Parameters:

  • queueUrl: The URL of the SQS queue from which messages are to be received.
  • maxItems: The maximum number of messages to retrieve in a single call.

Returns:

  • A slice of pointers to ReceiveMessageResult structures, each containing details of a received message.
  • An error object if issues are encountered during the retrieval. Otherwise, nil.

func (MessageQueue) SendMessage

func (mq MessageQueue) SendMessage(ctx context.Context, queueUrl string, messageBody string, messageGroupId string) (*messagequeue.SendMessageResult, error)

SendMessage sends a single message to an SQS queue identified by its URL.

Parameters:

  • queueUrl: The URL of the target SQS queue.
  • messageBody: The content of the message to be sent.
  • messageGroupId: A unique identifier for the message group. Relevant for FIFO (First-In-First-Out) queues.

Returns:

  • A pointer to a SendMessageResult structure containing the details of the sent message.
  • An error object if any issues are encountered during the sending process. Otherwise, nil.

func (MessageQueue) SendMessageWithDedupe

func (mq MessageQueue) SendMessageWithDedupe(ctx context.Context, queueUrl string, messageBody string, messageGroupId string, dedupeID string) (*messagequeue.SendMessageResult, error)

SendMessageWithDedupe sends a single message using an explicit FIFO deduplication id. It is used by higher-level publishers that already own an idempotency key.

type ObjectStorage

type ObjectStorage struct {
	S3Client          awsS3ClientInterface
	S3PresignerClient awsS3PresignerInterface
}

ObjectStorage provides methods for managing objects on AWS S3. It holds a reference to the AWS S3 client to interact with the S3 service.

func (ObjectStorage) CopyObject

func (os ObjectStorage) CopyObject(ctx context.Context, srcBucket string, srcObject string, destBucket string, destObject string) (*objectstorage.CopyObjectResult, error)

CopyObject copies an object from a source bucket to a destination bucket on AWS S3.

Parameters:

  • srcBucket: The name of the source bucket where the object currently resides.
  • srcObject: The key (path) of the object within the source bucket.
  • destBucket: The name of the destination bucket where the object should be copied to.
  • destObject: The desired key (path) of the object within the destination bucket.

Returns:

  • A pointer to CopyObjectResult structure, which contains information about the copied object.
  • An error object if issues are encountered during the copy operation. Otherwise, nil.

func (ObjectStorage) GetMultipleObjects

func (os ObjectStorage) GetMultipleObjects(ctx context.Context, bucket string, keys []string) ([]*objectstorage.GetObjectResult, error)

GetMultipleObjects retrieves multiple objects from the specified AWS S3 bucket using a list of keys. The objects are fetched concurrently in batches, determined by the MAX_GET_OBJECT_BATCH_LIMIT constant.

Parameters:

  • bucket: The name of the S3 bucket from which the objects are to be retrieved.
  • keys: A slice of string keys, each representing a unique identifier for an object within the bucket.

Returns:

  • A slice of pointers to GetObjectResult structures, each containing details of a retrieved object.
  • An error object if issues are encountered during the retrieval or while batching the keys. Otherwise, nil.

func (ObjectStorage) GetObject

func (os ObjectStorage) GetObject(ctx context.Context, bucket string, key string) (*objectstorage.GetObjectResult, error)

GetObject retrieves a specific object from the provided AWS S3 bucket using the given key. It makes use of the AWS SDK's GetObject function and maps the returned AWS object attributes to a custom GetObjectResult structure.

Parameters:

  • bucket: The name of the S3 bucket where the object is stored.
  • key: The unique identifier for the object within the bucket.

Returns:

  • A pointer to a GetObjectResult struct containing details of the retrieved object.
  • An error object if any issues are encountered during the retrieval. Otherwise, nil.

func (ObjectStorage) GetPresignedPutUrl

GetPresignedPutUrl generates a presigned URL for direct S3 upload.

func (ObjectStorage) GetPresignedUrl

func (os ObjectStorage) GetPresignedUrl(ctx context.Context, bucket string, key string, ttl time.Duration) (*objectstorage.GetPresignedUrlResult, error)

GetPresignedUrl generates a presigned URL for an S3 object, allowing temporary access to the object. This method creates a URL that can be used to retrieve the content of the specified S3 object.

Parameters:

  • bucket: The name of the S3 bucket in which the object is stored.
  • key: The object's key (its unique identifier within the bucket).
  • ttl: Duration after which the presigned URL will expire.

Returns:

  • A pointer to GetPresignedUrlResult structure, which contains:
  • The generated presigned URL.
  • The time-to-live (TTL) duration of the URL.
  • The time at which the URL was generated.
  • An error object if there were issues generating the presigned URL; nil otherwise.

func (ObjectStorage) HeadObject

func (os ObjectStorage) HeadObject(ctx context.Context, bucket string, key string) (*objectstorage.HeadObjectResult, error)

HeadObject retrieves object metadata without reading the body.

func (ObjectStorage) ListObject

func (os ObjectStorage) ListObject(ctx context.Context, bucket string, prefix string, maxObjects int32) (*objectstorage.ListObjectResult, error)

ListObject retrieves a list of objects from a specified AWS S3 bucket that matches a given prefix. The method fetches objects in batches to handle large object lists efficiently. It uses AWS S3's continuation tokens for paginated results, ensuring that all relevant objects (up to the specified maxObjects limit) are retrieved.

Parameters:

  • bucket: The name of the S3 bucket to list objects from.
  • prefix: The prefix string which the returned object keys must start with.
  • maxObjects: The maximum number of objects to return. If there are more objects in the bucket that match the given prefix, only the first 'maxObjects' will be returned.

Returns:

  • A pointer to a ListObjectResult struct containing the retrieved objects.
  • An error object if any errors are encountered during the fetch. Otherwise, nil.

func (ObjectStorage) PutObject

PutObject uploads an object to the specified AWS S3 bucket.

Parameters:

  • input: A pointer to PutObjectInput structure containing details of the object to be uploaded such as the bucket name, object key, access control list (ACL), content type, and the object's data.

Behavior:

  • If the provided ACL is empty, the function sets the default ACL to "private".

Returns:

  • A pointer to PutObjectResult structure, containing details of the uploaded object, like its ETag and object key.
  • An error object if issues are encountered during the upload. Otherwise, nil.

type PublishSubscribe

type PublishSubscribe struct {
	SNSClient awsSnsClientInterface
}

PublishSubscribe is a struct that encapsulates an AWS SNS client to provide simplified access to SNS functionalities. It uses an implementation of the awsSnsClientInterface to perform operations, allowing for flexibility in testing and operations management.

Attributes: - SNSClient: An instance of awsSnsClientInterface which is used to interact with AWS SNS.

func (*PublishSubscribe) GetTopicAttributes

GetTopicAttributes fetches the attributes of a specific SNS topic. It requires an input of type *pubsub.GetTopicAttributesInput, which should include the topic ID. This method wraps the topic ID into an SNS GetTopicAttributesInput and retrieves the attributes using the SNS client.

Parameters: - input: Specifies the topic ID for which attributes are being retrieved.

Returns: - *pubsub.GetTopicAttributesResult: Contains a map of the topic attributes if the operation is successful. - error: An error object that may occur during the attribute retrieval process, such as if the topic does not exist or network issues.

Usage: - Useful for managing and monitoring SNS topics, especially when adjusting topic configurations or auditing topic usage and permissions.

func (*PublishSubscribe) Publish

type VisualAnalysis

type VisualAnalysis struct {
	RekognitionClient awsRekognitionClientInterface
}

VisualAnalysis provides image-analysis methods backed by AWS Rekognition.

func (VisualAnalysis) CompareFaces

CompareFaces compares a source image with a target image.

func (VisualAnalysis) DetectFaces

DetectFaces runs face detection for an object-storage image.

func (VisualAnalysis) DetectLabels

DetectLabels runs label detection for an object-storage image.

Jump to

Keyboard shortcuts

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