Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new filter[related_assets] query parameter to /api/v2/metrics API #474

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-17 14:23:59.744596",
"spec_repo_commit": "60205e12"
"regenerated": "2025-01-17 18:24:10.233260",
"spec_repo_commit": "366b36ab"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-17 14:23:59.759696",
"spec_repo_commit": "60205e12"
"regenerated": "2025-01-17 18:24:10.248995",
"spec_repo_commit": "366b36ab"
}
}
}
8 changes: 8 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39523,6 +39523,14 @@ paths:
required: false
schema:
type: string
- description: Filter metrics that are used in dashboards, monitors, notebooks,
or SLOs.
example: true
in: query
name: filter[related_assets]
required: false
schema:
type: boolean
- description: 'The number of seconds of look back (from now) to apply to a
filter[tag] or filter[queried] query.

Expand Down
12 changes: 12 additions & 0 deletions src/datadogV2/api/api_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ pub struct ListTagConfigurationsOptionalParams {
/// Filter metrics that have been submitted with the given tags. Supports boolean and wildcard expressions.
/// Can only be combined with the filter[queried] filter.
pub filter_tags: Option<String>,
/// Filter metrics that are used in dashboards, monitors, notebooks, or SLOs.
pub filter_related_assets: Option<bool>,
/// 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 2,592,000 (30 days).
pub window_seconds: Option<i64>,
Expand Down Expand Up @@ -142,6 +144,11 @@ impl ListTagConfigurationsOptionalParams {
self.filter_tags = Some(value);
self
}
/// Filter metrics that are used in dashboards, monitors, notebooks, or SLOs.
pub fn filter_related_assets(mut self, value: bool) -> Self {
self.filter_related_assets = 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 2,592,000 (30 days).
pub fn window_seconds(mut self, value: i64) -> Self {
Expand Down Expand Up @@ -1545,6 +1552,7 @@ impl MetricsAPI {
let filter_include_percentiles = params.filter_include_percentiles;
let filter_queried = params.filter_queried;
let filter_tags = params.filter_tags;
let filter_related_assets = params.filter_related_assets;
let window_seconds = params.window_seconds;
let page_size = params.page_size;
let page_cursor = params.page_cursor;
Expand Down Expand Up @@ -1584,6 +1592,10 @@ impl MetricsAPI {
local_req_builder =
local_req_builder.query(&[("filter[tags]", &local_query_param.to_string())]);
};
if let Some(ref local_query_param) = filter_related_assets {
local_req_builder = local_req_builder
.query(&[("filter[related_assets]", &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
8 changes: 8 additions & 0 deletions tests/scenarios/function_mappings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18301,6 +18301,9 @@ fn test_v2_list_tag_configurations(world: &mut DatadogWorld, _parameters: &HashM
let filter_tags = _parameters
.get("filter[tags]")
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
let filter_related_assets = _parameters
.get("filter[related_assets]")
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
let window_seconds = _parameters
.get("window[seconds]")
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
Expand All @@ -18317,6 +18320,7 @@ fn test_v2_list_tag_configurations(world: &mut DatadogWorld, _parameters: &HashM
params.filter_include_percentiles = filter_include_percentiles;
params.filter_queried = filter_queried;
params.filter_tags = filter_tags;
params.filter_related_assets = filter_related_assets;
params.window_seconds = window_seconds;
params.page_size = page_size;
params.page_cursor = page_cursor;
Expand Down Expand Up @@ -18364,6 +18368,9 @@ fn test_v2_list_tag_configurations_with_pagination(
let filter_tags = _parameters
.get("filter[tags]")
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
let filter_related_assets = _parameters
.get("filter[related_assets]")
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
let window_seconds = _parameters
.get("window[seconds]")
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
Expand All @@ -18380,6 +18387,7 @@ fn test_v2_list_tag_configurations_with_pagination(
params.filter_include_percentiles = filter_include_percentiles;
params.filter_queried = filter_queried;
params.filter_tags = filter_tags;
params.filter_related_assets = filter_related_assets;
params.window_seconds = window_seconds;
params.page_size = page_size;
params.page_cursor = page_cursor;
Expand Down
Loading