table

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: AGPL-3.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         = "id"
	TimePartitionKey   = "timePartition"
	TimePartitionValue = "defaultPartition"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

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

type AlertItem added in v1.0.0

type AlertItem struct {
	AlertID         string    `json:"id"`
	RuleID          string    `json:"ruleId"`
	RuleVersion     string    `json:"ruleVersion"`
	RuleDisplayName *string   `json:"ruleDisplayName"`
	Title           *string   `json:"title"`
	DedupString     string    `json:"dedup"`
	CreationTime    time.Time `json:"creationTime"`
	UpdateTime      time.Time `json:"updateTime"`
	Severity        string    `json:"severity"`
	EventCount      int       `json:"eventCount"`
	LogTypes        []string  `json:"logTypes"`
}

AlertItem is a DDB representation of an Alert

type AlertsTable

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

AlertsTable encapsulates a connection to the Dynamo alerts table.

func (*AlertsTable) GetAlert

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

GetAlert retrieve a AlertItem from DDB

func (*AlertsTable) ListAll added in v0.1.1

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

func (*AlertsTable) ListByRule added in v0.1.1

func (table *AlertsTable) ListByRule(ruleID string, exclusiveStartKey *string, pageSize *int) (
	summaries []*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