v2_security_monitoring_UpdateCustomFramework/
v2_security-monitoring_UpdateCustomFramework.rs

1// Update a custom framework returns "OK" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
4use datadog_api_client::datadogV2::model::CustomFrameworkControl;
5use datadog_api_client::datadogV2::model::CustomFrameworkData;
6use datadog_api_client::datadogV2::model::CustomFrameworkDataAttributes;
7use datadog_api_client::datadogV2::model::CustomFrameworkRequirement;
8use datadog_api_client::datadogV2::model::CustomFrameworkType;
9use datadog_api_client::datadogV2::model::UpdateCustomFrameworkRequest;
10
11#[tokio::main]
12async fn main() {
13    let body = UpdateCustomFrameworkRequest::new(CustomFrameworkData::new(
14        CustomFrameworkDataAttributes::new(
15            "create-framework-new".to_string(),
16            "name".to_string(),
17            vec![CustomFrameworkRequirement::new(
18                vec![CustomFrameworkControl::new(
19                    "control".to_string(),
20                    vec!["def-000-be9".to_string()],
21                )],
22                "requirement".to_string(),
23            )],
24            "10".to_string(),
25        )
26        .icon_url("test-url".to_string()),
27        CustomFrameworkType::CUSTOM_FRAMEWORK,
28    ));
29    let configuration = datadog::Configuration::new();
30    let api = SecurityMonitoringAPI::with_config(configuration);
31    let resp = api
32        .update_custom_framework("create-framework-new".to_string(), "10".to_string(), body)
33        .await;
34    if let Ok(value) = resp {
35        println!("{:#?}", value);
36    } else {
37        println!("{:#?}", resp.unwrap_err());
38    }
39}