awscloudwatchactions

package
v2.108.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 10 Imported by: 3

README

CloudWatch Alarm Actions library

This library contains a set of classes which can be used as CloudWatch Alarm actions.

The currently implemented actions are: EC2 Actions, SNS Actions, SSM OpsCenter Actions, Autoscaling Actions and Application Autoscaling Actions

EC2 Action Example

// Alarm must be configured with an EC2 per-instance metric
var alarm alarm

// Attach a reboot when alarm triggers
alarm.AddAlarmAction(
actions.NewEc2Action(actions.Ec2InstanceAction_REBOOT))

SSM OpsCenter Action Example

var alarm alarm

// Create an OpsItem with specific severity and category when alarm triggers
alarm.AddAlarmAction(
actions.NewSsmAction(actions.OpsItemSeverity_CRITICAL, actions.OpsItemCategory_PERFORMANCE))

SSM Incident Manager Action Example

var alarm alarm

// Create an Incident Manager incident based on a specific response plan
alarm.AddAlarmAction(
actions.NewSsmIncidentAction(jsii.String("ResponsePlanName")))

See aws-cdk-lib/aws-cloudwatch for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApplicationScalingAction_Override

func NewApplicationScalingAction_Override(a ApplicationScalingAction, stepScalingAction awsapplicationautoscaling.StepScalingAction)

func NewAutoScalingAction_Override

func NewAutoScalingAction_Override(a AutoScalingAction, stepScalingAction awsautoscaling.StepScalingAction)

func NewEc2Action_Override

func NewEc2Action_Override(e Ec2Action, instanceAction Ec2InstanceAction)

func NewSnsAction_Override

func NewSnsAction_Override(s SnsAction, topic awssns.ITopic)

func NewSsmAction_Override added in v2.11.0

func NewSsmAction_Override(s SsmAction, severity OpsItemSeverity, category OpsItemCategory)

func NewSsmIncidentAction_Override added in v2.38.0

func NewSsmIncidentAction_Override(s SsmIncidentAction, responsePlanName *string)

Types

type ApplicationScalingAction

type ApplicationScalingAction interface {
	awscloudwatch.IAlarmAction
	// Returns an alarm action configuration to use an ApplicationScaling StepScalingAction as an alarm action.
	Bind(_scope constructs.Construct, _alarm awscloudwatch.IAlarm) *awscloudwatch.AlarmActionConfig
}

Use an ApplicationAutoScaling StepScalingAction as an Alarm Action.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var stepScalingAction stepScalingAction

applicationScalingAction := awscdk.Aws_cloudwatch_actions.NewApplicationScalingAction(stepScalingAction)

type AutoScalingAction

type AutoScalingAction interface {
	awscloudwatch.IAlarmAction
	// Returns an alarm action configuration to use an AutoScaling StepScalingAction as an alarm action.
	Bind(_scope constructs.Construct, _alarm awscloudwatch.IAlarm) *awscloudwatch.AlarmActionConfig
}

Use an AutoScaling StepScalingAction as an Alarm Action.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var stepScalingAction stepScalingAction

autoScalingAction := awscdk.Aws_cloudwatch_actions.NewAutoScalingAction(stepScalingAction)

func NewAutoScalingAction

func NewAutoScalingAction(stepScalingAction awsautoscaling.StepScalingAction) AutoScalingAction

type Ec2Action

type Ec2Action interface {
	awscloudwatch.IAlarmAction
	// Returns an alarm action configuration to use an EC2 action as an alarm action.
	Bind(_scope constructs.Construct, _alarm awscloudwatch.IAlarm) *awscloudwatch.AlarmActionConfig
}

Use an EC2 action as an Alarm action.

Example:

// Alarm must be configured with an EC2 per-instance metric
var alarm alarm

// Attach a reboot when alarm triggers
alarm.AddAlarmAction(
actions.NewEc2Action(actions.Ec2InstanceAction_REBOOT))

func NewEc2Action

func NewEc2Action(instanceAction Ec2InstanceAction) Ec2Action

type Ec2InstanceAction

type Ec2InstanceAction string

Types of EC2 actions available.

Example:

// Alarm must be configured with an EC2 per-instance metric
var alarm alarm

