aws_sdk_lightsail/client/
put_alarm.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3    /// Constructs a fluent builder for the [`PutAlarm`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder) operation.
4    ///
5    /// - The fluent builder is configurable:
6    ///   - [`alarm_name(impl Into<String>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::alarm_name) / [`set_alarm_name(Option<String>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::set_alarm_name):<br>required: **true**<br><p>The name for the alarm. Specify the name of an existing alarm to update, and overwrite the previous configuration of the alarm.</p><br>
7    ///   - [`metric_name(MetricName)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::metric_name) / [`set_metric_name(Option<MetricName>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::set_metric_name):<br>required: **true**<br><p>The name of the metric to associate with the alarm.</p> <p>You can configure up to two alarms per metric.</p> <p>The following metrics are available for each resource type:</p> <ul>  <li>   <p><b>Instances</b>: <code>BurstCapacityPercentage</code>, <code>BurstCapacityTime</code>, <code>CPUUtilization</code>, <code>NetworkIn</code>, <code>NetworkOut</code>, <code>StatusCheckFailed</code>, <code>StatusCheckFailed_Instance</code>, and <code>StatusCheckFailed_System</code>.</p></li>  <li>   <p><b>Load balancers</b>: <code>ClientTLSNegotiationErrorCount</code>, <code>HealthyHostCount</code>, <code>UnhealthyHostCount</code>, <code>HTTPCode_LB_4XX_Count</code>, <code>HTTPCode_LB_5XX_Count</code>, <code>HTTPCode_Instance_2XX_Count</code>, <code>HTTPCode_Instance_3XX_Count</code>, <code>HTTPCode_Instance_4XX_Count</code>, <code>HTTPCode_Instance_5XX_Count</code>, <code>InstanceResponseTime</code>, <code>RejectedConnectionCount</code>, and <code>RequestCount</code>.</p></li>  <li>   <p><b>Relational databases</b>: <code>CPUUtilization</code>, <code>DatabaseConnections</code>, <code>DiskQueueDepth</code>, <code>FreeStorageSpace</code>, <code>NetworkReceiveThroughput</code>, and <code>NetworkTransmitThroughput</code>.</p></li> </ul> <p>For more information about these metrics, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-resource-health-metrics#available-metrics">Metrics available in Lightsail</a>.</p><br>
8    ///   - [`monitored_resource_name(impl Into<String>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::monitored_resource_name) / [`set_monitored_resource_name(Option<String>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::set_monitored_resource_name):<br>required: **true**<br><p>The name of the Lightsail resource that will be monitored.</p> <p>Instances, load balancers, and relational databases are the only Lightsail resources that can currently be monitored by alarms.</p><br>
9    ///   - [`comparison_operator(ComparisonOperator)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::comparison_operator) / [`set_comparison_operator(Option<ComparisonOperator>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::set_comparison_operator):<br>required: **true**<br><p>The arithmetic operation to use when comparing the specified statistic to the threshold. The specified statistic value is used as the first operand.</p><br>
10    ///   - [`threshold(f64)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::threshold) / [`set_threshold(Option<f64>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::set_threshold):<br>required: **true**<br><p>The value against which the specified statistic is compared.</p><br>
11    ///   - [`evaluation_periods(i32)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::evaluation_periods) / [`set_evaluation_periods(Option<i32>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::set_evaluation_periods):<br>required: **true**<br><p>The number of most recent periods over which data is compared to the specified threshold. If you are setting an "M out of N" alarm, this value (<code>evaluationPeriods</code>) is the N.</p> <p>If you are setting an alarm that requires that a number of consecutive data points be breaching to trigger the alarm, this value specifies the rolling period of time in which data points are evaluated.</p> <p>Each evaluation period is five minutes long. For example, specify an evaluation period of 24 to evaluate a metric over a rolling period of two hours.</p> <p>You can specify a minimum valuation period of 1 (5 minutes), and a maximum evaluation period of 288 (24 hours).</p><br>
12    ///   - [`datapoints_to_alarm(i32)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::datapoints_to_alarm) / [`set_datapoints_to_alarm(Option<i32>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::set_datapoints_to_alarm):<br>required: **false**<br><p>The number of data points that must be not within the specified threshold to trigger the alarm. If you are setting an "M out of N" alarm, this value (<code>datapointsToAlarm</code>) is the M.</p><br>
13    ///   - [`treat_missing_data(TreatMissingData)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::treat_missing_data) / [`set_treat_missing_data(Option<TreatMissingData>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::set_treat_missing_data):<br>required: **false**<br><p>Sets how this alarm will handle missing data points.</p> <p>An alarm can treat missing data in the following ways:</p> <ul>  <li>   <p><code>breaching</code> - Assume the missing data is not within the threshold. Missing data counts towards the number of times the metric is not within the threshold.</p></li>  <li>   <p><code>notBreaching</code> - 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.</p></li>  <li>   <p><code>ignore</code> - Ignore the missing data. Maintains the current alarm state.</p></li>  <li>   <p><code>missing</code> - Missing data is treated as missing.</p></li> </ul> <p>If <code>treatMissingData</code> is not specified, the default behavior of <code>missing</code> is used.</p><br>
14    ///   - [`contact_protocols(ContactProtocol)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::contact_protocols) / [`set_contact_protocols(Option<Vec::<ContactProtocol>>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::set_contact_protocols):<br>required: **false**<br><p>The contact protocols to use for the alarm, such as <code>Email</code>, <code>SMS</code> (text messaging), or both.</p> <p>A notification is sent via the specified contact protocol if notifications are enabled for the alarm, and when the alarm is triggered.</p> <p>A notification is not sent if a contact protocol is not specified, if the specified contact protocol is not configured in the Amazon Web Services Region, or if notifications are not enabled for the alarm using the <code>notificationEnabled</code> paramater.</p> <p>Use the <code>CreateContactMethod</code> action to configure a contact protocol in an Amazon Web Services Region.</p><br>
15    ///   - [`notification_triggers(AlarmState)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::notification_triggers) / [`set_notification_triggers(Option<Vec::<AlarmState>>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::set_notification_triggers):<br>required: **false**<br><p>The alarm states that trigger a notification.</p> <p>An alarm has the following possible states:</p> <ul>  <li>   <p><code>ALARM</code> - The metric is outside of the defined threshold.</p></li>  <li>   <p><code>INSUFFICIENT_DATA</code> - The alarm has just started, the metric is not available, or not enough data is available for the metric to determine the alarm state.</p></li>  <li>   <p><code>OK</code> - The metric is within the defined threshold.</p></li> </ul> <p>When you specify a notification trigger, the <code>ALARM</code> state must be specified. The <code>INSUFFICIENT_DATA</code> and <code>OK</code> states can be specified in addition to the <code>ALARM</code> state.</p> <ul>  <li>   <p>If you specify <code>OK</code> as an alarm trigger, a notification is sent when the alarm switches from an <code>ALARM</code> or <code>INSUFFICIENT_DATA</code> alarm state to an <code>OK</code> state. This can be thought of as an <i>all clear</i> alarm notification.</p></li>  <li>   <p>If you specify <code>INSUFFICIENT_DATA</code> as the alarm trigger, a notification is sent when the alarm switches from an <code>OK</code> or <code>ALARM</code> alarm state to an <code>INSUFFICIENT_DATA</code> state.</p></li> </ul> <p>The notification trigger defaults to <code>ALARM</code> if you don't specify this parameter.</p><br>
16    ///   - [`notification_enabled(bool)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::notification_enabled) / [`set_notification_enabled(Option<bool>)`](crate::operation::put_alarm::builders::PutAlarmFluentBuilder::set_notification_enabled):<br>required: **false**<br><p>Indicates whether the alarm is enabled.</p> <p>Notifications are enabled by default if you don't specify this parameter.</p><br>
17    /// - On success, responds with [`PutAlarmOutput`](crate::operation::put_alarm::PutAlarmOutput) with field(s):
18    ///   - [`operations(Option<Vec::<Operation>>)`](crate::operation::put_alarm::PutAlarmOutput::operations): <p>An array of objects that describe the result of the action, such as the status of the request, the timestamp of the request, and the resources affected by the request.</p>
19    /// - On failure, responds with [`SdkError<PutAlarmError>`](crate::operation::put_alarm::PutAlarmError)
20    pub fn put_alarm(&self) -> crate::operation::put_alarm::builders::PutAlarmFluentBuilder {
21        crate::operation::put_alarm::builders::PutAlarmFluentBuilder::new(self.handle.clone())
22    }
23}