v1_aws_integration_CreateNewAWSExternalID/
v1_aws-integration_CreateNewAWSExternalID.rs

1// Generate a new external ID returns "OK" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV1::api_aws_integration::AWSIntegrationAPI;
4use datadog_api_client::datadogV1::model::AWSAccount;
5use std::collections::BTreeMap;
6
7#[tokio::main]
8async fn main() {
9    let body = AWSAccount::new()
10        .account_id("123456789012".to_string())
11        .account_specific_namespace_rules(BTreeMap::from([
12            ("auto_scaling".to_string(), false),
13            ("opswork".to_string(), false),
14        ]))
15        .cspm_resource_collection_enabled(true)
16        .excluded_regions(vec!["us-east-1".to_string(), "us-west-2".to_string()])
17        .extended_resource_collection_enabled(true)
18        .filter_tags(vec!["$KEY:$VALUE".to_string()])
19        .host_tags(vec!["$KEY:$VALUE".to_string()])
20        .metrics_collection_enabled(false)
21        .resource_collection_enabled(true)
22        .role_name("DatadogAWSIntegrationRole".to_string());
23    let configuration = datadog::Configuration::new();
24    let api = AWSIntegrationAPI::with_config(configuration);
25    let resp = api.create_new_aws_external_id(body).await;
26    if let Ok(value) = resp {
27        println!("{:#?}", value);
28    } else {
29        println!("{:#?}", resp.unwrap_err());
30    }
31}