// Attach a reboot when alarm triggers
alarm.AddAlarmAction(
actions.NewEc2Action(actions.Ec2InstanceAction_REBOOT))
const (
	// Stop the instance.
	Ec2InstanceAction_STOP Ec2InstanceAction = "STOP"
	// Terminatethe instance.
	Ec2InstanceAction_TERMINATE Ec2InstanceAction = "TERMINATE"
	// Recover the instance.
	Ec2InstanceAction_RECOVER Ec2InstanceAction = "RECOVER"
	// Reboot the instance.
	Ec2InstanceAction_REBOOT Ec2InstanceAction = "REBOOT"
)

type OpsItemCategory added in v2.11.0

type OpsItemCategory string

Types of OpsItem category available.

Example:

var alarm alarm

// Create an OpsItem with specific severity and category when alarm triggers
alarm.AddAlarmAction(
actions.NewSsmAction(actions.OpsItemSeverity_CRITICAL, actions.OpsItemCategory_PERFORMANCE))
const (
	// Set the category to availability.
	OpsItemCategory_AVAILABILITY OpsItemCategory = "AVAILABILITY"
	// Set the category to cost.
	OpsItemCategory_COST OpsItemCategory = "COST"
	// Set the category to performance.
	OpsItemCategory_PERFORMANCE OpsItemCategory = "PERFORMANCE"
	// Set the category to recovery.
	OpsItemCategory_RECOVERY OpsItemCategory = "RECOVERY"
	// Set the category to security.
	OpsItemCategory_SECURITY OpsItemCategory = "SECURITY"
)

type OpsItemSeverity added in v2.11.0

type OpsItemSeverity string

Types of OpsItem severity available.

Example:

var alarm alarm

// Create an OpsItem with specific severity and category when alarm triggers
alarm.AddAlarmAction(
actions.NewSsmAction(actions.OpsItemSeverity_CRITICAL, actions.OpsItemCategory_PERFORMANCE))
const (
	// Set the severity to critical.
	OpsItemSeverity_CRITICAL OpsItemSeverity = "CRITICAL"
	// Set the severity to high.
	OpsItemSeverity_HIGH OpsItemSeverity = "HIGH"
	// Set the severity to medium.
	OpsItemSeverity_MEDIUM OpsItemSeverity = "MEDIUM"
	// Set the severity to low.
	OpsItemSeverity_LOW OpsItemSeverity = "LOW"
)

type SnsAction

type SnsAction interface {
	awscloudwatch.IAlarmAction
	// Returns an alarm action configuration to use an SNS topic as an alarm action.
	Bind(_scope constructs.Construct, _alarm awscloudwatch.IAlarm) *awscloudwatch.AlarmActionConfig
}

Use an SNS topic as an alarm action.

Example:

import cw_actions "github.com/aws/aws-cdk-go/awscdk"
var alarm alarm

topic := sns.NewTopic(this, jsii.String("Topic"))
alarm.AddAlarmAction(cw_actions.NewSnsAction(topic))

func NewSnsAction

func NewSnsAction(topic awssns.ITopic) SnsAction

type SsmAction added in v2.11.0

type SsmAction interface {
	awscloudwatch.IAlarmAction
	// Returns an alarm action configuration to use an SSM OpsItem action as an alarm action.
	Bind(_scope constructs.Construct, _alarm awscloudwatch.IAlarm) *awscloudwatch.AlarmActionConfig
}

Use an SSM OpsItem action as an Alarm action.

Example:

var alarm alarm

// Create an OpsItem with specific severity and category when alarm triggers
alarm.AddAlarmAction(
actions.NewSsmAction(actions.OpsItemSeverity_CRITICAL, actions.OpsItemCategory_PERFORMANCE))

func NewSsmAction added in v2.11.0

func NewSsmAction(severity OpsItemSeverity, category OpsItemCategory) SsmAction

type SsmIncidentAction added in v2.38.0

type SsmIncidentAction interface {
	awscloudwatch.IAlarmAction
	// Returns an alarm action configuration to use an SSM Incident as an alarm action based on an Incident Manager Response Plan.
	Bind(_scope constructs.Construct, _alarm awscloudwatch.IAlarm) *awscloudwatch.AlarmActionConfig
}

Use an SSM Incident Response Plan as an Alarm action.

Example:

var alarm alarm

// Create an Incident Manager incident based on a specific response plan
alarm.AddAlarmAction(
actions.NewSsmIncidentAction(jsii.String("ResponsePlanName")))

func NewSsmIncidentAction added in v2.38.0

func NewSsmIncidentAction(responsePlanName *string) SsmIncidentAction

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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