Documentation ¶
Overview ¶
Package awswrapper wraps over the AWS official GO SDK to simplify the usage.
Index ¶
- func NewHTTPClientWithSettings(httpSettings HTTPClientSettings) (*http.Client, error)
- type By
- type ConcurrentDownloader
- type ConcurrentUploader
- type Consumer
- type ECRService
- type ECSService
- type HTTPClientSettings
- type LambdaService
- type MessageHandler
- type S3Service
- func (o *S3Service) AbortMultipart(bucketName, path, uploadID string) error
- func (o *S3Service) CompleteMultipart(bucketName, path, uploadID string, parts map[string]interface{}) error
- func (o *S3Service) CopyWithInS3(sourceBucketName, sourcePath, destBucketName, destPath string, ...) (err error)
- func (o *S3Service) CreateBucket(bucketName, region string) error
- func (o *S3Service) DeleteBucket(bucketName string) error
- func (o *S3Service) Exists(bucketName string, path string) (exists bool, err error)
- func (o *S3Service) GetPreSignedURL(bucketName, path string, validFor time.Duration) (string, error)
- func (o *S3Service) InitMultiPartUpload(bucketName, path string) (string, error)
- func (o *S3Service) ListAllS3(bucketName string, path string) (objectPaths []string, err error)
- func (o *S3Service) ReadFromS3(bucketName string, path string) (content []byte, err error)
- func (o *S3Service) ReadFromS3Concurrently(bucketName string, path string) (content []byte, err error)
- func (o *S3Service) ReadHeadObject(bucketName string, path string) (*s3.HeadObjectOutput, error)
- func (o *S3Service) RemoveAllFromS3(bucketName string, path string) (err error)
- func (o *S3Service) RemoveFromS3(bucketName string, path string) (err error)
- func (o *S3Service) UploadMultipart(bucketName, path, uploadID string, partNumber int64, b []byte) (string, error)
- func (o *S3Service) UploadToS3(content []byte, bucketName string, path string, args ...interface{}) error
- func (o *S3Service) UploadToS3Concurrently(content []byte, bucketName string, path string, args ...interface{}) error
- type SESService
- type SQSService
- type Signer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPClientWithSettings ¶
func NewHTTPClientWithSettings(httpSettings HTTPClientSettings) (*http.Client, error)
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 Consumer ¶
type Consumer struct { SqsService SQSService Handler MessageHandler Consuming bool PollTimeout time.Duration StopChan chan struct{} // a channel to signal to stop consumer StoppedChan chan struct{} // a channel to signal that consumer is stopped QName string MaxNumberOfMessagesPerRequest int64 WaitTimeSeconds int64 VisibilityTimeOut int64 // in seconds RetryCount int8 RetryDelay time.Duration // in seconds }
Consumer defines the attributes of a consumer
func NewConsumer ¶
func NewConsumer(mySQS *SQSService, messageHandler MessageHandler, pollTimeOut time.Duration, qName string, maxNumberOfMessagesPerRequest, waitTimeSeconds, visibilityTimeoutSeconds int64, retryDelay time.Duration, retryCount int8) *Consumer
NewConsumer creates a newConsumer object
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 ECSService ¶
type ECSService struct {
// contains filtered or unexported fields
}
S3Service represents a S3 service.
func GetECSService ¶
func GetECSService(region string) *ECSService
GetECSService gets a ecr service for a specific region
func (*ECSService) RunTask ¶
func (o *ECSService) RunTask(cluster, container, taskDefinitionName string, envVariables map[string]string, commands []string, fargate bool, subnetIDs, securityGroupIDs []string, timeout time.Duration) (err error)
RunTask starts a new task using the specified task definition and in given region
type HTTPClientSettings ¶
type LambdaService ¶
type LambdaService struct {
// contains filtered or unexported fields
}
S3Service represents a S3 service.
func GetLambdaService ¶
func GetLambdaService(region string) *LambdaService
GetLambdaService gets a ecr service for a specific region
func (*LambdaService) Invoke ¶
func (o *LambdaService) Invoke(functionName string, payload []byte, isEvent bool) (*lambda.InvokeOutput, error)
type MessageHandler ¶
MessageHandler defines an interface for message handler function
type S3Service ¶
type S3Service struct {
// contains filtered or unexported fields
}
S3Service represents a S3 service.
func GetS3Service ¶
GetS3Service gets a s3 service for a specific region
func (*S3Service) AbortMultipart ¶
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 ¶
CreateBucket creates a bucket with given name and in given region
func (*S3Service) DeleteBucket ¶
DeleteBucket delete a bucket with given name and in given region
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 ¶
InitMultiPartUpload inits a multiple parts upload
func (*S3Service) ReadFromS3 ¶
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) ReadHeadObject ¶ added in v1.2.0
ReadHeadObject return metadata of an object
func (*S3Service) RemoveAllFromS3 ¶
RemoveAllFromS3 removes a folder with bucketname and path
func (*S3Service) RemoveFromS3 ¶
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
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 string, toAddrs, ccAddrs []string, 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 toAddrs: email addresses to send to ccAddrs: email addresses to send cc 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 SQSService ¶
type SQSService struct {
// contains filtered or unexported fields
}
SQSService defines the attributes of a SQS service
func GetSQSService ¶
func GetSQSService(region string) *SQSService
GetSQSService gets a sqs service for a specific region
func (*SQSService) SendMessage ¶
func (o *SQSService) SendMessage(queueName, payload string) (messageID *string, err error)
SendMessage sends a message payload to a named queue
func (*SQSService) SendMessageBatch ¶ added in v1.3.0
func (o *SQSService) SendMessageBatch(queueName string, payloads []string, delaySeconds *int64) (failedMessageIDs, successMessageIDs []*string, err error)
SendMessageBatch sends the message payloads as a batch to a named queue
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