table

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.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 AlertOutputItem added in v0.1.1

type AlertOutputItem struct {

	// The user ID of the user that created the alert output
	CreatedBy *string `json:"createdBy"`

	// The time in epoch seconds when the alert output was created
	CreationTime *string `json:"creationTime"`

	// DisplayName is the user-provided name, e.g. "alert-channel".
	DisplayName *string `json:"displayName"`

	// EncryptedConfig is the encrypted JSON of the specific output details.
	EncryptedConfig []byte `json:"encryptedConfig"`

	// The user ID of the user that last modified the alert output last
	LastModifiedBy *string `json:"lastModifiedBy"`

	// The time in epoch seconds when the alert output was last modified
	LastModifiedTime *string `json:"lastModifiedTime"`

	// Identifies uniquely an alert output (table sort key)
	OutputID *string `json:"outputId"`

	// OutputType is the output class, e.g. "slack", "sns".
	// ("type" is a reserved Dynamo keyword, so we use "OutputType" instead)
	OutputType *string `json:"outputType"`

	DefaultForSeverity []*string `json:"defaultForSeverity" dynamodbav:"defaultForSeverity,stringset"`

	// AlertTypes is a whitelist of alert types to send to this destination.
	// To be backwards compatible, we cannot have a `min=1` and an empty list == all types.
	AlertTypes []string `json:"alertTypes" dynamodbav:"alertTypes,stringset"`
}

AlertOutputItem is the output configuration stored in DynamoDB.

type DynamoItem

type DynamoItem = map[string]*dynamodb.AttributeValue

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

type OutputsAPI

type OutputsAPI interface {
	GetOutputByName(*string) (*AlertOutputItem, error)
	DeleteOutput(*string) error
	GetOutputs() ([]*AlertOutputItem, error)
	GetOutput(*string) (*AlertOutputItem, error)
	PutOutput(*AlertOutputItem) error
	UpdateOutput(*AlertOutputItem) (*AlertOutputItem, error)
}

OutputsAPI defines the interface for the outputs table which can be used for mocking.

type OutputsTable

type OutputsTable struct {
	Name             *string
	DisplayNameIndex *string
	// contains filtered or unexported fields
}

OutputsTable encapsulates a connection to the Dynamo rules table.

func NewOutputs

func NewOutputs(name string, displayNameIndex string, sess *session.Session) *OutputsTable

NewOutputs creates an AWS client to interface with the outputs table.

func (*OutputsTable) DeleteOutput

func (table *OutputsTable) DeleteOutput(outputID *string) error

DeleteOutput removes an output from the table.

func (*OutputsTable) GetOutput

func (table *OutputsTable) GetOutput(outputID *string) (*AlertOutputItem, error)

GetOutput returns the configuration of an alert output

func (*OutputsTable) GetOutputByName

func (table *OutputsTable) GetOutputByName(displayName *string) (*AlertOutputItem, error)

GetOutputByName returns an output given it's displayName. If such output doesn't exist, it returns nil.

func (*OutputsTable) GetOutputs

func (table *OutputsTable) GetOutputs() (outputItems []*AlertOutputItem, err error)

GetOutputs returns all the Alert Outputs for one organization

func (*OutputsTable) PutOutput

func (table *OutputsTable) PutOutput(output *AlertOutputItem) error

PutOutput saves the output details to the table.

func (*OutputsTable) UpdateOutput

func (table *OutputsTable) UpdateOutput(alertOutput *AlertOutputItem) (*AlertOutputItem, error)

UpdateOutput updates an existing item in the table

Jump to

Keyboard shortcuts

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