cloudwatchcf

package
v1.3.0-testing Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlarmName

func AlarmName(alarmType, resourceName string) string

func GenerateDashboards

func GenerateDashboards(dashboards []*Dashboard) (cf []byte, err error)

func LambdaMetricFilterName

func LambdaMetricFilterName(lambdaName, metricName string) string

Types

type Alarm

type Alarm struct {
	Resource   string `json:"-"` // use '-' tag so field is not serialized
	Type       string
	Properties AlarmProperties
}

func GenerateAlarms

func GenerateAlarms(settings *config.PantherConfig, cfFiles ...string) ([]*Alarm, []byte, error)

GenerateAlarms will read the CF in yml files in the cfDir, and generate CF for CloudWatch alarms for the infrastructure. NOTE: this will not work for resources referenced with Refs, this code requires constant values.

func NewAlarm

func NewAlarm(resource, name, description string) *Alarm

func (*Alarm) EvaluationPeriods

func (alarm *Alarm) EvaluationPeriods(evalPeriods int) *Alarm

EvaluationPeriods configures alarm for specified evaluation periods

func (*Alarm) MaxMillisecondsThreshold

func (alarm *Alarm) MaxMillisecondsThreshold(threshold float32, period int) *Alarm

MaxMillisecondsThreshold configures alarm for max-based threshold with Milliseconds units

func (*Alarm) MaxNoUnitsThreshold

func (alarm *Alarm) MaxNoUnitsThreshold(threshold float32, period int) *Alarm

MaxNoUnitsThreshold configures alarm for max-based threshold with MB units

func (*Alarm) MaxSecondsThreshold

func (alarm *Alarm) MaxSecondsThreshold(threshold float32, period int) *Alarm

MaxSecondsThreshold configures alarm for max-based threshold with Seconds units

func (*Alarm) Metric

func (alarm *Alarm) Metric(namespace, metricName string, dimensions []MetricDimension) *Alarm

Metric configures alarm for basic metric

func (*Alarm) P95SecondsThreshold added in v1.2.0

func (alarm *Alarm) P95SecondsThreshold(threshold float32, period int) *Alarm

P95SecondsThreshold configures alarm for p90 threshold with Seconds units

func (*Alarm) SumCountThreshold

func (alarm *Alarm) SumCountThreshold(threshold float32, period int) *Alarm

SumCountThreshold configures alarm for sum-based threshold with Count units

func (*Alarm) SumNoUnitsThreshold

func (alarm *Alarm) SumNoUnitsThreshold(threshold float32, period int) *Alarm

SumNoUnitsThreshold configures alarm for sum-based threshold with Count units

type AlarmProperties

type AlarmProperties struct {
	AlarmName          string
	AlarmDescription   string      `json:",omitempty"`
	AlarmActions       []RefString `json:",omitempty"`
	TreatMissingData   string      `json:",omitempty"`
	Namespace          string      `json:",omitempty"`
	MetricName         string
	Dimensions         []MetricDimension `json:",omitempty"`
	ComparisonOperator string
	EvaluationPeriods  int
	Period             int
	Threshold          float32
	Unit               string
	Statistic          string `json:",omitempty"`
	ExtendedStatistic  string `json:",omitempty"`
}

see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html

type Dashboard

type Dashboard struct {
	Type       string
	Properties DashboardProperties
}

func NewDashboard

func NewDashboard(name, body string) *Dashboard

type DashboardProperties

type DashboardProperties struct {
	DashboardBody SubString
	DashboardName SubString
}

type DynamoDBAlarm

type DynamoDBAlarm struct {
	Alarm
}

func NewDynamoDBAlarm

func NewDynamoDBAlarm(operation, alarmType, metricName, message string, resource map[string]interface{}) *DynamoDBAlarm

type JSONDispatcher added in v1.2.0

type JSONDispatcher func(resourceType string, resource map[string]interface{})

type LambdaAlarm

type LambdaAlarm struct {
	Alarm
	// contains filtered or unexported fields
}

func NewLambdaAlarm

func NewLambdaAlarm(alarmType, metricName, message string, resource map[string]interface{}) *LambdaAlarm

type LambdaMetricFilterAlarm

type LambdaMetricFilterAlarm struct {
	LambdaAlarm
}

func NewLambdaMetricFilterAlarm

func NewLambdaMetricFilterAlarm(alarmType, metricName, message string, resource map[string]interface{}) *LambdaMetricFilterAlarm

type MetricDimension

type MetricDimension struct {
	Name string

	// Use only one of Value, ValueSub or ValueRef
	Value string
	// contains filtered or unexported fields
}

func (*MetricDimension) MarshalJSON

func (m *MetricDimension) MarshalJSON() ([]byte, error)

type RefString

type RefString struct {
	Ref string
}

type SFNAlarm added in v1.1.0

type SFNAlarm struct {
	Alarm
}

func NewSFNAlarm added in v1.1.0

func NewSFNAlarm(alarmType, metricName, message string, resource map[string]interface{}) *SFNAlarm

type SNSAlarm

type SNSAlarm struct {
	Alarm
}

func NewSNSAlarm

func NewSNSAlarm(alarmType, metricName, message string, resource map[string]interface{}) *SNSAlarm

type SQSAlarm

type SQSAlarm struct {
	Alarm
}

func NewSQSAlarm

func NewSQSAlarm(queueName, alarmType, metricName, message string) *SQSAlarm

type SubString

type SubString struct {
	Sub string `json:"Fn::Sub"`
}

Jump to

Keyboard shortcuts

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