table

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: AGPL-3.0, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

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)
	ListAlerts(*string, *int) ([]*models.AlertItem, *string, error)
	ListAlertsByRule(*string, *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
	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) ListAlerts

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

ListAlerts returns (a page of alerts, last evaluated key, any error)

func (*AlertsTable) ListAlertsByRule

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

ListAlertsByRule returns (a page of alerts, last evaluated key, any 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