Documentation
¶
Overview ¶
Package table manages all of the Dynamo calls (query, scan, get, write, etc).
Index ¶
- Constants
- type API
- type AlertItem
- type AlertsTable
- func (table *AlertsTable) GetAlert(alertID *string) (*AlertItem, error)
- func (table *AlertsTable) ListAll(input *models.ListAlertsInput) (summaries []*AlertItem, lastEvaluatedKey *string, err error)
- func (table *AlertsTable) UpdateAlertStatus(input *models.UpdateAlertStatusInput) (*AlertItem, error)
- type DynamoItem
Constants ¶
View Source
const ( RuleIDKey = "ruleId" AlertIDKey = "id" CreatedAtKey = "creationTime" TimePartitionKey = "timePartition" TimePartitionValue = "defaultPartition" TitleKey = "title" SeverityKey = "severity" EventCountKey = "eventCount" StatusKey = "status" LastUpdatedByKey = "lastUpdatedBy" LastUpdatedByTimeKey = "lastUpdatedByTime" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
GetAlert(*string) (*AlertItem, error)
ListAll(*models.ListAlertsInput) ([]*AlertItem, *string, error)
UpdateAlertStatus(*models.UpdateAlertStatusInput) (*AlertItem, 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 - stores the timestamp from an update from a dedup event
UpdateTime time.Time `json:"updateTime"`
Severity string `json:"severity"`
Status string `json:"status"`
EventCount int `json:"eventCount"`
LogTypes []string `json:"logTypes"`
// LastUpdatedBy - stores the UserID of the last person who modified the Alert
LastUpdatedBy string `json:"lastUpdatedBy"`
// LastUpdatedByTime - stores the timestamp of the last person who modified the Alert
LastUpdatedByTime time.Time `json:"lastUpdatedByTime"`
}
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(input *models.ListAlertsInput) ( summaries []*AlertItem, lastEvaluatedKey *string, err error)
ListAll - lists all alerts and apply filtering, sorting logic
func (*AlertsTable) UpdateAlertStatus ¶ added in v1.6.0
func (table *AlertsTable) UpdateAlertStatus(input *models.UpdateAlertStatusInput) (*AlertItem, error)
UpdateAlertStatus - updates the alert details and returns the updated item
type DynamoItem ¶
type DynamoItem = map[string]*dynamodb.AttributeValue
DynamoItem is a type alias for the item format expected by the Dynamo SDK.
Click to show internal directories.
Click to hide internal directories.