files

package
v0.0.0-...-8ec2312 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

FIXME: golangci-lint nolint:govet,revive

FIXME: golangci-lint nolint:govet,revive

FIXME: golangci-lint nolint:govet,revive

FIXME: golangci-lint nolint:revive

Index

Constants

View Source
const CloudwatchMaximumLogMessageSize = 262144

Variables

This section is empty.

Functions

func GetNewS3Session

func GetNewS3Session() *session.Session

GetNewS3Session return a new aws s3 session

func Sizeof

func Sizeof(rv reflect.Value) (int, int)

Sizeof receive a reflect value and returns the length and capacity of an object in memory using in Kb

Types

type BatchFolderDeleter

type BatchFolderDeleter struct {
	// contains filtered or unexported fields
}

func (*BatchFolderDeleter) Delete

func (batchFD *BatchFolderDeleter) Delete(bucket string, folderKey string) error

type BatchFolderDeleterAPI

type BatchFolderDeleterAPI interface {
	Delete(bucket string, folderKey string) error
}

func NewBachFolderDeleter

func NewBachFolderDeleter(client s3iface.S3API) BatchFolderDeleterAPI

type Downloader

type Downloader interface {
	DownloadToPath(source string, destinationPath string) error
}

Downloader is the interface that downloads a source into a path

func NewDownloader

func NewDownloader(log log.FieldLogger) Downloader

NewDownloader returns the main downloader used by Edge API

type Extractor

type Extractor interface {
	Extract(rc io.ReadCloser, dst string) error
}

Extractor defines methods to extract files to path

func NewExtractor

func NewExtractor(log log.FieldLogger) Extractor

NewExtractor returns the main extractor used by EdgeAPI

type HTTPDownloader

type HTTPDownloader struct {
	// contains filtered or unexported fields
}

HTTPDownloader implements Downloader and downloads from a URL through HTTP

func (*HTTPDownloader) DownloadToPath

func (d *HTTPDownloader) DownloadToPath(sourceURL string, destinationPath string) error

DownloadToPath download function that puts the source_url into the destination_path on the local filesystem

type LocalUploader

type LocalUploader struct {
	BaseDir string
	// contains filtered or unexported fields
}

LocalUploader isn't actually an uploader but implements the interface in order to allow the workflow to be done to completion on a local machine without S3

func (*LocalUploader) UploadFile

func (u *LocalUploader) UploadFile(fname string, uploadPath string) (string, error)

UploadFile basically copies a file to the local server path Allowing offline development without S3 and satisfying the interface

func (*LocalUploader) UploadRepo

func (u *LocalUploader) UploadRepo(src string, account string, acl string) (string, error)

UploadRepo just returns the src repo folder It doesnt do anything and it doesn't delete the original folder It returns error if the repo is not using u.BaseDir as its base folder Allowing offline development without S3 and satisfying the interface

type RequestPreSigner

type RequestPreSigner struct{}

RequestPreSigner define a request pre-signer

func (*RequestPreSigner) Presign

func (rs *RequestPreSigner) Presign(req S3RequestAPI, expire time.Duration) (string, error)

Presign return a signed URL of a s3 bucket object using a predefined object request

type RequestPreSignerAPI

type RequestPreSignerAPI interface {
	Presign(req S3RequestAPI, expire time.Duration) (string, error)
}

RequestPreSignerAPI base interface for RequestPreSignerAPI

type S3Client

type S3Client struct {
	Client           S3ClientAPI
	Downloader       S3DownloaderAPI
	RequestPreSigner RequestPreSignerAPI
	Uploader         S3UploaderAPI
	FolderDeleter    BatchFolderDeleterAPI
}

S3Client a struct of the S3Client

func GetNewS3Client

func GetNewS3Client() *S3Client

GetNewS3Client return a new S3Client

func (*S3Client) DeleteObject

func (s3Client *S3Client) DeleteObject(bucket string, key string) (*s3.DeleteObjectOutput, error)

DeleteObject API operation on S3 bucket

func (*S3Client) Download

func (s3Client *S3Client) Download(file io.WriterAt, bucket string, key string) (int64, error)

Download downloads an object in S3 and writes the payload into file

func (*S3Client) GetObject

func (s3Client *S3Client) GetObject(bucket string, key string) (*s3.GetObjectOutput, error)

GetObject API operation on S3 bucket

func (*S3Client) GetSignedURL

func (s3Client *S3Client) GetSignedURL(bucket string, key string, expire time.Duration) (string, error)

GetSignedURL return a signed URL of a s3 bucket object location

