Skip to content

Commit d35cdc9

Browse files
authored
Merge branch 'master' into datadog-api-spec/generated/3594
2 parents 625bdb2 + 97f2b30 commit d35cdc9

File tree

9 files changed

+267
-11
lines changed

9 files changed

+267
-11
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,33 @@ components:
17151715
xray_services:
17161716
$ref: '#/components/schemas/XRayServicesList'
17171717
type: object
1718+
AccountFilteringConfig:
1719+
description: The account filtering configuration.
1720+
properties:
1721+
excluded_accounts:
1722+
description: The AWS account IDs to be excluded from your billing dataset.
1723+
This field is used when `include_new_accounts` is `true`.
1724+
example:
1725+
- '123456789123'
1726+
- '123456789143'
1727+
items:
1728+
type: string
1729+
type: array
1730+
include_new_accounts:
1731+
description: Whether or not to automatically include new member accounts
1732+
by default in your billing dataset.
1733+
example: true
1734+
type: boolean
1735+
included_accounts:
1736+
description: The AWS account IDs to be included in your billing dataset.
1737+
This field is used when `include_new_accounts` is `false`.
1738+
example:
1739+
- '123456789123'
1740+
- '123456789143'
1741+
items:
1742+
type: string
1743+
type: array
1744+
type: object
17181745
ActionConnectionAttributes:
17191746
description: The definition of `ActionConnectionAttributes` object.
17201747
properties:
@@ -2870,6 +2897,8 @@ components:
28702897
AwsCURConfigAttributes:
28712898
description: Attributes for An AWS CUR config.
28722899
properties:
2900+
account_filters:
2901+
$ref: '#/components/schemas/AccountFilteringConfig'
28732902
account_id:
28742903
description: The AWS account ID.
28752904
example: '123456789123'
@@ -2947,12 +2976,12 @@ components:
29472976
AwsCURConfigPatchRequestAttributes:
29482977
description: Attributes for AWS CUR config Patch Request.
29492978
properties:
2979+
account_filters:
2980+
$ref: '#/components/schemas/AccountFilteringConfig'
29502981
is_enabled:
29512982
description: Whether or not the Cloud Cost Management account is enabled.
29522983
example: true
29532984
type: boolean
2954-
required:
2955-
- is_enabled
29562985
type: object
29572986
AwsCURConfigPatchRequestType:
29582987
default: aws_cur_config_patch_request
@@ -2985,6 +3014,8 @@ components:
29853014
AwsCURConfigPostRequestAttributes:
29863015
description: Attributes for AWS CUR config Post Request.
29873016
properties:
3017+
account_filters:
3018+
$ref: '#/components/schemas/AccountFilteringConfig'
29883019
account_id:
29893020
description: The AWS account ID.
29903021
example: '123456789123'
@@ -35642,7 +35673,8 @@ paths:
3564235673
permissions:
3564335674
- cloud_cost_management_write
3564435675
patch:
35645-
description: Update the status of an AWS CUR config (active/archived).
35676+
description: Update the status (active/archived) and/or account filtering configuration
35677+
of an AWS CUR config.
3564635678
operationId: UpdateCostAWSCURConfig
3564735679
parameters:
3564835680
- $ref: '#/components/parameters/CloudAccountID'

examples/v2_cloud-cost-management_UpdateCostAWSCURConfig.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use datadog_api_client::datadogV2::model::AwsCURConfigPatchRequestType;
99
#[tokio::main]
1010
async fn main() {
1111
let body = AwsCURConfigPatchRequest::new(AwsCURConfigPatchData::new(
12-
AwsCURConfigPatchRequestAttributes::new(true),
12+
AwsCURConfigPatchRequestAttributes::new().is_enabled(true),
1313
AwsCURConfigPatchRequestType::AWS_CUR_CONFIG_PATCH_REQUEST,
1414
));
1515
let configuration = datadog::Configuration::new();

src/datadogV2/api/api_cloud_cost_management.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ impl CloudCostManagementAPI {
11761176
}
11771177
}
11781178

