Skip to content

Commit f988fc8

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add text field in synthetics search endpoint (#806)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent a3f7536 commit f988fc8

File tree

8 files changed

+29
-5
lines changed

8 files changed

+29
-5
lines changed

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "bd643af",
3-
"generated": "2025-07-22 16:47:27.533"
2+
"spec_repo_commit": "04d09cb",
3+
"generated": "2025-07-23 09:27:41.344"
44
}

.generator/schemas/v1/openapi.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33827,6 +33827,12 @@ paths:
3382733827
description: Search for Synthetic tests and Test Suites.
3382833828
operationId: SearchTests
3382933829
parameters:
33830+
- description: The search query.
33831+
in: query
33832+
name: text
33833+
required: false
33834+
schema:
33835+
type: string
3383033836
- description: If true, include the full configuration for each test in the
3383133837
response.
3383233838
in: query

examples/v1_synthetics_SearchTests_195957771.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ async fn main() {
1010
let resp = api
1111
.search_tests(
1212
SearchTestsOptionalParams::default()
13+
.text("tag:value".to_string())
1314
.include_full_config(true)
1415
.search_suites(true)
1516
.facets_only(true)

src/datadogV1/api/api_synthetics.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ impl ListTestsOptionalParams {
9999
#[non_exhaustive]
100100
#[derive(Clone, Default, Debug)]
101101
pub struct SearchTestsOptionalParams {
102+
/// The search query.
103+
pub text: Option<String>,
102104
/// If true, include the full configuration for each test in the response.
103105
pub include_full_config: Option<bool>,
104106
/// If true, returns suites instead of tests.
@@ -114,6 +116,11 @@ pub struct SearchTestsOptionalParams {
114116
}
115117

116118
impl SearchTestsOptionalParams {
119+
/// The search query.
120+
pub fn text(mut self, value: String) -> Self {
121+
self.text = Some(value);
122+
self
123+
}
117124
/// If true, include the full configuration for each test in the response.
118125
pub fn include_full_config(mut self, value: bool) -> Self {
119126
self.include_full_config = Some(value);
@@ -3828,6 +3835,7 @@ impl SyntheticsAPI {
38283835
let operation_id = "v1.search_tests";
38293836

38303837
// unbox and build optional parameters
3838+
let text = params.text;
38313839
let include_full_config = params.include_full_config;
38323840
let search_suites = params.search_suites;
38333841
let facets_only = params.facets_only;
@@ -3844,6 +3852,10 @@ impl SyntheticsAPI {
38443852
let mut local_req_builder =
38453853
local_client.request(reqwest::Method::GET, local_uri_str.as_str());
38463854

3855+
if let Some(ref local_query_param) = text {
3856+
local_req_builder =
3857+
local_req_builder.query(&[("text", &local_query_param.to_string())]);
3858+
};
38473859
if let Some(ref local_query_param) = include_full_config {
38483860
local_req_builder =
38493861
local_req_builder.query(&[("include_full_config", &local_query_param.to_string())]);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025-07-01T15:52:56.329Z
1+
2025-07-22T14:56:49.377Z

tests/scenarios/cassettes/v1/synthetics/Search-Synthetic-tests-with-boolean-query-parameters.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
]
1010
},
1111
"method": "get",
12-
"uri": "https://api.datadoghq.com/api/v1/synthetics/tests/search?include_full_config=true&search_suites=true&facets_only=true&start=10&count=5&sort=name%2Cdesc"
12+
"uri": "https://api.datadoghq.com/api/v1/synthetics/tests/search?text=tag%3Avalue&include_full_config=true&search_suites=true&facets_only=true&start=10&count=5&sort=name%2Cdesc"
1313
},
1414
"response": {
1515
"body": {
@@ -26,7 +26,7 @@
2626
"message": "OK"
2727
}
2828
},
29-
"recorded_at": "Tue, 01 Jul 2025 15:52:56 GMT"
29+
"recorded_at": "Tue, 22 Jul 2025 14:56:49 GMT"
3030
}
3131
],
3232
"recorded_with": "VCR 6.0.0"

tests/scenarios/features/v1/synthetics.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,7 @@ Feature: Synthetics
806806
@team:DataDog/synthetics-ct
807807
Scenario: Search Synthetic tests with boolean query parameters
808808
Given new "SearchTests" request
809+
And request contains "text" parameter with value "tag:value"
809810
And request contains "include_full_config" parameter with value true
810811
And request contains "search_suites" parameter with value true
811812
And request contains "facets_only" parameter with value true

tests/scenarios/function_mappings.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10344,6 +10344,9 @@ fn test_v1_search_tests(world: &mut DatadogWorld, _parameters: &HashMap<String,
1034410344
.v1_api_synthetics
1034510345
.as_ref()
1034610346
.expect("api instance not found");
10347+
let text = _parameters
10348+
.get("text")
10349+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
1034710350
let include_full_config = _parameters
1034810351
.get("include_full_config")
1034910352
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
@@ -10363,6 +10366,7 @@ fn test_v1_search_tests(world: &mut DatadogWorld, _parameters: &HashMap<String,
1036310366
.get("sort")
1036410367
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
1036510368
let mut params = datadogV1::api_synthetics::SearchTestsOptionalParams::default();
10369+
params.text = text;
1036610370
params.include_full_config = include_full_config;
1036710371
params.search_suites = search_suites;
1036810372
params.facets_only = facets_only;

0 commit comments

Comments
 (0)