notifier

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(e events.DynamoDBEvent) error

Handler receives a DynamoDB stream and forwards the message on to SNOW

Types

type DB

type DB struct {
	DynamoDB dynamodbiface.DynamoDBAPI
}

DB wraps DynamodDB with iface pkg for easier testing

func (*DB) AddID

func (d *DB) AddID(ur *Response) (*dynamodb.UpdateItemOutput, error)

AddID adds internal_identifier to existing db record

type Message

type Message struct {
	MessageID string `json:"messageid"`
	IntID     string `json:"internal_identifier,omitempty"`

	Payload `json:"payload"`
}

Message represents a change event

func (*Message) Notify

func (m *Message) Notify() (string, error)

Notify calls SNOW API and returns internal_identifier to Handler

type Payload

type Payload struct {
	SupplierRef string `json:"supplierRef"`
	Status      string `json:"status"`
	Title       string `json:"title"`
	Description string `json:"description"`
	StartTime   string `json:"startTime"`
	EndTime     string `json:"endTime"`
	Success     bool   `json:"success,omitempty"`
}

Payload is the message body

func (*Payload) SetMsg

func (p *Payload) SetMsg(record *events.DynamoDBEventRecord) (*Message, error)

SetMsg adds a message header

type Response

type Response struct {
	SupplierRef string `json:"supplierRef"`
	IntIdent    string `json:"internal_identifier"`
}

Response is returned from SNOW

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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