Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-02-20 13:35:02.579691",
"spec_repo_commit": "c64543d0"
"regenerated": "2025-02-20 18:33:29.867322",
"spec_repo_commit": "d3fcdb89"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-02-20 13:35:02.595038",
"spec_repo_commit": "c64543d0"
"regenerated": "2025-02-20 18:33:29.882630",
"spec_repo_commit": "d3fcdb89"
}
}
}
38 changes: 35 additions & 3 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,33 @@ components:
xray_services:
$ref: '#/components/schemas/XRayServicesList'
type: object
AccountFilteringConfig:
description: The account filtering configuration.
properties:
excluded_accounts:
description: The AWS account IDs to be excluded from your billing dataset.
This field is used when `include_new_accounts` is `true`.
example:
- '123456789123'
- '123456789143'
items:
type: string
type: array
include_new_accounts:
description: Whether or not to automatically include new member accounts
by default in your billing dataset.
example: true
type: boolean
included_accounts:
description: The AWS account IDs to be included in your billing dataset.
This field is used when `include_new_accounts` is `false`.
example:
- '123456789123'
- '123456789143'
items:
type: string
type: array
type: object
ActionConnectionAttributes:
description: The definition of `ActionConnectionAttributes` object.
properties:
Expand Down Expand Up @@ -2870,6 +2897,8 @@ components:
AwsCURConfigAttributes:
description: Attributes for An AWS CUR config.
properties:
account_filters:
$ref: '#/components/schemas/AccountFilteringConfig'
account_id:
description: The AWS account ID.
example: '123456789123'
Expand Down Expand Up @@ -2947,12 +2976,12 @@ components:
AwsCURConfigPatchRequestAttributes:
description: Attributes for AWS CUR config Patch Request.
properties:
account_filters:
$ref: '#/components/schemas/AccountFilteringConfig'
is_enabled:
description: Whether or not the Cloud Cost Management account is enabled.
example: true
type: boolean
required:
- is_enabled
type: object
AwsCURConfigPatchRequestType:
default: aws_cur_config_patch_request
Expand Down Expand Up @@ -2985,6 +3014,8 @@ components:
AwsCURConfigPostRequestAttributes:
description: Attributes for AWS CUR config Post Request.
properties:
account_filters:
$ref: '#/components/schemas/AccountFilteringConfig'
account_id:
description: The AWS account ID.
example: '123456789123'
Expand Down Expand Up @@ -35630,7 +35661,8 @@ paths:
permissions:
- cloud_cost_management_write
patch:
description: Update the status of an AWS CUR config (active/archived).
description: Update the status (active/archived) and/or account filtering configuration
of an AWS CUR config.
operationId: UpdateCostAWSCURConfig
parameters:
- $ref: '#/components/parameters/CloudAccountID'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use datadog_api_client::datadogV2::model::AwsCURConfigPatchRequestType;
#[tokio::main]
async fn main() {
let body = AwsCURConfigPatchRequest::new(AwsCURConfigPatchData::new(
AwsCURConfigPatchRequestAttributes::new(true),
AwsCURConfigPatchRequestAttributes::new().is_enabled(true),
AwsCURConfigPatchRequestType::AWS_CUR_CONFIG_PATCH_REQUEST,
));
let configuration = datadog::Configuration::new();
Expand Down
4 changes: 2 additions & 2 deletions src/datadogV2/api/api_cloud_cost_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ impl CloudCostManagementAPI {
}
}

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

/// Update the status of an AWS CUR config (active/archived).
/// Update the status (active/archived) and/or account filtering configuration of an AWS CUR config.
pub async fn update_cost_awscur_config_with_http_info(
&self,
cloud_account_id: String,
Expand Down
2 changes: 2 additions & 0 deletions src/datadogV2/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,8 @@ pub mod model_aws_cur_config;
pub use self::model_aws_cur_config::AwsCURConfig;
pub mod model_aws_cur_config_attributes;
pub use self::model_aws_cur_config_attributes::AwsCURConfigAttributes;
pub mod model_account_filtering_config;
pub use self::model_account_filtering_config::AccountFilteringConfig;
pub mod model_aws_cur_config_type;
pub use self::model_aws_cur_config_type::AwsCURConfigType;
pub mod model_aws_cur_config_post_request;
Expand Down
142 changes: 142 additions & 0 deletions src/datadogV2/model/model_account_filtering_config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.
use serde::de::{Error, MapAccess, Visitor};
use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};

