software.amazon.awssdk.services.cloudwatch.model.PutMetricAlarmRequest Maven / Gradle / Ivy
Show all versions of bundle Show documentation
/*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.cloudwatch.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class PutMetricAlarmRequest extends CloudWatchRequest implements
ToCopyableBuilder {
private final String alarmName;
private final String alarmDescription;
private final Boolean actionsEnabled;
private final List okActions;
private final List alarmActions;
private final List insufficientDataActions;
private final String metricName;
private final String namespace;
private final String statistic;
private final String extendedStatistic;
private final List dimensions;
private final Integer period;
private final String unit;
private final Integer evaluationPeriods;
private final Integer datapointsToAlarm;
private final Double threshold;
private final String comparisonOperator;
private final String treatMissingData;
private final String evaluateLowSampleCountPercentile;
private PutMetricAlarmRequest(BuilderImpl builder) {
super(builder);
this.alarmName = builder.alarmName;
this.alarmDescription = builder.alarmDescription;
this.actionsEnabled = builder.actionsEnabled;
this.okActions = builder.okActions;
this.alarmActions = builder.alarmActions;
this.insufficientDataActions = builder.insufficientDataActions;
this.metricName = builder.metricName;
this.namespace = builder.namespace;
this.statistic = builder.statistic;
this.extendedStatistic = builder.extendedStatistic;
this.dimensions = builder.dimensions;
this.period = builder.period;
this.unit = builder.unit;
this.evaluationPeriods = builder.evaluationPeriods;
this.datapointsToAlarm = builder.datapointsToAlarm;
this.threshold = builder.threshold;
this.comparisonOperator = builder.comparisonOperator;
this.treatMissingData = builder.treatMissingData;
this.evaluateLowSampleCountPercentile = builder.evaluateLowSampleCountPercentile;
}
/**
*
* The name for the alarm. This name must be unique within the AWS account.
*
*
* @return The name for the alarm. This name must be unique within the AWS account.
*/
public String alarmName() {
return alarmName;
}
/**
*
* The description for the alarm.
*
*
* @return The description for the alarm.
*/
public String alarmDescription() {
return alarmDescription;
}
/**
*
* Indicates whether actions should be executed during any changes to the alarm state.
*
*
* @return Indicates whether actions should be executed during any changes to the alarm state.
*/
public Boolean actionsEnabled() {
return actionsEnabled;
}
/**
*
* The actions to execute when this alarm transitions to an OK
state from any other state. Each action
* is specified as an Amazon Resource Name (ARN).
*
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover | arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The actions to execute when this alarm transitions to an OK
state from any other state. Each
* action is specified as an Amazon Resource Name (ARN).
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*/
public List okActions() {
return okActions;
}
/**
*
* The actions to execute when this alarm transitions to the ALARM
state from any other state. Each
* action is specified as an Amazon Resource Name (ARN).
*
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover | arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The actions to execute when this alarm transitions to the ALARM
state from any other state.
* Each action is specified as an Amazon Resource Name (ARN).
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*/
public List alarmActions() {
return alarmActions;
}
/**
*
* The actions to execute when this alarm transitions to the INSUFFICIENT_DATA
state from any other
* state. Each action is specified as an Amazon Resource Name (ARN).
*
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover | arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The actions to execute when this alarm transitions to the INSUFFICIENT_DATA
state from any
* other state. Each action is specified as an Amazon Resource Name (ARN).
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*/
public List insufficientDataActions() {
return insufficientDataActions;
}
/**
*
* The name for the metric associated with the alarm.
*
*
* @return The name for the metric associated with the alarm.
*/
public String metricName() {
return metricName;
}
/**
*
* The namespace for the metric associated with the alarm.
*
*
* @return The namespace for the metric associated with the alarm.
*/
public String namespace() {
return namespace;
}
/**
*
* The statistic for the metric associated with the alarm, other than percentile. For percentile statistics, use
* ExtendedStatistic
. When you call PutMetricAlarm
, you must specify either
* Statistic
or ExtendedStatistic,
but not both.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #statistic} will
* return {@link Statistic#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statisticAsString}.
*
*
* @return The statistic for the metric associated with the alarm, other than percentile. For percentile statistics,
* use ExtendedStatistic
. When you call PutMetricAlarm
, you must specify either
* Statistic
or ExtendedStatistic,
but not both.
* @see Statistic
*/
public Statistic statistic() {
return Statistic.fromValue(statistic);
}
/**
*
* The statistic for the metric associated with the alarm, other than percentile. For percentile statistics, use
* ExtendedStatistic
. When you call PutMetricAlarm
, you must specify either
* Statistic
or ExtendedStatistic,
but not both.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #statistic} will
* return {@link Statistic#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statisticAsString}.
*
*
* @return The statistic for the metric associated with the alarm, other than percentile. For percentile statistics,
* use ExtendedStatistic
. When you call PutMetricAlarm
, you must specify either
* Statistic
or ExtendedStatistic,
but not both.
* @see Statistic
*/
public String statisticAsString() {
return statistic;
}
/**
*
* The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100. When
* you call PutMetricAlarm
, you must specify either Statistic
or
* ExtendedStatistic,
but not both.
*
*
* @return The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.
* When you call PutMetricAlarm
, you must specify either Statistic
or
* ExtendedStatistic,
but not both.
*/
public String extendedStatistic() {
return extendedStatistic;
}
/**
*
* The dimensions for the metric associated with the alarm.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The dimensions for the metric associated with the alarm.
*/
public List dimensions() {
return dimensions;
}
/**
*
* The period, in seconds, over which the specified statistic is applied. Valid values are 10, 30, and any multiple
* of 60.
*
*
* Be sure to specify 10 or 30 only for metrics that are stored by a PutMetricData
call with a
* StorageResolution
of 1. If you specify a period of 10 or 30 for a metric that does not have
* sub-minute resolution, the alarm still attempts to gather data at the period rate that you specify. In this case,
* it does not receive data for the attempts that do not correspond to a one-minute data resolution, and the alarm
* may often lapse into INSUFFICENT_DATA status. Specifying 10 or 30 also sets this alarm as a high-resolution
* alarm, which has a higher charge than other alarms. For more information about pricing, see Amazon CloudWatch Pricing.
*
*
* An alarm's total current evaluation period can be no longer than one day, so Period
multiplied by
* EvaluationPeriods
cannot be more than 86,400 seconds.
*
*
* @return The period, in seconds, over which the specified statistic is applied. Valid values are 10, 30, and any
* multiple of 60.
*
* Be sure to specify 10 or 30 only for metrics that are stored by a PutMetricData
call with a
* StorageResolution
of 1. If you specify a period of 10 or 30 for a metric that does not have
* sub-minute resolution, the alarm still attempts to gather data at the period rate that you specify. In
* this case, it does not receive data for the attempts that do not correspond to a one-minute data
* resolution, and the alarm may often lapse into INSUFFICENT_DATA status. Specifying 10 or 30 also sets
* this alarm as a high-resolution alarm, which has a higher charge than other alarms. For more information
* about pricing, see Amazon CloudWatch Pricing.
*
*
* An alarm's total current evaluation period can be no longer than one day, so Period
* multiplied by EvaluationPeriods
cannot be more than 86,400 seconds.
*/
public Integer period() {
return period;
}
/**
*
* The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are Bytes
* because NetworkIn tracks the number of bytes that an instance receives on all network interfaces. You can also
* specify a unit when you create a custom metric. Units help provide conceptual meaning to your data. Metric data
* points that specify a unit of measure, such as Percent, are aggregated separately.
*
*
* If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the CloudWatch alarm
* can get stuck in the INSUFFICIENT DATA
state.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #unit} will return
* {@link StandardUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #unitAsString}.
*
*
* @return The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are
* Bytes because NetworkIn tracks the number of bytes that an instance receives on all network interfaces.
* You can also specify a unit when you create a custom metric. Units help provide conceptual meaning to
* your data. Metric data points that specify a unit of measure, such as Percent, are aggregated
* separately.
*
* If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the CloudWatch
* alarm can get stuck in the INSUFFICIENT DATA
state.
* @see StandardUnit
*/
public StandardUnit unit() {
return StandardUnit.fromValue(unit);
}
/**
*
* The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are Bytes
* because NetworkIn tracks the number of bytes that an instance receives on all network interfaces. You can also
* specify a unit when you create a custom metric. Units help provide conceptual meaning to your data. Metric data
* points that specify a unit of measure, such as Percent, are aggregated separately.
*
*
* If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the CloudWatch alarm
* can get stuck in the INSUFFICIENT DATA
state.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #unit} will return
* {@link StandardUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #unitAsString}.
*
*
* @return The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are
* Bytes because NetworkIn tracks the number of bytes that an instance receives on all network interfaces.
* You can also specify a unit when you create a custom metric. Units help provide conceptual meaning to
* your data. Metric data points that specify a unit of measure, such as Percent, are aggregated
* separately.
*
* If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the CloudWatch
* alarm can get stuck in the INSUFFICIENT DATA
state.
* @see StandardUnit
*/
public String unitAsString() {
return unit;
}
/**
*
* The number of periods over which data is compared to the specified threshold. If you are setting an alarm which
* requires that a number of consecutive data points be breaching to trigger the alarm, this value specifies that
* number. If you are setting an "M out of N" alarm, this value is the N.
*
*
* An alarm's total current evaluation period can be no longer than one day, so this number multiplied by
* Period
cannot be more than 86,400 seconds.
*
*
* @return The number of periods over which data is compared to the specified threshold. If you are setting an alarm
* which requires that a number of consecutive data points be breaching to trigger the alarm, this value
* specifies that number. If you are setting an "M out of N" alarm, this value is the N.
*
* An alarm's total current evaluation period can be no longer than one day, so this number multiplied by
* Period
cannot be more than 86,400 seconds.
*/
public Integer evaluationPeriods() {
return evaluationPeriods;
}
/**
*
* The number of datapoints that must be breaching to trigger the alarm. This is used only if you are setting an
* "M out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide.
*
*
* @return The number of datapoints that must be breaching to trigger the alarm. This is used only if you are
* setting an "M out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide.
*/
public Integer datapointsToAlarm() {
return datapointsToAlarm;
}
/**
*
* The value against which the specified statistic is compared.
*
*
* @return The value against which the specified statistic is compared.
*/
public Double threshold() {
return threshold;
}
/**
*
* The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic
* value is used as the first operand.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #comparisonOperator} will return {@link ComparisonOperator#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #comparisonOperatorAsString}.
*
*
* @return The arithmetic operation to use when comparing the specified statistic and threshold. The specified
* statistic value is used as the first operand.
* @see ComparisonOperator
*/
public ComparisonOperator comparisonOperator() {
return ComparisonOperator.fromValue(comparisonOperator);
}
/**
*
* The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic
* value is used as the first operand.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #comparisonOperator} will return {@link ComparisonOperator#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #comparisonOperatorAsString}.
*
*
* @return The arithmetic operation to use when comparing the specified statistic and threshold. The specified
* statistic value is used as the first operand.
* @see ComparisonOperator
*/
public String comparisonOperatorAsString() {
return comparisonOperator;
}
/**
*
* Sets how this alarm is to handle missing data points. If TreatMissingData
is omitted, the default
* behavior of missing
is used. For more information, see Configuring How CloudWatch Alarms Treats Missing Data.
*
*
* Valid Values: breaching | notBreaching | ignore | missing
*
*
* @return Sets how this alarm is to handle missing data points. If TreatMissingData
is omitted, the
* default behavior of missing
is used. For more information, see Configuring How CloudWatch Alarms Treats Missing Data.
*
* Valid Values: breaching | notBreaching | ignore | missing
*/
public String treatMissingData() {
return treatMissingData;
}
/**
*
* Used only for alarms based on percentiles. If you specify ignore
, the alarm state does not change
* during periods with too few data points to be statistically significant. If you specify evaluate
or
* omit this parameter, the alarm is always evaluated and possibly changes state no matter how many data points are
* available. For more information, see Percentile-Based CloudWatch Alarms and Low Data Samples.
*
*
* Valid Values: evaluate | ignore
*
*
* @return Used only for alarms based on percentiles. If you specify ignore
, the alarm state does not
* change during periods with too few data points to be statistically significant. If you specify
* evaluate
or omit this parameter, the alarm is always evaluated and possibly changes state no
* matter how many data points are available. For more information, see Percentile-Based CloudWatch Alarms and Low Data Samples.
*
* Valid Values: evaluate | ignore
*/
public String evaluateLowSampleCountPercentile() {
return evaluateLowSampleCountPercentile;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(alarmName());
hashCode = 31 * hashCode + Objects.hashCode(alarmDescription());
hashCode = 31 * hashCode + Objects.hashCode(actionsEnabled());
hashCode = 31 * hashCode + Objects.hashCode(okActions());
hashCode = 31 * hashCode + Objects.hashCode(alarmActions());
hashCode = 31 * hashCode + Objects.hashCode(insufficientDataActions());
hashCode = 31 * hashCode + Objects.hashCode(metricName());
hashCode = 31 * hashCode + Objects.hashCode(namespace());
hashCode = 31 * hashCode + Objects.hashCode(statisticAsString());
hashCode = 31 * hashCode + Objects.hashCode(extendedStatistic());
hashCode = 31 * hashCode + Objects.hashCode(dimensions());
hashCode = 31 * hashCode + Objects.hashCode(period());
hashCode = 31 * hashCode + Objects.hashCode(unitAsString());
hashCode = 31 * hashCode + Objects.hashCode(evaluationPeriods());
hashCode = 31 * hashCode + Objects.hashCode(datapointsToAlarm());
hashCode = 31 * hashCode + Objects.hashCode(threshold());
hashCode = 31 * hashCode + Objects.hashCode(comparisonOperatorAsString());
hashCode = 31 * hashCode + Objects.hashCode(treatMissingData());
hashCode = 31 * hashCode + Objects.hashCode(evaluateLowSampleCountPercentile());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof PutMetricAlarmRequest)) {
return false;
}
PutMetricAlarmRequest other = (PutMetricAlarmRequest) obj;
return Objects.equals(alarmName(), other.alarmName()) && Objects.equals(alarmDescription(), other.alarmDescription())
&& Objects.equals(actionsEnabled(), other.actionsEnabled()) && Objects.equals(okActions(), other.okActions())
&& Objects.equals(alarmActions(), other.alarmActions())
&& Objects.equals(insufficientDataActions(), other.insufficientDataActions())
&& Objects.equals(metricName(), other.metricName()) && Objects.equals(namespace(), other.namespace())
&& Objects.equals(statisticAsString(), other.statisticAsString())
&& Objects.equals(extendedStatistic(), other.extendedStatistic())
&& Objects.equals(dimensions(), other.dimensions()) && Objects.equals(period(), other.period())
&& Objects.equals(unitAsString(), other.unitAsString())
&& Objects.equals(evaluationPeriods(), other.evaluationPeriods())
&& Objects.equals(datapointsToAlarm(), other.datapointsToAlarm())
&& Objects.equals(threshold(), other.threshold())
&& Objects.equals(comparisonOperatorAsString(), other.comparisonOperatorAsString())
&& Objects.equals(treatMissingData(), other.treatMissingData())
&& Objects.equals(evaluateLowSampleCountPercentile(), other.evaluateLowSampleCountPercentile());
}
@Override
public String toString() {
return ToString.builder("PutMetricAlarmRequest").add("AlarmName", alarmName())
.add("AlarmDescription", alarmDescription()).add("ActionsEnabled", actionsEnabled())
.add("OKActions", okActions()).add("AlarmActions", alarmActions())
.add("InsufficientDataActions", insufficientDataActions()).add("MetricName", metricName())
.add("Namespace", namespace()).add("Statistic", statisticAsString())
.add("ExtendedStatistic", extendedStatistic()).add("Dimensions", dimensions()).add("Period", period())
.add("Unit", unitAsString()).add("EvaluationPeriods", evaluationPeriods())
.add("DatapointsToAlarm", datapointsToAlarm()).add("Threshold", threshold())
.add("ComparisonOperator", comparisonOperatorAsString()).add("TreatMissingData", treatMissingData())
.add("EvaluateLowSampleCountPercentile", evaluateLowSampleCountPercentile()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AlarmName":
return Optional.ofNullable(clazz.cast(alarmName()));
case "AlarmDescription":
return Optional.ofNullable(clazz.cast(alarmDescription()));
case "ActionsEnabled":
return Optional.ofNullable(clazz.cast(actionsEnabled()));
case "OKActions":
return Optional.ofNullable(clazz.cast(okActions()));
case "AlarmActions":
return Optional.ofNullable(clazz.cast(alarmActions()));
case "InsufficientDataActions":
return Optional.ofNullable(clazz.cast(insufficientDataActions()));
case "MetricName":
return Optional.ofNullable(clazz.cast(metricName()));
case "Namespace":
return Optional.ofNullable(clazz.cast(namespace()));
case "Statistic":
return Optional.ofNullable(clazz.cast(statisticAsString()));
case "ExtendedStatistic":
return Optional.ofNullable(clazz.cast(extendedStatistic()));
case "Dimensions":
return Optional.ofNullable(clazz.cast(dimensions()));
case "Period":
return Optional.ofNullable(clazz.cast(period()));
case "Unit":
return Optional.ofNullable(clazz.cast(unitAsString()));
case "EvaluationPeriods":
return Optional.ofNullable(clazz.cast(evaluationPeriods()));
case "DatapointsToAlarm":
return Optional.ofNullable(clazz.cast(datapointsToAlarm()));
case "Threshold":
return Optional.ofNullable(clazz.cast(threshold()));
case "ComparisonOperator":
return Optional.ofNullable(clazz.cast(comparisonOperatorAsString()));
case "TreatMissingData":
return Optional.ofNullable(clazz.cast(treatMissingData()));
case "EvaluateLowSampleCountPercentile":
return Optional.ofNullable(clazz.cast(evaluateLowSampleCountPercentile()));
default:
return Optional.empty();
}
}
public interface Builder extends CloudWatchRequest.Builder, CopyableBuilder {
/**
*
* The name for the alarm. This name must be unique within the AWS account.
*
*
* @param alarmName
* The name for the alarm. This name must be unique within the AWS account.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder alarmName(String alarmName);
/**
*
* The description for the alarm.
*
*
* @param alarmDescription
* The description for the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder alarmDescription(String alarmDescription);
/**
*
* Indicates whether actions should be executed during any changes to the alarm state.
*
*
* @param actionsEnabled
* Indicates whether actions should be executed during any changes to the alarm state.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder actionsEnabled(Boolean actionsEnabled);
/**
*
* The actions to execute when this alarm transitions to an OK
state from any other state. Each
* action is specified as an Amazon Resource Name (ARN).
*
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*
*
* @param okActions
* The actions to execute when this alarm transitions to an OK
state from any other state.
* Each action is specified as an Amazon Resource Name (ARN).
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder okActions(Collection okActions);
/**
*
* The actions to execute when this alarm transitions to an OK
state from any other state. Each
* action is specified as an Amazon Resource Name (ARN).
*
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*
*
* @param okActions
* The actions to execute when this alarm transitions to an OK
state from any other state.
* Each action is specified as an Amazon Resource Name (ARN).
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder okActions(String... okActions);
/**
*
* The actions to execute when this alarm transitions to the ALARM
state from any other state. Each
* action is specified as an Amazon Resource Name (ARN).
*
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*
*
* @param alarmActions
* The actions to execute when this alarm transitions to the ALARM
state from any other
* state. Each action is specified as an Amazon Resource Name (ARN).
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder alarmActions(Collection alarmActions);
/**
*
* The actions to execute when this alarm transitions to the ALARM
state from any other state. Each
* action is specified as an Amazon Resource Name (ARN).
*
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*
*
* @param alarmActions
* The actions to execute when this alarm transitions to the ALARM
state from any other
* state. Each action is specified as an Amazon Resource Name (ARN).
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder alarmActions(String... alarmActions);
/**
*
* The actions to execute when this alarm transitions to the INSUFFICIENT_DATA
state from any other
* state. Each action is specified as an Amazon Resource Name (ARN).
*
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*
*
* @param insufficientDataActions
* The actions to execute when this alarm transitions to the INSUFFICIENT_DATA
state from
* any other state. Each action is specified as an Amazon Resource Name (ARN).
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder insufficientDataActions(Collection insufficientDataActions);
/**
*
* The actions to execute when this alarm transitions to the INSUFFICIENT_DATA
state from any other
* state. Each action is specified as an Amazon Resource Name (ARN).
*
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
*
*
* @param insufficientDataActions
* The actions to execute when this alarm transitions to the INSUFFICIENT_DATA
state from
* any other state. Each action is specified as an Amazon Resource Name (ARN).
*
* Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate |
* arn:aws:automate:region:ec2:recover |
* arn:aws:sns:region:account-id:sns-topic-name |
* arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id
* autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name
*
*
* Valid Values (for use with IAM roles):
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Stop/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Terminate/1.0 |
* arn:aws:swf:region:{account-id}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder insufficientDataActions(String... insufficientDataActions);
/**
*
* The name for the metric associated with the alarm.
*
*
* @param metricName
* The name for the metric associated with the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder metricName(String metricName);
/**
*
* The namespace for the metric associated with the alarm.
*
*
* @param namespace
* The namespace for the metric associated with the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder namespace(String namespace);
/**
*
* The statistic for the metric associated with the alarm, other than percentile. For percentile statistics, use
* ExtendedStatistic
. When you call PutMetricAlarm
, you must specify either
* Statistic
or ExtendedStatistic,
but not both.
*
*
* @param statistic
* The statistic for the metric associated with the alarm, other than percentile. For percentile
* statistics, use ExtendedStatistic
. When you call PutMetricAlarm
, you must
* specify either Statistic
or ExtendedStatistic,
but not both.
* @see Statistic
* @return Returns a reference to this object so that method calls can be chained together.
* @see Statistic
*/
Builder statistic(String statistic);
/**
*
* The statistic for the metric associated with the alarm, other than percentile. For percentile statistics, use
* ExtendedStatistic
. When you call PutMetricAlarm
, you must specify either
* Statistic
or ExtendedStatistic,
but not both.
*
*
* @param statistic
* The statistic for the metric associated with the alarm, other than percentile. For percentile
* statistics, use ExtendedStatistic
. When you call PutMetricAlarm
, you must
* specify either Statistic
or ExtendedStatistic,
but not both.
* @see Statistic
* @return Returns a reference to this object so that method calls can be chained together.
* @see Statistic
*/
Builder statistic(Statistic statistic);
/**
*
* The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.
* When you call PutMetricAlarm
, you must specify either Statistic
or
* ExtendedStatistic,
but not both.
*
*
* @param extendedStatistic
* The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and
* p100. When you call PutMetricAlarm
, you must specify either Statistic
or
* ExtendedStatistic,
but not both.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder extendedStatistic(String extendedStatistic);
/**
*
* The dimensions for the metric associated with the alarm.
*
*
* @param dimensions
* The dimensions for the metric associated with the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dimensions(Collection dimensions);
/**
*
* The dimensions for the metric associated with the alarm.
*
*
* @param dimensions
* The dimensions for the metric associated with the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dimensions(Dimension... dimensions);
/**
*
* The dimensions for the metric associated with the alarm.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to
* create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its
* result is passed to {@link #dimensions(List)}.
*
* @param dimensions
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #dimensions(List)
*/
Builder dimensions(Consumer... dimensions);
/**
*
* The period, in seconds, over which the specified statistic is applied. Valid values are 10, 30, and any
* multiple of 60.
*
*
* Be sure to specify 10 or 30 only for metrics that are stored by a PutMetricData
call with a
* StorageResolution
of 1. If you specify a period of 10 or 30 for a metric that does not have
* sub-minute resolution, the alarm still attempts to gather data at the period rate that you specify. In this
* case, it does not receive data for the attempts that do not correspond to a one-minute data resolution, and
* the alarm may often lapse into INSUFFICENT_DATA status. Specifying 10 or 30 also sets this alarm as a
* high-resolution alarm, which has a higher charge than other alarms. For more information about pricing, see
* Amazon CloudWatch Pricing.
*
*
* An alarm's total current evaluation period can be no longer than one day, so Period
multiplied
* by EvaluationPeriods
cannot be more than 86,400 seconds.
*
*
* @param period
* The period, in seconds, over which the specified statistic is applied. Valid values are 10, 30, and
* any multiple of 60.
*
* Be sure to specify 10 or 30 only for metrics that are stored by a PutMetricData
call with
* a StorageResolution
of 1. If you specify a period of 10 or 30 for a metric that does not
* have sub-minute resolution, the alarm still attempts to gather data at the period rate that you
* specify. In this case, it does not receive data for the attempts that do not correspond to a
* one-minute data resolution, and the alarm may often lapse into INSUFFICENT_DATA status. Specifying 10
* or 30 also sets this alarm as a high-resolution alarm, which has a higher charge than other alarms.
* For more information about pricing, see Amazon
* CloudWatch Pricing.
*
*
* An alarm's total current evaluation period can be no longer than one day, so Period
* multiplied by EvaluationPeriods
cannot be more than 86,400 seconds.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder period(Integer period);
/**
*
* The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are Bytes
* because NetworkIn tracks the number of bytes that an instance receives on all network interfaces. You can
* also specify a unit when you create a custom metric. Units help provide conceptual meaning to your data.
* Metric data points that specify a unit of measure, such as Percent, are aggregated separately.
*
*
* If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the CloudWatch
* alarm can get stuck in the INSUFFICIENT DATA
state.
*
*
* @param unit
* The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are
* Bytes because NetworkIn tracks the number of bytes that an instance receives on all network
* interfaces. You can also specify a unit when you create a custom metric. Units help provide conceptual
* meaning to your data. Metric data points that specify a unit of measure, such as Percent, are
* aggregated separately.
*
* If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the
* CloudWatch alarm can get stuck in the INSUFFICIENT DATA
state.
* @see StandardUnit
* @return Returns a reference to this object so that method calls can be chained together.
* @see StandardUnit
*/
Builder unit(String unit);
/**
*
* The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are Bytes
* because NetworkIn tracks the number of bytes that an instance receives on all network interfaces. You can
* also specify a unit when you create a custom metric. Units help provide conceptual meaning to your data.
* Metric data points that specify a unit of measure, such as Percent, are aggregated separately.
*
*
* If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the CloudWatch
* alarm can get stuck in the INSUFFICIENT DATA
state.
*
*
* @param unit
* The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are
* Bytes because NetworkIn tracks the number of bytes that an instance receives on all network
* interfaces. You can also specify a unit when you create a custom metric. Units help provide conceptual
* meaning to your data. Metric data points that specify a unit of measure, such as Percent, are
* aggregated separately.
*
* If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the
* CloudWatch alarm can get stuck in the INSUFFICIENT DATA
state.
* @see StandardUnit
* @return Returns a reference to this object so that method calls can be chained together.
* @see StandardUnit
*/
Builder unit(StandardUnit unit);
/**
*
* The number of periods over which data is compared to the specified threshold. If you are setting an alarm
* which requires that a number of consecutive data points be breaching to trigger the alarm, this value
* specifies that number. If you are setting an "M out of N" alarm, this value is the N.
*
*
* An alarm's total current evaluation period can be no longer than one day, so this number multiplied by
* Period
cannot be more than 86,400 seconds.
*
*
* @param evaluationPeriods
* The number of periods over which data is compared to the specified threshold. If you are setting an
* alarm which requires that a number of consecutive data points be breaching to trigger the alarm, this
* value specifies that number. If you are setting an "M out of N" alarm, this value is the N.
*
* An alarm's total current evaluation period can be no longer than one day, so this number multiplied by
* Period
cannot be more than 86,400 seconds.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder evaluationPeriods(Integer evaluationPeriods);
/**
*
* The number of datapoints that must be breaching to trigger the alarm. This is used only if you are setting an
* "M out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide.
*
*
* @param datapointsToAlarm
* The number of datapoints that must be breaching to trigger the alarm. This is used only if you are
* setting an "M out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder datapointsToAlarm(Integer datapointsToAlarm);
/**
*
* The value against which the specified statistic is compared.
*
*
* @param threshold
* The value against which the specified statistic is compared.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder threshold(Double threshold);
/**
*
* The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic
* value is used as the first operand.
*
*
* @param comparisonOperator
* The arithmetic operation to use when comparing the specified statistic and threshold. The specified
* statistic value is used as the first operand.
* @see ComparisonOperator
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComparisonOperator
*/
Builder comparisonOperator(String comparisonOperator);
/**
*
* The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic
* value is used as the first operand.
*
*
* @param comparisonOperator
* The arithmetic operation to use when comparing the specified statistic and threshold. The specified
* statistic value is used as the first operand.
* @see ComparisonOperator
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComparisonOperator
*/
Builder comparisonOperator(ComparisonOperator comparisonOperator);
/**
*
* Sets how this alarm is to handle missing data points. If TreatMissingData
is omitted, the
* default behavior of missing
is used. For more information, see Configuring How CloudWatch Alarms Treats Missing Data.
*
*
* Valid Values: breaching | notBreaching | ignore | missing
*
*
* @param treatMissingData
* Sets how this alarm is to handle missing data points. If TreatMissingData
is omitted, the
* default behavior of missing
is used. For more information, see Configuring How CloudWatch Alarms Treats Missing Data.
*
* Valid Values: breaching | notBreaching | ignore | missing
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder treatMissingData(String treatMissingData);
/**
*
* Used only for alarms based on percentiles. If you specify ignore
, the alarm state does not
* change during periods with too few data points to be statistically significant. If you specify
* evaluate
or omit this parameter, the alarm is always evaluated and possibly changes state no
* matter how many data points are available. For more information, see Percentile-Based CloudWatch Alarms and Low Data Samples.
*
*
* Valid Values: evaluate | ignore
*
*
* @param evaluateLowSampleCountPercentile
* Used only for alarms based on percentiles. If you specify ignore
, the alarm state does
* not change during periods with too few data points to be statistically significant. If you specify
* evaluate
or omit this parameter, the alarm is always evaluated and possibly changes state
* no matter how many data points are available. For more information, see Percentile-Based CloudWatch Alarms and Low Data Samples.
*
* Valid Values: evaluate | ignore
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder evaluateLowSampleCountPercentile(String evaluateLowSampleCountPercentile);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends CloudWatchRequest.BuilderImpl implements Builder {
private String alarmName;
private String alarmDescription;
private Boolean actionsEnabled;
private List okActions = DefaultSdkAutoConstructList.getInstance();
private List alarmActions = DefaultSdkAutoConstructList.getInstance();
private List insufficientDataActions = DefaultSdkAutoConstructList.getInstance();
private String metricName;
private String namespace;
private String statistic;
private String extendedStatistic;
private List dimensions = DefaultSdkAutoConstructList.getInstance();
private Integer period;
private String unit;
private Integer evaluationPeriods;
private Integer datapointsToAlarm;
private Double threshold;
private String comparisonOperator;
private String treatMissingData;
private String evaluateLowSampleCountPercentile;
private BuilderImpl() {
}
private BuilderImpl(PutMetricAlarmRequest model) {
super(model);
alarmName(model.alarmName);
alarmDescription(model.alarmDescription);
actionsEnabled(model.actionsEnabled);
okActions(model.okActions);
alarmActions(model.alarmActions);
insufficientDataActions(model.insufficientDataActions);
metricName(model.metricName);
namespace(model.namespace);
statistic(model.statistic);
extendedStatistic(model.extendedStatistic);
dimensions(model.dimensions);
period(model.period);
unit(model.unit);
evaluationPeriods(model.evaluationPeriods);
datapointsToAlarm(model.datapointsToAlarm);
threshold(model.threshold);
comparisonOperator(model.comparisonOperator);
treatMissingData(model.treatMissingData);
evaluateLowSampleCountPercentile(model.evaluateLowSampleCountPercentile);
}
public final String getAlarmName() {
return alarmName;
}
@Override
public final Builder alarmName(String alarmName) {
this.alarmName = alarmName;
return this;
}
public final void setAlarmName(String alarmName) {
this.alarmName = alarmName;
}
public final String getAlarmDescription() {
return alarmDescription;
}
@Override
public final Builder alarmDescription(String alarmDescription) {
this.alarmDescription = alarmDescription;
return this;
}
public final void setAlarmDescription(String alarmDescription) {
this.alarmDescription = alarmDescription;
}
public final Boolean getActionsEnabled() {
return actionsEnabled;
}
@Override
public final Builder actionsEnabled(Boolean actionsEnabled) {
this.actionsEnabled = actionsEnabled;
return this;
}
public final void setActionsEnabled(Boolean actionsEnabled) {
this.actionsEnabled = actionsEnabled;
}
public final Collection getOKActions() {
return okActions;
}
@Override
public final Builder okActions(Collection okActions) {
this.okActions = ResourceListCopier.copy(okActions);
return this;
}
@Override
@SafeVarargs
public final Builder okActions(String... okActions) {
okActions(Arrays.asList(okActions));
return this;
}
public final void setOKActions(Collection okActions) {
this.okActions = ResourceListCopier.copy(okActions);
}
public final Collection getAlarmActions() {
return alarmActions;
}
@Override
public final Builder alarmActions(Collection alarmActions) {
this.alarmActions = ResourceListCopier.copy(alarmActions);
return this;
}
@Override
@SafeVarargs
public final Builder alarmActions(String... alarmActions) {
alarmActions(Arrays.asList(alarmActions));
return this;
}
public final void setAlarmActions(Collection alarmActions) {
this.alarmActions = ResourceListCopier.copy(alarmActions);
}
public final Collection getInsufficientDataActions() {
return insufficientDataActions;
}
@Override
public final Builder insufficientDataActions(Collection insufficientDataActions) {
this.insufficientDataActions = ResourceListCopier.copy(insufficientDataActions);
return this;
}
@Override
@SafeVarargs
public final Builder insufficientDataActions(String... insufficientDataActions) {
insufficientDataActions(Arrays.asList(insufficientDataActions));
return this;
}
public final void setInsufficientDataActions(Collection insufficientDataActions) {
this.insufficientDataActions = ResourceListCopier.copy(insufficientDataActions);
}
public final String getMetricName() {
return metricName;
}
@Override
public final Builder metricName(String metricName) {
this.metricName = metricName;
return this;
}
public final void setMetricName(String metricName) {
this.metricName = metricName;
}
public final String getNamespace() {
return namespace;
}
@Override
public final Builder namespace(String namespace) {
this.namespace = namespace;
return this;
}
public final void setNamespace(String namespace) {
this.namespace = namespace;
}
public final String getStatistic() {
return statistic;
}
@Override
public final Builder statistic(String statistic) {
this.statistic = statistic;
return this;
}
@Override
public final Builder statistic(Statistic statistic) {
this.statistic(statistic.toString());
return this;
}
public final void setStatistic(String statistic) {
this.statistic = statistic;
}
public final String getExtendedStatistic() {
return extendedStatistic;
}
@Override
public final Builder extendedStatistic(String extendedStatistic) {
this.extendedStatistic = extendedStatistic;
return this;
}
public final void setExtendedStatistic(String extendedStatistic) {
this.extendedStatistic = extendedStatistic;
}
public final Collection getDimensions() {
return dimensions != null ? dimensions.stream().map(Dimension::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder dimensions(Collection dimensions) {
this.dimensions = DimensionsCopier.copy(dimensions);
return this;
}
@Override
@SafeVarargs
public final Builder dimensions(Dimension... dimensions) {
dimensions(Arrays.asList(dimensions));
return this;
}
@Override
@SafeVarargs
public final Builder dimensions(Consumer... dimensions) {
dimensions(Stream.of(dimensions).map(c -> Dimension.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setDimensions(Collection dimensions) {
this.dimensions = DimensionsCopier.copyFromBuilder(dimensions);
}
public final Integer getPeriod() {
return period;
}
@Override
public final Builder period(Integer period) {
this.period = period;
return this;
}
public final void setPeriod(Integer period) {
this.period = period;
}
public final String getUnit() {
return unit;
}
@Override
public final Builder unit(String unit) {
this.unit = unit;
return this;
}
@Override
public final Builder unit(StandardUnit unit) {
this.unit(unit.toString());
return this;
}
public final void setUnit(String unit) {
this.unit = unit;
}
public final Integer getEvaluationPeriods() {
return evaluationPeriods;
}
@Override
public final Builder evaluationPeriods(Integer evaluationPeriods) {
this.evaluationPeriods = evaluationPeriods;
return this;
}
public final void setEvaluationPeriods(Integer evaluationPeriods) {
this.evaluationPeriods = evaluationPeriods;
}
public final Integer getDatapointsToAlarm() {
return datapointsToAlarm;
}
@Override
public final Builder datapointsToAlarm(Integer datapointsToAlarm) {
this.datapointsToAlarm = datapointsToAlarm;
return this;
}
public final void setDatapointsToAlarm(Integer datapointsToAlarm) {
this.datapointsToAlarm = datapointsToAlarm;
}
public final Double getThreshold() {
return threshold;
}
@Override
public final Builder threshold(Double threshold) {
this.threshold = threshold;
return this;
}
public final void setThreshold(Double threshold) {
this.threshold = threshold;
}
public final String getComparisonOperator() {
return comparisonOperator;
}
@Override
public final Builder comparisonOperator(String comparisonOperator) {
this.comparisonOperator = comparisonOperator;
return this;
}
@Override
public final Builder comparisonOperator(ComparisonOperator comparisonOperator) {
this.comparisonOperator(comparisonOperator.toString());
return this;
}
public final void setComparisonOperator(String comparisonOperator) {
this.comparisonOperator = comparisonOperator;
}
public final String getTreatMissingData() {
return treatMissingData;
}
@Override
public final Builder treatMissingData(String treatMissingData) {
this.treatMissingData = treatMissingData;
return this;
}
public final void setTreatMissingData(String treatMissingData) {
this.treatMissingData = treatMissingData;
}
public final String getEvaluateLowSampleCountPercentile() {
return evaluateLowSampleCountPercentile;
}
@Override
public final Builder evaluateLowSampleCountPercentile(String evaluateLowSampleCountPercentile) {
this.evaluateLowSampleCountPercentile = evaluateLowSampleCountPercentile;
return this;
}
public final void setEvaluateLowSampleCountPercentile(String evaluateLowSampleCountPercentile) {
this.evaluateLowSampleCountPercentile = evaluateLowSampleCountPercentile;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public PutMetricAlarmRequest build() {
return new PutMetricAlarmRequest(this);
}
}
}