v1_synthetics_UpdateMobileTest/
v1_synthetics_UpdateMobileTest.rs

1// Edit a Mobile test returns "OK" 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    // there is a valid "synthetics_mobile_test" in the system
15    let synthetics_mobile_test_public_id =
16        std::env::var("SYNTHETICS_MOBILE_TEST_PUBLIC_ID").unwrap();
17    let body = SyntheticsMobileTest::new(
18        SyntheticsMobileTestConfig::new().variables(vec![]),
19        "".to_string(),
20        "Example-Synthetic-updated".to_string(),
21        SyntheticsMobileTestOptions::new(
22            vec!["synthetics:mobile:device:iphone_15_ios_17".to_string()],
23            SyntheticsMobileTestsMobileApplication::new(
24                "ab0e0aed-536d-411a-9a99-5428c27d8f8e".to_string(),
25                "6115922a-5f5d-455e-bc7e-7955a57f3815".to_string(),
26                SyntheticsMobileTestsMobileApplicationReferenceType::VERSION,
27            ),
28            3600,
29        ),
30        SyntheticsMobileTestType::MOBILE,
31    )
32    .status(SyntheticsTestPauseStatus::PAUSED)
33    .steps(vec![]);
34    let configuration = datadog::Configuration::new();
35    let api = SyntheticsAPI::with_config(configuration);
36    let resp = api
37        .update_mobile_test(synthetics_mobile_test_public_id.clone(), body)
38        .await;
39    if let Ok(value) = resp {
40        println!("{:#?}", value);
41    } else {
42        println!("{:#?}", resp.unwrap_err());
43    }
44}