kinesisfirehoseevt

package
Version: 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: 3 Imported by: 0

README

Amazon Kinesis Firehose Events

Back to Home Go Doc AWS Doc

This package allows you to write AWS Lambda functions to transform incoming Amazon Kinesis Firehose source data and deliver the transformed data to destinations.

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/kinesisfirehoseevt"
	"github.com/eawsy/aws-lambda-go-core/service/lambda/runtime"
)

func Handle(in *kinesisfirehoseevt.Input, ctx *runtime.Context) (kinesisfirehoseevt.Output, error) {
	rcds := make([]*kinesisfirehoseevt.OutputRecord, 0)
	for _, r := range in.Records {
		log.Println(r)
		rcds = append(rcds, &kinesisfirehoseevt.OutputRecord{
			RecordID: r.RecordID,
			Result:   "Ok",
			Data:     r.Data,
		})
	}
	return kinesisfirehoseevt.Output{Records: rcds}, nil
}

Documentation

Overview

Package kinesisfirehoseevt allows you to write AWS Lambda functions to transform incoming Amazon Kinesis Firehose source data and deliver the transformed data to destinations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	// The invocation ID.
	InvocationID string

	// The ARN of the Amazon Kinesis Firehose.
	DeliveryStreamARN string

	// The AWS region where the event originated.
	Region string

	// The list of Amazon Kinesis Firehose event records.
	Records []*InputRecord
}

Input represents an Amazon Kinesis Firehose delivery stream event and provides contextual information.

func (*Input) GoString

func (e *Input) GoString() string

GoString returns the string representation.

func (*Input) String

func (e *Input) String() string

String returns the string representation.

type InputRecord

type InputRecord struct {
	// The unique identifier of the record passed from
	// Amazon Kinesis Firehose to AWS Lambda.
	RecordID string

	// The approximate time that the record was inserted into the
	// Amazon Kinesis Firehose delivery stream. This is set when a delivery
	// stream successfully receives and stores a record and is commonly
	// referred to as a server-side timestamp. It has millisecond precision
	// and there are no guarantees about its accuracy, or that it is always
	// increasing. For example, records in a specific
	// Amazon Kinesis Firehose delivery stream might have timestamps that
	// are out of order.
	ApproximateArrivalTimestamp time.Time

	// The data blob. The data in the blob is both opaque and immutable to
	// the Amazon Kinesis Firehose service, which does not inspect,
	// interpret, or change the data in the blob in any way. The data blob
	// consists of any kind of data and the total size must not exceed the
	// maximum record size (1 MB).
	// Data is automatically base64 encoded/decoded by the SDK.
	Data []byte
}

InputRecord represents the unit of data of an Amazon Kinesis Firehose event.

func (*InputRecord) MarshalJSON

func (r *InputRecord) MarshalJSON() ([]byte, error)

MarshalJSON reverts the effect of type aliasing and struct embedding used during the marshalling step to make the pattern seamless.

func (*InputRecord) UnmarshalJSON

func (r *InputRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON interprets data as a Record with a special timestamp. It then leverages type aliasing and struct embedding to fill Record with an usual time.Time.

type Output

type Output struct {
	// Transformed Amazon Kinesis Firehose records.
	Records []*OutputRecord `json:"records"`
}

Output represents the result of the processing of Amazon Kinesis Firehose input records.

func (*Output) GoString

func (e *Output) GoString() string

GoString returns the string representation.

func (*Output) String

func (e *Output) String() string

String returns the string representation.

type OutputRecord

type OutputRecord struct {
	// The record ID is passed from Amazon Kinesis Firehose to AWS Lambda
	// during the invocation. The transformed record must contain the same
	// record ID. Any mismatch between the ID of the original record and the
	// ID of the transformed record is treated as a data transformation
	// failure.
	RecordID string `json:"recordId"`

	// The status of the data transformation of the record. The possible
	// values are:
	// - "Ok": the record was transformed successfully.
	// - "Dropped": the record was dropped intentionally by your processing
	//   logic.
	// - "ProcessingFailed": the record could not be transformed.
	// If a record has a status of "Ok" or "Dropped",
	// Amazon Kinesis firehose considers it successfully processed.
	// Otherwise, Amazon Kinesis Firehose considers it unsuccessfully
	// processed.
	Result string `json:"result"`

	// The transformed data payload, after base64-encoding.
	Data []byte `json:"data"`
}

OutputRecord represents the transformed Amazon Kinesis Firehose record

Jump to

Keyboard shortcuts

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