v1_synthetics_CreateSyntheticsMobileTest/
v1_synthetics_CreateSyntheticsMobileTest.rs

1// Create a mobile test returns "OK - Returns the created test details." response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV1::api_synthetics::SyntheticsAPI;
4use datadog_api_client::datadogV1::model::SyntheticsMobileTest;
5use datadog_api_client::datadogV1::model::SyntheticsMobileTestConfig;
6use datadog_api_client::datadogV1::model::SyntheticsMobileTestOptions;
7use datadog_api_client::datadogV1::model::SyntheticsMobileTestType;
8use datadog_api_client::datadogV1::model::SyntheticsMobileTestsMobileApplication;
9use datadog_api_client::datadogV1::model::SyntheticsMobileTestsMobileApplicationReferenceType;
10use datadog_api_client::datadogV1::model::SyntheticsTestPauseStatus;
11
12#[tokio::main]
13async fn main() {
14    let body = SyntheticsMobileTest::new(
15        SyntheticsMobileTestConfig::new().variables(vec![]),
16        "".to_string(),
17        "Example-Synthetic".to_string(),
18        SyntheticsMobileTestOptions::new(
19            vec!["synthetics:mobile:device:iphone_15_ios_17".to_string()],
20            SyntheticsMobileTestsMobileApplication::new(
21                "ab0e0aed-536d-411a-9a99-5428c27d8f8e".to_string(),
22                "6115922a-5f5d-455e-bc7e-7955a57f3815".to_string(),
23                SyntheticsMobileTestsMobileApplicationReferenceType::VERSION,
24            ),
25            3600,
26        ),
27        SyntheticsMobileTestType::MOBILE,
28    )
29    .status(SyntheticsTestPauseStatus::PAUSED)
30    .steps(vec![]);
31    let configuration = datadog::Configuration::new();
32    let api = SyntheticsAPI::with_config(configuration);
33    let resp = api.create_synthetics_mobile_test(body).await;
34    if let Ok(value) = resp {
35        println!("{:#?}", value);
36    } else {
37        println!("{:#?}", resp.unwrap_err());
38    }
39}