1179-
/// Update the status of an AWS CUR config (active/archived).
1179+
/// Update the status (active/archived) and/or account filtering configuration of an AWS CUR config.
11801180
pub async fn update_cost_awscur_config(
11811181
&self,
11821182
cloud_account_id: String,
@@ -1202,7 +1202,7 @@ impl CloudCostManagementAPI {
12021202
}
12031203
}
12041204

1205-
/// Update the status of an AWS CUR config (active/archived).
1205+
/// Update the status (active/archived) and/or account filtering configuration of an AWS CUR config.
12061206
pub async fn update_cost_awscur_config_with_http_info(
12071207
&self,
12081208
cloud_account_id: String,

src/datadogV2/model/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,8 @@ pub mod model_aws_cur_config;
966966
pub use self::model_aws_cur_config::AwsCURConfig;
967967
pub mod model_aws_cur_config_attributes;
968968
pub use self::model_aws_cur_config_attributes::AwsCURConfigAttributes;
969+
pub mod model_account_filtering_config;
970+
pub use self::model_account_filtering_config::AccountFilteringConfig;
969971
pub mod model_aws_cur_config_type;
970972
pub use self::model_aws_cur_config_type::AwsCURConfigType;
971973
pub mod model_aws_cur_config_post_request;
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
use serde::de::{Error, MapAccess, Visitor};
5+
use serde::{Deserialize, Deserializer, Serialize};
6+
use serde_with::skip_serializing_none;
7+
use std::fmt::{self, Formatter};
8+
9+
/// The account filtering configuration.
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct AccountFilteringConfig {
14+
/// The AWS account IDs to be excluded from your billing dataset. This field is used when `include_new_accounts` is `true`.
15+
#[serde(rename = "excluded_accounts")]
16+
pub excluded_accounts: Option<Vec<String>>,
17+
/// Whether or not to automatically include new member accounts by default in your billing dataset.
18+
#[serde(rename = "include_new_accounts")]
19+
pub include_new_accounts: Option<bool>,
20+
/// The AWS account IDs to be included in your billing dataset. This field is used when `include_new_accounts` is `false`.
21+
#[serde(rename = "included_accounts")]
22+
pub included_accounts: Option<Vec<String>>,
23+
#[serde(flatten)]
24+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
25+
#[serde(skip)]
26+
#[serde(default)]
27+
pub(crate) _unparsed: bool,
28+
}
29+
30+
impl AccountFilteringConfig {
31+
pub fn new() -> AccountFilteringConfig {
32+
AccountFilteringConfig {
33+
excluded_accounts: None,
34+
include_new_accounts: None,
35+
included_accounts: None,
36+
additional_properties: std::collections::BTreeMap::new(),
37+
_unparsed: false,
38+
}
39+
}
40+
41+
pub fn excluded_accounts(mut self, value: Vec<String>) -> Self {
42+
self.excluded_accounts = Some(value);
43+
self
44+
}
45+
46+
pub fn include_new_accounts(mut self, value: bool) -> Self {
47+
self.include_new_accounts = Some(value);
48+
self
49+
}
50+
51+
pub fn included_accounts(mut self, value: Vec<String>) -> Self {
52+
self.included_accounts = Some(value);
53+
self
54+
}
55+
56+
pub fn additional_properties(
57+
mut self,
58+
value: std::collections::BTreeMap<String, serde_json::Value>,
59+
) -> Self {
60+
self.additional_properties = value;
61+
self
62+
}
63+
}
64+
65+
impl Default for AccountFilteringConfig {
66+
fn default() -> Self {
67+
Self::new()
68+
}
69+
}
70+
71+
impl<'de> Deserialize<'de> for AccountFilteringConfig {
72+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
73+
where
74+
D: Deserializer<'de>,
75+
{
76+
struct AccountFilteringConfigVisitor;
77+
impl<'a> Visitor<'a> for AccountFilteringConfigVisitor {
78+
type Value = AccountFilteringConfig;
79+
80+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
81+
f.write_str("a mapping")
82+
}
83+
84+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
85+
where
86+
M: MapAccess<'a>,
87+
{
88+
let mut excluded_accounts: Option<Vec<String>> = None;
89+
let mut include_new_accounts: Option<bool> = None;
90+
let mut included_accounts: Option<Vec<String>> = None;
91+
let mut additional_properties: std::collections::BTreeMap<
92+
String,
93+
serde_json::Value,
94+
> = std::collections::BTreeMap::new();
95+
let mut _unparsed = false;
96+
97+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
98+
match k.as_str() {
99+
"excluded_accounts" => {
100+
if v.is_null() {
101+
continue;
102+
}
103+
excluded_accounts =
104+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
105+
}
106+
"include_new_accounts" => {
107+
if v.is_null() {
108+
continue;
109+
}
110+
include_new_accounts =
111+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
112+
}
113+
"included_accounts" => {
114+
if v.is_null() {
115+
continue;
116+
}
117+
included_accounts =
118+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
119+
}
120+
&_ => {
121+
if let Ok(value) = serde_json::from_value(v.clone()) {
122+
additional_properties.insert(k, value);
123+
}
124+
}
125+
}
126+
}
127+
128+
let content = AccountFilteringConfig {
129+
excluded_accounts,
130+
include_new_accounts,
131+
included_accounts,
132+
additional_properties,
133+
_unparsed,
134+
};
135+
136+
Ok(content)
137+
}
138+
}
139+
140+
deserializer.deserialize_any(AccountFilteringConfigVisitor)
141+
}
142+
}

