Skip to content

Commit ef6c954

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
add changes for datadog partner program to estimated cost and billable usage APIs (#155)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 6ba1bdb commit ef6c954

File tree

8 files changed

+138
-4
lines changed

8 files changed

+138
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
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-07-11 16:35:09.396752",
8-
"spec_repo_commit": "d83fe206"
7+
"regenerated": "2024-07-16 10:52:41.488047",
8+
"spec_repo_commit": "06d5775d"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-07-11 16:35:09.414475",
13-
"spec_repo_commit": "d83fe206"
12+
"regenerated": "2024-07-16 10:52:41.505656",
13+
"spec_repo_commit": "06d5775d"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17269,6 +17269,12 @@ components:
1726917269
UsageBillableSummaryHour:
1727017270
description: Response with monthly summary of data billed by Datadog.
1727117271
properties:
17272+
account_name:
17273+
description: The account name.
17274+
type: string
17275+
account_public_id:
17276+
description: The account public ID.
17277+
type: string
1727217278
billing_plan:
1727317279
description: The billing plan.
1727417280
type: string
@@ -31646,6 +31652,15 @@ paths:
3164631652
schema:
3164731653
format: date-time
3164831654
type: string
31655+
- description: 'Boolean to specify whether to include accounts connected to
31656+
the current account as partner customers in the Datadog partner network
31657+
program. Defaults to `false`. '
31658+
in: query
31659+
name: include_connected_accounts
31660+
required: false
31661+
schema:
31662+
default: false
31663+
type: boolean
3164931664
responses:
3165031665
'200':
3165131666
content:

.generator/schemas/v2/openapi.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5390,6 +5390,12 @@ components:
53905390
CostByOrgAttributes:
53915391
description: Cost attributes data.
53925392
properties:
5393+
account_name:
5394+
description: The account name.
5395+
type: string
5396+
account_public_id:
5397+
description: The account public ID.
5398+
type: string
53935399
charges:
53945400
description: List of charges data reported for the requested month.
53955401
items:
@@ -36185,6 +36191,15 @@ paths:
3618536191
schema:
3618636192
format: date-time
3618736193
type: string
36194+
- description: 'Boolean to specify whether to include accounts connected to
36195+
the current account as partner customers in the Datadog partner network
36196+
program. Defaults to `false`. '
36197+
in: query
36198+
name: include_connected_accounts
36199+
required: false
36200+
schema:
36201+
default: false
36202+
type: boolean
3618836203
responses:
3618936204
'200':
3619036205
content:

src/datadogV1/api/api_usage_metering.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ impl GetUsageAuditLogsOptionalParams {
258258
pub struct GetUsageBillableSummaryOptionalParams {
259259
/// Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage starting this month.
260260
pub month: Option<chrono::DateTime<chrono::Utc>>,
261+
/// Boolean to specify whether to include accounts connected to the current account as partner customers in the Datadog partner network program. Defaults to `false`.
262+
pub include_connected_accounts: Option<bool>,
261263
}
262264

263265
impl GetUsageBillableSummaryOptionalParams {
@@ -266,6 +268,11 @@ impl GetUsageBillableSummaryOptionalParams {
266268
self.month = Some(value);
267269
self
268270
}
271+
/// Boolean to specify whether to include accounts connected to the current account as partner customers in the Datadog partner network program. Defaults to `false`.
272+
pub fn include_connected_accounts(mut self, value: bool) -> Self {
273+
self.include_connected_accounts = Some(value);
274+
self
275+
}
269276
}
270277

271278
/// GetUsageCIAppOptionalParams is a struct for passing parameters to the method [`UsageMeteringAPI::get_usage_ci_app`]
@@ -2568,6 +2575,7 @@ impl UsageMeteringAPI {
25682575

25692576
// unbox and build optional parameters
25702577
let month = params.month;
2578+
let include_connected_accounts = params.include_connected_accounts;
25712579

25722580
let local_client = &self.client;
25732581

@@ -2584,6 +2592,10 @@ impl UsageMeteringAPI {
25842592
&local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
25852593
)]);
25862594
};
2595+
if let Some(ref local_query_param) = include_connected_accounts {
2596+
local_req_builder = local_req_builder
2597+
.query(&[("include_connected_accounts", &local_query_param.to_string())]);
2598+
};
25872599

25882600
// build headers
25892601
let mut headers = HeaderMap::new();

