
com.amazonaws.services.lightsail.model.Alarm Maven / Gradle / Ivy
/*
* Copyright 2018-2023 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 com.amazonaws.services.lightsail.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Describes an alarm.
*
*
* An alarm is a way to monitor your Lightsail resource metrics. For more information, see Alarms in Amazon
* Lightsail.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Alarm implements Serializable, Cloneable, StructuredPojo {
/**
*
* The name of the alarm.
*
*/
private String name;
/**
*
* The Amazon Resource Name (ARN) of the alarm.
*
*/
private String arn;
/**
*
* The timestamp when the alarm was created.
*
*/
private java.util.Date createdAt;
/**
*
* An object that lists information about the location of the alarm.
*
*/
private ResourceLocation location;
/**
*
* The Lightsail resource type (e.g., Alarm
).
*
*/
private String resourceType;
/**
*
* The support code. Include this code in your email to support when you have questions about your Lightsail alarm.
* This code enables our support team to look up your Lightsail information more easily.
*
*/
private String supportCode;
/**
*
* An object that lists information about the resource monitored by the alarm.
*
*/
private MonitoredResourceInfo monitoredResourceInfo;
/**
*
* The arithmetic operation used when comparing the specified statistic and threshold.
*
*/
private String comparisonOperator;
/**
*
* The number of periods over which data is compared to the specified threshold.
*
*/
private Integer evaluationPeriods;
/**
*
* The period, in seconds, over which the statistic is applied.
*
*/
private Integer period;
/**
*
* The value against which the specified statistic is compared.
*
*/
private Double threshold;
/**
*
* The number of data points that must not within the specified threshold to trigger the alarm.
*
*/
private Integer datapointsToAlarm;
/**
*
* Specifies how the alarm handles missing data points.
*
*
* An alarm can treat missing data in the following ways:
*
*
* -
*
* breaching
- Assume the missing data is not within the threshold. Missing data counts towards the
* number of times the metric is not within the threshold.
*
*
* -
*
* notBreaching
- Assume the missing data is within the threshold. Missing data does not count towards
* the number of times the metric is not within the threshold.
*
*
* -
*
* ignore
- Ignore the missing data. Maintains the current alarm state.
*
*
* -
*
* missing
- Missing data is treated as missing.
*
*
*
*/
private String treatMissingData;
/**
*
* The statistic for the metric associated with the alarm.
*
*
* The following statistics are available:
*
*
* -
*
* Minimum
- The lowest value observed during the specified period. Use this value to determine low
* volumes of activity for your application.
*
*
* -
*
* Maximum
- The highest value observed during the specified period. Use this value to determine high
* volumes of activity for your application.
*
*
* -
*
* Sum
- All values submitted for the matching metric added together. You can use this statistic to
* determine the total volume of a metric.
*
*
* -
*
* Average
- The value of Sum / SampleCount during the specified period. By comparing this statistic
* with the Minimum and Maximum values, you can determine the full scope of a metric and how close the average use
* is to the Minimum and Maximum values. This comparison helps you to know when to increase or decrease your
* resources.
*
*
* -
*
* SampleCount
- The count, or number, of data points used for the statistical calculation.
*
*
*
*/
private String statistic;
/**
*
* The name of the metric associated with the alarm.
*
*/
private String metricName;
/**
*
* The current state of the alarm.
*
*
* An alarm has the following possible states:
*
*
* -
*
* ALARM
- The metric is outside of the defined threshold.
*
*
* -
*
* INSUFFICIENT_DATA
- The alarm has just started, the metric is not available, or not enough data is
* available for the metric to determine the alarm state.
*
*
* -
*
* OK
- The metric is within the defined threshold.
*
*
*
*/
private String state;
/**
*
* The unit of the metric associated with the alarm.
*
*/
private String unit;
/**
*
* The contact protocols for the alarm, such as Email
, SMS
(text messaging), or both.
*
*/
private java.util.List contactProtocols;
/**
*
* The alarm states that trigger a notification.
*
*/
private java.util.List notificationTriggers;
/**
*
* Indicates whether the alarm is enabled.
*
*/
private Boolean notificationEnabled;
/**
*
* The name of the alarm.
*
*
* @param name
* The name of the alarm.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The name of the alarm.
*
*
* @return The name of the alarm.
*/
public String getName() {
return this.name;
}
/**
*
* The name of the alarm.
*
*
* @param name
* The name of the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Alarm withName(String name) {
setName(name);
return this;
}
/**
*
* The Amazon Resource Name (ARN) of the alarm.
*
*
* @param arn
* The Amazon Resource Name (ARN) of the alarm.
*/
public void setArn(String arn) {
this.arn = arn;
}
/**
*
* The Amazon Resource Name (ARN) of the alarm.
*
*
* @return The Amazon Resource Name (ARN) of the alarm.
*/
public String getArn() {
return this.arn;
}
/**
*
* The Amazon Resource Name (ARN) of the alarm.
*
*
* @param arn
* The Amazon Resource Name (ARN) of the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Alarm withArn(String arn) {
setArn(arn);
return this;
}
/**
*
* The timestamp when the alarm was created.
*
*
* @param createdAt
* The timestamp when the alarm was created.
*/
public void setCreatedAt(java.util.Date createdAt) {
this.createdAt = createdAt;
}
/**
*
* The timestamp when the alarm was created.
*
*
* @return The timestamp when the alarm was created.
*/
public java.util.Date getCreatedAt() {
return this.createdAt;
}
/**
*
* The timestamp when the alarm was created.
*
*
* @param createdAt
* The timestamp when the alarm was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Alarm withCreatedAt(java.util.Date createdAt) {
setCreatedAt(createdAt);
return this;
}
/**
*
* An object that lists information about the location of the alarm.
*
*
* @param location
* An object that lists information about the location of the alarm.
*/
public void setLocation(ResourceLocation location) {
this.location = location;
}
/**
*
* An object that lists information about the location of the alarm.
*
*
* @return An object that lists information about the location of the alarm.
*/
public ResourceLocation getLocation() {
return this.location;
}
/**
*
* An object that lists information about the location of the alarm.
*
*
* @param location
* An object that lists information about the location of the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Alarm withLocation(ResourceLocation location) {
setLocation(location);
return this;
}
/**
*
* The Lightsail resource type (e.g., Alarm
).
*
*
* @param resourceType
* The Lightsail resource type (e.g., Alarm
).
* @see ResourceType
*/
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
/**
*
* The Lightsail resource type (e.g., Alarm
).
*
*
* @return The Lightsail resource type (e.g., Alarm
).
* @see ResourceType
*/
public String getResourceType() {
return this.resourceType;
}
/**
*
* The Lightsail resource type (e.g., Alarm
).
*
*
* @param resourceType
* The Lightsail resource type (e.g., Alarm
).
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceType
*/
public Alarm withResourceType(String resourceType) {
setResourceType(resourceType);
return this;
}
/**
*
* The Lightsail resource type (e.g., Alarm
).
*
*
* @param resourceType
* The Lightsail resource type (e.g., Alarm
).
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceType
*/
public Alarm withResourceType(ResourceType resourceType) {
this.resourceType = resourceType.toString();
return this;
}
/**
*
* The support code. Include this code in your email to support when you have questions about your Lightsail alarm.
* This code enables our support team to look up your Lightsail information more easily.
*
*
* @param supportCode
* The support code. Include this code in your email to support when you have questions about your Lightsail
* alarm. This code enables our support team to look up your Lightsail information more easily.
*/
public void setSupportCode(String supportCode) {
this.supportCode = supportCode;
}
/**
*
* The support code. Include this code in your email to support when you have questions about your Lightsail alarm.
* This code enables our support team to look up your Lightsail information more easily.
*
*
* @return The support code. Include this code in your email to support when you have questions about your Lightsail
* alarm. This code enables our support team to look up your Lightsail information more easily.
*/
public String getSupportCode() {
return this.supportCode;
}
/**
*
* The support code. Include this code in your email to support when you have questions about your Lightsail alarm.
* This code enables our support team to look up your Lightsail information more easily.
*
*
* @param supportCode
* The support code. Include this code in your email to support when you have questions about your Lightsail
* alarm. This code enables our support team to look up your Lightsail information more easily.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Alarm withSupportCode(String supportCode) {
setSupportCode(supportCode);
return this;
}
/**
*
* An object that lists information about the resource monitored by the alarm.
*
*
* @param monitoredResourceInfo
* An object that lists information about the resource monitored by the alarm.
*/
public void setMonitoredResourceInfo(MonitoredResourceInfo monitoredResourceInfo) {
this.monitoredResourceInfo = monitoredResourceInfo;
}
/**
*
* An object that lists information about the resource monitored by the alarm.
*
*
* @return An object that lists information about the resource monitored by the alarm.
*/
public MonitoredResourceInfo getMonitoredResourceInfo() {
return this.monitoredResourceInfo;
}
/**
*
* An object that lists information about the resource monitored by the alarm.
*
*
* @param monitoredResourceInfo
* An object that lists information about the resource monitored by the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Alarm withMonitoredResourceInfo(MonitoredResourceInfo monitoredResourceInfo) {
setMonitoredResourceInfo(monitoredResourceInfo);
return this;
}
/**
*
* The arithmetic operation used when comparing the specified statistic and threshold.
*
*
* @param comparisonOperator
* The arithmetic operation used when comparing the specified statistic and threshold.
* @see ComparisonOperator
*/
public void setComparisonOperator(String comparisonOperator) {
this.comparisonOperator = comparisonOperator;
}
/**
*
* The arithmetic operation used when comparing the specified statistic and threshold.
*
*
* @return The arithmetic operation used when comparing the specified statistic and threshold.
* @see ComparisonOperator
*/
public String getComparisonOperator() {
return this.comparisonOperator;
}
/**
*
* The arithmetic operation used when comparing the specified statistic and threshold.
*
*
* @param comparisonOperator
* The arithmetic operation used when comparing the specified statistic and threshold.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComparisonOperator
*/
public Alarm withComparisonOperator(String comparisonOperator) {
setComparisonOperator(comparisonOperator);
return this;
}
/**
*
* The arithmetic operation used when comparing the specified statistic and threshold.
*
*
* @param comparisonOperator
* The arithmetic operation used when comparing the specified statistic and threshold.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComparisonOperator
*/
public Alarm withComparisonOperator(ComparisonOperator comparisonOperator) {
this.comparisonOperator = comparisonOperator.toString();
return this;
}
/**
*
* The number of periods over which data is compared to the specified threshold.
*
*
* @param evaluationPeriods
* The number of periods over which data is compared to the specified threshold.
*/
public void setEvaluationPeriods(Integer evaluationPeriods) {
this.evaluationPeriods = evaluationPeriods;
}
/**
*
* The number of periods over which data is compared to the specified threshold.
*
*
* @return The number of periods over which data is compared to the specified threshold.
*/
public Integer getEvaluationPeriods() {
return this.evaluationPeriods;
}
/**
*
* The number of periods over which data is compared to the specified threshold.
*
*
* @param evaluationPeriods
* The number of periods over which data is compared to the specified threshold.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Alarm withEvaluationPeriods(Integer evaluationPeriods) {
setEvaluationPeriods(evaluationPeriods);
return this;
}
/**
*
* The period, in seconds, over which the statistic is applied.
*
*
* @param period
* The period, in seconds, over which the statistic is applied.
*/
public void setPeriod(Integer period) {
this.period = period;
}
/**
*
* The period, in seconds, over which the statistic is applied.
*
*
* @return The period, in seconds, over which the statistic is applied.
*/
public Integer getPeriod() {
return this.period;
}
/**
*
* The period, in seconds, over which the statistic is applied.
*
*
* @param period
* The period, in seconds, over which the statistic is applied.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Alarm withPeriod(Integer period) {
setPeriod(period);
return this;
}
/**
*
* The value against which the specified statistic is compared.
*
*
* @param threshold
* The value against which the specified statistic is compared.
*/
public void setThreshold(Double threshold) {
this.threshold = threshold;
}
/**
*
* The value against which the specified statistic is compared.
*
*
* @return The value against which the specified statistic is compared.
*/
public Double getThreshold() {
return this.threshold;
}
/**
*
* 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.
*/
public Alarm withThreshold(Double threshold) {
setThreshold(threshold);
return this;
}
/**
*
* The number of data points that must not within the specified threshold to trigger the alarm.
*
*
* @param datapointsToAlarm
* The number of data points that must not within the specified threshold to trigger the alarm.
*/
public void setDatapointsToAlarm(Integer datapointsToAlarm) {
this.datapointsToAlarm = datapointsToAlarm;
}
/**
*
* The number of data points that must not within the specified threshold to trigger the alarm.
*
*
* @return The number of data points that must not within the specified threshold to trigger the alarm.
*/
public Integer getDatapointsToAlarm() {
return this.datapointsToAlarm;
}
/**
*
* The number of data points that must not within the specified threshold to trigger the alarm.
*
*
* @param datapointsToAlarm
* The number of data points that must not within the specified threshold to trigger the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Alarm withDatapointsToAlarm(Integer datapointsToAlarm) {
setDatapointsToAlarm(datapointsToAlarm);
return this;
}
/**
*
* Specifies how the alarm handles missing data points.
*
*
* An alarm can treat missing data in the following ways:
*
*
* -
*
* breaching
- Assume the missing data is not within the threshold. Missing data counts towards the
* number of times the metric is not within the threshold.
*
*
* -
*
* notBreaching
- Assume the missing data is within the threshold. Missing data does not count towards
* the number of times the metric is not within the threshold.
*
*
* -
*
* ignore
- Ignore the missing data. Maintains the current alarm state.
*
*
* -
*
* missing
- Missing data is treated as missing.
*
*
*
*
* @param treatMissingData
* Specifies how the alarm handles missing data points.
*
* An alarm can treat missing data in the following ways:
*
*
* -
*
* breaching
- Assume the missing data is not within the threshold. Missing data counts towards
* the number of times the metric is not within the threshold.
*
*
* -
*
* notBreaching
- Assume the missing data is within the threshold. Missing data does not count
* towards the number of times the metric is not within the threshold.
*
*
* -
*
* ignore
- Ignore the missing data. Maintains the current alarm state.
*
*
* -
*
* missing
- Missing data is treated as missing.
*
*
* @see TreatMissingData
*/
public void setTreatMissingData(String treatMissingData) {
this.treatMissingData = treatMissingData;
}
/**
*
* Specifies how the alarm handles missing data points.
*
*
* An alarm can treat missing data in the following ways:
*
*
* -
*
* breaching
- Assume the missing data is not within the threshold. Missing data counts towards the
* number of times the metric is not within the threshold.
*
*
* -
*
* notBreaching
- Assume the missing data is within the threshold. Missing data does not count towards
* the number of times the metric is not within the threshold.
*
*
* -
*
* ignore
- Ignore the missing data. Maintains the current alarm state.
*
*
* -
*
* missing
- Missing data is treated as missing.
*
*
*
*
* @return Specifies how the alarm handles missing data points.
*
* An alarm can treat missing data in the following ways:
*
*
* -
*
* breaching
- Assume the missing data is not within the threshold. Missing data counts towards
* the number of times the metric is not within the threshold.
*
*
* -
*
* notBreaching
- Assume the missing data is within the threshold. Missing data does not count
* towards the number of times the metric is not within the threshold.
*
*
* -
*
* ignore
- Ignore the missing data. Maintains the current alarm state.
*
*
* -
*
* missing
- Missing data is treated as missing.
*
*
* @see TreatMissingData
*/
public String getTreatMissingData() {
return this.treatMissingData;
}
/**
*
* Specifies how the alarm handles missing data points.
*
*
* An alarm can treat missing data in the following ways:
*
*
* -
*
* breaching
- Assume the missing data is not within the threshold. Missing data counts towards the
* number of times the metric is not within the threshold.
*
*
* -
*
* notBreaching
- Assume the missing data is within the threshold. Missing data does not count towards
* the number of times the metric is not within the threshold.
*
*
* -
*
* ignore
- Ignore the missing data. Maintains the current alarm state.
*
*
* -
*
* missing
- Missing data is treated as missing.
*
*
*
*
* @param treatMissingData
* Specifies how the alarm handles missing data points.
*
* An alarm can treat missing data in the following ways:
*
*
* -
*
* breaching
- Assume the missing data is not within the threshold. Missing data counts towards
* the number of times the metric is not within the threshold.
*
*
* -
*
* notBreaching
- Assume the missing data is within the threshold. Missing data does not count
* towards the number of times the metric is not within the threshold.
*
*
* -
*
* ignore
- Ignore the missing data. Maintains the current alarm state.
*
*
* -
*
* missing
- Missing data is treated as missing.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see TreatMissingData
*/
public Alarm withTreatMissingData(String treatMissingData) {
setTreatMissingData(treatMissingData);
return this;
}
/**
*
* Specifies how the alarm handles missing data points.
*
*
* An alarm can treat missing data in the following ways:
*
*
* -
*
* breaching
- Assume the missing data is not within the threshold. Missing data counts towards the
* number of times the metric is not within the threshold.
*
*
* -
*
* notBreaching
- Assume the missing data is within the threshold. Missing data does not count towards
* the number of times the metric is not within the threshold.
*
*
* -
*
* ignore
- Ignore the missing data. Maintains the current alarm state.
*
*
* -
*
* missing
- Missing data is treated as missing.
*
*
*
*
* @param treatMissingData
* Specifies how the alarm handles missing data points.
*
* An alarm can treat missing data in the following ways:
*
*
* -
*
* breaching
- Assume the missing data is not within the threshold. Missing data counts towards
* the number of times the metric is not within the threshold.
*
*
* -
*
* notBreaching
- Assume the missing data is within the threshold. Missing data does not count
* towards the number of times the metric is not within the threshold.
*
*
* -
*
* ignore
- Ignore the missing data. Maintains the current alarm state.
*
*
* -
*
* missing
- Missing data is treated as missing.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see TreatMissingData
*/
public Alarm withTreatMissingData(TreatMissingData treatMissingData) {
this.treatMissingData = treatMissingData.toString();
return this;
}
/**
*
* The statistic for the metric associated with the alarm.
*
*
* The following statistics are available:
*
*
* -
*
* Minimum
- The lowest value observed during the specified period. Use this value to determine low
* volumes of activity for your application.
*
*
* -
*
* Maximum
- The highest value observed during the specified period. Use this value to determine high
* volumes of activity for your application.
*
*
* -
*
* Sum
- All values submitted for the matching metric added together. You can use this statistic to
* determine the total volume of a metric.
*
*
* -
*
* Average
- The value of Sum / SampleCount during the specified period. By comparing this statistic
* with the Minimum and Maximum values, you can determine the full scope of a metric and how close the average use
* is to the Minimum and Maximum values. This comparison helps you to know when to increase or decrease your
* resources.
*
*
* -
*
* SampleCount
- The count, or number, of data points used for the statistical calculation.
*
*
*
*
* @param statistic
* The statistic for the metric associated with the alarm.
*
* The following statistics are available:
*
*
* -
*
* Minimum
- The lowest value observed during the specified period. Use this value to determine
* low volumes of activity for your application.
*
*
* -
*
* Maximum
- The highest value observed during the specified period. Use this value to determine
* high volumes of activity for your application.
*
*
* -
*
* Sum
- All values submitted for the matching metric added together. You can use this statistic
* to determine the total volume of a metric.
*
*
* -
*
* Average
- The value of Sum / SampleCount during the specified period. By comparing this
* statistic with the Minimum and Maximum values, you can determine the full scope of a metric and how close
* the average use is to the Minimum and Maximum values. This comparison helps you to know when to increase
* or decrease your resources.
*
*
* -
*
* SampleCount
- The count, or number, of data points used for the statistical calculation.
*
*
* @see MetricStatistic
*/
public void setStatistic(String statistic) {
this.statistic = statistic;
}
/**
*
* The statistic for the metric associated with the alarm.
*
*
* The following statistics are available:
*
*
* -
*
* Minimum
- The lowest value observed during the specified period. Use this value to determine low
* volumes of activity for your application.
*
*
* -
*
* Maximum
- The highest value observed during the specified period. Use this value to determine high
* volumes of activity for your application.
*
*
* -
*
* Sum
- All values submitted for the matching metric added together. You can use this statistic to
* determine the total volume of a metric.
*
*
* -
*
* Average
- The value of Sum / SampleCount during the specified period. By comparing this statistic
* with the Minimum and Maximum values, you can determine the full scope of a metric and how close the average use
* is to the Minimum and Maximum values. This comparison helps you to know when to increase or decrease your
* resources.
*
*
* -
*
* SampleCount
- The count, or number, of data points used for the statistical calculation.
*
*
*
*
* @return The statistic for the metric associated with the alarm.
*
* The following statistics are available:
*
*
* -
*
* Minimum
- The lowest value observed during the specified period. Use this value to determine
* low volumes of activity for your application.
*
*
* -
*
* Maximum
- The highest value observed during the specified period. Use this value to
* determine high volumes of activity for your application.
*
*
* -
*
* Sum
- All values submitted for the matching metric added together. You can use this
* statistic to determine the total volume of a metric.
*
*
* -
*
* Average
- The value of Sum / SampleCount during the specified period. By comparing this
* statistic with the Minimum and Maximum values, you can determine the full scope of a metric and how close
* the average use is to the Minimum and Maximum values. This comparison helps you to know when to increase
* or decrease your resources.
*
*
* -
*
* SampleCount
- The count, or number, of data points used for the statistical calculation.
*
*
* @see MetricStatistic
*/
public String getStatistic() {
return this.statistic;
}
/**
*
* The statistic for the metric associated with the alarm.
*
*
* The following statistics are available:
*
*
* -
*
* Minimum
- The lowest value observed during the specified period. Use this value to determine low
* volumes of activity for your application.
*
*
* -
*
* Maximum
- The highest value observed during the specified period. Use this value to determine high
* volumes of activity for your application.
*
*
* -
*
* Sum
- All values submitted for the matching metric added together. You can use this statistic to
* determine the total volume of a metric.
*
*
* -
*
* Average
- The value of Sum / SampleCount during the specified period. By comparing this statistic
* with the Minimum and Maximum values, you can determine the full scope of a metric and how close the average use
* is to the Minimum and Maximum values. This comparison helps you to know when to increase or decrease your
* resources.
*
*
* -
*
* SampleCount
- The count, or number, of data points used for the statistical calculation.
*
*
*
*
* @param statistic
* The statistic for the metric associated with the alarm.
*
* The following statistics are available:
*
*
* -
*
* Minimum
- The lowest value observed during the specified period. Use this value to determine
* low volumes of activity for your application.
*
*
* -
*
* Maximum
- The highest value observed during the specified period. Use this value to determine
* high volumes of activity for your application.
*
*
* -
*
* Sum
- All values submitted for the matching metric added together. You can use this statistic
* to determine the total volume of a metric.
*
*
* -
*
* Average
- The value of Sum / SampleCount during the specified period. By comparing this
* statistic with the Minimum and Maximum values, you can determine the full scope of a metric and how close
* the average use is to the Minimum and Maximum values. This comparison helps you to know when to increase
* or decrease your resources.
*
*
* -
*
* SampleCount
- The count, or number, of data points used for the statistical calculation.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see MetricStatistic
*/
public Alarm withStatistic(String statistic) {
setStatistic(statistic);
return this;
}
/**
*
* The statistic for the metric associated with the alarm.
*
*
* The following statistics are available:
*
*
* -
*
* Minimum
- The lowest value observed during the specified period. Use this value to determine low
* volumes of activity for your application.
*
*
* -
*
* Maximum
- The highest value observed during the specified period. Use this value to determine high
* volumes of activity for your application.
*
*
* -
*
* Sum
- All values submitted for the matching metric added together. You can use this statistic to
* determine the total volume of a metric.
*
*
* -
*
* Average
- The value of Sum / SampleCount during the specified period. By comparing this statistic
* with the Minimum and Maximum values, you can determine the full scope of a metric and how close the average use
* is to the Minimum and Maximum values. This comparison helps you to know when to increase or decrease your
* resources.
*
*
* -
*
* SampleCount
- The count, or number, of data points used for the statistical calculation.
*
*
*
*
* @param statistic
* The statistic for the metric associated with the alarm.
*
* The following statistics are available:
*
*
* -
*
* Minimum
- The lowest value observed during the specified period. Use this value to determine
* low volumes of activity for your application.
*
*
* -
*
* Maximum
- The highest value observed during the specified period. Use this value to determine
* high volumes of activity for your application.
*
*
* -
*
* Sum
- All values submitted for the matching metric added together. You can use this statistic
* to determine the total volume of a metric.
*
*
* -
*
* Average
- The value of Sum / SampleCount during the specified period. By comparing this
* statistic with the Minimum and Maximum values, you can determine the full scope of a metric and how close
* the average use is to the Minimum and Maximum values. This comparison helps you to know when to increase
* or decrease your resources.
*
*
* -
*
* SampleCount
- The count, or number, of data points used for the statistical calculation.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see MetricStatistic
*/
public Alarm withStatistic(MetricStatistic statistic) {
this.statistic = statistic.toString();
return this;
}
/**
*
* The name of the metric associated with the alarm.
*
*
* @param metricName
* The name of the metric associated with the alarm.
* @see MetricName
*/
public void setMetricName(String metricName) {
this.metricName = metricName;
}
/**
*
* The name of the metric associated with the alarm.
*
*
* @return The name of the metric associated with the alarm.
* @see MetricName
*/
public String getMetricName() {
return this.metricName;
}
/**
*
* The name of the metric associated with the alarm.
*
*
* @param metricName
* The name of the metric associated with the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
* @see MetricName
*/
public Alarm withMetricName(String metricName) {
setMetricName(metricName);
return this;
}
/**
*
* The name of the metric associated with the alarm.
*
*
* @param metricName
* The name of the metric associated with the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
* @see MetricName
*/
public Alarm withMetricName(MetricName metricName) {
this.metricName = metricName.toString();
return this;
}
/**
*
* The current state of the alarm.
*
*
* An alarm has the following possible states:
*
*
* -
*
* ALARM
- The metric is outside of the defined threshold.
*
*
* -
*
* INSUFFICIENT_DATA
- The alarm has just started, the metric is not available, or not enough data is
* available for the metric to determine the alarm state.
*
*
* -
*
* OK
- The metric is within the defined threshold.
*
*
*
*
* @param state
* The current state of the alarm.
*
* An alarm has the following possible states:
*
*
* -
*
* ALARM
- The metric is outside of the defined threshold.
*
*
* -
*
* INSUFFICIENT_DATA
- The alarm has just started, the metric is not available, or not enough
* data is available for the metric to determine the alarm state.
*
*
* -
*
* OK
- The metric is within the defined threshold.
*
*
* @see AlarmState
*/
public void setState(String state) {
this.state = state;
}
/**
*
* The current state of the alarm.
*
*
* An alarm has the following possible states:
*
*
* -
*
* ALARM
- The metric is outside of the defined threshold.
*
*
* -
*
* INSUFFICIENT_DATA
- The alarm has just started, the metric is not available, or not enough data is
* available for the metric to determine the alarm state.
*
*
* -
*
* OK
- The metric is within the defined threshold.
*
*
*
*
* @return The current state of the alarm.
*
* An alarm has the following possible states:
*
*
* -
*
* ALARM
- The metric is outside of the defined threshold.
*
*
* -
*
* INSUFFICIENT_DATA
- The alarm has just started, the metric is not available, or not enough
* data is available for the metric to determine the alarm state.
*
*
* -
*
* OK
- The metric is within the defined threshold.
*
*
* @see AlarmState
*/
public String getState() {
return this.state;
}
/**
*
* The current state of the alarm.
*
*
* An alarm has the following possible states:
*
*
* -
*
* ALARM
- The metric is outside of the defined threshold.
*
*
* -
*
* INSUFFICIENT_DATA
- The alarm has just started, the metric is not available, or not enough data is
* available for the metric to determine the alarm state.
*
*
* -
*
* OK
- The metric is within the defined threshold.
*
*
*
*
* @param state
* The current state of the alarm.
*
* An alarm has the following possible states:
*
*
* -
*
* ALARM
- The metric is outside of the defined threshold.
*
*
* -
*
* INSUFFICIENT_DATA
- The alarm has just started, the metric is not available, or not enough
* data is available for the metric to determine the alarm state.
*
*
* -
*
* OK
- The metric is within the defined threshold.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see AlarmState
*/
public Alarm withState(String state) {
setState(state);
return this;
}
/**
*
* The current state of the alarm.
*
*
* An alarm has the following possible states:
*
*
* -
*
* ALARM
- The metric is outside of the defined threshold.
*
*
* -
*
* INSUFFICIENT_DATA
- The alarm has just started, the metric is not available, or not enough data is
* available for the metric to determine the alarm state.
*
*
* -
*
* OK
- The metric is within the defined threshold.
*
*
*
*
* @param state
* The current state of the alarm.
*
* An alarm has the following possible states:
*
*
* -
*
* ALARM
- The metric is outside of the defined threshold.
*
*
* -
*
* INSUFFICIENT_DATA
- The alarm has just started, the metric is not available, or not enough
* data is available for the metric to determine the alarm state.
*
*
* -
*
* OK
- The metric is within the defined threshold.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see AlarmState
*/
public Alarm withState(AlarmState state) {
this.state = state.toString();
return this;
}
/**
*
* The unit of the metric associated with the alarm.
*
*
* @param unit
* The unit of the metric associated with the alarm.
* @see MetricUnit
*/
public void setUnit(String unit) {
this.unit = unit;
}
/**
*
* The unit of the metric associated with the alarm.
*
*
* @return The unit of the metric associated with the alarm.
* @see MetricUnit
*/
public String getUnit() {
return this.unit;
}
/**
*
* The unit of the metric associated with the alarm.
*
*
* @param unit
* The unit of the metric associated with the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
* @see MetricUnit
*/
public Alarm withUnit(String unit) {
setUnit(unit);
return this;
}
/**
*
* The unit of the metric associated with the alarm.
*
*
* @param unit
* The unit of the metric associated with the alarm.
* @return Returns a reference to this object so that method calls can be chained together.
* @see MetricUnit
*/
public Alarm withUnit(MetricUnit unit) {
this.unit = unit.toString();
return this;
}
/**
*
* The contact protocols for the alarm, such as Email
, SMS
(text messaging), or both.
*
*
* @return The contact protocols for the alarm, such as Email
, SMS
(text messaging), or
* both.
* @see ContactProtocol
*/
public java.util.List getContactProtocols() {
return contactProtocols;
}
/**
*
* The contact protocols for the alarm, such as Email
, SMS
(text messaging), or both.
*
*
* @param contactProtocols
* The contact protocols for the alarm, such as Email
, SMS
(text messaging), or
* both.
* @see ContactProtocol
*/
public void setContactProtocols(java.util.Collection contactProtocols) {
if (contactProtocols == null) {
this.contactProtocols = null;
return;
}
this.contactProtocols = new java.util.ArrayList(contactProtocols);
}
/**
*
* The contact protocols for the alarm, such as Email
, SMS
(text messaging), or both.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setContactProtocols(java.util.Collection)} or {@link #withContactProtocols(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param contactProtocols
* The contact protocols for the alarm, such as Email
, SMS
(text messaging), or
* both.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ContactProtocol
*/
public Alarm withContactProtocols(String... contactProtocols) {
if (this.contactProtocols == null) {
setContactProtocols(new java.util.ArrayList(contactProtocols.length));
}
for (String ele : contactProtocols) {
this.contactProtocols.add(ele);
}
return this;
}
/**
*
* The contact protocols for the alarm, such as Email
, SMS
(text messaging), or both.
*
*
* @param contactProtocols
* The contact protocols for the alarm, such as Email
, SMS
(text messaging), or
* both.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ContactProtocol
*/
public Alarm withContactProtocols(java.util.Collection contactProtocols) {
setContactProtocols(contactProtocols);
return this;
}
/**
*
* The contact protocols for the alarm, such as Email
, SMS
(text messaging), or both.
*
*
* @param contactProtocols
* The contact protocols for the alarm, such as Email
, SMS
(text messaging), or
* both.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ContactProtocol
*/
public Alarm withContactProtocols(ContactProtocol... contactProtocols) {
java.util.ArrayList contactProtocolsCopy = new java.util.ArrayList(contactProtocols.length);
for (ContactProtocol value : contactProtocols) {
contactProtocolsCopy.add(value.toString());
}
if (getContactProtocols() == null) {
setContactProtocols(contactProtocolsCopy);
} else {
getContactProtocols().addAll(contactProtocolsCopy);
}
return this;
}
/**
*
* The alarm states that trigger a notification.
*
*
* @return The alarm states that trigger a notification.
* @see AlarmState
*/
public java.util.List getNotificationTriggers() {
return notificationTriggers;
}
/**
*
* The alarm states that trigger a notification.
*
*
* @param notificationTriggers
* The alarm states that trigger a notification.
* @see AlarmState
*/
public void setNotificationTriggers(java.util.Collection notificationTriggers) {
if (notificationTriggers == null) {
this.notificationTriggers = null;
return;
}
this.notificationTriggers = new java.util.ArrayList(notificationTriggers);
}
/**
*
* The alarm states that trigger a notification.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setNotificationTriggers(java.util.Collection)} or {@link #withNotificationTriggers(java.util.Collection)}
* if you want to override the existing values.
*
*
* @param notificationTriggers
* The alarm states that trigger a notification.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AlarmState
*/
public Alarm withNotificationTriggers(String... notificationTriggers) {
if (this.notificationTriggers == null) {
setNotificationTriggers(new java.util.ArrayList(notificationTriggers.length));
}
for (String ele : notificationTriggers) {
this.notificationTriggers.add(ele);
}
return this;
}
/**
*
* The alarm states that trigger a notification.
*
*
* @param notificationTriggers
* The alarm states that trigger a notification.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AlarmState
*/
public Alarm withNotificationTriggers(java.util.Collection notificationTriggers) {
setNotificationTriggers(notificationTriggers);
return this;
}
/**
*
* The alarm states that trigger a notification.
*
*
* @param notificationTriggers
* The alarm states that trigger a notification.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AlarmState
*/
public Alarm withNotificationTriggers(AlarmState... notificationTriggers) {
java.util.ArrayList notificationTriggersCopy = new java.util.ArrayList(notificationTriggers.length);
for (AlarmState value : notificationTriggers) {
notificationTriggersCopy.add(value.toString());
}
if (getNotificationTriggers() == null) {
setNotificationTriggers(notificationTriggersCopy);
} else {
getNotificationTriggers().addAll(notificationTriggersCopy);
}
return this;
}
/**
*
* Indicates whether the alarm is enabled.
*
*
* @param notificationEnabled
* Indicates whether the alarm is enabled.
*/
public void setNotificationEnabled(Boolean notificationEnabled) {
this.notificationEnabled = notificationEnabled;
}
/**
*
* Indicates whether the alarm is enabled.
*
*
* @return Indicates whether the alarm is enabled.
*/
public Boolean getNotificationEnabled() {
return this.notificationEnabled;
}
/**
*
* Indicates whether the alarm is enabled.
*
*
* @param notificationEnabled
* Indicates whether the alarm is enabled.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Alarm withNotificationEnabled(Boolean notificationEnabled) {
setNotificationEnabled(notificationEnabled);
return this;
}
/**
*
* Indicates whether the alarm is enabled.
*
*
* @return Indicates whether the alarm is enabled.
*/
public Boolean isNotificationEnabled() {
return this.notificationEnabled;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getArn() != null)
sb.append("Arn: ").append(getArn()).append(",");
if (getCreatedAt() != null)
sb.append("CreatedAt: ").append(getCreatedAt()).append(",");
if (getLocation() != null)
sb.append("Location: ").append(getLocation()).append(",");
if (getResourceType() != null)
sb.append("ResourceType: ").append(getResourceType()).append(",");
if (getSupportCode() != null)
sb.append("SupportCode: ").append(getSupportCode()).append(",");
if (getMonitoredResourceInfo() != null)
sb.append("MonitoredResourceInfo: ").append(getMonitoredResourceInfo()).append(",");
if (getComparisonOperator() != null)
sb.append("ComparisonOperator: ").append(getComparisonOperator()).append(",");
if (getEvaluationPeriods() != null)
sb.append("EvaluationPeriods: ").append(getEvaluationPeriods()).append(",");
if (getPeriod() != null)
sb.append("Period: ").append(getPeriod()).append(",");
if (getThreshold() != null)
sb.append("Threshold: ").append(getThreshold()).append(",");
if (getDatapointsToAlarm() != null)
sb.append("DatapointsToAlarm: ").append(getDatapointsToAlarm()).append(",");
if (getTreatMissingData() != null)
sb.append("TreatMissingData: ").append(getTreatMissingData()).append(",");
if (getStatistic() != null)
sb.append("Statistic: ").append(getStatistic()).append(",");
if (getMetricName() != null)
sb.append("MetricName: ").append(getMetricName()).append(",");
if (getState() != null)
sb.append("State: ").append(getState()).append(",");
if (getUnit() != null)
sb.append("Unit: ").append(getUnit()).append(",");
if (getContactProtocols() != null)
sb.append("ContactProtocols: ").append(getContactProtocols()).append(",");
if (getNotificationTriggers() != null)
sb.append("NotificationTriggers: ").append(getNotificationTriggers()).append(",");
if (getNotificationEnabled() != null)
sb.append("NotificationEnabled: ").append(getNotificationEnabled());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Alarm == false)
return false;
Alarm other = (Alarm) obj;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getArn() == null ^ this.getArn() == null)
return false;
if (other.getArn() != null && other.getArn().equals(this.getArn()) == false)
return false;
if (other.getCreatedAt() == null ^ this.getCreatedAt() == null)
return false;
if (other.getCreatedAt() != null && other.getCreatedAt().equals(this.getCreatedAt()) == false)
return false;
if (other.getLocation() == null ^ this.getLocation() == null)
return false;
if (other.getLocation() != null && other.getLocation().equals(this.getLocation()) == false)
return false;
if (other.getResourceType() == null ^ this.getResourceType() == null)
return false;
if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == false)
return false;
if (other.getSupportCode() == null ^ this.getSupportCode() == null)
return false;
if (other.getSupportCode() != null && other.getSupportCode().equals(this.getSupportCode()) == false)
return false;
if (other.getMonitoredResourceInfo() == null ^ this.getMonitoredResourceInfo() == null)
return false;
if (other.getMonitoredResourceInfo() != null && other.getMonitoredResourceInfo().equals(this.getMonitoredResourceInfo()) == false)
return false;
if (other.getComparisonOperator() == null ^ this.getComparisonOperator() == null)
return false;
if (other.getComparisonOperator() != null && other.getComparisonOperator().equals(this.getComparisonOperator()) == false)
return false;
if (other.getEvaluationPeriods() == null ^ this.getEvaluationPeriods() == null)
return false;
if (other.getEvaluationPeriods() != null && other.getEvaluationPeriods().equals(this.getEvaluationPeriods()) == false)
return false;
if (other.getPeriod() == null ^ this.getPeriod() == null)
return false;
if (other.getPeriod() != null && other.getPeriod().equals(this.getPeriod()) == false)
return false;
if (other.getThreshold() == null ^ this.getThreshold() == null)
return false;
if (other.getThreshold() != null && other.getThreshold().equals(this.getThreshold()) == false)
return false;
if (other.getDatapointsToAlarm() == null ^ this.getDatapointsToAlarm() == null)
return false;
if (other.getDatapointsToAlarm() != null && other.getDatapointsToAlarm().equals(this.getDatapointsToAlarm()) == false)
return false;
if (other.getTreatMissingData() == null ^ this.getTreatMissingData() == null)
return false;
if (other.getTreatMissingData() != null && other.getTreatMissingData().equals(this.getTreatMissingData()) == false)
return false;
if (other.getStatistic() == null ^ this.getStatistic() == null)
return false;
if (other.getStatistic() != null && other.getStatistic().equals(this.getStatistic()) == false)
return false;
if (other.getMetricName() == null ^ this.getMetricName() == null)
return false;
if (other.getMetricName() != null && other.getMetricName().equals(this.getMetricName()) == false)
return false;
if (other.getState() == null ^ this.getState() == null)
return false;
if (other.getState() != null && other.getState().equals(this.getState()) == false)
return false;
if (other.getUnit() == null ^ this.getUnit() == null)
return false;
if (other.getUnit() != null && other.getUnit().equals(this.getUnit()) == false)
return false;
if (other.getContactProtocols() == null ^ this.getContactProtocols() == null)
return false;
if (other.getContactProtocols() != null && other.getContactProtocols().equals(this.getContactProtocols()) == false)
return false;
if (other.getNotificationTriggers() == null ^ this.getNotificationTriggers() == null)
return false;
if (other.getNotificationTriggers() != null && other.getNotificationTriggers().equals(this.getNotificationTriggers()) == false)
return false;
if (other.getNotificationEnabled() == null ^ this.getNotificationEnabled() == null)
return false;
if (other.getNotificationEnabled() != null && other.getNotificationEnabled().equals(this.getNotificationEnabled()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode());
hashCode = prime * hashCode + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
hashCode = prime * hashCode + ((getLocation() == null) ? 0 : getLocation().hashCode());
hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode());
hashCode = prime * hashCode + ((getSupportCode() == null) ? 0 : getSupportCode().hashCode());
hashCode = prime * hashCode + ((getMonitoredResourceInfo() == null) ? 0 : getMonitoredResourceInfo().hashCode());
hashCode = prime * hashCode + ((getComparisonOperator() == null) ? 0 : getComparisonOperator().hashCode());
hashCode = prime * hashCode + ((getEvaluationPeriods() == null) ? 0 : getEvaluationPeriods().hashCode());
hashCode = prime * hashCode + ((getPeriod() == null) ? 0 : getPeriod().hashCode());
hashCode = prime * hashCode + ((getThreshold() == null) ? 0 : getThreshold().hashCode());
hashCode = prime * hashCode + ((getDatapointsToAlarm() == null) ? 0 : getDatapointsToAlarm().hashCode());
hashCode = prime * hashCode + ((getTreatMissingData() == null) ? 0 : getTreatMissingData().hashCode());
hashCode = prime * hashCode + ((getStatistic() == null) ? 0 : getStatistic().hashCode());
hashCode = prime * hashCode + ((getMetricName() == null) ? 0 : getMetricName().hashCode());
hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode());
hashCode = prime * hashCode + ((getUnit() == null) ? 0 : getUnit().hashCode());
hashCode = prime * hashCode + ((getContactProtocols() == null) ? 0 : getContactProtocols().hashCode());
hashCode = prime * hashCode + ((getNotificationTriggers() == null) ? 0 : getNotificationTriggers().hashCode());
hashCode = prime * hashCode + ((getNotificationEnabled() == null) ? 0 : getNotificationEnabled().hashCode());
return hashCode;
}
@Override
public Alarm clone() {
try {
return (Alarm) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.lightsail.model.transform.AlarmMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}