From a67c874c5720cfd9d783bd0319b2200a726f4145 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 30 Jun 2025 08:53:55 +0000 Subject: [PATCH] Regenerate client from commit 36849030 of spec repo --- .apigentools-info | 8 ++--- .generator/schemas/v2/openapi.yaml | 11 +++++++ .../v2_metrics_ListVolumesByMetricName.rs | 6 +++- src/datadogV2/api/api_metrics.rs | 30 ++++++++++++++++- tests/scenarios/function_mappings.rs | 32 +++++++++++-------- 5 files changed, 68 insertions(+), 19 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index 3b1f87db3..25d9f2508 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-26 17:56:17.758022", - "spec_repo_commit": "76086f13" + "regenerated": "2025-06-30 08:48:14.436273", + "spec_repo_commit": "36849030" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-26 17:56:17.774479", - "spec_repo_commit": "76086f13" + "regenerated": "2025-06-30 08:48:14.452070", + "spec_repo_commit": "36849030" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d5a8de2b6..f09218160 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -52633,6 +52633,17 @@ paths: operationId: ListVolumesByMetricName parameters: - $ref: '#/components/parameters/MetricName' + - description: 'The number of seconds of look back (from now). + + Default value is 604,800 (1 week), minimum value is 7200 (2 hours), maximum + value is 2,630,000 (1 month).' + example: 7200 + in: query + name: window[seconds] + required: false + schema: + format: int64 + type: integer responses: '200': content: diff --git a/examples/v2_metrics_ListVolumesByMetricName.rs b/examples/v2_metrics_ListVolumesByMetricName.rs index b03c7128c..980756ed9 100644 --- a/examples/v2_metrics_ListVolumesByMetricName.rs +++ b/examples/v2_metrics_ListVolumesByMetricName.rs @@ -1,5 +1,6 @@ // List distinct metric volumes by metric name returns "Success" response use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_metrics::ListVolumesByMetricNameOptionalParams; use datadog_api_client::datadogV2::api_metrics::MetricsAPI; #[tokio::main] @@ -7,7 +8,10 @@ async fn main() { let configuration = datadog::Configuration::new(); let api = MetricsAPI::with_config(configuration); let resp = api - .list_volumes_by_metric_name("static_test_metric_donotdelete".to_string()) + .list_volumes_by_metric_name( + "static_test_metric_donotdelete".to_string(), + ListVolumesByMetricNameOptionalParams::default(), + ) .await; if let Ok(value) = resp { println!("{:#?}", value); diff --git a/src/datadogV2/api/api_metrics.rs b/src/datadogV2/api/api_metrics.rs index a68fa52f9..92feadff1 100644 --- a/src/datadogV2/api/api_metrics.rs +++ b/src/datadogV2/api/api_metrics.rs @@ -169,6 +169,24 @@ impl ListTagConfigurationsOptionalParams { } } +/// ListVolumesByMetricNameOptionalParams is a struct for passing parameters to the method [`MetricsAPI::list_volumes_by_metric_name`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListVolumesByMetricNameOptionalParams { + /// The number of seconds of look back (from now). + /// Default value is 604,800 (1 week), minimum value is 7200 (2 hours), maximum value is 2,630,000 (1 month). + pub window_seconds: Option, +} + +impl ListVolumesByMetricNameOptionalParams { + /// The number of seconds of look back (from now). + /// Default value is 604,800 (1 week), minimum value is 7200 (2 hours), maximum value is 2,630,000 (1 month). + pub fn window_seconds(mut self, value: i64) -> Self { + self.window_seconds = Some(value); + self + } +} + /// SubmitMetricsOptionalParams is a struct for passing parameters to the method [`MetricsAPI::submit_metrics`] #[non_exhaustive] #[derive(Clone, Default, Debug)] @@ -1794,12 +1812,13 @@ impl MetricsAPI { pub async fn list_volumes_by_metric_name( &self, metric_name: String, + params: ListVolumesByMetricNameOptionalParams, ) -> Result< crate::datadogV2::model::MetricVolumesResponse, datadog::Error, > { match self - .list_volumes_by_metric_name_with_http_info(metric_name) + .list_volumes_by_metric_name_with_http_info(metric_name, params) .await { Ok(response_content) => { @@ -1821,6 +1840,7 @@ impl MetricsAPI { pub async fn list_volumes_by_metric_name_with_http_info( &self, metric_name: String, + params: ListVolumesByMetricNameOptionalParams, ) -> Result< datadog::ResponseContent, datadog::Error, @@ -1828,6 +1848,9 @@ impl MetricsAPI { let local_configuration = &self.config; let operation_id = "v2.list_volumes_by_metric_name"; + // unbox and build optional parameters + let window_seconds = params.window_seconds; + let local_client = &self.client; let local_uri_str = format!( @@ -1838,6 +1861,11 @@ impl MetricsAPI { let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = window_seconds { + local_req_builder = + local_req_builder.query(&[("window[seconds]", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index 0294f34cf..435becec5 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -22236,20 +22236,26 @@ fn test_v2_list_volumes_by_metric_name( .expect("api instance not found"); let metric_name = serde_json::from_value(_parameters.get("metric_name").unwrap().clone()).unwrap(); - let response = match block_on(api.list_volumes_by_metric_name_with_http_info(metric_name)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); + let window_seconds = _parameters + .get("window[seconds]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_metrics::ListVolumesByMetricNameOptionalParams::default(); + params.window_seconds = window_seconds; + let response = + match block_on(api.list_volumes_by_metric_name_with_http_info(metric_name, params)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; + _ => panic!("error parsing response: {error}"), + }; + } + }; world.response.object = serde_json::to_value(response.entity).unwrap(); world.response.code = response.status.as_u16(); }