func (*S3Client) PutObject

func (s3Client *S3Client) PutObject(file io.ReadSeeker, bucket string, key string, acl string) (*s3.PutObjectOutput, error)

PutObject API operation on S3 bucket

func (*S3Client) Upload

func (s3Client *S3Client) Upload(file io.Reader, bucket string, key string, acl string) (*s3manager.UploadOutput, error)

Upload uploads an object to S3 bucket while reading from file

type S3ClientAPI

type S3ClientAPI interface {
	GetObject(input *s3.GetObjectInput) (*s3.GetObjectOutput, error)
	PutObject(input *s3.PutObjectInput) (*s3.PutObjectOutput, error)
	DeleteObject(input *s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)
	GetObjectRequest(input *s3.GetObjectInput) (req *request.Request, output *s3.GetObjectOutput)
}

S3ClientAPI base interface for S3ClientAPI

type S3ClientInterface

type S3ClientInterface interface {
	GetObject(bucket string, key string) (output *s3.GetObjectOutput, err error)
	PutObject(file io.ReadSeeker, bucket string, key string, acl string) (*s3.PutObjectOutput, error)
	DeleteObject(bucket string, key string) (*s3.DeleteObjectOutput, error)
	Download(file io.WriterAt, bucket string, key string) (n int64, err error)
	Upload(file io.Reader, bucket string, key string, acl string) (*s3manager.UploadOutput, error)
	GetSignedURL(bucket string, key string, expire time.Duration) (string, error)
}

S3ClientInterface base interface for S3Client

type S3Downloader

type S3Downloader struct {
	Client S3ClientInterface
	// contains filtered or unexported fields
}

S3Downloader aws s3 files Downloader, download resources at aws s3 bucket via sdk

func NewS3Downloader

func NewS3Downloader(logger log.FieldLogger, client S3ClientInterface) *S3Downloader

NewS3Downloader return a new S3Downloader

func (*S3Downloader) DownloadToPath

func (d *S3Downloader) DownloadToPath(sourceURL string, destinationPath string) error

DownloadToPath download function that puts the source_url at s3 bucket into the destination_path on the local filesystem

type S3DownloaderAPI

type S3DownloaderAPI interface {
	Download(w io.WriterAt, input *s3.GetObjectInput, options ...func(*s3manager.Downloader)) (n int64, err error)
}

S3DownloaderAPI base interface for S3DownloaderAPI

type S3RequestAPI

type S3RequestAPI interface {
	Presign(expire time.Duration) (string, error)
}

S3RequestAPI base interface for S3RequestAPI

type S3Uploader

type S3Uploader struct {
	Client S3ClientInterface
	Bucket string
	// contains filtered or unexported fields
}

S3Uploader defines the mechanism to upload data to S3

func NewS3Uploader

func NewS3Uploader(log log.FieldLogger, client S3ClientInterface) *S3Uploader

NewS3Uploader return a new S3Uploader

func (*S3Uploader) UploadFile

func (u *S3Uploader) UploadFile(fname string, uploadPath string) (string, error)

UploadFile takes a Filename path as a string and then uploads that to the supplied location in s3

func (*S3Uploader) UploadFileWithACL

func (u *S3Uploader) UploadFileWithACL(fname string, uploadPath string, acl string) (string, error)

UploadFileWithACL upload a file from local file system to remote s3 bucket location using the acl supplied. uploadFile takes a Filename path as a string and then uploads that to

func (*S3Uploader) UploadRepo

func (u *S3Uploader) UploadRepo(src string, account string, acl string) (string, error)

UploadRepo uploads the repo to a backing object storage bucket the repository is uploaded to bucket/$account/$name/ with ACL "private" or "public-read"

type S3UploaderAPI

type S3UploaderAPI interface {
	Upload(input *s3manager.UploadInput, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)
}

S3UploaderAPI base interface for S3UploaderAPI

type TARFileExtractor

type TARFileExtractor struct {
	// contains filtered or unexported fields
}

TARFileExtractor implements a method to extract TAR files into a path

func (*TARFileExtractor) Extract

func (f *TARFileExtractor) Extract(rc io.ReadCloser, dst string) error

Extract extracts file to destination path

type Uploader

type Uploader interface {
	UploadRepo(src string, account string, acl string) (string, error)
	UploadFile(fname string, uploadPath string) (string, error)
}

Uploader is an interface for uploading repository

func NewUploader

func NewUploader(log log.FieldLogger) Uploader

NewUploader returns the uploader used by EdgeAPI based on configurations

Jump to

Keyboard shortcuts

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