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 related_assets filter query parameter to the get a list of metrics V2 API #474

Merged
merged 1 commit into from
Feb 6, 2025
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
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-02-06 14:56:56.714327",
"spec_repo_commit": "3c39fb0c"
"regenerated": "2025-02-06 17:59:42.408810",
"spec_repo_commit": "b89b292b"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-02-06 14:56:56.731125",
"spec_repo_commit": "3c39fb0c"
"regenerated": "2025-02-06 17:59:42.424278",
"spec_repo_commit": "b89b292b"
}
}
}
10 changes: 9 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40196,7 +40196,7 @@ paths:
required: false
schema:
type: boolean
- description: '(Beta) Filter custom metrics that have or have not been queried
- description: '(Preview) Filter custom metrics that have or have not been queried
in the specified window[seconds].

If no window is provided or the window is less than 2 hours, a default of
Expand All @@ -40217,6 +40217,14 @@ paths:
required: false
schema:
type: string
- description: (Preview) Filter metrics that are used in dashboards, monitors,
notebooks, 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
16 changes: 14 additions & 2 deletions src/datadogV2/api/api_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ pub struct ListTagConfigurationsOptionalParams {
/// Filter distributions with additional percentile
/// aggregations enabled or disabled.
pub filter_include_percentiles: Option<bool>,
/// (Beta) Filter custom metrics that have or have not been queried in the specified window[seconds].
/// (Preview) Filter custom metrics that have or have not been queried in the specified window[seconds].
/// If no window is provided or the window is less than 2 hours, a default of 2 hours will be applied.
pub filter_queried: Option<bool>,
/// 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>,
/// (Preview) Filter metrics that are used in dashboards, monitors, notebooks, 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 @@ -130,7 +132,7 @@ impl ListTagConfigurationsOptionalParams {
self.filter_include_percentiles = Some(value);
self
}
/// (Beta) Filter custom metrics that have or have not been queried in the specified window[seconds].
/// (Preview) Filter custom metrics that have or have not been queried in the specified window[seconds].
/// If no window is provided or the window is less than 2 hours, a default of 2 hours will be applied.
pub fn filter_queried(mut self, value: bool) -> Self {
self.filter_queried = Some(value);
Expand All @@ -142,6 +144,11 @@ impl ListTagConfigurationsOptionalParams {
self.filter_tags = Some(value);
self
}
/// (Preview) Filter metrics that are used in dashboards, monitors, notebooks, 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 @@ -18511,6 +18511,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 @@ -18527,6 +18530,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 @@ -18574,6 +18578,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 @@ -18590,6 +18597,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