s3

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package s3 provides structs for working with AWS S3 records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(h Handler)

Handle S3 events with handler.

func HandleFunc

func HandleFunc(h HandlerFunc)

HandleFunc handles S3 events with callback function.

Types

type Bucket

type Bucket struct {
	Name          string `json:"name"`
	OwnerIdentity struct {
		PrincipalID string `json:"principalId"`
	} `json:"ownerIdentity"`
	ARN string `json:"arn"`
}

Bucket is an S3 bucket.

type Event

type Event struct {
	Records []*Record `json:"Records"`
}

Event represents a S3 event with one or more records.

type Handler

type Handler interface {
	HandleS3(*Event, *apex.Context) error
}

Handler handles S3 events.

type HandlerFunc

type HandlerFunc func(*Event, *apex.Context) error

HandlerFunc unmarshals S3 events before passing control.

func (HandlerFunc) Handle

func (h HandlerFunc) Handle(data json.RawMessage, ctx *apex.Context) (interface{}, error)

Handle implements apex.Handler.

type Object

type Object struct {
	Key       string `json:"key"`
	Size      int    `json:"size"`
	ETag      string `json:"eTag"`
	VersionID string `json:"versionId"`
	Sequencer string `json:"sequencer"`
}

Object is an S3 object.

type Record

type Record struct {
	EventVersion string    `json:"eventVersion"`
	EventSource  string    `json:"eventSource"`
	AWSRegion    string    `json:"awsRegion"`
	EventTime    time.Time `json:"eventTime"`
	EventName    string    `json:"eventName"`
	UserIdentity struct {
		PrincipalID string `json:"principalId"`
	} `json:"userIdentity"`
	RequestParameters struct {
		SourceIPAddress string `json:"sourceIPAddress"`
	} `json:"requestParameters"`
	S3 struct {
		SchemaVersion   string  `json:"s3SchemaVersion"`
		ConfigurationID string  `json:"configurationId"`
		Bucket          *Bucket `json:"bucket"`
		Object          *Object `json:"object"`
	}
}

Record represents a single S3 record.

Jump to

Keyboard shortcuts

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