doggo

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertMetricAlarmToAlarmSNSPayload

func ConvertMetricAlarmToAlarmSNSPayload(alarm types.MetricAlarm) (*events.CloudWatchAlarmSNSPayload, error)

func Main

func Main(d *Doggo) error

Main is an entry point for cloudwatchdoggo.

Types

type BarkItem

type BarkItem struct {
	BarkItemKey

	LastBarkedAt time.Time `json:"last_barked_at" dynamodbav:"last_barked_at"`
	TTL          int64     `json:"ttl" dynamodbav:"ttl"`
}

BarkItem represents an item stored in DynamoDB.

func (BarkItem) ShouldBark

func (i BarkItem) ShouldBark(willBarkAfter time.Time) bool

type BarkItemKey

type BarkItemKey struct {
	AlarmID        string `json:"alarm_id" dynamodbav:"alarm_id"`                 // hash key
	StateUpdatedAt int64  `json:"state_updated_at" dynamodbav:"state_updated_at"` // range key
}

BarkItemKey represents a primary key of the BarkItem.

type Doggo

type Doggo struct {
	SNS        *sns.Client
	CloudWatch *cloudwatch.Client
	DynamoDB   *dynamodb.Client

	// DynamoDB Table to store the state
	TableName string

	// Amazon SNS Topic used with AWS Chatbot
	BarkSNSArn string

	// An interval to bark again since the last bark
	BarkInterval time.Duration

	// If true, it will print debug logs.
	DebugOn bool
}

func (*Doggo) Bark

func (d *Doggo) Bark(alarm types.MetricAlarm) error

Bark sends a given alarm to actions specified in the alarm.

func (*Doggo) GetLatestBarkStatus

func (d *Doggo) GetLatestBarkStatus(alarm types.MetricAlarm) (*BarkItem, error)

func (*Doggo) ListAlarmsInAlarm

func (d *Doggo) ListAlarmsInAlarm() ([]types.MetricAlarm, error)

Jump to

Keyboard shortcuts

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