aws

package
v0.0.0-...-dbd657b Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSession

func NewSession() *session.Session

NewSession creates an AWS session. Credentials loaded from SDK default credential chain: 1. Environment 2. Shared credentials (~/.aws/credentials) 3. EC2 instance role

Types

type S3

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

S3 handle simple S3 methods

func NewS3

func NewS3(session *session.Session) *S3

NewS3 is a construct function for creating the object with session

func (*S3) GetReadCloser

func (s *S3) GetReadCloser(o *S3Object) (io.ReadCloser, error)

GetReadCloser returns a io.ReadCloser to be readed (and then closed) by another method.

func (*S3) ListObjects

func (s *S3) ListObjects(o *S3Object, oh s3ObjectHandler) (int, error)

ListObjects lists objects present on o.Bucket and prefix o.Key

type S3Object

type S3Object struct {
	Bucket string
	Key    string
}

S3Object represents an object on S3

func NewS3Object

func NewS3Object(bucket, key string) *S3Object

NewS3Object creates a new S3 object

func NewS3ObjectFromURI

func NewS3ObjectFromURI(uri string) (*S3Object, error)

NewS3ObjectFromURI creates a new S3 object from a URI with format: s3://bucket/path

func (*S3Object) String

func (s *S3Object) String() string

String converts current object into string

type S3ObjectWithOriginal

type S3ObjectWithOriginal struct {
	*s3.Object
	*S3Object
}

S3ObjectWithOriginal represents an object on S3 and includes information from original

func NewS3ObjectWithOriginal

func NewS3ObjectWithOriginal(bucket string, original *s3.Object) *S3ObjectWithOriginal

NewS3ObjectWithOriginal creates a new S3 object which includes the original obtained from AWS

type SQS

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

SQS handle simple SQS queue functions used by a consumer

func NewSQS

func NewSQS(session *session.Session, queueURL *string) *SQS

NewSQS is a construct function for creating the object with session and url of the queue as arguments

func (*SQS) DeleteMessage

func (s *SQS) DeleteMessage(receiptHandle *string) error

DeleteMessage deletes a message from queue

func (*SQS) ReceiveMessages

func (s *SQS) ReceiveMessages(mh sqsMessageHandler) (int, bool, error)

ReceiveMessages receives messages from queue and executes message handler for each message Returns the number of messages received and error (if any) Fields present per message:

Body: "{jsonbody}"
MD5OfBody: "1212f7afeed9f2bff8e8ee2b4f81020a"

MessageId: "b872e5af-be32-4a67-82d5-87f062937c8a" ReceiptHandle: "base64encodedstring" Returns an integer with the number of messages received, a boolean indicating that more possible available messages are present on the queue, and the error (if any)

func (*SQS) String

func (s *SQS) String() string

type SQSMessage

type SQSMessage struct {
	*sqs.Message
}

SQSMessage SQS message

func (*SQSMessage) String

func (sm *SQSMessage) String() string

String converts to String

func (*SQSMessage) VerifyMD5Sum

func (sm *SQSMessage) VerifyMD5Sum() bool

VerifyMD5Sum returns true if MD5 passed on message corresponds with the one obtained from body.

type SQSMessageS3Event

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

SQSMessageS3Event SQS message providing from an S3 event

func NewSQSMessageS3Event

func NewSQSMessageS3Event(sqsMessage *SQSMessage) *SQSMessageS3Event

NewSQSMessageS3Event creates a new SQS message from S3 event based on an SQS message

func (*SQSMessageS3Event) ExtractNewObjects

func (s *SQSMessageS3Event) ExtractNewObjects(mh func(*S3Object) error) (uint64, error)

ExtractNewObjects extracts those new S3 objects present on an SQS message Returns the number of new S3 objects extracted

Jump to

Keyboard shortcuts

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