v2_confluent_cloud_CreateConfluentAccount/
v2_confluent-cloud_CreateConfluentAccount.rs

1// Add Confluent account returns "OK" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_confluent_cloud::ConfluentCloudAPI;
4use datadog_api_client::datadogV2::model::ConfluentAccountCreateRequest;
5use datadog_api_client::datadogV2::model::ConfluentAccountCreateRequestAttributes;
6use datadog_api_client::datadogV2::model::ConfluentAccountCreateRequestData;
7use datadog_api_client::datadogV2::model::ConfluentAccountResourceAttributes;
8use datadog_api_client::datadogV2::model::ConfluentAccountType;
9
10#[tokio::main]
11async fn main() {
12    let body = ConfluentAccountCreateRequest::new(ConfluentAccountCreateRequestData::new(
13        ConfluentAccountCreateRequestAttributes::new(
14            "TESTAPIKEY123".to_string(),
15            "test-api-secret-123".to_string(),
16        )
17        .resources(vec![ConfluentAccountResourceAttributes::new(
18            "kafka".to_string(),
19        )
20        .enable_custom_metrics(false)
21        .id("resource-id-123".to_string())
22        .tags(vec!["myTag".to_string(), "myTag2:myValue".to_string()])])
23        .tags(vec!["myTag".to_string(), "myTag2:myValue".to_string()]),
24        ConfluentAccountType::CONFLUENT_CLOUD_ACCOUNTS,
25    ));
26    let configuration = datadog::Configuration::new();
27    let api = ConfluentCloudAPI::with_config(configuration);
28    let resp = api.create_confluent_account(body).await;
29    if let Ok(value) = resp {
30        println!("{:#?}", value);
31    } else {
32        println!("{:#?}", resp.unwrap_err());
33    }
34}