aws

package
v0.0.0-...-537d0aa Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfigData

type ClientConfigData struct {
	AwsRegion      string
	AwsAccessKeyID string
	AwsSecretKey   string
}

func S3ProductionConfig

func S3ProductionConfig() (awsClientConfig *ClientConfigData, bucketName string,
	err error)

Retrieve configuration data (eg. aws region, access key) from .env file for production settings only Base parameter for dependency injection of aws client (production)

type MethodInterface

type MethodInterface struct {
	RepositoryInterfaceS3 S3Repository
}

func GetAwsMethods

func GetAwsMethods(awsClientConfig *ClientConfigData) (awsClientMethods *MethodInterface, err error)

func NewAwsMethodInterface

func NewAwsMethodInterface(s3Client *S3Client) *MethodInterface

type S3Client

type S3Client struct {
	Client *s3.Client // Requires AWS SDK setup for actual usage
}

func NewAwsClient

func NewAwsClient(awsClientConfig *ClientConfigData) (client *S3Client, err error)

func (*S3Client) BucketExists

func (client *S3Client) BucketExists(bucketName string) (bucketExists bool, err error)

//////////////////////////////////////////////////////////// Validate if S3 bucket exists ////////////////////////////////

func (*S3Client) ChangeObjectName

func (client *S3Client) ChangeObjectName(bucketName, oldObjectKey, newObjectKey string) error

/////////////////////////////////////////////////////////////////////// List all virtual folders inside a virtual S3 folder (folderPrefix) ///////////////////////////////////

func (*S3Client) DeleteObjects

func (client *S3Client) DeleteObjects(bucketName string, objectKeys []string) error

//////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// Delete object from aws S3 bucket

func (*S3Client) S3ObjectExists

func (client *S3Client) S3ObjectExists(objectKey, bucketName string) (objectExists bool, err error)

//////////////////////////////////////////////////////////// Check if object in S3 bucket exists ///////////////////////////////////

func (*S3Client) UploadFile

func (client *S3Client) UploadFile(bucketName string, objectKey string, fileBytes []byte) error

///////////////////////////////////////////////////////////////////// //// UPLOADER Upload object to S3

type S3Repository

type S3Repository interface {
	UploadFile(bucketName string, objectKey string, fileBytes []byte) error
	BucketExists(bucketName string) (bucketExists bool, err error)
	DeleteObjects(bucketName string, objectKeys []string) error
	S3ObjectExists(objectKey, bucketName string) (objectExists bool, err error)
	ChangeObjectName(bucketName, oldObjectKey, newObjectKey string) error
}

/////////////////////////////////////////////////////////// Setup interface for AWS S3 repository utilizing Dependency Injection /////////////////////

Jump to

Keyboard shortcuts

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