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) UpdateAlertDelivery(input *models.UpdateAlertDeliveryInput) (*AlertItem, error)
- func (table *AlertsTable) UpdateAlertStatus(input *models.UpdateAlertStatusInput) ([]*AlertItem, error)
- type AlertsTableEnvConfig
- type DynamoItem
Constants ¶
View Source
const ( RuleIDKey = "ruleId" AlertIDKey = "id" CreatedAtKey = "creationTime" TimePartitionKey = "timePartition" TimePartitionValue = "defaultPartition" TitleKey = "title" SeverityKey = "severity" EventCountKey = "eventCount" StatusKey = "status" LogTypesKey = "logTypes" DeliveryResponsesKey = "deliveryResponses" LastUpdatedByKey = "lastUpdatedBy" LastUpdatedByTimeKey = "lastUpdatedByTime" TypeKey = "type" )
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) UpdateAlertDelivery(*models.UpdateAlertDeliveryInput) (*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"` Type string `json:"type"` RuleID string `json:"ruleId"` RuleVersion string `json:"ruleVersion"` RuleDisplayName *string `json:"ruleDisplayName"` Title string `json:"title"` Description string `json:"description"` Reference string `json:"reference"` Runbook string `json:"runbook"` DestinationOverride []string `json:"destinationOverride,omitempty" validate:"dive,uuid4"` DedupString string `json:"dedup"` FirstEventMatchTime time.Time `json:"firstEventMatchTime"` CreationTime time.Time `json:"creationTime"` DeliveryResponses []*models.DeliveryResponse `json:"deliveryResponses"` // 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) UpdateAlertDelivery ¶ added in v1.8.0
func (table *AlertsTable) UpdateAlertDelivery(input *models.UpdateAlertDeliveryInput) (*AlertItem, error)
UpdateAlertDelivery - updates the alert details and returns the updated item
func (*AlertsTable) UpdateAlertStatus ¶ added in v1.6.0
func (table *AlertsTable) UpdateAlertStatus(input *models.UpdateAlertStatusInput) ([]*AlertItem, error)
UpdateAlertStatus - updates a list of alerts to a specified status and returns the updated list
type AlertsTableEnvConfig ¶ added in v1.12.0
type AlertsTableEnvConfig struct { // env config for instantiating a table.AlertsTable AlertsTableName string `required:"true" split_words:"true"` AlertsRuleIndexName string `required:"true" split_words:"true"` AlertsTimeIndexName string `required:"true" split_words:"true"` }
func (*AlertsTableEnvConfig) NewAlertsTable ¶ added in v1.12.0
func (config *AlertsTableEnvConfig) NewAlertsTable(client dynamodbiface.DynamoDBAPI) *AlertsTable
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.