Documentation ¶
Overview ¶
Package sns provides types to support unmarshalling generic `event *json.RawMessage` types into SNS specific event structures. Sparta-based SNS event listeners can unmarshall the RawMesssage into source-specific data. Example:
func s3EventListener(event *json.RawMessage, context *sparta.LambdaContext, w http.ResponseWriter, logger *logrus.Logger) { var lambdaEvent spartaSNS.Event err := json.Unmarshal([]byte(*event), &lambdaEvent) if err != nil { logger.Error("Failed to unmarshal event data: ", err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) } for _, eachRecord := range lambdaEvent.Records { logger.Info("Message subject: ", eachRecord.Subject) } }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventRecord ¶
type EventRecord struct { EventSource string `json:"EventSource"` EventVersion string `json:"EventVersion"` EventSubscriptionArn string `json:"EventSubscriptionArn"` Sns Sns `json:"Sns"` }
EventRecord event data
type MessageAttributeValues ¶
MessageAttributeValues type/value data for the parent key
type Sns ¶
type Sns struct { Type string `json:"Type"` MessageID string `json:"MessageId"` TopicArn string `json:"TopicArn"` Subject string `json:"Subject"` Message string `json:"Message"` Timestamp string `json:"Timestamp"` SignatureVersion string `json:"SignatureVersion"` Signature string `json:"Signature"` SigningCertURL string `json:"SigningCertUrl"` UnsubscribeURL string `json:"UnsubscribeUrl"` MessageAttributes map[string]MessageAttributeValues }
Sns event information
Click to show internal directories.
Click to hide internal directories.