v2_gcp_integration_CreateGCPSTSAccount/
v2_gcp-integration_CreateGCPSTSAccount.rs

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