Enum HttpCodeTarget
java.lang.Object
java.lang.Enum<HttpCodeTarget>
software.amazon.awscdk.services.elasticloadbalancingv2.HttpCodeTarget
- All Implemented Interfaces:
Serializable
,Comparable<HttpCodeTarget>
,java.lang.constant.Constable
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-11-15T10:24:59.417Z")
@Stability(Stable)
public enum HttpCodeTarget
extends Enum<HttpCodeTarget>
Count of HTTP status originating from the targets.
Example:
import software.amazon.awscdk.services.cloudwatch.*; FargateService service; ApplicationTargetGroup blueTargetGroup; ApplicationTargetGroup greenTargetGroup; IApplicationListener listener; // Alarm on the number of unhealthy ECS tasks in each target group Alarm blueUnhealthyHosts = Alarm.Builder.create(this, "BlueUnhealthyHosts") .alarmName(Stack.of(this).getStackName() + "-Unhealthy-Hosts-Blue") .metric(blueTargetGroup.metricUnhealthyHostCount()) .threshold(1) .evaluationPeriods(2) .build(); Alarm greenUnhealthyHosts = Alarm.Builder.create(this, "GreenUnhealthyHosts") .alarmName(Stack.of(this).getStackName() + "-Unhealthy-Hosts-Green") .metric(greenTargetGroup.metricUnhealthyHostCount()) .threshold(1) .evaluationPeriods(2) .build(); // Alarm on the number of HTTP 5xx responses returned by each target group Alarm blueApiFailure = Alarm.Builder.create(this, "Blue5xx") .alarmName(Stack.of(this).getStackName() + "-Http-5xx-Blue") .metric(blueTargetGroup.metricHttpCodeTarget(HttpCodeTarget.TARGET_5XX_COUNT, MetricOptions.builder().period(Duration.minutes(1)).build())) .threshold(1) .evaluationPeriods(1) .build(); Alarm greenApiFailure = Alarm.Builder.create(this, "Green5xx") .alarmName(Stack.of(this).getStackName() + "-Http-5xx-Green") .metric(greenTargetGroup.metricHttpCodeTarget(HttpCodeTarget.TARGET_5XX_COUNT, MetricOptions.builder().period(Duration.minutes(1)).build())) .threshold(1) .evaluationPeriods(1) .build(); EcsDeploymentGroup.Builder.create(this, "BlueGreenDG") // CodeDeploy will monitor these alarms during a deployment and automatically roll back .alarms(List.of(blueUnhealthyHosts, greenUnhealthyHosts, blueApiFailure, greenApiFailure)) .autoRollback(AutoRollbackConfig.builder() // CodeDeploy will automatically roll back if a deployment is stopped .stoppedDeployment(true) .build()) .service(service) .blueGreenDeploymentConfig(EcsBlueGreenDeploymentConfig.builder() .blueTargetGroup(blueTargetGroup) .greenTargetGroup(greenTargetGroup) .listener(listener) .build()) .deploymentConfig(EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES) .build();
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThe number of 2xx response codes from targets.The number of 3xx response codes from targets.The number of 4xx response codes from targets.The number of 5xx response codes from targets. -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpCodeTarget
Returns the enum constant of this type with the specified name.static HttpCodeTarget[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
TARGET_2XX_COUNT
The number of 2xx response codes from targets. -
TARGET_3XX_COUNT
The number of 3xx response codes from targets. -
TARGET_4XX_COUNT
The number of 4xx response codes from targets. -
TARGET_5XX_COUNT
The number of 5xx response codes from targets.
-
-
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
-