Skip to content

Commit 489e047

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 88697ae of spec repo
1 parent 2dbb97e commit 489e047

11 files changed

Lines changed: 569 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18525,6 +18525,45 @@ components:
1852518525
x-enum-varnames:
1852618526
- "TRUE"
1852718527
- "FALSE"
18528+
CostTagMetadataMonth:
18529+
description: A month that has Cloud Cost Management tag metadata available for a given provider.
18530+
properties:
18531+
id:
18532+
description: The month, in `YYYY-MM` format.
18533+
example: "2026-04"
18534+
type: string
18535+
type:
18536+
$ref: "#/components/schemas/CostTagMetadataMonthType"
18537+
required:
18538+
- id
18539+
- type
18540+
type: object
18541+
CostTagMetadataMonthType:
18542+
default: cost_tag_metadata_month
18543+
description: Type of the Cloud Cost Management tag metadata month resource.
18544+
enum:
18545+
- cost_tag_metadata_month
18546+
example: cost_tag_metadata_month
18547+
type: string
18548+
x-enum-varnames:
18549+
- COST_TAG_METADATA_MONTH
18550+
CostTagMetadataMonthsResponse:
18551+
description: List of months that have Cloud Cost Management tag metadata for the requested provider, ordered most-recent first and capped at 36 months.
18552+
example:
18553+
data:
18554+
- id: "2026-04"
18555+
type: cost_tag_metadata_month
18556+
- id: "2026-03"
18557+
type: cost_tag_metadata_month
18558+
properties:
18559+
data:
18560+
description: List of months that have tag metadata available.
18561+
items:
18562+
$ref: "#/components/schemas/CostTagMetadataMonth"
18563+
type: array
18564+
required:
18565+
- data
18566+
type: object
1852818567
CostTagType:
1852918568
default: cost_tag
1853018569
description: Type of the Cloud Cost Management tag resource.
@@ -108886,6 +108925,68 @@ paths:
108886108925
x-unstable: |-
108887108926
**Note**: This endpoint is in preview and is subject to change.
108888108927
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
108928+
/api/v2/cost/tag_metadata/months:
108929+
get:
108930+
description: |-
108931+
List months that have Cloud Cost Management tag metadata for a given provider,
108932+
ordered most-recent first. The response is capped at 36 months.
108933+
operationId: ListCostTagMetadataMonths
108934+
parameters:
108935+
- description: |-
108936+
Provider to scope the query to. Use the value of the `providername` tag in CCM
108937+
(for example, `aws`, `azure`, `gcp`, `Oracle`, `Confluent Cloud`, `Snowflake`).
108938+
For costs uploaded through the Custom Costs API, use `custom`.
108939+
Values are case-sensitive.
108940+
example: aws
108941+
in: query
108942+
name: filter[provider]
108943+
required: true
108944+
schema:
108945+
type: string
108946+
responses:
108947+
"200":
108948+
content:
108949+
application/json:
108950+
examples:
108951+
default:
108952+
value:
108953+
data:
108954+
- id: "2026-04"
108955+
type: cost_tag_metadata_month
108956+
- id: "2026-03"
108957+
type: cost_tag_metadata_month
108958+
schema:
108959+
$ref: "#/components/schemas/CostTagMetadataMonthsResponse"
108960+
description: OK
108961+
"400":
108962+
content:
108963+
application/json:
108964+
schema:
108965+
$ref: "#/components/schemas/APIErrorResponse"
108966+
description: Bad Request
108967+
"403":
108968+
content:
108969+
application/json:
108970+
schema:
108971+
$ref: "#/components/schemas/APIErrorResponse"
108972+
description: Forbidden
108973+
"429":
108974+
$ref: "#/components/responses/TooManyRequestsResponse"
108975+
security:
108976+
- apiKeyAuth: []
108977+
appKeyAuth: []
108978+
- AuthZ:
108979+
- cloud_cost_management_read
108980+
summary: List Cloud Cost Management tag metadata months
108981+
tags:
108982+
- Cloud Cost Management
108983+
"x-permission":
108984+
operator: OR
108985+
permissions:
108986+
- cloud_cost_management_read
108987+
x-unstable: |-
108988+
**Note**: This endpoint is in preview and is subject to change.
108989+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
108889108990
/api/v2/cost/tag_metadata/orchestrators:
108890108991
get:
108891108992
description: List container orchestrators (for example, `kubernetes`, `ecs`) detected in Cloud Cost Management data for the requested period.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// List Cloud Cost Management tag metadata months returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let mut configuration = datadog::Configuration::new();
8+
configuration.set_unstable_operation_enabled("v2.ListCostTagMetadataMonths", true);
9+
let api = CloudCostManagementAPI::with_config(configuration);
10+
let resp = api
11+
.list_cost_tag_metadata_months("filter[provider]".to_string())
12+
.await;
13+
if let Ok(value) = resp {
14+
println!("{:#?}", value);
15+
} else {
16+
println!("{:#?}", resp.unwrap_err());
17+
}
18+
}