src/datadogV2/model/model_aws_cur_config_attributes.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct AwsCURConfigAttributes {
14+
/// The account filtering configuration.
15+
#[serde(rename = "account_filters")]
16+
pub account_filters: Option<crate::datadogV2::model::AccountFilteringConfig>,
1417
/// The AWS account ID.
1518
#[serde(rename = "account_id")]
1619
pub account_id: String,
@@ -63,6 +66,7 @@ impl AwsCURConfigAttributes {
6366
) -> AwsCURConfigAttributes {
6467
#[allow(deprecated)]
6568
AwsCURConfigAttributes {
69+
account_filters: None,
6670
account_id,
6771
bucket_name,
6872
bucket_region,
@@ -79,6 +83,15 @@ impl AwsCURConfigAttributes {
7983
}
8084
}
8185

86+
#[allow(deprecated)]
87+
pub fn account_filters(
88+
mut self,
89+
value: crate::datadogV2::model::AccountFilteringConfig,
90+
) -> Self {
91+
self.account_filters = Some(value);
92+
self
93+
}
94+
8295
#[allow(deprecated)]
8396
pub fn created_at(mut self, value: String) -> Self {
8497
self.created_at = Some(value);
@@ -135,6 +148,8 @@ impl<'de> Deserialize<'de> for AwsCURConfigAttributes {
135148
where
136149
M: MapAccess<'a>,
137150
{
151+
let mut account_filters: Option<crate::datadogV2::model::AccountFilteringConfig> =
152+
None;
138153
let mut account_id: Option<String> = None;
139154
let mut bucket_name: Option<String> = None;
140155
let mut bucket_region: Option<String> = None;
@@ -154,6 +169,13 @@ impl<'de> Deserialize<'de> for AwsCURConfigAttributes {
154169

155170
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
156171
match k.as_str() {
172+
"account_filters" => {
173+
if v.is_null() {
174+
continue;
175+
}
176+
account_filters =
177+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
178+
}
157179
"account_id" => {
158180
account_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
159181
}
@@ -228,6 +250,7 @@ impl<'de> Deserialize<'de> for AwsCURConfigAttributes {
228250

229251
#[allow(deprecated)]
230252
let content = AwsCURConfigAttributes {
253+
account_filters,
231254
account_id,
232255
bucket_name,
233256
bucket_region,

0 commit comments

Comments
 (0)