Skip to content

Commit 5ccfafe

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit d9760384 of spec repo
1 parent e230bdf commit 5ccfafe

File tree

5 files changed

+29
-18
lines changed

5 files changed

+29
-18
lines changed

.apigentools-info

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-10-10 19:45:59.732627",
8-
"spec_repo_commit": "049920eb"
7+
"regenerated": "2024-10-15 10:12:34.384822",
8+
"spec_repo_commit": "d9760384"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-10 19:45:59.753615",
13-
"spec_repo_commit": "049920eb"
12+
"regenerated": "2024-10-15 10:12:34.402805",
13+
"spec_repo_commit": "d9760384"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28730,7 +28730,7 @@ paths:
2873028730
for cost ending this month.'
2873128731
in: query
2873228732
name: end_month
28733-
required: true
28733+
required: false
2873428734
schema:
2873528735
format: date-time
2873628736
type: string

examples/v2_usage-metering_GetMonthlyCostAttribution.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ async fn main() {
1414
DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00")
1515
.expect("Failed to parse datetime")
1616
.with_timezone(&Utc),
17-
DateTime::parse_from_rfc3339("2021-11-08T11:11:11+00:00")
18-
.expect("Failed to parse datetime")
19-
.with_timezone(&Utc),
2017
"infra_host_total_cost".to_string(),
21-
GetMonthlyCostAttributionOptionalParams::default(),
18+
GetMonthlyCostAttributionOptionalParams::default().end_month(
19+
DateTime::parse_from_rfc3339("2021-11-08T11:11:11+00:00")
20+
.expect("Failed to parse datetime")
21+
.with_timezone(&Utc),
22+
),
2223
)
2324
.await;
2425
if let Ok(value) = resp {

src/datadogV2/api/api_usage_metering.rs

+15-7
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ impl GetHourlyUsageOptionalParams {
169169
#[non_exhaustive]
170170
#[derive(Clone, Default, Debug)]
171171
pub struct GetMonthlyCostAttributionOptionalParams {
172+
/// Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost ending this month.
173+
pub end_month: Option<chrono::DateTime<chrono::Utc>>,
172174
/// The direction to sort by: `[desc, asc]`.
173175
pub sort_direction: Option<crate::datadogV2::model::SortDirection>,
174176
/// The billing dimension to sort by. Always sorted by total cost. Example: `infra_host`.
@@ -183,6 +185,11 @@ pub struct GetMonthlyCostAttributionOptionalParams {
183185
}
184186

185187
impl GetMonthlyCostAttributionOptionalParams {
188+
/// Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for cost ending this month.
189+
pub fn end_month(mut self, value: chrono::DateTime<chrono::Utc>) -> Self {
190+
self.end_month = Some(value);
191+
self
192+
}
186193
/// The direction to sort by: `[desc, asc]`.
187194
pub fn sort_direction(mut self, value: crate::datadogV2::model::SortDirection) -> Self {
188195
self.sort_direction = Some(value);
@@ -1193,15 +1200,14 @@ impl UsageMeteringAPI {
11931200
pub async fn get_monthly_cost_attribution(
11941201
&self,
11951202
start_month: chrono::DateTime<chrono::Utc>,
1196-
end_month: chrono::DateTime<chrono::Utc>,
11971203
fields: String,
11981204
params: GetMonthlyCostAttributionOptionalParams,
11991205
) -> Result<
12001206
crate::datadogV2::model::MonthlyCostAttributionResponse,
12011207
datadog::Error<GetMonthlyCostAttributionError>,
12021208
> {
12031209
match self
1204-
.get_monthly_cost_attribution_with_http_info(start_month, end_month, fields, params)
1210+
.get_monthly_cost_attribution_with_http_info(start_month, fields, params)
12051211
.await
12061212
{
12071213
Ok(response_content) => {
@@ -1236,7 +1242,6 @@ impl UsageMeteringAPI {
12361242
pub async fn get_monthly_cost_attribution_with_http_info(
12371243
&self,
12381244
start_month: chrono::DateTime<chrono::Utc>,
1239-
end_month: chrono::DateTime<chrono::Utc>,
12401245
fields: String,
12411246
params: GetMonthlyCostAttributionOptionalParams,
12421247
) -> Result<
@@ -1255,6 +1260,7 @@ impl UsageMeteringAPI {
12551260
}
12561261

12571262
// unbox and build optional parameters
1263+
let end_month = params.end_month;
12581264
let sort_direction = params.sort_direction;
12591265
let sort_name = params.sort_name;
12601266
let tag_breakdown_keys = params.tag_breakdown_keys;
@@ -1274,11 +1280,13 @@ impl UsageMeteringAPI {
12741280
"start_month",
12751281
&start_month.to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
12761282
)]);
1277-
local_req_builder = local_req_builder.query(&[(
1278-
"end_month",
1279-
&end_month.to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
1280-
)]);
12811283
local_req_builder = local_req_builder.query(&[("fields", &fields.to_string())]);
1284+
if let Some(ref local_query_param) = end_month {
1285+
local_req_builder = local_req_builder.query(&[(
1286+
"end_month",
1287+
&local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
1288+
)]);
1289+
};
12821290
if let Some(ref local_query_param) = sort_direction {
12831291
local_req_builder =
12841292
local_req_builder.query(&[("sort_direction", &local_query_param.to_string())]);

tests/scenarios/function_mappings.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -13151,8 +13151,10 @@ fn test_v2_get_monthly_cost_attribution(
1315113151
.expect("api instance not found");
1315213152
let start_month =
1315313153
serde_json::from_value(_parameters.get("start_month").unwrap().clone()).unwrap();
13154-
let end_month = serde_json::from_value(_parameters.get("end_month").unwrap().clone()).unwrap();
1315513154
let fields = serde_json::from_value(_parameters.get("fields").unwrap().clone()).unwrap();
13155+
let end_month = _parameters
13156+
.get("end_month")
13157+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
1315613158
let sort_direction = _parameters
1315713159
.get("sort_direction")
1315813160
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
@@ -13170,14 +13172,14 @@ fn test_v2_get_monthly_cost_attribution(
1317013172
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
1317113173
let mut params =
1317213174
datadogV2::api_usage_metering::GetMonthlyCostAttributionOptionalParams::default();
13175+
params.end_month = end_month;
1317313176
params.sort_direction = sort_direction;
1317413177
params.sort_name = sort_name;
1317513178
params.tag_breakdown_keys = tag_breakdown_keys;
1317613179
params.next_record_id = next_record_id;
1317713180
params.include_descendants = include_descendants;
1317813181
let response = match block_on(api.get_monthly_cost_attribution_with_http_info(
1317913182
start_month,
13180-
end_month,
1318113183
fields,
1318213184
params,
1318313185
)) {

0 commit comments

Comments
 (0)