sns

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: 1

Documentation

Overview

Package sns provides structs for working with AWS SNS records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(h Handler)

Handle SNS events with handler.

func HandleFunc

func HandleFunc(h HandlerFunc)

HandleFunc handles SNS events with callback function.

Types

type Event

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

Event represents a SNS event. It is safe to assume a single record will be present, as AWS will not send more than one.

type Handler

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

Handler handles SNS events.

type HandlerFunc

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

HandlerFunc unmarshals SNS events before passing control.

func (HandlerFunc) Handle

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

Handle implements apex.Handler.

type Record

type Record struct {
	EventSource  string `json:"EventSource"`
	EventVersion string `json:"EventVersion"`
	SNS          struct {
		Type              string                 `json:"Type"`
		MessageID         string                 `json:"MessageID"`
		TopicARN          string                 `json:"TopicArn"`
		Subject           string                 `json:"Subject"`
		Message           string                 `json:"Message"`
		Timestamp         time.Time              `json:"Timestamp"`
		SignatureVersion  string                 `json:"SignatureVersion"`
		Signature         string                 `json:"Signature"`
		SignatureCertURL  string                 `json:"SignatureCertURL"`
		UnsubscribeURL    string                 `json:"UnsubscribeURL"`
		MessageAttributes map[string]interface{} `json:"MessageAttributes"`
	} `json:"Sns"`
}

Record represents a single SNS record.

Jump to

Keyboard shortcuts

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