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
708 changes: 177 additions & 531 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions examples/v2_cloud-cost-management_ListCostTagMetadataMonths.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// List Cloud Cost Management tag metadata months returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.ListCostTagMetadataMonths", true);
let api = CloudCostManagementAPI::with_config(configuration);
let resp = api
.list_cost_tag_metadata_months("filter[provider]".to_string())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
21 changes: 0 additions & 21 deletions examples/v2_oauth2-client-public_DeleteScopesRestriction.rs

This file was deleted.

21 changes: 0 additions & 21 deletions examples/v2_oauth2-client-public_GetScopesRestriction.rs

This file was deleted.

35 changes: 0 additions & 35 deletions examples/v2_oauth2-client-public_RegisterOAuthClient.rs

This file was deleted.

40 changes: 0 additions & 40 deletions examples/v2_oauth2-client-public_UpsertScopesRestriction.rs

This file was deleted.

5 changes: 1 addition & 4 deletions src/datadog/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ impl Default for Configuration {
("v2.list_cost_tag_key_sources".to_owned(), false),
("v2.list_cost_tag_metadata".to_owned(), false),
("v2.list_cost_tag_metadata_metrics".to_owned(), false),
("v2.list_cost_tag_metadata_months".to_owned(), false),
("v2.list_cost_tag_metadata_orchestrators".to_owned(), false),
("v2.search_cost_recommendations".to_owned(), false),
("v2.create_dashboard_secure_embed".to_owned(), false),
Expand Down Expand Up @@ -540,10 +541,6 @@ impl Default for Configuration {
false,
),
("v2.validate_monitor_user_template".to_owned(), false),
("v2.delete_scopes_restriction".to_owned(), false),
("v2.get_scopes_restriction".to_owned(), false),
("v2.register_o_auth_client".to_owned(), false),
("v2.upsert_scopes_restriction".to_owned(), false),
("v2.bulk_update_org_group_memberships".to_owned(), false),
("v2.create_org_group".to_owned(), false),
("v2.create_org_group_policy".to_owned(), false),
Expand Down
132 changes: 132 additions & 0 deletions src/datadogV2/api/api_cloud_cost_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,14 @@ pub enum ListCostTagMetadataMetricsError {
UnknownValue(serde_json::Value),
}

/// ListCostTagMetadataMonthsError is a struct for typed errors of method [`CloudCostManagementAPI::list_cost_tag_metadata_months`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListCostTagMetadataMonthsError {
APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
UnknownValue(serde_json::Value),
}

/// ListCostTagMetadataOrchestratorsError is a struct for typed errors of method [`CloudCostManagementAPI::list_cost_tag_metadata_orchestrators`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -6163,6 +6171,130 @@ impl CloudCostManagementAPI {
}
}

/// List months that have Cloud Cost Management tag metadata for a given provider,
/// ordered most-recent first. The response is capped at 36 months.
pub async fn list_cost_tag_metadata_months(
&self,
filter_provider: String,
) -> Result<
crate::datadogV2::model::CostTagMetadataMonthsResponse,
datadog::Error<ListCostTagMetadataMonthsError>,
> {
match self
.list_cost_tag_metadata_months_with_http_info(filter_provider)
.await
{
Ok(response_content) => {
if let Some(e) = response_content.entity {
Ok(e)
} else {
Err(datadog::Error::Serde(serde::de::Error::custom(
"response content was None",
)))
}
}
Err(err) => Err(err),
}
}

/// List months that have Cloud Cost Management tag metadata for a given provider,
/// ordered most-recent first. The response is capped at 36 months.
pub async fn list_cost_tag_metadata_months_with_http_info(
&self,
filter_provider: String,
) -> Result<
datadog::ResponseContent<crate::datadogV2::model::CostTagMetadataMonthsResponse>,
datadog::Error<ListCostTagMetadataMonthsError>,
> {
let local_configuration = &self.config;
let operation_id = "v2.list_cost_tag_metadata_months";
if local_configuration.is_unstable_operation_enabled(operation_id) {
warn!("Using unstable operation {operation_id}");
} else {
let local_error = datadog::UnstableOperationDisabledError {
msg: "Operation 'v2.list_cost_tag_metadata_months' is not enabled".to_string(),
};
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
}

let local_client = &self.client;

let local_uri_str = format!(
"{}/api/v2/cost/tag_metadata/months",
local_configuration.get_operation_host(operation_id)
);
let mut local_req_builder =
local_client.request(reqwest::Method::GET, local_uri_str.as_str());

local_req_builder =
local_req_builder.query(&[("filter[provider]", &filter_provider.to_string())]);

// build headers
let mut headers = HeaderMap::new();
headers.insert("Accept", HeaderValue::from_static("application/json"));

// build user agent
match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
Err(e) => {
log::warn!("Failed to parse user agent header: {e}, falling back to default");
headers.insert(
reqwest::header::USER_AGENT,
HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
)
}
};

// build auth
if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
headers.insert(
"DD-API-KEY",
HeaderValue::from_str(local_key.key.as_str())
.expect("failed to parse DD-API-KEY header"),
);
};
if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
headers.insert(
"DD-APPLICATION-KEY",
HeaderValue::from_str(local_key.key.as_str())
.expect("failed to parse DD-APPLICATION-KEY header"),
);
};

local_req_builder = local_req_builder.headers(headers);
let local_req = local_req_builder.build()?;
log::debug!("request content: {:?}", local_req.body());
let local_resp = local_client.execute(local_req).await?;

let local_status = local_resp.status();
let local_content = local_resp.text().await?;
log::debug!("response content: {}", local_content);

if !local_status.is_client_error() && !local_status.is_server_error() {
match serde_json::from_str::<crate::datadogV2::model::CostTagMetadataMonthsResponse>(
&local_content,
) {
Ok(e) => {
return Ok(datadog::ResponseContent {
status: local_status,
content: local_content,
entity: Some(e),
})
}
Err(e) => return Err(datadog::Error::Serde(e)),
};
} else {
let local_entity: Option<ListCostTagMetadataMonthsError> =
serde_json::from_str(&local_content).ok();
let local_error = datadog::ResponseContent {
status: local_status,
content: local_content,
entity: local_entity,
};
Err(datadog::Error::ResponseError(local_error))
}
}

/// List container orchestrators (for example, `kubernetes`, `ecs`) detected in Cloud Cost Management data for the requested period.
pub async fn list_cost_tag_metadata_orchestrators(
&self,
Expand Down
Loading
Loading