Skip to content

Commit 136b7ee

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 932f605 of spec repo
1 parent f5bf354 commit 136b7ee

File tree

9 files changed

+486
-0
lines changed

9 files changed

+486
-0
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14597,6 +14597,61 @@ components:
1459714597
oneOf:
1459814598
- $ref: '#/components/schemas/SyntheticsAPITestStep'
1459914599
- $ref: '#/components/schemas/SyntheticsAPIWaitStep'
14600+
- $ref: '#/components/schemas/SyntheticsAPISubtestStep'
14601+
SyntheticsAPISubtestStep:
14602+
description: The subtest step used in a Synthetics multi-step API test.
14603+
properties:
14604+
allowFailure:
14605+
description: Determines whether or not to continue with test if this step
14606+
fails.
14607+
type: boolean
14608+
alwaysExecute:
14609+
description: A boolean set to always execute this step even if the previous
14610+
step failed or was skipped.
14611+
type: boolean
14612+
exitIfSucceed:
14613+
description: Determines whether or not to exit the test if the step succeeds.
14614+
type: boolean
14615+
extractedValuesFromScript:
14616+
description: Generate variables using JavaScript.
14617+
type: string
14618+
id:
14619+
description: ID of the step.
14620+
example: abc-def-123
14621+
readOnly: true
14622+
type: string
14623+
isCritical:
14624+
description: 'Determines whether or not to consider the entire test as failed
14625+
if this step fails.
14626+
14627+
Can be used only if `allowFailure` is `true`.'
14628+
type: boolean
14629+
name:
14630+
description: The name of the step.
14631+
example: Example step name
14632+
type: string
14633+
retry:
14634+
$ref: '#/components/schemas/SyntheticsTestOptionsRetry'
14635+
subtestPublicId:
14636+
description: Public ID of the test to be played as part of a `playSubTest`
14637+
step type.
14638+
example: ''
14639+
type: string
14640+
subtype:
14641+
$ref: '#/components/schemas/SyntheticsAPISubtestStepSubtype'
14642+
required:
14643+
- name
14644+
- subtype
14645+
- subtestPublicId
14646+
type: object
14647+
SyntheticsAPISubtestStepSubtype:
14648+
description: The subtype of the Synthetic multi-step API subtest step.
14649+
enum:
14650+
- playSubTest
14651+
example: playSubTest
14652+
type: string
14653+
x-enum-varnames:
14654+
- PLAY_SUB_TEST
1460014655
SyntheticsAPITest:
1460114656
description: Object containing details about a Synthetic API test.
1460214657
properties:

