Documentation
¶
Overview ¶
Package providers contains functionality for managing and interfacing with various AWS services. It abstracts the complexities of AWS SDK configuration and provides simplified access to AWS resources like S3, SQS, and SNS. The package defines structures and methods for initializing AWS clients based on different authentication modes, and it handles client lifecycle management including configuration caching and service client instantiation.
Structures:
- AwsCloud: Central structure in the package, providing methods to retrieve configured service clients for AWS services. It supports different authentication mechanisms, including IAM roles and access key based authentication.
Key Functionalities:
- Configuring AWS clients: AwsCloud uses the AWS SDK's config and credentials packages to configure and initialize service clients with appropriate authentication credentials.
- Service Client Initialization: AwsCloud provides methods to get instances of service clients (for S3, SQS, and SNS), ensuring thread safety and reusability using sync.Mutex for each service client type.
- Authentication Handling: Supports IAM role-based and access key-based authentication by handling AWS credentials dynamically based on the configured authentication mode.
Index ¶
- type AwsCloud
- func (awscloud *AwsCloud) GetAppConfigService(ctx context.Context) (*awsservice.AppConfig, error)
- func (awscloud *AwsCloud) GetEmailService(ctx context.Context) (*awsservice.EmailService, error)
- func (awscloud *AwsCloud) GetMessageQueue(ctx context.Context) (*awsservice.MessageQueue, error)
- func (awscloud *AwsCloud) GetObjectStorage(ctx context.Context) (*awsservice.ObjectStorage, error)
- func (awscloud *AwsCloud) GetPublishSubscribe(ctx context.Context) (*awsservice.PublishSubscribe, error)
- func (awscloud *AwsCloud) GetVisualAnalysisService(ctx context.Context) (*awsservice.VisualAnalysis, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AwsCloud ¶
type AwsCloud struct {
AuthArguments *entity.CloudAuthArguments
// contains filtered or unexported fields
}
AwsCloud represents a structure to interact with various AWS services. It contains AWS configuration, synchronization primitives, and service clients.
func NewAwsCloud ¶
func NewAwsCloud(authArguments *entity.CloudAuthArguments) (*AwsCloud, error)
func (*AwsCloud) GetAppConfigService ¶
func (*AwsCloud) GetEmailService ¶
func (awscloud *AwsCloud) GetEmailService(ctx context.Context) (*awsservice.EmailService, error)
func (*AwsCloud) GetMessageQueue ¶
func (awscloud *AwsCloud) GetMessageQueue(ctx context.Context) (*awsservice.MessageQueue, error)
GetMessageQueue initializes and returns the MessageQueue service client for AWS SQS. The service client is set up once and reused for subsequent calls.
func (*AwsCloud) GetObjectStorage ¶
func (awscloud *AwsCloud) GetObjectStorage(ctx context.Context) (*awsservice.ObjectStorage, error)
GetObjectStorage initializes and returns the ObjectStorage service client for AWS S3. The service client is set up once and reused for subsequent calls.
func (*AwsCloud) GetPublishSubscribe ¶
func (awscloud *AwsCloud) GetPublishSubscribe(ctx context.Context) (*awsservice.PublishSubscribe, error)
GetPublishSubscribe initializes and returns the PublishSubscribe service client for AWS SNS. The service client is set up once and reused for subsequent calls.
func (*AwsCloud) GetVisualAnalysisService ¶
func (awscloud *AwsCloud) GetVisualAnalysisService(ctx context.Context) (*awsservice.VisualAnalysis, error)