Skip to content
Open
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
550 changes: 32 additions & 518 deletions .generator/schemas/v1/openapi.yaml

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69185,6 +69185,42 @@ components:
usage_type:
$ref: '#/components/schemas/HourlyUsageType'
type: object
UsageAttributionTypesAttributes:
description: List of usage attribution types.
properties:
values:
description: List of usage attribution types.
items:
description: A given usage type in a list.
example: infra_host
type: string
type: array
type: object
UsageAttributionTypesBody:
description: Usage attribution types data.
properties:
attributes:
$ref: '#/components/schemas/UsageAttributionTypesAttributes'
id:
description: Unique ID of the response.
type: string
type:
$ref: '#/components/schemas/UsageAttributionTypesType'
type: object
UsageAttributionTypesResponse:
description: Usage attribution types response.
properties:
data:
$ref: '#/components/schemas/UsageAttributionTypesBody'
type: object
UsageAttributionTypesType:
default: usage_attribution_types
description: Type of usage attribution types data.
enum:
- usage_attribution_types
type: string
x-enum-varnames:
- USAGE_ATTRIBUTION_TYPES
UsageDataObject:
description: Usage data.
properties:
Expand Down Expand Up @@ -107057,6 +107093,41 @@ paths:
permissions:
- usage_read
- billing_read
/api/v2/usage/usage-attribution-types:
get:
description: Get usage attribution types.
operationId: GetUsageAttributionTypes
responses:
'200':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/UsageAttributionTypesResponse'
description: OK
'403':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden - User is not authorized
'429':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Too many requests
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- usage_read
summary: Get usage attribution types
tags:
- Usage Metering
x-permission:
operator: OR
permissions:
- usage_read
/api/v2/user_invitations:
post:
description: Sends emails to one or more users inviting them to join the organization.
Expand Down
3 changes: 1 addition & 2 deletions examples/v1_usage-metering_GetHourlyUsageAttribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use chrono::{DateTime, Utc};
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_usage_metering::GetHourlyUsageAttributionOptionalParams;
use datadog_api_client::datadogV1::api_usage_metering::UsageMeteringAPI;
use datadog_api_client::datadogV1::model::HourlyUsageAttributionUsageType;

