#[non_exhaustive]pub struct Alarm {Show 20 fields
pub name: Option<String>,
pub arn: Option<String>,
pub created_at: Option<DateTime>,
pub location: Option<ResourceLocation>,
pub resource_type: Option<ResourceType>,
pub support_code: Option<String>,
pub monitored_resource_info: Option<MonitoredResourceInfo>,
pub comparison_operator: Option<ComparisonOperator>,
pub evaluation_periods: Option<i32>,
pub period: Option<i32>,
pub threshold: Option<f64>,
pub datapoints_to_alarm: Option<i32>,
pub treat_missing_data: Option<TreatMissingData>,
pub statistic: Option<MetricStatistic>,
pub metric_name: Option<MetricName>,
pub state: Option<AlarmState>,
pub unit: Option<MetricUnit>,
pub contact_protocols: Option<Vec<ContactProtocol>>,
pub notification_triggers: Option<Vec<AlarmState>>,
pub notification_enabled: Option<bool>,
}Expand description
Describes an alarm.
An alarm is a way to monitor your Lightsail resource metrics. For more information, see Alarms in Amazon Lightsail.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: Option<String>The name of the alarm.
arn: Option<String>The Amazon Resource Name (ARN) of the alarm.
created_at: Option<DateTime>The timestamp when the alarm was created.
location: Option<ResourceLocation>An object that lists information about the location of the alarm.
resource_type: Option<ResourceType>The Lightsail resource type of the alarm.
support_code: Option<String>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.
monitored_resource_info: Option<MonitoredResourceInfo>An object that lists information about the resource monitored by the alarm.
comparison_operator: Option<ComparisonOperator>The arithmetic operation used when comparing the specified statistic and threshold.
evaluation_periods: Option<i32>The number of periods over which data is compared to the specified threshold.
period: Option<i32>The period, in seconds, over which the statistic is applied.
threshold: Option<f64>The value against which the specified statistic is compared.
datapoints_to_alarm: Option<i32>The number of data points that must not within the specified threshold to trigger the alarm.
treat_missing_data: Option<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.
statistic: Option<MetricStatistic>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.
metric_name: Option<MetricName>The name of the metric associated with the alarm.
state: Option<AlarmState>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.
unit: Option<MetricUnit>The unit of the metric associated with the alarm.
contact_protocols: Option<Vec<ContactProtocol>>The contact protocols for the alarm, such as Email, SMS (text messaging), or both.
notification_triggers: Option<Vec<AlarmState>>The alarm states that trigger a notification.
notification_enabled: Option<bool>Indicates whether the alarm is enabled.
Implementations§
Source§impl Alarm
impl Alarm
Sourcepub fn created_at(&self) -> Option<&DateTime>
pub fn created_at(&self) -> Option<&DateTime>
The timestamp when the alarm was created.
Sourcepub fn location(&self) -> Option<&ResourceLocation>
pub fn location(&self) -> Option<&ResourceLocation>
An object that lists information about the location of the alarm.
Sourcepub fn resource_type(&self) -> Option<&ResourceType>
pub fn resource_type(&self) -> Option<&ResourceType>
The Lightsail resource type of the alarm.
Sourcepub fn support_code(&self) -> Option<&str>
pub fn support_code(&self) -> Option<&str>
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.
Sourcepub fn monitored_resource_info(&self) -> Option<&MonitoredResourceInfo>
pub fn monitored_resource_info(&self) -> Option<&MonitoredResourceInfo>
An object that lists information about the resource monitored by the alarm.
Sourcepub fn comparison_operator(&self) -> Option<&ComparisonOperator>
pub fn comparison_operator(&self) -> Option<&ComparisonOperator>
The arithmetic operation used when comparing the specified statistic and threshold.
Sourcepub fn evaluation_periods(&self) -> Option<i32>
pub fn evaluation_periods(&self) -> Option<i32>
The number of periods over which data is compared to the specified threshold.
Sourcepub fn period(&self) -> Option<i32>
pub fn period(&self) -> Option<i32>
The period, in seconds, over which the statistic is applied.
Sourcepub fn threshold(&self) -> Option<f64>
pub fn threshold(&self) -> Option<f64>
The value against which the specified statistic is compared.
Sourcepub fn datapoints_to_alarm(&self) -> Option<i32>
pub fn datapoints_to_alarm(&self) -> Option<i32>
The number of data points that must not within the specified threshold to trigger the alarm.
Sourcepub fn treat_missing_data(&self) -> Option<&TreatMissingData>
pub fn treat_missing_data(&self) -> Option<&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.
Sourcepub fn statistic(&self) -> Option<&MetricStatistic>
pub fn statistic(&self) -> Option<&MetricStatistic>
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.
Sourcepub fn metric_name(&self) -> Option<&MetricName>
pub fn metric_name(&self) -> Option<&MetricName>
The name of the metric associated with the alarm.
Sourcepub fn state(&self) -> Option<&AlarmState>
pub fn state(&self) -> Option<&AlarmState>
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.
Sourcepub fn unit(&self) -> Option<&MetricUnit>
pub fn unit(&self) -> Option<&MetricUnit>
The unit of the metric associated with the alarm.
Sourcepub fn contact_protocols(&self) -> &[ContactProtocol]
pub fn contact_protocols(&self) -> &[ContactProtocol]
The contact protocols for the alarm, such as Email, SMS (text messaging), or both.
If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use .contact_protocols.is_none().
Sourcepub fn notification_triggers(&self) -> &[AlarmState]
pub fn notification_triggers(&self) -> &[AlarmState]
The alarm states that trigger a notification.
If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use .notification_triggers.is_none().
Sourcepub fn notification_enabled(&self) -> Option<bool>
pub fn notification_enabled(&self) -> Option<bool>
Indicates whether the alarm is enabled.
Trait Implementations§
impl StructuralPartialEq for Alarm
Auto Trait Implementations§
impl Freeze for Alarm
impl RefUnwindSafe for Alarm
impl Send for Alarm
impl Sync for Alarm
impl Unpin for Alarm
impl UnwindSafe for Alarm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);