table

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: AGPL-3.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package table manages all of the Dynamo calls (query, scan, get, write, etc).

Index

Constants

View Source
const (
	RuleIDKey        = "ruleId"
	AlertIDKey       = "alertId"
	TimePartitionKey = "timePartition"
	CreationTimeKey  = "creationTime"
	EventHashKey     = "eventHash"
	EventKey         = "event"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	GetAlert(*string) (*models.AlertItem, error)
	GetEvent([]byte) (*string, error)
	ListByRule(string, *string, *int) ([]*models.AlertItem, *string, error)
	ListAll(*string, *int) ([]*models.AlertItem, *string, error)
}

API defines the interface for the alerts table which can be used for mocking.

type AlertsTable

type AlertsTable struct {
	AlertsTableName                    string
	RuleIDCreationTimeIndexName        string
	TimePartitionCreationTimeIndexName string
	EventsTableName                    string
	Client                             dynamodbiface.DynamoDBAPI
}

AlertsTable encapsulates a connection to the Dynamo alerts table.

func (*AlertsTable) GetAlert

func (table *AlertsTable) GetAlert(alertID *string) (*models.AlertItem, error)

GetAlert retrieve a AlertItem from DDB

func (*AlertsTable) GetEvent

func (table *AlertsTable) GetEvent(eventHash []byte) (*string, error)

GetEvent retrieves an event from DDB

func (*AlertsTable) ListAll added in v0.1.1

func (table *AlertsTable) ListAll(exclusiveStartKey *string, pageSize *int) (
	summaries []*models.AlertItem, lastEvaluatedKey *string, err error)

func (*AlertsTable) ListByRule added in v0.1.1

func (table *AlertsTable) ListByRule(ruleID string, exclusiveStartKey *string, pageSize *int) (
	summaries []*models.AlertItem, lastEvaluatedKey *string, err error)

type DynamoItem

type DynamoItem = map[string]*dynamodb.AttributeValue

DynamoItem is a type alias for the item format expected by the Dynamo SDK.

Jump to

Keyboard shortcuts

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