1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>The amount of cost or usage that's measured for a budget.</p>
/// <p><i>Cost example:</i> A <code>Spend</code> for <code>3 USD</code> of costs has the following parameters:</p>
/// <ul>
/// <li>
/// <p>An <code>Amount</code> of <code>3</code></p></li>
/// <li>
/// <p>A <code>Unit</code> of <code>USD</code></p></li>
/// </ul>
/// <p><i>Usage example:</i> A <code>Spend</code> for <code>3 GB</code> of S3 usage has the following parameters:</p>
/// <ul>
/// <li>
/// <p>An <code>Amount</code> of <code>3</code></p></li>
/// <li>
/// <p>A <code>Unit</code> of <code>GB</code></p></li>
/// </ul>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Spend {
/// <p>The cost or usage amount that's associated with a budget forecast, actual spend, or budget threshold.</p>
pub amount: ::std::string::String,
/// <p>The unit of measurement that's used for the budget forecast, actual spend, or budget threshold.</p>
pub unit: ::std::string::String,
}
impl Spend {
/// <p>The cost or usage amount that's associated with a budget forecast, actual spend, or budget threshold.</p>
pub fn amount(&self) -> &str {
use std::ops::Deref;
self.amount.deref()
}
/// <p>The unit of measurement that's used for the budget forecast, actual spend, or budget threshold.</p>
pub fn unit(&self) -> &str {
use std::ops::Deref;
self.unit.deref()
}
}
impl Spend {
/// Creates a new builder-style object to manufacture [`Spend`](crate::types::Spend).
pub fn builder() -> crate::types::builders::SpendBuilder {
crate::types::builders::SpendBuilder::default()
}
}
/// A builder for [`Spend`](crate::types::Spend).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SpendBuilder {
pub(crate) amount: ::std::option::Option<::std::string::String>,
pub(crate) unit: ::std::option::Option<::std::string::String>,
}
impl SpendBuilder {
/// <p>The cost or usage amount that's associated with a budget forecast, actual spend, or budget threshold.</p>
/// This field is required.
pub fn amount(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.amount = ::std::option::Option::Some(input.into());
self
}
/// <p>The cost or usage amount that's associated with a budget forecast, actual spend, or budget threshold.</p>
pub fn set_amount(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.amount = input;
self
}
/// <p>The cost or usage amount that's associated with a budget forecast, actual spend, or budget threshold.</p>
pub fn get_amount(&self) -> &::std::option::Option<::std::string::String> {
&self.amount
}
/// <p>The unit of measurement that's used for the budget forecast, actual spend, or budget threshold.</p>
/// This field is required.
pub fn unit(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.unit = ::std::option::Option::Some(input.into());
self
}
/// <p>The unit of measurement that's used for the budget forecast, actual spend, or budget threshold.</p>
pub fn set_unit(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.unit = input;
self
}
/// <p>The unit of measurement that's used for the budget forecast, actual spend, or budget threshold.</p>
pub fn get_unit(&self) -> &::std::option::Option<::std::string::String> {
&self.unit
}
/// Consumes the builder and constructs a [`Spend`](crate::types::Spend).
/// This method will fail if any of the following fields are not set:
/// - [`amount`](crate::types::builders::SpendBuilder::amount)
/// - [`unit`](crate::types::builders::SpendBuilder::unit)
pub fn build(self) -> ::std::result::Result<crate::types::Spend, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Spend {
amount: self.amount.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"amount",
"amount was not specified but it is required when building Spend",
)
})?,
unit: self.unit.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"unit",
"unit was not specified but it is required when building Spend",
)
})?,
})
}
}