src/datadog/configuration.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ impl Default for Configuration {
370370
("v2.list_cost_tag_key_sources".to_owned(), false),
371371
("v2.list_cost_tag_metadata".to_owned(), false),
372372
("v2.list_cost_tag_metadata_metrics".to_owned(), false),
373+
("v2.list_cost_tag_metadata_months".to_owned(), false),
373374
("v2.list_cost_tag_metadata_orchestrators".to_owned(), false),
374375
("v2.search_cost_recommendations".to_owned(), false),
375376
("v2.create_dashboard_secure_embed".to_owned(), false),

src/datadogV2/api/api_cloud_cost_management.rs

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,14 @@ pub enum ListCostTagMetadataMetricsError {
875875
UnknownValue(serde_json::Value),
876876
}
877877

878+
/// ListCostTagMetadataMonthsError is a struct for typed errors of method [`CloudCostManagementAPI::list_cost_tag_metadata_months`]
879+
#[derive(Debug, Clone, Serialize, Deserialize)]
880+
#[serde(untagged)]
881+
pub enum ListCostTagMetadataMonthsError {
882+
APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
883+
UnknownValue(serde_json::Value),
884+
}
885+
878886
/// ListCostTagMetadataOrchestratorsError is a struct for typed errors of method [`CloudCostManagementAPI::list_cost_tag_metadata_orchestrators`]
879887
#[derive(Debug, Clone, Serialize, Deserialize)]
880888
#[serde(untagged)]
@@ -6163,6 +6171,130 @@ impl CloudCostManagementAPI {
61636171
}
61646172
}
61656173

