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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// A monetary amount in a single currency.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Price {
/// The ISO 4217 currency code (three uppercase letters, for example, "USD").
pub currency_code: ::std::string::String,
/// An arbitrary-precision decimal represented as a string (for example, "9.99").
pub amount: ::std::string::String,
}
impl Price {
/// The ISO 4217 currency code (three uppercase letters, for example, "USD").
pub fn currency_code(&self) -> &str {
use std::ops::Deref;
self.currency_code.deref()
}
/// An arbitrary-precision decimal represented as a string (for example, "9.99").
pub fn amount(&self) -> &str {
use std::ops::Deref;
self.amount.deref()
}
}
impl Price {
/// Creates a new builder-style object to manufacture [`Price`](crate::types::Price).
pub fn builder() -> crate::types::builders::PriceBuilder {
crate::types::builders::PriceBuilder::default()
}
}
/// A builder for [`Price`](crate::types::Price).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PriceBuilder {
pub(crate) currency_code: ::std::option::Option<::std::string::String>,
pub(crate) amount: ::std::option::Option<::std::string::String>,
}
impl PriceBuilder {
/// The ISO 4217 currency code (three uppercase letters, for example, "USD").
/// This field is required.
pub fn currency_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.currency_code = ::std::option::Option::Some(input.into());
self
}
/// The ISO 4217 currency code (three uppercase letters, for example, "USD").
pub fn set_currency_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.currency_code = input;
self
}
/// The ISO 4217 currency code (three uppercase letters, for example, "USD").
pub fn get_currency_code(&self) -> &::std::option::Option<::std::string::String> {
&self.currency_code
}
/// An arbitrary-precision decimal represented as a string (for example, "9.99").
/// 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
}
/// An arbitrary-precision decimal represented as a string (for example, "9.99").
pub fn set_amount(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.amount = input;
self
}
/// An arbitrary-precision decimal represented as a string (for example, "9.99").
pub fn get_amount(&self) -> &::std::option::Option<::std::string::String> {
&self.amount
}
/// Consumes the builder and constructs a [`Price`](crate::types::Price).
/// This method will fail if any of the following fields are not set:
/// - [`currency_code`](crate::types::builders::PriceBuilder::currency_code)
/// - [`amount`](crate::types::builders::PriceBuilder::amount)
pub fn build(self) -> ::std::result::Result<crate::types::Price, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Price {
currency_code: self.currency_code.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"currency_code",
"currency_code was not specified but it is required when building Price",
)
})?,
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 Price",
)
})?,
})
}
}