v1_synthetics_PatchTest/
v1_synthetics_PatchTest.rs1use datadog_api_client::datadog;
3use datadog_api_client::datadogV1::api_synthetics::SyntheticsAPI;
4use datadog_api_client::datadogV1::model::SyntheticsPatchTestBody;
5use datadog_api_client::datadogV1::model::SyntheticsPatchTestOperation;
6use datadog_api_client::datadogV1::model::SyntheticsPatchTestOperationName;
7use serde_json::Value;
8
9#[tokio::main]
10async fn main() {
11 let synthetics_api_test_public_id = std::env::var("SYNTHETICS_API_TEST_PUBLIC_ID").unwrap();
13 let body = SyntheticsPatchTestBody::new().data(vec![
14 SyntheticsPatchTestOperation::new()
15 .op(SyntheticsPatchTestOperationName::REPLACE)
16 .path("/name".to_string())
17 .value(Value::from("New test name")),
18 SyntheticsPatchTestOperation::new()
19 .op(SyntheticsPatchTestOperationName::REMOVE)
20 .path("/config/assertions/0".to_string()),
21 ]);
22 let configuration = datadog::Configuration::new();
23 let api = SyntheticsAPI::with_config(configuration);
24 let resp = api
25 .patch_test(synthetics_api_test_public_id.clone(), body)
26 .await;
27 if let Ok(value) = resp {
28 println!("{:#?}", value);
29 } else {
30 println!("{:#?}", resp.unwrap_err());
31 }
32}