6174+
/// List months that have Cloud Cost Management tag metadata for a given provider,
6175+
/// ordered most-recent first. The response is capped at 36 months.
6176+
pub async fn list_cost_tag_metadata_months(
6177+
&self,
6178+
filter_provider: String,
6179+
) -> Result<
6180+
crate::datadogV2::model::CostTagMetadataMonthsResponse,
6181+
datadog::Error<ListCostTagMetadataMonthsError>,
6182+
> {
6183+
match self
6184+
.list_cost_tag_metadata_months_with_http_info(filter_provider)
6185+
.await
6186+
{
6187+
Ok(response_content) => {
6188+
if let Some(e) = response_content.entity {
6189+
Ok(e)
6190+
} else {
6191+
Err(datadog::Error::Serde(serde::de::Error::custom(
6192+
"response content was None",
6193+
)))
6194+
}
6195+
}
6196+
Err(err) => Err(err),
6197+
}
6198+
}
6199+
6200+
/// List months that have Cloud Cost Management tag metadata for a given provider,
6201+
/// ordered most-recent first. The response is capped at 36 months.
6202+
pub async fn list_cost_tag_metadata_months_with_http_info(
6203+
&self,
6204+
filter_provider: String,
6205+
) -> Result<
6206+
datadog::ResponseContent<crate::datadogV2::model::CostTagMetadataMonthsResponse>,
6207+
datadog::Error<ListCostTagMetadataMonthsError>,
6208+
> {
6209+
let local_configuration = &self.config;
6210+
let operation_id = "v2.list_cost_tag_metadata_months";
6211+
if local_configuration.is_unstable_operation_enabled(operation_id) {
6212+
warn!("Using unstable operation {operation_id}");
6213+
} else {
6214+
let local_error = datadog::UnstableOperationDisabledError {
6215+
msg: "Operation 'v2.list_cost_tag_metadata_months' is not enabled".to_string(),
6216+
};
6217+
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
6218+
}
6219+
6220+
let local_client = &self.client;
6221+
6222+
let local_uri_str = format!(
6223+
"{}/api/v2/cost/tag_metadata/months",
6224+
local_configuration.get_operation_host(operation_id)
6225+
);
6226+
let mut local_req_builder =
6227+
local_client.request(reqwest::Method::GET, local_uri_str.as_str());
6228+
6229+
local_req_builder =
6230+
local_req_builder.query(&[("filter[provider]", &filter_provider.to_string())]);
6231+
6232+
// build headers
6233+
let mut headers = HeaderMap::new();
6234+
headers.insert("Accept", HeaderValue::from_static("application/json"));
6235+
6236+
// build user agent
6237+
match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
6238+
Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
6239+
Err(e) => {
6240+
log::warn!("Failed to parse user agent header: {e}, falling back to default");
6241+
headers.insert(
6242+
reqwest::header::USER_AGENT,
6243+
HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
6244+
)
6245+
}
6246+
};
6247+
6248+
// build auth
6249+
if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
6250+
headers.insert(
6251+
"DD-API-KEY",
6252+
HeaderValue::from_str(local_key.key.as_str())
6253+
.expect("failed to parse DD-API-KEY header"),
6254+
);
6255+
};
6256+
if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
6257+
headers.insert(
6258+
"DD-APPLICATION-KEY",
6259+
HeaderValue::from_str(local_key.key.as_str())
6260+
.expect("failed to parse DD-APPLICATION-KEY header"),
6261+
);
6262+
};
6263+
6264+
local_req_builder = local_req_builder.headers(headers);
6265+
let local_req = local_req_builder.build()?;
6266+
log::debug!("request content: {:?}", local_req.body());
6267+
let local_resp = local_client.execute(local_req).await?;
6268+
6269+
let local_status = local_resp.status();
6270+
let local_content = local_resp.text().await?;
6271+
log::debug!("response content: {}", local_content);
6272+
6273+
if !local_status.is_client_error() && !local_status.is_server_error() {
6274+
match serde_json::from_str::<crate::datadogV2::model::CostTagMetadataMonthsResponse>(
6275+
&local_content,
6276+
) {
6277+
Ok(e) => {
6278+
return Ok(datadog::ResponseContent {
6279+
status: local_status,
6280+
content: local_content,
6281+
entity: Some(e),
6282+
})
6283+
}
6284+
Err(e) => return Err(datadog::Error::Serde(e)),
6285+
};
6286+
} else {
6287+
let local_entity: Option<ListCostTagMetadataMonthsError> =
6288+
serde_json::from_str(&local_content).ok();
6289+
let local_error = datadog::ResponseContent {
6290+
status: local_status,
6291+
content: local_content,
6292+
entity: local_entity,
6293+
};
6294+
Err(datadog::Error::ResponseError(local_error))
6295+
}
6296+
}
6297+
61666298
/// List container orchestrators (for example, `kubernetes`, `ecs`) detected in Cloud Cost Management data for the requested period.
61676299
pub async fn list_cost_tag_metadata_orchestrators(
61686300
&self,

src/datadogV2/model/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,6 +2992,12 @@ pub mod model_cost_metric;
29922992
pub use self::model_cost_metric::CostMetric;
29932993
pub mod model_cost_metric_type;
29942994
pub use self::model_cost_metric_type::CostMetricType;
2995+
pub mod model_cost_tag_metadata_months_response;
2996+
pub use self::model_cost_tag_metadata_months_response::CostTagMetadataMonthsResponse;
2997+
pub mod model_cost_tag_metadata_month;
2998+
pub use self::model_cost_tag_metadata_month::CostTagMetadataMonth;
2999+
pub mod model_cost_tag_metadata_month_type;
3000+
pub use self::model_cost_tag_metadata_month_type::CostTagMetadataMonthType;
29953001
pub mod model_cost_orchestrators_response;
29963002
pub use self::model_cost_orchestrators_response::CostOrchestratorsResponse;
29973003
pub mod model_cost_orchestrator;

0 commit comments

Comments
 (0)