* TP-55555 | document client and kafka integration * TP-55555 | introduce service concept refactor code * TP-55555 | s3 and kafka producer integrated and tested * TP-55555 | s3 and kafka producer integrated and tested * TP-55555 | fixed kafka for subsequent request * TP-55555 | fixed kafka for subsequent request
27 lines
547 B
Go
27 lines
547 B
Go
package aws
|
|
|
|
import (
|
|
"context"
|
|
"cybertron/configs"
|
|
"github.com/aws/aws-sdk-go-v2/config"
|
|
"github.com/aws/aws-sdk-go-v2/service/s3"
|
|
"log"
|
|
)
|
|
|
|
type Actions struct {
|
|
S3Client *s3.Client
|
|
S3PresignClient *s3.PresignClient
|
|
}
|
|
|
|
func NewS3client(clientConfig configs.AwsConfig) *Actions {
|
|
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion(clientConfig.Region))
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
svc := s3.NewFromConfig(cfg)
|
|
return &Actions{
|
|
S3Client: svc,
|
|
S3PresignClient: s3.NewPresignClient(svc),
|
|
}
|
|
}
|