src/datadogV1/model/model_usage_billable_summary_hour.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct UsageBillableSummaryHour {
14+
/// The account name.
15+
#[serde(rename = "account_name")]
16+
pub account_name: Option<String>,
17+
/// The account public ID.
18+
#[serde(rename = "account_public_id")]
19+
pub account_public_id: Option<String>,
1420
/// The billing plan.
1521
#[serde(rename = "billing_plan")]
1622
pub billing_plan: Option<String>,
@@ -46,6 +52,8 @@ pub struct UsageBillableSummaryHour {
4652
impl UsageBillableSummaryHour {
4753
pub fn new() -> UsageBillableSummaryHour {
4854
UsageBillableSummaryHour {
55+
account_name: None,
56+
account_public_id: None,
4957
billing_plan: None,
5058
end_date: None,
5159
num_orgs: None,
@@ -59,6 +67,16 @@ impl UsageBillableSummaryHour {
5967
}
6068
}
6169

70+
pub fn account_name(mut self, value: String) -> Self {
71+
self.account_name = Some(value);
72+
self
73+
}
74+
75+
pub fn account_public_id(mut self, value: String) -> Self {
76+
self.account_public_id = Some(value);
77+
self
78+
}
79+
6280
pub fn billing_plan(mut self, value: String) -> Self {
6381
self.billing_plan = Some(value);
6482
self
@@ -128,6 +146,8 @@ impl<'de> Deserialize<'de> for UsageBillableSummaryHour {
128146
where
129147
M: MapAccess<'a>,
130148
{
149+
let mut account_name: Option<String> = None;
150+
let mut account_public_id: Option<String> = None;
131151
let mut billing_plan: Option<String> = None;
132152
let mut end_date: Option<chrono::DateTime<chrono::Utc>> = None;
133153
let mut num_orgs: Option<i64> = None;
@@ -141,6 +161,20 @@ impl<'de> Deserialize<'de> for UsageBillableSummaryHour {
141161

142162
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
143163
match k.as_str() {
164+
"account_name" => {
165+
if v.is_null() {
166+
continue;
167+
}
168+
account_name =
169+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
170+
}
171+
"account_public_id" => {
172+
if v.is_null() {
173+
continue;
174+
}
175+
account_public_id =
176+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
177+
}
144178
"billing_plan" => {
145179
if v.is_null() {
146180
continue;
@@ -202,6 +236,8 @@ impl<'de> Deserialize<'de> for UsageBillableSummaryHour {
202236
}
203237

204238
let content = UsageBillableSummaryHour {
239+
account_name,
240+
account_public_id,
205241
billing_plan,
206242
end_date,
207243
num_orgs,

src/datadogV2/api/api_usage_metering.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ pub struct GetEstimatedCostByOrgOptionalParams {
3636
pub start_date: Option<chrono::DateTime<chrono::Utc>>,
3737
/// Datetime in ISO-8601 format, UTC, precise to day: `[YYYY-MM-DD]` for cost ending this day.
3838
pub end_date: Option<chrono::DateTime<chrono::Utc>>,
39+
/// Boolean to specify whether to include accounts connected to the current account as partner customers in the Datadog partner network program. Defaults to `false`.
40+
pub include_connected_accounts: Option<bool>,
3941
}
4042

4143
impl GetEstimatedCostByOrgOptionalParams {
@@ -64,6 +66,11 @@ impl GetEstimatedCostByOrgOptionalParams {
6466
self.end_date = Some(value);
6567
self
6668
}
69+
/// Boolean to specify whether to include accounts connected to the current account as partner customers in the Datadog partner network program. Defaults to `false`.
70+
pub fn include_connected_accounts(mut self, value: bool) -> Self {
71+
self.include_connected_accounts = Some(value);
72+
self
73+
}
6774
}
6875

6976
/// GetHistoricalCostByOrgOptionalParams is a struct for passing parameters to the method [`UsageMeteringAPI::get_historical_cost_by_org`]
@@ -717,6 +724,7 @@ impl UsageMeteringAPI {
717724
let end_month = params.end_month;
718725
let start_date = params.start_date;
719726
let end_date = params.end_date;
727+
let include_connected_accounts = params.include_connected_accounts;
720728

721729
let local_client = &self.client;
722730

@@ -755,6 +763,10 @@ impl UsageMeteringAPI {
755763
&local_query_param.to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
756764
)]);
757765
};
766+
if let Some(ref local_query_param) = include_connected_accounts {
767+
local_req_builder = local_req_builder
768+
.query(&[("include_connected_accounts", &local_query_param.to_string())]);
769+
};
758770

759771
// build headers
760772
let mut headers = HeaderMap::new();

src/datadogV2/model/model_cost_by_org_attributes.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct CostByOrgAttributes {
14+
/// The account name.
15+
#[serde(rename = "account_name")]
16+
pub account_name: Option<String>,
17+
/// The account public ID.
18+
#[serde(rename = "account_public_id")]
19+
pub account_public_id: Option<String>,
1420
/// List of charges data reported for the requested month.
1521
#[serde(rename = "charges")]
1622
pub charges: Option<Vec<crate::datadogV2::model::ChargebackBreakdown>>,
@@ -37,6 +43,8 @@ pub struct CostByOrgAttributes {
3743
impl CostByOrgAttributes {
3844
pub fn new() -> CostByOrgAttributes {
3945
CostByOrgAttributes {
46+
account_name: None,
47+
account_public_id: None,
4048
charges: None,
4149
date: None,
4250
org_name: None,
@@ -47,6 +55,16 @@ impl CostByOrgAttributes {
4755
}
4856
}
4957

58+
pub fn account_name(mut self, value: String) -> Self {
59+
self.account_name = Some(value);
60+
self
61+
}
62+
63+
pub fn account_public_id(mut self, value: String) -> Self {
64+
self.account_public_id = Some(value);
65+
self
66+
}
67+
5068
pub fn charges(mut self, value: Vec<crate::datadogV2::model::ChargebackBreakdown>) -> Self {
5169
self.charges = Some(value);
5270
self
@@ -101,6 +119,8 @@ impl<'de> Deserialize<'de> for CostByOrgAttributes {
101119
where
102120
M: MapAccess<'a>,
103121
{
122+
let mut account_name: Option<String> = None;
123+
let mut account_public_id: Option<String> = None;
104124
let mut charges: Option<Vec<crate::datadogV2::model::ChargebackBreakdown>> = None;
105125
let mut date: Option<chrono::DateTime<chrono::Utc>> = None;
106126
let mut org_name: Option<String> = None;
@@ -111,6 +131,20 @@ impl<'de> Deserialize<'de> for CostByOrgAttributes {
111131

112132
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
113133
match k.as_str() {
134+
"account_name" => {
135+
if v.is_null() {
136+
continue;
137+
}
138+
account_name =
139+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
140+
}
141+
"account_public_id" => {
142+
if v.is_null() {
143+
continue;
144+
}
145+
account_public_id =
146+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
147+
}
114148
"charges" => {
115149
if v.is_null() {
116150
continue;
@@ -152,6 +186,8 @@ impl<'de> Deserialize<'de> for CostByOrgAttributes {
152186
}
153187

154188
let content = CostByOrgAttributes {
189+
account_name,
190+
account_public_id,
155191
charges,
156192
date,
157193
org_name,

tests/scenarios/function_mappings.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3408,9 +3408,13 @@ fn test_v1_get_usage_billable_summary(
34083408
let month = _parameters
34093409
.get("month")
34103410
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
3411+
let include_connected_accounts = _parameters
3412+
.get("include_connected_accounts")
3413+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
34113414
let mut params =
34123415
datadogV1::api_usage_metering::GetUsageBillableSummaryOptionalParams::default();
34133416
params.month = month;
3417+
params.include_connected_accounts = include_connected_accounts;
34143418
let response = match block_on(api.get_usage_billable_summary_with_http_info(params)) {
34153419
Ok(response) => response,
34163420
Err(error) => {
@@ -12738,12 +12742,16 @@ fn test_v2_get_estimated_cost_by_org(
1273812742
let end_date = _parameters
1273912743
.get("end_date")
1274012744
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
12745+
let include_connected_accounts = _parameters
12746+
.get("include_connected_accounts")
12747+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
1274112748
let mut params = datadogV2::api_usage_metering::GetEstimatedCostByOrgOptionalParams::default();
1274212749
params.view = view;
1274312750
params.start_month = start_month;
1274412751
params.end_month = end_month;
1274512752
params.start_date = start_date;
1274612753
params.end_date = end_date;
12754+
params.include_connected_accounts = include_connected_accounts;
1274712755
let response = match block_on(api.get_estimated_cost_by_org_with_http_info(params)) {
1274812756
Ok(response) => response,
1274912757
Err(error) => {

0 commit comments

Comments
 (0)