awswrapper

package
v0.0.0-...-08da8a6 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package awswrapper wraps over the AWS official GO SDK to simplify the usage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type By

type By func(r1, r2 *ecr.ImageDetail) bool

By is the type of a "less" function that defines the ordering of its Planet arguments.

func (By) Sort

func (by By) Sort(imageDetails []*ecr.ImageDetail)

Sort is a method on the function type, By, that sorts the argument slice according to the function.

type ConcurrentDownloader

type ConcurrentDownloader struct {
	DownloadContent map[string][]byte

	DownloadComplete chan bool
	// contains filtered or unexported fields
}

ConcurrentDownloader is used to download multiple files to S3 concurrently.

func NewConcurrentDownloader

func NewConcurrentDownloader(bucketName, region string) (downloader *ConcurrentDownloader)

NewConcurrentDownloader creates a new downloader

func (*ConcurrentDownloader) Download

func (downloader *ConcurrentDownloader) Download(path string)

Download marks to be downloaded path, it will not execute the actual downloading.

func (*ConcurrentDownloader) Execute

func (downloader *ConcurrentDownloader) Execute()

Execute executes the downloading process.

type ConcurrentUploader

type ConcurrentUploader struct {
	UploadComplete chan bool
	// contains filtered or unexported fields
}

ConcurrentUploader is used to upload multiple files to S3 concurrently.

func NewConcurrentUploader

func NewConcurrentUploader(bucketName, region string) (uploader *ConcurrentUploader)

NewConcurrentUploader creates a new uploader

func (*ConcurrentUploader) Execute

func (uploader *ConcurrentUploader) Execute()

Execute executes the uploading process.

func (*ConcurrentUploader) Upload

func (uploader *ConcurrentUploader) Upload(content []byte, path string)

Upload marks the content with the upload path, it will not execute the actual uploading.

type ECRService

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

ECRService represents anecr service.

func GetECRService

func GetECRService(region string) *ECRService

GetECRService gets a ecr service for a specific region

func (*ECRService) ListImages

func (o *ECRService) ListImages(repoName string) (tags [][]string)

ListImages returns all tagged images for a given repo

type S3Service

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

S3Service represents a S3 service.

func GetS3Service

func GetS3Service(region string) *S3Service

GetS3Service gets a s3 service for a specific region

func (*S3Service) AbortMultipart

func (o *S3Service) AbortMultipart(bucketName, path, uploadID string) error

AbortMultipart aborts a multipart upload

func (*S3Service) CompleteMultipart

func (o *S3Service) CompleteMultipart(bucketName, path, uploadID string, parts map[string]interface{}) error

CompleteMultipart marks a multi part upload as complete

func (*S3Service) CopyWithInS3

func (o *S3Service) CopyWithInS3(sourceBucketName, sourcePath, destBucketName, destPath string, deleteAfterCopy bool) (err error)

CopyWithInS3 copys a object from one place to another within a bucket on S3

func (*S3Service) CreateBucket

func (o *S3Service) CreateBucket(bucketName, region string) error

CreateBucket creates a bucket with given name and in given region

func (*S3Service) DeleteBucket

func (o *S3Service) DeleteBucket(bucketName string) error

DeleteBucket delete a bucket with given name and in given region

func (*S3Service) Exists

func (o *S3Service) Exists(bucketName string, path string) (exists bool, err error)

Exists checks whether a given object exists.

func (*S3Service) GetPreSignedURL

func (o *S3Service) GetPreSignedURL(bucketName, path string, validFor time.Duration) (string, error)

GetPreSignedURL gets pre-signed URL that are valid for specified duration.

func (*S3Service) InitMultiPartUpload

func (o *S3Service) InitMultiPartUpload(bucketName, path string) (string, error)

InitMultiPartUpload inits a multiple parts upload

func (*S3Service) ListAllS3

func (o *S3Service) ListAllS3(bucketName string, path string) (objectPaths []string, err error)

ListAllS3 lists all objects with the path as prefix

func (*S3Service) ReadFromS3

func (o *S3Service) ReadFromS3(bucketName string, path string) (content []byte, err error)

ReadFromS3 read the content in byte from S3 with a specific bucket and path

func (*S3Service) ReadFromS3Concurrently

func (o *S3Service) ReadFromS3Concurrently(bucketName string, path string) (content []byte, err error)

ReadFromS3Concurrently reads content from S3 concurrently

func (*S3Service) RemoveAllFromS3

func (o *S3Service) RemoveAllFromS3(bucketName string, path string) (err error)

RemoveAllFromS3 removes a folder with bucketname and path

func (*S3Service) RemoveFromS3

func (o *S3Service) RemoveFromS3(bucketName string, path string) (err error)

RemoveFromS3 removes a object using its bucketname and path

func (*S3Service) UploadMultipart

func (o *S3Service) UploadMultipart(bucketName, path, uploadID string, partNumber int64, b []byte) (string, error)

UploadMultipart uploads a part to S3

func (*S3Service) UploadToS3

func (o *S3Service) UploadToS3(content []byte, bucketName string, path string, args ...interface{}) error

UploadToS3 uploads the content in byte to S3 with a specific bucket and path args. [0]. Make Public Or Not.

func (*S3Service) UploadToS3Concurrently

func (o *S3Service) UploadToS3Concurrently(content []byte, bucketName string, path string, args ...interface{}) error

UploadToS3Concurrently uploads content to S3 concurrently args. [0]. Make Public Or Not.

type SESService

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

SESService represents a SES service.

func GetSESService

func GetSESService(region string) *SESService

GetSESService gets a SES service for a specific region

func (*SESService) SendSESEmail

func (o *SESService) SendSESEmail(subject, fromName, fromAddr, toAddr, data, dataType string, tags ...string) error

SendSESEmail sends email using AWS SES api Parameters: subject: subject of the email fromAddr: email address it's from fromName: whom it's from toAddr: email address to send to data: the body of the email dataType: the type of the body, text or html tags: tags on the email, comes in as key value pair, e.g. "serviceName", "proceq", "env", "dev"

type Signer

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

Signer is a wrapper over aws's signers

func GetURLSigner

func GetURLSigner(keyID string, privateKey *rsa.PrivateKey) *Signer

GetURLSigner gets URL signer by given keyID and private key

func (*Signer) SignURL

func (o *Signer) SignURL(domain, objectPath string, validityTime time.Duration, fileName ...string) (string, error)

SignURL generates a signed cloudfront URL domain: the cloudfront domain objectPath: the S3 path to the object keyID: the cloudfront key ID privKey: the private key validityTime: the validity time of this url in seconds

Jump to

Keyboard shortcuts

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