Documentation
¶
Overview ¶
Package cloudaws provides a set of interfaces and implementations for interacting with various AWS services. This package is designed to simplify the creation and management of AWS service clients, making it easier for developers to integrate AWS services into their applications.
The cloudaws package includes an interface, AWSAdapter, which defines methods for creating clients for different AWS services such as SNS, SQS, S3, RDS, EC2, IAM, DynamoDB, Auto Scaling, ECS, and EKS. By using this interface, developers can create mock implementations for testing purposes or extend the functionality to support additional AWS services.
Example usage:
import ( "context" "github.com/yourusername/yourrepo/pkg/cloudaws" ) func main() { // Create a new AWS adapter adapter := cloudaws.NewAWSAdapter() // Create a new S3 client s3Client := adapter.NewS3() // Use the S3 client to interact with the S3 service // ... }
The cloudaws package also provides default implementations for the AWSAdapter interface, which use the AWS SDK for Go (v2) to create service clients. These implementations handle the configuration and authentication required to interact with AWS services, allowing developers to focus on their application logic.
For more information on the AWS SDK for Go (v2), visit: https://aws.github.io/aws-sdk-go-v2/
Note: Ensure that you have the necessary AWS credentials and permissions to access the AWS services you intend to use. You can configure your AWS credentials using environment variables, shared credentials files, or other methods supported by the AWS SDK for Go (v2).
Index ¶
- type AWS
- func (a *AWS) NewAutoScaling() *autoscaling.Client
- func (a *AWS) NewDynamoDB() *dynamodb.Client
- func (a *AWS) NewEC2() *ec2.Client
- func (a *AWS) NewECS() *ecs.Client
- func (a *AWS) NewEKS() *eks.Client
- func (a *AWS) NewIAM() *iam.Client
- func (a *AWS) NewRDS() *rds.Client
- func (a *AWS) NewS3() *s3.Client
- func (a *AWS) NewSNS() *sns.Client
- func (a *AWS) NewSQS() *sqs.Client
- type AWSAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWS ¶
type AWS struct { Region string // contains filtered or unexported fields }
AWS implements the AWSAdapter interface and holds the configuration for AWS services.
func (*AWS) NewAutoScaling ¶
func (a *AWS) NewAutoScaling() *autoscaling.Client
NewAutoScaling creates a new Auto Scaling client.
Returns:
- *autoscaling.Client: A new Auto Scaling client.
func (*AWS) NewDynamoDB ¶
NewDynamoDB creates a new DynamoDB client.
Returns:
- *dynamodb.Client: A new DynamoDB client.
func (*AWS) NewEC2 ¶
NewEC2 creates a new Elastic Compute Cloud (EC2) client.
Returns:
- *ec2.Client: A new EC2 client.
func (*AWS) NewECS ¶
NewECS creates a new Elastic Container Service (ECS) client.
Returns:
- *ecs.Client: A new ECS client.
func (*AWS) NewEKS ¶
NewEKS creates a new Elastic Kubernetes Service (EKS) client.
Returns:
- *eks.Client: A new EKS client.
func (*AWS) NewIAM ¶
NewIAM creates a new Identity and Access Management (IAM) client.
Returns:
- *iam.Client: A new IAM client.
func (*AWS) NewRDS ¶
NewRDS creates a new Relational Database Service (RDS) client.
Returns:
- *rds.Client: A new RDS client.
func (*AWS) NewS3 ¶
NewS3 creates a new Simple Storage Service (S3) client.
Returns:
- *s3.Client: A new S3 client.
type AWSAdapter ¶
type AWSAdapter interface { // NewSNS creates a new Simple Notification Service (SNS) client. NewSNS() *sns.Client // NewSQS creates a new Simple Queue Service (SQS) client. NewSQS() *sqs.Client // NewS3 creates a new Simple Storage Service (S3) client. NewS3() *s3.Client // NewRDS creates a new Relational Database Service (RDS) client. NewRDS() *rds.Client // NewEC2 creates a new Elastic Compute Cloud (EC2) client. NewEC2() *ec2.Client // NewIAM creates a new Identity and Access Management (IAM) client. NewIAM() *iam.Client // NewDynamoDB creates a new DynamoDB client. NewDynamoDB() *dynamodb.Client // NewAutoScaling creates a new Auto Scaling client. NewAutoScaling() *autoscaling.Client // NewECS creates a new Elastic Container Service (ECS) client. NewECS() *ecs.Client // NewEKS creates a new Elastic Kubernetes Service (EKS) client. NewEKS() *eks.Client }
AWSAdapter defines an interface for creating various AWS service clients.
func NewAWS ¶
func NewAWS(region string) (AWSAdapter, error)
NewAWS creates a new instance of AWS with the specified region. It requires AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables to be set.
Parameters:
- region: The AWS region to use.
Returns:
- AWSAdapter: An interface for creating AWS service clients.
- error: An error if the AWS configuration could not be loaded.