kinesis

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2018 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package kinesis provides types to support unmarshalling generic `event *json.RawMessage` types into Kinesis specific event structures. Sparta-based Kinesis 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 spartaKinesis.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("Kinesis event:", eachRecord.EventName)
  }
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Records []EventRecord
}

Event data

type EventRecord

type EventRecord struct {
	EventSource       string  `json:"eventSource"`
	EventID           string  `json:"eventID"`
	InvokeIdentityARN string  `json:"invokeIdentityArn"`
	EventVersion      string  `json:"eventVersion"`
	EventName         string  `json:"eventName"`
	EventSourceARN    string  `json:"eventSourceARN"`
	AWSRegion         string  `json:"awsRegion"`
	Kinesis           Kinesis `json:"kinesis"`
}

EventRecord event data

type Kinesis

type Kinesis struct {
	PartitionKey         string `json:"partitionKey"`
	KinesisSchemaVersion string `json:"kinesisSchemaVersion"`
	Data                 string `json:"data"`
	SequenceNumber       string `json:"sequenceNumber"`
}

Kinesis Event data. TODO - automatically base64 decode `Data`

Jump to

Keyboard shortcuts

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