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
59 changes: 58 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38523,6 +38523,8 @@ components:
properties:
id:
$ref: '#/components/schemas/MetricName'
relationships:
$ref: '#/components/schemas/MetricRelationships'
type:
$ref: '#/components/schemas/MetricType'
type: object
Expand Down Expand Up @@ -39298,6 +39300,12 @@ components:
format: double
type: number
type: object
MetricRelationships:
description: Relationships to related metric objects.
properties:
metric_volumes:
$ref: '#/components/schemas/MetricVolumesRelationship'
type: object
MetricResource:
description: Metric resource.
example:
Expand Down Expand Up @@ -39741,6 +39749,33 @@ components:
oneOf:
- $ref: '#/components/schemas/MetricDistinctVolume'
- $ref: '#/components/schemas/MetricIngestedIndexedVolume'
MetricVolumesInclude:
description: Comma-separated list of additional data to include in the response.
Allowed values are `metric_volumes`.
enum:
- metric_volumes
- generated_metric_attributes
type: string
x-enum-varnames:
- METRIC_VOLUMES
- GENERATED_METRIC_ATTRIBUTES
MetricVolumesRelationship:
description: Relationship to a metric's ingested and indexed volumes.
properties:
data:
$ref: '#/components/schemas/MetricVolumesRelationshipData'
type: object
MetricVolumesRelationshipData:
description: Relationship data for a metric's ingested and indexed volumes.
properties:
id:
$ref: '#/components/schemas/MetricName'
type:
$ref: '#/components/schemas/MetricIngestedIndexedVolumeType'
required:
- type
- id
type: object
MetricVolumesResponse:
description: Response object which includes a single metric's volume.
properties:
Expand Down Expand Up @@ -39787,6 +39822,12 @@ components:
items:
$ref: '#/components/schemas/MetricsAndMetricTagConfigurations'
type: array
included:
description: Array of included metric volume objects. Only present when
`include=metric_volumes` is requested.
items:
$ref: '#/components/schemas/MetricIngestedIndexedVolume'
type: array
links:
$ref: '#/components/schemas/MetricsListResponseLinks'
meta:
Expand Down Expand Up @@ -91450,7 +91491,13 @@ paths:
`next_cursor` value from the response as the new `page[cursor]` value.

Once the `meta.pagination.next_cursor` value is null, all pages have been
retrieved.'
retrieved.

Use the `include` query parameter to fetch additional data with the response.
When `include=metric_volumes` is specified, the response includes volume data
for each custom metric in the `included` array, with a corresponding `relationships`
link on each metric in `data`. Volume data is only returned for custom metrics.
All volume values represent a 1-hour timeframe.'
operationId: ListTagConfigurations
parameters:
- description: Filter custom metrics that have configured tags.
Expand Down Expand Up @@ -91532,6 +91579,16 @@ paths:
required: false
schema:
type: boolean
- description: 'Comma-separated list of additional data to include in the response.
Allowed values: `metric_volumes`. When `metric_volumes` is specified, the
response includes volume data for each custom metric in the `included` array,
with a corresponding `relationships` link on each metric in `data`.'
example: metric_volumes
in: query
name: include
required: false
schema:
$ref: '#/components/schemas/MetricVolumesInclude'
- description: 'The number of seconds of look back (from now) to apply to a
filter[tag] or filter[queried] query.

