Skip to content

Commit 9450f67

Browse files
api-clients-generation-pipeline[bot]amaskara-ddci.datadog-api-spec
authored
Add support for all subtypes in multistep steps (#665)
Co-authored-by: Anika Maskara <[email protected]> Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 11ec058 commit 9450f67

17 files changed

+485
-54
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-06-05 09:49:39.264892",
8-
"spec_repo_commit": "faa72400"
7+
"regenerated": "2025-06-06 11:21:32.793270",
8+
"spec_repo_commit": "14586db5"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-06-05 09:49:39.280328",
13-
"spec_repo_commit": "faa72400"
12+
"regenerated": "2025-06-06 11:21:32.811408",
13+
"spec_repo_commit": "14586db5"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14107,11 +14107,23 @@ components:
1410714107
enum:
1410814108
- http
1410914109
- grpc
14110+
- ssl
14111+
- dns
14112+
- tcp
14113+
- udp
14114+
- icmp
14115+
- websocket
1411014116
example: http
1411114117
type: string
1411214118
x-enum-varnames:
1411314119
- HTTP
1411414120
- GRPC
14121+
- SSL
14122+
- DNS
14123+
- TCP
14124+
- UDP
14125+
- ICMP
14126+
- WEBSOCKET
1411514127
SyntheticsAPITestType:
1411614128
default: api
1411714129
description: Type of the Synthetic test, `api`.
@@ -17177,6 +17189,9 @@ components:
1717717189
example: ''
1717817190
type: string
1717917191
type: array
17192+
checkCertificateRevocation:
17193+
description: Check for certificate revocation.
17194+
type: boolean
1718017195
compressedJsonDescriptor:
1718117196
description: A protobuf JSON descriptor that needs to be gzipped first then
1718217197
base64 encoded.
@@ -17206,6 +17221,9 @@ components:
1720617221
type: string
1720717222
httpVersion:
1720817223
$ref: '#/components/schemas/SyntheticsTestOptionsHTTPVersion'
17224+
isMessageBase64Encoded:
17225+
description: Whether the message is base64 encoded.
17226+
type: boolean
1720917227
message:
1721017228
description: Message to send for UDP or WebSocket tests.
1721117229
type: string

.generator/src/generator/formatter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ def format_data_with_schema(
409409
def format_string(x):
410410
if isinstance(x, bool):
411411
raise TypeError(f"{x} is not supported type {schema}")
412-
if x and ("`" in x or '"' in x or "\n" in x):
412+
# reordering this conditional is a hacky fix to handle the oneOf double/string case as done in the java and go formatters
413+
if ("`" in x or '"' in x or "\n" in x) and x:
413414
return f"r#\"{x}\"#.to_string()", set()
414415
if x:
415416
return f'"{x}".to_string()', set()

examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator;
1515
use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget;
1616
use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue;
1717
use datadog_api_client::datadogV1::model::SyntheticsAssertionType;
18+
use datadog_api_client::datadogV1::model::SyntheticsBasicAuth;
19+
use datadog_api_client::datadogV1::model::SyntheticsBasicAuthWeb;
20+
use datadog_api_client::datadogV1::model::SyntheticsBasicAuthWebType;
1821
use datadog_api_client::datadogV1::model::SyntheticsConfigVariable;
1922
use datadog_api_client::datadogV1::model::SyntheticsConfigVariableType;
2023
use datadog_api_client::datadogV1::model::SyntheticsGlobalVariableParserType;
@@ -133,6 +136,193 @@ async fn main() {
133136
.is_critical(true)
134137
.retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
135138
),
139+
),
140+
SyntheticsAPIStep::SyntheticsAPITestStep(
141+
Box::new(
142+
SyntheticsAPITestStep::new(
143+
vec![
144+
SyntheticsAssertion::SyntheticsAssertionTarget(
145+
Box::new(
146+
SyntheticsAssertionTarget::new(
147+
SyntheticsAssertionOperator::IS_IN_MORE_DAYS_THAN,
148+
SyntheticsAssertionTargetValue
149+
::SyntheticsAssertionTargetValueNumber(
150+
10.0 as f64,
151+
),
152+
SyntheticsAssertionType::CERTIFICATE,
153+
),
154+
),
155+
)
156+
],
157+
"SSL step".to_string(),
158+
SyntheticsTestRequest::new()
159+
.check_certificate_revocation(true)
160+
.host("example.org".to_string())
161+
.port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(443)),
162+
SyntheticsAPITestStepSubtype::SSL,
163+
)
164+
.allow_failure(false)
165+
.is_critical(true)
166+
.retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
167+
),
168+
),
169+
SyntheticsAPIStep::SyntheticsAPITestStep(
170+
Box::new(
171+
SyntheticsAPITestStep::new(
172+
vec![
173+
SyntheticsAssertion::SyntheticsAssertionTarget(
174+
Box::new(
175+
SyntheticsAssertionTarget::new(
176+
SyntheticsAssertionOperator::LESS_THAN,
177+
SyntheticsAssertionTargetValue
178+
::SyntheticsAssertionTargetValueNumber(
179+
1000.0 as f64,
180+
),
181+
SyntheticsAssertionType::RESPONSE_TIME,
182+
),
183+
),
184+
)
185+
],
186+
"DNS step".to_string(),
187+
SyntheticsTestRequest::new()
188+
.dns_server("8.8.8.8".to_string())
189+
.dns_server_port("53".to_string())
190+
.host("troisdizaines.com".to_string()),
191+
SyntheticsAPITestStepSubtype::DNS,
192+
)
193+
.allow_failure(false)
194+
.is_critical(true)
195+
.retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
196+
),
197+
),
198+
SyntheticsAPIStep::SyntheticsAPITestStep(
199+
Box::new(
200+
SyntheticsAPITestStep::new(
201+
vec![
202+
SyntheticsAssertion::SyntheticsAssertionTarget(
203+
Box::new(
204+
SyntheticsAssertionTarget::new(
205+
SyntheticsAssertionOperator::LESS_THAN,
206+
SyntheticsAssertionTargetValue
207+
::SyntheticsAssertionTargetValueNumber(
208+
1000.0 as f64,
209+
),
210+
SyntheticsAssertionType::RESPONSE_TIME,
211+
),
212+
),
213+
)
214+
],
215+
"TCP step".to_string(),
216+
SyntheticsTestRequest::new()
217+
.host("34.95.79.70".to_string())
218+
.port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(80))
219+
.should_track_hops(true)
220+
.timeout(32.0 as f64),
221+
SyntheticsAPITestStepSubtype::TCP,
222+
)
223+
.allow_failure(false)
224+
.is_critical(true)
225+
.retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
226+
),
227+
),
228+
SyntheticsAPIStep::SyntheticsAPITestStep(
229+
Box::new(
230+
SyntheticsAPITestStep::new(
231+
vec![
232+
SyntheticsAssertion::SyntheticsAssertionTarget(
233+
Box::new(
234+
SyntheticsAssertionTarget::new(
235+
SyntheticsAssertionOperator::IS,
236+
SyntheticsAssertionTargetValue
237+
::SyntheticsAssertionTargetValueNumber(
238+
0.0 as f64,
239+
),
240+
SyntheticsAssertionType::PACKET_LOSS_PERCENTAGE,
241+
),
242+
),
243+
)
244+
],
245+
"ICMP step".to_string(),
246+
SyntheticsTestRequest::new()
247+
.host("34.95.79.70".to_string())
248+
.number_of_packets(4)
249+
.should_track_hops(true)
250+
.timeout(38.0 as f64),
251+
SyntheticsAPITestStepSubtype::ICMP,
252+
)
253+
.allow_failure(false)
254+
.is_critical(true)
255+
.retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
256+
),
257+
),
258+
SyntheticsAPIStep::SyntheticsAPITestStep(
259+
Box::new(
260+
SyntheticsAPITestStep::new(
261+
vec![
262+
SyntheticsAssertion::SyntheticsAssertionTarget(
263+
Box::new(
264+
SyntheticsAssertionTarget::new(
265+
SyntheticsAssertionOperator::LESS_THAN,
266+
SyntheticsAssertionTargetValue
267+
::SyntheticsAssertionTargetValueNumber(
268+
1000.0 as f64,
269+
),
270+
SyntheticsAssertionType::RESPONSE_TIME,
271+
),
272+
),
273+
)
274+
],
275+
"Websocket step".to_string(),
276+
SyntheticsTestRequest::new()
277+
.basic_auth(
278+
SyntheticsBasicAuth::SyntheticsBasicAuthWeb(
279+
Box::new(
280+
SyntheticsBasicAuthWeb::new(
281+
"password".to_string(),
282+
"user".to_string(),
283+
).type_(SyntheticsBasicAuthWebType::WEB),
284+
),
285+
),
286+
)
287+
.headers(BTreeMap::from([("f".to_string(), "g".to_string())]))
288+
.is_message_base64_encoded(true)
289+
.message("My message".to_string())
290+
.url("ws://34.95.79.70/web-socket".to_string()),
291+
SyntheticsAPITestStepSubtype::WEBSOCKET,
292+
)
293+
.allow_failure(false)
294+
.is_critical(true)
295+
.retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
296+
),
297+
),
298+
SyntheticsAPIStep::SyntheticsAPITestStep(
299+
Box::new(
300+
SyntheticsAPITestStep::new(
301+
vec![
302+
SyntheticsAssertion::SyntheticsAssertionTarget(
303+
Box::new(
304+
SyntheticsAssertionTarget::new(
305+
SyntheticsAssertionOperator::LESS_THAN,
306+
SyntheticsAssertionTargetValue
307+
::SyntheticsAssertionTargetValueNumber(
308+
1000.0 as f64,
309+
),
310+
SyntheticsAssertionType::RESPONSE_TIME,
311+
),
312+
),
313+
)
314+
],
315+
"UDP step".to_string(),
316+
SyntheticsTestRequest::new()
317+
.host("8.8.8.8".to_string())
318+
.message("A image.google.com".to_string())
319+
.port(SyntheticsTestRequestPort::SyntheticsTestRequestNumericalPort(53)),
320+
SyntheticsAPITestStepSubtype::UDP,
321+
)
322+
.allow_failure(false)
323+
.is_critical(true)
324+
.retry(SyntheticsTestOptionsRetry::new().count(0).interval(300.0 as f64)),
325+
),
136326
)
137327
],
138328
),