#[tokio::main]
async fn main() {
Expand All @@ -14,7 +13,7 @@ async fn main() {
DateTime::parse_from_rfc3339("2021-11-08T11:11:11+00:00")
.expect("Failed to parse datetime")
.with_timezone(&Utc),
HourlyUsageAttributionUsageType::INFRA_HOST_USAGE,
"infra_host_usage".to_string(),
GetHourlyUsageAttributionOptionalParams::default(),
)
.await;
Expand Down
3 changes: 1 addition & 2 deletions examples/v1_usage-metering_GetMonthlyUsageAttribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use chrono::{DateTime, Utc};
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_usage_metering::GetMonthlyUsageAttributionOptionalParams;
use datadog_api_client::datadogV1::api_usage_metering::UsageMeteringAPI;
use datadog_api_client::datadogV1::model::MonthlyUsageAttributionSupportedMetrics;

#[tokio::main]
async fn main() {
Expand All @@ -14,7 +13,7 @@ async fn main() {
DateTime::parse_from_rfc3339("2021-11-08T11:11:11+00:00")
.expect("Failed to parse datetime")
.with_timezone(&Utc),
MonthlyUsageAttributionSupportedMetrics::INFRA_HOST_USAGE,
"infra_host_usage".to_string(),
GetMonthlyUsageAttributionOptionalParams::default(),
)
.await;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use chrono::{DateTime, Utc};
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_usage_metering::GetMonthlyUsageAttributionOptionalParams;
use datadog_api_client::datadogV1::api_usage_metering::UsageMeteringAPI;
use datadog_api_client::datadogV1::model::MonthlyUsageAttributionSupportedMetrics;

#[tokio::main]
async fn main() {
Expand All @@ -17,7 +16,7 @@ async fn main() {
DateTime::parse_from_rfc3339("2021-11-08T11:11:11+00:00")
.expect("Failed to parse datetime")
.with_timezone(&Utc),
MonthlyUsageAttributionSupportedMetrics::INFRA_HOST_USAGE,
"infra_host_usage".to_string(),
GetMonthlyUsageAttributionOptionalParams::default().next_record_id(
monthly_usage_attribution_metadata_pagination_next_record_id.clone(),
),
Expand Down
15 changes: 15 additions & 0 deletions examples/v2_usage-metering_GetUsageAttributionTypes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Get usage attribution types returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_usage_metering::UsageMeteringAPI;

#[tokio::main]
async fn main() {
let configuration = datadog::Configuration::new();
let api = UsageMeteringAPI::with_config(configuration);
let resp = api.get_usage_attribution_types().await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
33 changes: 14 additions & 19 deletions src/datadogV1/api/api_usage_metering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ pub struct GetMonthlyUsageAttributionOptionalParams {
pub end_month: Option<chrono::DateTime<chrono::Utc>>,
/// The direction to sort by: `[desc, asc]`.
pub sort_direction: Option<crate::datadogV1::model::UsageSortDirection>,
/// The field to sort by.
/// The following values have been **deprecated**:
/// `estimated_indexed_spans_usage`, `estimated_indexed_spans_percentage`, `estimated_ingested_spans_usage`, `estimated_ingested_spans_percentage`.
pub sort_name: Option<crate::datadogV1::model::MonthlyUsageAttributionSupportedMetrics>,
/// The field to sort by. Sort fields are in the format `<usage_type>_usage`.
/// Example: `infra_host_usage`
/// To obtain the complete list of usage attribution types that can be used to replace
/// `<usage_type>` in the field names, make a request to the [Get usage attribution types API](<https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-attribution-types>).
pub sort_name: Option<String>,
/// Comma separated list of tag keys used to group usage. If no value is provided the usage will not be broken down by tags.
///
/// To see which tags are available, look for the value of `tag_config_source` in the API response.
Expand All @@ -191,13 +192,11 @@ impl GetMonthlyUsageAttributionOptionalParams {
self.sort_direction = Some(value);
self
}
/// The field to sort by.
/// The following values have been **deprecated**:
/// `estimated_indexed_spans_usage`, `estimated_indexed_spans_percentage`, `estimated_ingested_spans_usage`, `estimated_ingested_spans_percentage`.
pub fn sort_name(
mut self,
value: crate::datadogV1::model::MonthlyUsageAttributionSupportedMetrics,
) -> Self {
/// The field to sort by. Sort fields are in the format `<usage_type>_usage`.
/// Example: `infra_host_usage`
/// To obtain the complete list of usage attribution types that can be used to replace
/// `<usage_type>` in the field names, make a request to the [Get usage attribution types API](<https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-attribution-types>).
pub fn sort_name(mut self, value: String) -> Self {
self.sort_name = Some(value);
self
}
Expand Down Expand Up @@ -1296,12 +1295,10 @@ impl UsageMeteringAPI {
/// cursor := response.metadata.pagination.next_record_id
/// END
/// ```
/// The following values have been **deprecated**:
/// `estimated_indexed_spans_usage`, `estimated_indexed_spans_percentage`, `estimated_ingested_spans_usage`, `estimated_ingested_spans_percentage`, `llm_observability_usage`, `llm_observability_percentage`.
pub async fn get_hourly_usage_attribution(
&self,
start_hr: chrono::DateTime<chrono::Utc>,
usage_type: crate::datadogV1::model::HourlyUsageAttributionUsageType,
usage_type: String,
params: GetHourlyUsageAttributionOptionalParams,
) -> Result<
crate::datadogV1::model::HourlyUsageAttributionResponse,
Expand Down Expand Up @@ -1339,12 +1336,10 @@ impl UsageMeteringAPI {
/// cursor := response.metadata.pagination.next_record_id
/// END
/// ```
/// The following values have been **deprecated**:
/// `estimated_indexed_spans_usage`, `estimated_indexed_spans_percentage`, `estimated_ingested_spans_usage`, `estimated_ingested_spans_percentage`, `llm_observability_usage`, `llm_observability_percentage`.
pub async fn get_hourly_usage_attribution_with_http_info(
&self,
start_hr: chrono::DateTime<chrono::Utc>,
usage_type: crate::datadogV1::model::HourlyUsageAttributionUsageType,
usage_type: String,
params: GetHourlyUsageAttributionOptionalParams,
) -> Result<
datadog::ResponseContent<crate::datadogV1::model::HourlyUsageAttributionResponse>,
Expand Down Expand Up @@ -1881,7 +1876,7 @@ impl UsageMeteringAPI {
pub async fn get_monthly_usage_attribution(
&self,
start_month: chrono::DateTime<chrono::Utc>,
fields: crate::datadogV1::model::MonthlyUsageAttributionSupportedMetrics,
fields: String,
params: GetMonthlyUsageAttributionOptionalParams,
) -> Result<
crate::datadogV1::model::MonthlyUsageAttributionResponse,
Expand Down Expand Up @@ -1922,7 +1917,7 @@ impl UsageMeteringAPI {
pub async fn get_monthly_usage_attribution_with_http_info(
&self,
start_month: chrono::DateTime<chrono::Utc>,
fields: crate::datadogV1::model::MonthlyUsageAttributionSupportedMetrics,
fields: String,
params: GetMonthlyUsageAttributionOptionalParams,
) -> Result<
datadog::ResponseContent<crate::datadogV1::model::MonthlyUsageAttributionResponse>,
Expand Down
4 changes: 0 additions & 4 deletions src/datadogV1/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1808,8 +1808,6 @@ pub mod model_usage_hosts_response;
pub use self::model_usage_hosts_response::UsageHostsResponse;
pub mod model_usage_host_hour;
pub use self::model_usage_host_hour::UsageHostHour;
pub mod model_hourly_usage_attribution_usage_type;
pub use self::model_hourly_usage_attribution_usage_type::HourlyUsageAttributionUsageType;
pub mod model_hourly_usage_attribution_response;
pub use self::model_hourly_usage_attribution_response::HourlyUsageAttributionResponse;
pub mod model_hourly_usage_attribution_metadata;
Expand Down Expand Up @@ -1846,8 +1844,6 @@ pub mod model_usage_logs_by_index_response;
pub use self::model_usage_logs_by_index_response::UsageLogsByIndexResponse;
pub mod model_usage_logs_by_index_hour;
pub use self::model_usage_logs_by_index_hour::UsageLogsByIndexHour;
pub mod model_monthly_usage_attribution_supported_metrics;
pub use self::model_monthly_usage_attribution_supported_metrics::MonthlyUsageAttributionSupportedMetrics;
pub mod model_monthly_usage_attribution_response;
pub use self::model_monthly_usage_attribution_response::MonthlyUsageAttributionResponse;
pub mod model_monthly_usage_attribution_metadata;
Expand Down
21 changes: 4 additions & 17 deletions src/datadogV1/model/model_hourly_usage_attribution_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ pub struct HourlyUsageAttributionBody {
#[serde(rename = "updated_at")]
pub updated_at: Option<String>,
/// Supported products for hourly usage attribution requests.
/// The following values have been **deprecated**: `estimated_indexed_spans_usage`, `estimated_ingested_spans_usage`.
/// To obtain the complete list of valid usage types, make a request to the [Get usage attribution types API](<https://docs.datadoghq.com/api/latest/usage-metering/#get-usage-attribution-types>).
#[serde(rename = "usage_type")]
pub usage_type: Option<crate::datadogV1::model::HourlyUsageAttributionUsageType>,
pub usage_type: Option<String>,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
Expand Down Expand Up @@ -107,10 +107,7 @@ impl HourlyUsageAttributionBody {
self
}

pub fn usage_type(
mut self,
value: crate::datadogV1::model::HourlyUsageAttributionUsageType,
) -> Self {
pub fn usage_type(mut self, value: String) -> Self {
self.usage_type = Some(value);
self
}
Expand Down Expand Up @@ -156,9 +153,7 @@ impl<'de> Deserialize<'de> for HourlyUsageAttributionBody {
None;
let mut total_usage_sum: Option<f64> = None;
let mut updated_at: Option<String> = None;
let mut usage_type: Option<
crate::datadogV1::model::HourlyUsageAttributionUsageType,
> = None;
let mut usage_type: Option<String> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
Expand Down Expand Up @@ -219,14 +214,6 @@ impl<'de> Deserialize<'de> for HourlyUsageAttributionBody {
continue;
}
usage_type = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
if let Some(ref _usage_type) = usage_type {
match _usage_type {
crate::datadogV1::model::HourlyUsageAttributionUsageType::UnparsedObject(_usage_type) => {
_unparsed = true;
},
_ => {}
}
}
}
&_ => {
if let Ok(value) = serde_json::from_value(v.clone()) {
Expand Down
Loading