snsevt

package
v0.0.0-...-e888a5e Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

README

Amazon Simple Notification Service Events

Back to Home Go Doc AWS Doc

This package allows you to write AWS Lambda functions to process Amazon Simple Notification Service notifications.

Quick Hands-On

For step by step instructions on how to author your AWS Lambda function code in Go, see eawsy/aws-lambda-go-shim.

go get -u -d github.com/eawsy/aws-lambda-go-event/...
package main

import (
	"log"

	"github.com/eawsy/aws-lambda-go-event/service/lambda/runtime/event/snsevt"
	"github.com/eawsy/aws-lambda-go-core/service/lambda/runtime"
)

func Handle(evt *snsevt.Event, ctx *runtime.Context) (interface{}, error) {
	for _, rec := range evt.Records {
		log.Println(rec)
	}
	return nil, nil
}

Documentation

Overview

Package snsevt allows you to write AWS Lambda functions to process Amazon Simple Notification Service notifications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// The list of Amazon SNS event records.
	Records []*EventRecord
}

Event represents an Amazon SNS event.

func (*Event) GoString

func (e *Event) GoString() string

GoString returns the string representation.

func (*Event) String

func (e *Event) String() string

String returns the string representation.

type EventRecord

type EventRecord struct {
	// The event version.
	EventVersion string

	// The event source.
	EventSource string

	// The ARN of the Lambda subscription.
	EventSubscriptionARN string

	// The underlying Amazon SNS record associated with the event.
	SNS *Record
}

EventRecord provides contextual information about an Amazon SNS event.

func (*EventRecord) GoString

func (e *EventRecord) GoString() string

GoString returns the string representation.

func (*EventRecord) String

func (e *EventRecord) String() string

String returns the string representation.

type MessageAttributes

type MessageAttributes struct {
	// The attribute type.
	Type string

	// The attribute value.
	Value string
}

MessageAttributes represents an SNS message attribute.

type Record

type Record struct {
	// A Universally Unique Identifier, unique for each message published.
	// For a message that Amazon SNS resends during a retry, the message ID
	// of the original message is used.
	MessageID string

	// The type of the message.
	Type string

	// The time when the notification was published.
	Timestamp time.Time

	// The Subject parameter specified when the notification was published
	// to the topic.
	// Note that this is an optional parameter.
	Subject string

	// The Message value specified when the notification was published to
	// the topic.
	Message string

	// The attributes associated with the message.
	MessageAttributes map[string]*MessageAttributes

	// The Version of the Amazon SNS signature used.
	SignatureVersion string

	// Base64-encoded "SHA1withRSA" signature of the Message, MessageID,
	// Subject (if present), Type, Timestamp, and TopicARN values.
	// See also http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.verify.signature.html
	Signature string

	// The URL to the certificate that was used to sign the message.
	SignatureCertURL string

	// The URL that you must visit in order to confirm the subscription.
	// Alternatively, you can instead use the Token with the
	// ConfirmSubscription action to confirm the subscription.
	SubscribeURL string

	// A value you can use with the ConfirmSubscription action to confirm the
	// subscription. Alternatively, you can simply visit the SubscribeURL.
	Token string

	// The ARN of the topic that this message was published to.
	TopicARN string

	// An URL that you can use to unsubscribe the endpoint from this topic.
	// If you visit this URL, Amazon SNS unsubscribes the endpoint and stops
	// sending notifications to this endpoint.
	UnsubscribeURL string
}

Record represents the unit of data of an Amazon SNS message. See also http://docs.aws.amazon.com/sns/latest/dg/json-formats.html

Jump to

Keyboard shortcuts

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