LICENSE-3rdparty.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ zerofrom-derive,https://github.com/unicode-org/icu4x,Unicode-3.0,Manish Goregaok
208208
zerotrie,https://github.com/unicode-org/icu4x,Unicode-3.0,The ICU4X Project Developers
209209
zerovec,https://github.com/unicode-org/icu4x,Unicode-3.0,The ICU4X Project Developers
210210
zerovec-derive,https://github.com/unicode-org/icu4x,Unicode-3.0,Manish Goregaokar <[email protected]>
211+
zmij,https://github.com/dtolnay/zmij,MIT,David Tolnay <[email protected]>
211212
zstd,https://github.com/gyscos/zstd-rs,MIT,Alexandre Bury <[email protected]>
212213
zstd-safe,https://github.com/gyscos/zstd-rs,MIT OR Apache-2.0,Alexandre Bury <[email protected]>
213214
zstd-sys,https://github.com/gyscos/zstd-rs,MIT OR Apache-2.0,Alexandre Bury <[email protected]>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Create a multistep test with subtest returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV1::api_synthetics::SyntheticsAPI;
4+
use datadog_api_client::datadogV1::model::SyntheticsAPIStep;
5+
use datadog_api_client::datadogV1::model::SyntheticsAPISubtestStep;
6+
use datadog_api_client::datadogV1::model::SyntheticsAPISubtestStepSubtype;
7+
use datadog_api_client::datadogV1::model::SyntheticsAPITest;
8+
use datadog_api_client::datadogV1::model::SyntheticsAPITestConfig;
9+
use datadog_api_client::datadogV1::model::SyntheticsAPITestStep;
10+
use datadog_api_client::datadogV1::model::SyntheticsAPITestStepSubtype;
11+
use datadog_api_client::datadogV1::model::SyntheticsAPITestType;
12+
use datadog_api_client::datadogV1::model::SyntheticsAssertion;
13+
use datadog_api_client::datadogV1::model::SyntheticsAssertionOperator;
14+
use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget;
15+
use datadog_api_client::datadogV1::model::SyntheticsAssertionTargetValue;
16+
use datadog_api_client::datadogV1::model::SyntheticsAssertionType;
17+
use datadog_api_client::datadogV1::model::SyntheticsBasicAuth;
18+
use datadog_api_client::datadogV1::model::SyntheticsBasicAuthWeb;
19+
use datadog_api_client::datadogV1::model::SyntheticsTestDetailsSubType;
20+
use datadog_api_client::datadogV1::model::SyntheticsTestOptions;
21+
use datadog_api_client::datadogV1::model::SyntheticsTestRequest;
22+
23+
#[tokio::main]
24+
async fn main() {
25+
// there is a valid "synthetics_api_test" in the system
26+
let synthetics_api_test_public_id = std::env::var("SYNTHETICS_API_TEST_PUBLIC_ID").unwrap();
27+
let body = SyntheticsAPITest::new(
28+
SyntheticsAPITestConfig::new().steps(vec![
29+
SyntheticsAPIStep::SyntheticsAPITestStep(Box::new(SyntheticsAPITestStep::new(
30+
vec![SyntheticsAssertion::SyntheticsAssertionTarget(Box::new(
31+
SyntheticsAssertionTarget::new(
32+
SyntheticsAssertionOperator::IS,
33+
SyntheticsAssertionTargetValue::SyntheticsAssertionTargetValueNumber(
34+
200.0 as f64,
35+
),
36+
SyntheticsAssertionType::STATUS_CODE,
37+
),
38+
))],
39+
"request is sent".to_string(),
40+
SyntheticsTestRequest::new()
41+
.basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
42+
SyntheticsBasicAuthWeb::new()
43+
.password("password".to_string())
44+
.username("username".to_string()),
45+
)))
46+
.method("GET".to_string())
47+
.url("https://httpbin.org/status/200".to_string()),
48+
SyntheticsAPITestStepSubtype::HTTP,
49+
))),
50+
SyntheticsAPIStep::SyntheticsAPISubtestStep(Box::new(SyntheticsAPISubtestStep::new(
51+
"subtest step".to_string(),
52+
synthetics_api_test_public_id.clone(),
53+
SyntheticsAPISubtestStepSubtype::PLAY_SUB_TEST,
54+
))),
55+
]),
56+
vec!["aws:us-east-2".to_string()],
57+
"BDD test payload: synthetics_api_test_multi_step_with_subtest.json".to_string(),
58+
"Example-Synthetic".to_string(),
59+
SyntheticsTestOptions::new().tick_every(60),
60+
SyntheticsAPITestType::API,
61+
)
62+
.subtype(SyntheticsTestDetailsSubType::MULTI);
63+
let configuration = datadog::Configuration::new();
64+
let api = SyntheticsAPI::with_config(configuration);
65+
let resp = api.create_synthetics_api_test(body).await;
66+
if let Ok(value) = resp {
67+
println!("{:#?}", value);
68+
} else {
69+
println!("{:#?}", resp.unwrap_err());
70+
}
71+
}

src/datadogV1/model/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,10 @@ pub mod model_synthetics_api_wait_step;
15461546
pub use self::model_synthetics_api_wait_step::SyntheticsAPIWaitStep;
15471547
pub mod model_synthetics_api_wait_step_subtype;
15481548
pub use self::model_synthetics_api_wait_step_subtype::SyntheticsAPIWaitStepSubtype;
1549+
pub mod model_synthetics_api_subtest_step;
1550+
pub use self::model_synthetics_api_subtest_step::SyntheticsAPISubtestStep;
1551+
pub mod model_synthetics_api_subtest_step_subtype;
1552+
pub use self::model_synthetics_api_subtest_step_subtype::SyntheticsAPISubtestStepSubtype;
15491553
pub mod model_synthetics_api_step;
15501554
pub use self::model_synthetics_api_step::SyntheticsAPIStep;
15511555
pub mod model_synthetics_api_test_type;

src/datadogV1/model/model_synthetics_api_step.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use serde::{Deserialize, Deserializer, Serialize};
1010
pub enum SyntheticsAPIStep {
1111
SyntheticsAPITestStep(Box<crate::datadogV1::model::SyntheticsAPITestStep>),
1212
SyntheticsAPIWaitStep(Box<crate::datadogV1::model::SyntheticsAPIWaitStep>),
13+
SyntheticsAPISubtestStep(Box<crate::datadogV1::model::SyntheticsAPISubtestStep>),
1314
UnparsedObject(crate::datadog::UnparsedObject),
1415
}
1516

@@ -33,6 +34,14 @@ impl<'de> Deserialize<'de> for SyntheticsAPIStep {
3334
return Ok(SyntheticsAPIStep::SyntheticsAPIWaitStep(_v));
3435
}
3536
}
37+
if let Ok(_v) = serde_json::from_value::<
38+
Box<crate::datadogV1::model::SyntheticsAPISubtestStep>,
39+
>(value.clone())
40+
{
41+
if !_v._unparsed {
42+
return Ok(SyntheticsAPIStep::SyntheticsAPISubtestStep(_v));
43+
}
44+
}
3645

3746
return Ok(SyntheticsAPIStep::UnparsedObject(
3847
crate::datadog::UnparsedObject { value },

0 commit comments

Comments
 (0)