aws

package
v0.0.0-...-b89426d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AwsClientConfigData

type AwsClientConfigData struct {
	AwsRegion      string
	AwsAccessKeyId string
	AwsSecretKey   string
}

func AwsS3ProductionConfig

func AwsS3ProductionConfig() (awsClientConfig *AwsClientConfigData, 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 AwsMethodInterface

type AwsMethodInterface struct {
	MethodInterface S3Repository
}

func GetAwsMethods

func GetAwsMethods(awsClientConfig *AwsClientConfigData) (awsClientMethods *AwsMethodInterface, err error)

func NewAwsMethodInterface

func NewAwsMethodInterface(s3Client *S3Client) *AwsMethodInterface

type S3Client

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

func NewAwsClient

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

func (*S3Client) BucketExists

func (awsS3 *S3Client) BucketExists(bucketName string) (bool, error)

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

func (*S3Client) DeleteFolderContents

func (awsS3 *S3Client) DeleteFolderContents(bucketName, folderPrefix string) error

////////////////////////////////////////////////////////////////////////////////////// DeleteFolderContents recursively deletes all objects and subfolders within a folder ////////////////////

func (*S3Client) DeleteObjects

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

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

func (*S3Client) ListFolderNamesS3

func (awsS3 *S3Client) ListFolderNamesS3(bucketName, folderPrefix string) ([]string, error)

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

func (*S3Client) S3ObjectExists

func (awsS3 *S3Client) S3ObjectExists(key, bucketName string) (bool, error)

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

func (*S3Client) UploadFile

func (client *S3Client) UploadFile(bucketName string, objectKey string, filePath string) error

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

type S3Repository

type S3Repository interface {
	UploadFile(bucketName string, objectKey string, filePath string) error
	DeleteObjects(bucketName string, objectKeys []string) error
	ListFolderNamesS3(bucketName, folderPrefix string) ([]string, error)
	DeleteFolderContents(bucketName, folderPrefix string) error
	BucketExists(bucketName string) (bool, 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