aws_sdk_budgets/types/
_action_threshold.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The trigger threshold of the action.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ActionThreshold {
7    /// <p>The threshold of a notification.</p>
8    pub action_threshold_value: f64,
9    /// <p>The type of threshold for a notification.</p>
10    pub action_threshold_type: crate::types::ThresholdType,
11}
12impl ActionThreshold {
13    /// <p>The threshold of a notification.</p>
14    pub fn action_threshold_value(&self) -> f64 {
15        self.action_threshold_value
16    }
17    /// <p>The type of threshold for a notification.</p>
18    pub fn action_threshold_type(&self) -> &crate::types::ThresholdType {
19        &self.action_threshold_type
20    }
21}
22impl ActionThreshold {
23    /// Creates a new builder-style object to manufacture [`ActionThreshold`](crate::types::ActionThreshold).
24    pub fn builder() -> crate::types::builders::ActionThresholdBuilder {
25        crate::types::builders::ActionThresholdBuilder::default()
26    }
27}
28
29/// A builder for [`ActionThreshold`](crate::types::ActionThreshold).
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
31#[non_exhaustive]
32pub struct ActionThresholdBuilder {
33    pub(crate) action_threshold_value: ::std::option::Option<f64>,
34    pub(crate) action_threshold_type: ::std::option::Option<crate::types::ThresholdType>,
35}
36impl ActionThresholdBuilder {
37    /// <p>The threshold of a notification.</p>
38    /// This field is required.
39    pub fn action_threshold_value(mut self, input: f64) -> Self {
40        self.action_threshold_value = ::std::option::Option::Some(input);
41        self
42    }
43    /// <p>The threshold of a notification.</p>
44    pub fn set_action_threshold_value(mut self, input: ::std::option::Option<f64>) -> Self {
45        self.action_threshold_value = input;
46        self
47    }
48    /// <p>The threshold of a notification.</p>
49    pub fn get_action_threshold_value(&self) -> &::std::option::Option<f64> {
50        &self.action_threshold_value
51    }
52    /// <p>The type of threshold for a notification.</p>
53    /// This field is required.
54    pub fn action_threshold_type(mut self, input: crate::types::ThresholdType) -> Self {
55        self.action_threshold_type = ::std::option::Option::Some(input);
56        self
57    }
58    /// <p>The type of threshold for a notification.</p>
59    pub fn set_action_threshold_type(mut self, input: ::std::option::Option<crate::types::ThresholdType>) -> Self {
60        self.action_threshold_type = input;
61        self
62    }
63    /// <p>The type of threshold for a notification.</p>
64    pub fn get_action_threshold_type(&self) -> &::std::option::Option<crate::types::ThresholdType> {
65        &self.action_threshold_type
66    }
67    /// Consumes the builder and constructs a [`ActionThreshold`](crate::types::ActionThreshold).
68    /// This method will fail if any of the following fields are not set:
69    /// - [`action_threshold_type`](crate::types::builders::ActionThresholdBuilder::action_threshold_type)
70    pub fn build(self) -> ::std::result::Result<crate::types::ActionThreshold, ::aws_smithy_types::error::operation::BuildError> {
71        ::std::result::Result::Ok(crate::types::ActionThreshold {
72            action_threshold_value: self.action_threshold_value.unwrap_or_default(),
73            action_threshold_type: self.action_threshold_type.ok_or_else(|| {
74                ::aws_smithy_types::error::operation::BuildError::missing_field(
75                    "action_threshold_type",
76                    "action_threshold_type was not specified but it is required when building ActionThreshold",
77                )
78            })?,
79        })
80    }
81}