xaws

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 20 Imported by: 0

README

xaws

Documentation

Index

Constants

View Source
const (
	KB           = 1024         // kilobyte
	MB           = KB * KB      // megabyte
	GB           = KB * KB * KB // gigabyte
	TB           = MB * MB      // terabyte
	MinPartSize  = 5 * MB       // except last part, which can be smaller
	MaxPartSize  = 5 * GB
	MaxTotalSize = 5 * TB
)

re https://docs.aws.amazon.com/AmazonS3/latest/userguide/qfacts.html

View Source
const MaxEmailBytesSESV2 = 40 * 1024 * 1024

Variables

View Source
var ErrDeferTaskTokenResponse = errors.New("task token response deferred")

if an activity function returns this, that means it wants to handle the task token response itself.

Functions

func NewKMS added in v0.0.8

func NewKMS() (*kms.Client, error)

func NewS3 added in v0.0.3

func NewS3() (*s3.Client, error)

func NewSFN added in v0.0.5

func NewSFN() (*sfn.Client, error)

func NewSesV2

func NewSesV2() (*sesv2.Client, error)

func RunActivity added in v0.0.5

func RunActivity[IN, OUT any](
	c context.Context,
	svc *sfn.Client,
	workerName string,
	arn string,
	heartbeatInterval time.Duration,
	activityFunc func(IN, TaskContext) (OUT, error),
) error

func SendEmail

func SendEmail(svc *sesv2.Client, es CoreEmailSpec) (string, error)

will try sending with attachments, and if that fails due to length limit, will try sending without attachments.

func SendEmailWithLength added in v0.0.2

func SendEmailWithLength(svc *sesv2.Client, es CoreEmailSpec) (string, int, error)

sends email and returns with length of raw email data, in bytes, even on error.

Types

type Attachment

type Attachment struct {
	Filename  string
	Content   []byte
	MimeType  string
	ContentID string // optional, will be inline if present
}

type CoreEmailSpec

type CoreEmailSpec struct {
	Subject     string
	From        mail.Address
	ReplyTo     []mail.Address
	To          []mail.Address
	Cc          []mail.Address
	HTML        string
	InReplyTo   string
	References  []string
	Attachments []Attachment
}

type File added in v0.0.2

type File interface {
	io.Reader
	Stat() (fs.FileInfo, error)
}

type MultipartResponse added in v0.0.2

type MultipartResponse struct {
	BytesUploaded int
	PartsUploaded int
}

func UploadMultipart added in v0.0.2

func UploadMultipart(c context.Context, svc *s3.Client, f File, bucket, key string) (*MultipartResponse, error)

for large uploads

type TaskContext added in v0.0.5

type TaskContext struct {
	TaskToken string
}

Jump to

Keyboard shortcuts

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