src/datadogV1/model/model_synthetics_api_test_step_subtype.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
99
pub enum SyntheticsAPITestStepSubtype {
1010
HTTP,
1111
GRPC,
12+
SSL,
13+
DNS,
14+
TCP,
15+
UDP,
16+
ICMP,
17+
WEBSOCKET,
1218
UnparsedObject(crate::datadog::UnparsedObject),
1319
}
1420

@@ -17,6 +23,12 @@ impl ToString for SyntheticsAPITestStepSubtype {
1723
match self {
1824
Self::HTTP => String::from("http"),
1925
Self::GRPC => String::from("grpc"),
26+
Self::SSL => String::from("ssl"),
27+
Self::DNS => String::from("dns"),
28+
Self::TCP => String::from("tcp"),
29+
Self::UDP => String::from("udp"),
30+
Self::ICMP => String::from("icmp"),
31+
Self::WEBSOCKET => String::from("websocket"),
2032
Self::UnparsedObject(v) => v.value.to_string(),
2133
}
2234
}
@@ -43,6 +55,12 @@ impl<'de> Deserialize<'de> for SyntheticsAPITestStepSubtype {
4355
Ok(match s.as_str() {
4456
"http" => Self::HTTP,
4557
"grpc" => Self::GRPC,
58+
"ssl" => Self::SSL,
59+
"dns" => Self::DNS,
60+
"tcp" => Self::TCP,
61+
"udp" => Self::UDP,
62+
"icmp" => Self::ICMP,
63+
"websocket" => Self::WEBSOCKET,
4664
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
4765
value: serde_json::Value::String(s.into()),
4866
}),

0 commit comments

Comments
 (0)