v2_gcp_integration_CreateGCPSTSAccount_109518525/
v2_gcp-integration_CreateGCPSTSAccount_109518525.rs

1// Create a new entry for your service account with account_tags returns "OK"
2// response
3use datadog_api_client::datadog;
4use datadog_api_client::datadogV2::api_gcp_integration::GCPIntegrationAPI;
5use datadog_api_client::datadogV2::model::GCPSTSServiceAccountAttributes;
6use datadog_api_client::datadogV2::model::GCPSTSServiceAccountCreateRequest;
7use datadog_api_client::datadogV2::model::GCPSTSServiceAccountData;
8use datadog_api_client::datadogV2::model::GCPServiceAccountType;
9
10#[tokio::main]
11async fn main() {
12    let body = GCPSTSServiceAccountCreateRequest::new().data(
13        GCPSTSServiceAccountData::new()
14            .attributes(
15                GCPSTSServiceAccountAttributes::new()
16                    .account_tags(vec!["lorem".to_string(), "ipsum".to_string()])
17                    .client_email(
18                        "Test-252bf553ef04b351@test-project.iam.gserviceaccount.com".to_string(),
19                    )
20                    .host_filters(vec![]),
21            )
22            .type_(GCPServiceAccountType::GCP_SERVICE_ACCOUNT),
23    );
24    let configuration = datadog::Configuration::new();
25    let api = GCPIntegrationAPI::with_config(configuration);
26    let resp = api.create_gcpsts_account(body).await;
27    if let Ok(value) = resp {
28        println!("{:#?}", value);
29    } else {
30        println!("{:#?}", resp.unwrap_err());
31    }
32}