Expand Down
14 changes: 14 additions & 0 deletions src/datadogV2/api/api_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ pub struct ListTagConfigurationsOptionalParams {
pub filter_tags: Option<String>,
/// (Preview) Filter metrics that are used in dashboards, monitors, notebooks, SLOs.
pub filter_related_assets: Option<bool>,
/// Comma-separated list of additional data to include in the response. Allowed values: `metric_volumes`. When `metric_volumes` is specified, the response includes volume data for each custom metric in the `included` array, with a corresponding `relationships` link on each metric in `data`.
pub include: Option<crate::datadogV2::model::MetricVolumesInclude>,
/// The number of seconds of look back (from now) to apply to a filter[tag] or filter[queried] query.
/// Default value is 3600 (1 hour), maximum value is 5,184,000 (60 days).
pub window_seconds: Option<i64>,
Expand Down Expand Up @@ -164,6 +166,11 @@ impl ListTagConfigurationsOptionalParams {
self.filter_related_assets = Some(value);
self
}
/// Comma-separated list of additional data to include in the response. Allowed values: `metric_volumes`. When `metric_volumes` is specified, the response includes volume data for each custom metric in the `included` array, with a corresponding `relationships` link on each metric in `data`.
pub fn include(mut self, value: crate::datadogV2::model::MetricVolumesInclude) -> Self {
self.include = Some(value);
self
}
/// The number of seconds of look back (from now) to apply to a filter[tag] or filter[queried] query.
/// Default value is 3600 (1 hour), maximum value is 5,184,000 (60 days).
pub fn window_seconds(mut self, value: i64) -> Self {
Expand Down Expand Up @@ -1666,6 +1673,7 @@ impl MetricsAPI {
/// Optionally, paginate by using the `page[cursor]` and/or `page[size]` query parameters.
/// To fetch the first page, pass in a query parameter with either a valid `page[size]` or an empty cursor like `page[cursor]=`. To fetch the next page, pass in the `next_cursor` value from the response as the new `page[cursor]` value.
/// Once the `meta.pagination.next_cursor` value is null, all pages have been retrieved.
/// Use the `include` query parameter to fetch additional data with the response. When `include=metric_volumes` is specified, the response includes volume data for each custom metric in the `included` array, with a corresponding `relationships` link on each metric in `data`. Volume data is only returned for custom metrics. All volume values represent a 1-hour timeframe.
pub async fn list_tag_configurations(
&self,
params: ListTagConfigurationsOptionalParams,
Expand Down Expand Up @@ -1729,6 +1737,7 @@ impl MetricsAPI {
/// Optionally, paginate by using the `page[cursor]` and/or `page[size]` query parameters.
/// To fetch the first page, pass in a query parameter with either a valid `page[size]` or an empty cursor like `page[cursor]=`. To fetch the next page, pass in the `next_cursor` value from the response as the new `page[cursor]` value.
/// Once the `meta.pagination.next_cursor` value is null, all pages have been retrieved.
/// Use the `include` query parameter to fetch additional data with the response. When `include=metric_volumes` is specified, the response includes volume data for each custom metric in the `included` array, with a corresponding `relationships` link on each metric in `data`. Volume data is only returned for custom metrics. All volume values represent a 1-hour timeframe.
pub async fn list_tag_configurations_with_http_info(
&self,
params: ListTagConfigurationsOptionalParams,
Expand All @@ -1750,6 +1759,7 @@ impl MetricsAPI {
let filter_queried_window_seconds = params.filter_queried_window_seconds;
let filter_tags = params.filter_tags;
let filter_related_assets = params.filter_related_assets;
let include = params.include;
let window_seconds = params.window_seconds;
let page_size = params.page_size;
let page_cursor = params.page_cursor;
Expand Down Expand Up @@ -1799,6 +1809,10 @@ impl MetricsAPI {
local_req_builder = local_req_builder
.query(&[("filter[related_assets]", &local_query_param.to_string())]);
};
if let Some(ref local_query_param) = include {
local_req_builder =
local_req_builder.query(&[("include", &local_query_param.to_string())]);
};
if let Some(ref local_query_param) = window_seconds {
local_req_builder =
local_req_builder.query(&[("window[seconds]", &local_query_param.to_string())]);
Expand Down
20 changes: 14 additions & 6 deletions src/datadogV2/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4422,10 +4422,20 @@ pub mod model_logs_list_request_page;
pub use self::model_logs_list_request_page::LogsListRequestPage;
pub mod model_metric_tag_configuration_metric_type_category;
pub use self::model_metric_tag_configuration_metric_type_category::MetricTagConfigurationMetricTypeCategory;
pub mod model_metric_volumes_include;
pub use self::model_metric_volumes_include::MetricVolumesInclude;
pub mod model_metrics_and_metric_tag_configurations_response;
pub use self::model_metrics_and_metric_tag_configurations_response::MetricsAndMetricTagConfigurationsResponse;
pub mod model_metric;
pub use self::model_metric::Metric;
pub mod model_metric_relationships;
pub use self::model_metric_relationships::MetricRelationships;
pub mod model_metric_volumes_relationship;
pub use self::model_metric_volumes_relationship::MetricVolumesRelationship;
pub mod model_metric_volumes_relationship_data;
pub use self::model_metric_volumes_relationship_data::MetricVolumesRelationshipData;
pub mod model_metric_ingested_indexed_volume_type;
pub use self::model_metric_ingested_indexed_volume_type::MetricIngestedIndexedVolumeType;
pub mod model_metric_type;
pub use self::model_metric_type::MetricType;
pub mod model_metric_tag_configuration;
Expand All @@ -4444,6 +4454,10 @@ pub mod model_metric_tag_configuration_type;
pub use self::model_metric_tag_configuration_type::MetricTagConfigurationType;
pub mod model_metrics_and_metric_tag_configurations;
pub use self::model_metrics_and_metric_tag_configurations::MetricsAndMetricTagConfigurations;
pub mod model_metric_ingested_indexed_volume;
pub use self::model_metric_ingested_indexed_volume::MetricIngestedIndexedVolume;
pub mod model_metric_ingested_indexed_volume_attributes;
pub use self::model_metric_ingested_indexed_volume_attributes::MetricIngestedIndexedVolumeAttributes;
pub mod model_metrics_list_response_links;
pub use self::model_metrics_list_response_links::MetricsListResponseLinks;
pub mod model_metric_pagination_meta;
Expand Down Expand Up @@ -4570,12 +4584,6 @@ pub mod model_metric_distinct_volume_attributes;
pub use self::model_metric_distinct_volume_attributes::MetricDistinctVolumeAttributes;
pub mod model_metric_distinct_volume_type;
pub use self::model_metric_distinct_volume_type::MetricDistinctVolumeType;
pub mod model_metric_ingested_indexed_volume;
pub use self::model_metric_ingested_indexed_volume::MetricIngestedIndexedVolume;
pub mod model_metric_ingested_indexed_volume_attributes;
pub use self::model_metric_ingested_indexed_volume_attributes::MetricIngestedIndexedVolumeAttributes;
pub mod model_metric_ingested_indexed_volume_type;
pub use self::model_metric_ingested_indexed_volume_type::MetricIngestedIndexedVolumeType;
pub mod model_metric_volumes;
pub use self::model_metric_volumes::MetricVolumes;
pub mod model_monitor_notification_rule_list_response;
Expand Down
18 changes: 18 additions & 0 deletions src/datadogV2/model/model_metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ pub struct Metric {
/// The metric name for this resource.
#[serde(rename = "id")]
pub id: Option<String>,
/// Relationships to related metric objects.
#[serde(rename = "relationships")]
pub relationships: Option<crate::datadogV2::model::MetricRelationships>,
/// The metric resource type.
#[serde(rename = "type")]
pub type_: Option<crate::datadogV2::model::MetricType>,
Expand All @@ -28,6 +31,7 @@ impl Metric {
pub fn new() -> Metric {
Metric {
id: None,
relationships: None,
type_: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
Expand All @@ -39,6 +43,11 @@ impl Metric {
self
}

pub fn relationships(mut self, value: crate::datadogV2::model::MetricRelationships) -> Self {
self.relationships = Some(value);
self
}

pub fn type_(mut self, value: crate::datadogV2::model::MetricType) -> Self {
self.type_ = Some(value);
self
Expand Down Expand Up @@ -77,6 +86,7 @@ impl<'de> Deserialize<'de> for Metric {
M: MapAccess<'a>,
{
let mut id: Option<String> = None;
let mut relationships: Option<crate::datadogV2::model::MetricRelationships> = None;
let mut type_: Option<crate::datadogV2::model::MetricType> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
Expand All @@ -92,6 +102,13 @@ impl<'de> Deserialize<'de> for Metric {
}
id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"relationships" => {
if v.is_null() {
continue;
}
relationships =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"type" => {
if v.is_null() {
continue;
Expand All @@ -116,6 +133,7 @@ impl<'de> Deserialize<'de> for Metric {

let content = Metric {
id,
relationships,
type_,
additional_properties,
_unparsed,
Expand Down
110 changes: 110 additions & 0 deletions src/datadogV2/model/model_metric_relationships.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// 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};

/// Relationships to related metric objects.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct MetricRelationships {
/// Relationship to a metric's ingested and indexed volumes.
#[serde(rename = "metric_volumes")]
pub metric_volumes: Option<crate::datadogV2::model::MetricVolumesRelationship>,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
}

impl MetricRelationships {
pub fn new() -> MetricRelationships {
MetricRelationships {
metric_volumes: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}

pub fn metric_volumes(
mut self,
value: crate::datadogV2::model::MetricVolumesRelationship,
) -> Self {
self.metric_volumes = 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 MetricRelationships {
fn default() -> Self {
Self::new()
}
}

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

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 metric_volumes: Option<crate::datadogV2::model::MetricVolumesRelationship> =
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() {
"metric_volumes" => {
if v.is_null() {
continue;
}
metric_volumes =
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 = MetricRelationships {
metric_volumes,
additional_properties,
_unparsed,
};

Ok(content)
}
}

deserializer.deserialize_any(MetricRelationshipsVisitor)
}
}
Loading
Loading