Enum AlarmBehavior
- All Implemented Interfaces:
Serializable
,Comparable<AlarmBehavior>
,java.lang.constant.Constable
@Generated(value="jsii-pacmak/1.106.0 (build e852934)",
date="2025-01-25T00:20:54.820Z")
@Stability(Stable)
public enum AlarmBehavior
extends Enum<AlarmBehavior>
Deployment behavior when an ECS Service Deployment Alarm is triggered.
Example:
import software.amazon.awscdk.services.cloudwatch.*; Cluster cluster; TaskDefinition taskDefinition; Alarm elbAlarm; FargateService service = FargateService.Builder.create(this, "Service") .cluster(cluster) .taskDefinition(taskDefinition) .minHealthyPercent(100) .deploymentAlarms(DeploymentAlarmConfig.builder() .alarmNames(List.of(elbAlarm.getAlarmName())) .behavior(AlarmBehavior.ROLLBACK_ON_ALARM) .build()) .build(); // Defining a deployment alarm after the service has been created String cpuAlarmName = "MyCpuMetricAlarm"; Alarm.Builder.create(this, "CPUAlarm") .alarmName(cpuAlarmName) .metric(service.metricCpuUtilization()) .evaluationPeriods(2) .threshold(80) .build(); service.enableDeploymentAlarms(List.of(cpuAlarmName), DeploymentAlarmOptions.builder() .behavior(AlarmBehavior.FAIL_ON_ALARM) .build());
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionFAIL_ON_ALARM causes the deployment to fail immediately when any deployment alarm enters the 'Alarm' state.ROLLBACK_ON_ALARM causes the service to roll back to the previous deployment when any deployment alarm enters the 'Alarm' state. -
Method Summary
Modifier and TypeMethodDescriptionstatic AlarmBehavior
Returns the enum constant of this type with the specified name.static AlarmBehavior[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
ROLLBACK_ON_ALARM
ROLLBACK_ON_ALARM causes the service to roll back to the previous deployment when any deployment alarm enters the 'Alarm' state.The Cloudformation stack will be rolled back and enter state "UPDATE_ROLLBACK_COMPLETE".
-
FAIL_ON_ALARM
FAIL_ON_ALARM causes the deployment to fail immediately when any deployment alarm enters the 'Alarm' state.In order to restore functionality, you must roll the stack forward by pushing a new version of the ECS service.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-