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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
//! Types for the AWS Cost Explorer API (v1).
//!
//! Auto-generated from the AWS Botocore Model.
//! **Do not edit manually** — modify the manifest and re-run codegen.
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
/// The time period of the request.
///
/// **AWS API**: `ce.v1.DateInterval`
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct DateInterval {
/// The beginning of the time period. The start date is inclusive. For example, if start is
/// 2017-01-01, Amazon Web Services retrieves cost and usage data starting at 2017-01-01 up
/// to the end date. The start date must be equal to or no later than the current date to
/// avoid a validation error.
pub start: String,
/// The end of the time period. The end date is exclusive. For example, if end is
/// 2017-05-01, Amazon Web Services retrieves cost and usage data from the start date up to,
/// but not including, 2017-05-01.
pub end: String,
}
impl DateInterval {
#[cfg(any(test, feature = "test-support"))]
/// Create a fixture instance for testing.
pub fn fixture() -> Self {
Self {
start: "test-start".into(),
end: "test-end".into(),
}
}
}
/// Represents a group when you specify a group by criteria or in the response to a query with a
/// specific grouping.
///
/// **AWS API**: `ce.v1.GroupDefinition`
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct GroupDefinition {
/// The string that represents the type of group.
#[serde(rename = "Type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub r#type: Option<String>,
/// The string that represents a key for a specified group.
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
}
impl GroupDefinition {
#[cfg(any(test, feature = "test-support"))]
/// Create a fixture instance for testing.
pub fn fixture() -> Self {
Self {
r#type: Some("test-type".into()),
key: Some("test-key".into()),
}
}
}
/// The aggregated value for a metric.
///
/// **AWS API**: `ce.v1.MetricValue`
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MetricValue {
/// The actual number that represents the metric.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<String>,
/// The unit that the metric is given in.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit: Option<String>,
}
impl MetricValue {
#[cfg(any(test, feature = "test-support"))]
/// Create a fixture instance for testing.
pub fn fixture() -> Self {
Self {
amount: Some("test-amount".into()),
unit: Some("test-unit".into()),
}
}
}
/// One level of grouped data in the results.
///
/// **AWS API**: `ce.v1.Group`
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Group {
/// The keys that are included in this group.
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub keys: Vec<String>,
/// The metrics that are included in this group.
#[serde(default)]
#[serde(skip_serializing_if = "HashMap::is_empty")]
pub metrics: std::collections::HashMap<String, MetricValue>,
}
impl Group {
#[cfg(any(test, feature = "test-support"))]
/// Create a fixture instance for testing.
pub fn fixture() -> Self {
Self {
keys: vec![],
..Default::default()
}
}
}
/// The result that's associated with a time period.
///
/// **AWS API**: `ce.v1.ResultByTime`
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ResultByTime {
/// The time period that the result covers.
#[serde(skip_serializing_if = "Option::is_none")]
pub time_period: Option<DateInterval>,
/// The total amount of cost or usage accrued during the time period.
#[serde(default)]
#[serde(skip_serializing_if = "HashMap::is_empty")]
pub total: std::collections::HashMap<String, MetricValue>,
/// The groups that this time period includes.
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub groups: Vec<Group>,
/// Determines whether the result is estimated.
#[serde(skip_serializing_if = "Option::is_none")]
pub estimated: Option<bool>,
}
impl ResultByTime {
#[cfg(any(test, feature = "test-support"))]
/// Create a fixture instance for testing.
pub fn fixture() -> Self {
Self {
time_period: Some(DateInterval::fixture()),
groups: vec![],
estimated: Some(false),
..Default::default()
}
}
}
///
/// **AWS API**: `ce.v1.GetCostAndUsageRequest`
///
/// ## Coverage
/// 5 of 7 fields included.
/// Omitted fields:
/// - `Filter` — not selected in manifest
/// - `BillingViewArn` — not selected in manifest
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct GetCostAndUsageRequest {
/// Sets the start date and end date for retrieving Amazon Web Services costs. The start
/// date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01
/// and end is 2017-05-01, then the cost and usage data is retrieved from 2017-01-01 up to
/// and including 2017-04-30 but not including 2017-05-01.
pub time_period: DateInterval,
/// Sets the Amazon Web Services cost granularity to MONTHLY or DAILY, or HOURLY. If
/// Granularity isn't set, the response object doesn't include the Granularity, either
/// MONTHLY or DAILY, or HOURLY.
pub granularity: String,
/// Which metrics are returned in the query. For more information about blended and
/// unblended rates, see Why does the "blended" annotation appear on some line items in my
/// bill?. Valid values are AmortizedCost, BlendedCost, NetAmortizedCost, NetUnblendedCost,
/// NormalizedUsageAmount, UnblendedCost, and UsageQuantity. If you return the UsageQuantity
/// metric, the service aggregates all usage numbers without taking into account the units.
/// For example, if you aggregate usageQuantity across all of Amazon EC2, the results aren't
/// meaningful because Amazon EC2 compute hours and data transfer are measured in different
/// units (for example, hours and GB). To get more meaningful UsageQuantity metrics, filter
/// by UsageType or UsageTypeGroups. Metrics is required for GetCostAndUsage requests.
#[serde(default)]
pub metrics: Vec<String>,
/// You can group Amazon Web Services costs using up to two different groups, either
/// dimensions, tag keys, cost categories, or any two group by types. Valid values for the
/// DIMENSION type are AZ, INSTANCE_TYPE, LEGAL_ENTITY_NAME, INVOICING_ENTITY,
/// LINKED_ACCOUNT, OPERATION, PLATFORM, PURCHASE_TYPE, SERVICE, TENANCY, RECORD_TYPE, and
/// USAGE_TYPE. When you group by the TAG type and include a valid tag key, you get all tag
/// values, including empty strings.
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub group_by: Vec<GroupDefinition>,
/// The token to retrieve the next set of results. Amazon Web Services provides the token
/// when the response from a previous call has more results than the maximum page size.
#[serde(skip_serializing_if = "Option::is_none")]
pub next_page_token: Option<String>,
}
impl GetCostAndUsageRequest {
#[cfg(any(test, feature = "test-support"))]
/// Create a fixture instance for testing.
pub fn fixture() -> Self {
Self {
time_period: DateInterval::fixture(),
granularity: "test-granularity".into(),
metrics: vec![],
group_by: vec![],
next_page_token: Some("test-next_page_token".into()),
}
}
}
///
/// **AWS API**: `ce.v1.GetCostAndUsageResponse`
///
/// ## Coverage
/// 3 of 4 fields included.
/// Omitted fields:
/// - `DimensionValueAttributes` — not selected in manifest
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct GetCostAndUsageResponse {
/// The token for the next set of retrievable results. Amazon Web Services provides the
/// token when the response from a previous call has more results than the maximum page
/// size.
#[serde(skip_serializing_if = "Option::is_none")]
pub next_page_token: Option<String>,
/// The groups that are specified by the Filter or GroupBy parameters in the request.
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub group_definitions: Vec<GroupDefinition>,
/// The time period that's covered by the results in the response.
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub results_by_time: Vec<ResultByTime>,
}
impl GetCostAndUsageResponse {
#[cfg(any(test, feature = "test-support"))]
/// Create a fixture instance for testing.
pub fn fixture() -> Self {
Self {
next_page_token: Some("test-next_page_token".into()),
group_definitions: vec![],
results_by_time: vec![],
}
}
}