/// The account filtering configuration.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct AccountFilteringConfig {
/// The AWS account IDs to be excluded from your billing dataset. This field is used when `include_new_accounts` is `true`.
#[serde(rename = "excluded_accounts")]
pub excluded_accounts: Option<Vec<String>>,
/// Whether or not to automatically include new member accounts by default in your billing dataset.
#[serde(rename = "include_new_accounts")]
pub include_new_accounts: Option<bool>,
/// The AWS account IDs to be included in your billing dataset. This field is used when `include_new_accounts` is `false`.
#[serde(rename = "included_accounts")]
pub included_accounts: Option<Vec<String>>,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
}

impl AccountFilteringConfig {
pub fn new() -> AccountFilteringConfig {
AccountFilteringConfig {
excluded_accounts: None,
include_new_accounts: None,
included_accounts: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}

pub fn excluded_accounts(mut self, value: Vec<String>) -> Self {
self.excluded_accounts = Some(value);
self
}

pub fn include_new_accounts(mut self, value: bool) -> Self {
self.include_new_accounts = Some(value);
self
}

pub fn included_accounts(mut self, value: Vec<String>) -> Self {
self.included_accounts = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
) -> Self {
self.additional_properties = value;
self
}
}

impl Default for AccountFilteringConfig {
fn default() -> Self {
Self::new()
}
}

impl<'de> Deserialize<'de> for AccountFilteringConfig {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct AccountFilteringConfigVisitor;
impl<'a> Visitor<'a> for AccountFilteringConfigVisitor {
type Value = AccountFilteringConfig;

fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.write_str("a mapping")
}

fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
where
M: MapAccess<'a>,
{
let mut excluded_accounts: Option<Vec<String>> = None;
let mut include_new_accounts: Option<bool> = None;
let mut included_accounts: Option<Vec<String>> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
> = std::collections::BTreeMap::new();
let mut _unparsed = false;

while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
match k.as_str() {
"excluded_accounts" => {
if v.is_null() {
continue;
}
excluded_accounts =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"include_new_accounts" => {
if v.is_null() {
continue;
}
include_new_accounts =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"included_accounts" => {
if v.is_null() {
continue;
}
included_accounts =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
&_ => {
if let Ok(value) = serde_json::from_value(v.clone()) {
additional_properties.insert(k, value);
}
}
}
}

let content = AccountFilteringConfig {
excluded_accounts,
include_new_accounts,
included_accounts,
additional_properties,
_unparsed,
};

Ok(content)
}
}

deserializer.deserialize_any(AccountFilteringConfigVisitor)
}
}
23 changes: 23 additions & 0 deletions src/datadogV2/model/model_aws_cur_config_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use std::fmt::{self, Formatter};
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct AwsCURConfigAttributes {
/// The account filtering configuration.
#[serde(rename = "account_filters")]
pub account_filters: Option<crate::datadogV2::model::AccountFilteringConfig>,
/// The AWS account ID.
#[serde(rename = "account_id")]
pub account_id: String,
Expand Down Expand Up @@ -63,6 +66,7 @@ impl AwsCURConfigAttributes {
) -> AwsCURConfigAttributes {
#[allow(deprecated)]
AwsCURConfigAttributes {
account_filters: None,
account_id,
bucket_name,
bucket_region,
Expand All @@ -79,6 +83,15 @@ impl AwsCURConfigAttributes {
}
}

#[allow(deprecated)]
pub fn account_filters(
mut self,
value: crate::datadogV2::model::AccountFilteringConfig,
) -> Self {
self.account_filters = Some(value);
self
}

#[allow(deprecated)]
pub fn created_at(mut self, value: String) -> Self {
self.created_at = Some(value);
Expand Down Expand Up @@ -135,6 +148,8 @@ impl<'de> Deserialize<'de> for AwsCURConfigAttributes {
where
M: MapAccess<'a>,
{
let mut account_filters: Option<crate::datadogV2::model::AccountFilteringConfig> =
None;
let mut account_id: Option<String> = None;
let mut bucket_name: Option<String> = None;
let mut bucket_region: Option<String> = None;
Expand All @@ -154,6 +169,13 @@ impl<'de> Deserialize<'de> for AwsCURConfigAttributes {

while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
match k.as_str() {
"account_filters" => {
if v.is_null() {
continue;
}
account_filters =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"account_id" => {
account_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
Expand Down Expand Up @@ -228,6 +250,7 @@ impl<'de> Deserialize<'de> for AwsCURConfigAttributes {

#[allow(deprecated)]
let content = AwsCURConfigAttributes {
account_filters,
account_id,
bucket_name,
bucket_region,
Expand Down
Loading
Loading