v1_gcp_integration_CreateGCPIntegration/
v1_gcp-integration_CreateGCPIntegration.rs

1// Create a GCP integration returns "OK" response
2use datadog_api_client::datadog;
3use datadog_api_client::datadogV1::api_gcp_integration::GCPIntegrationAPI;
4use datadog_api_client::datadogV1::model::GCPAccount;
5
6#[tokio::main]
7async fn main() {
8    let body = GCPAccount::new()
9        .auth_provider_x509_cert_url("https://www.googleapis.com/oauth2/v1/certs".to_string())
10        .auth_uri("https://accounts.google.com/o/oauth2/auth".to_string())
11        .client_email("252bf553ef04b351@example.com".to_string())
12        .client_id("163662907116366290710".to_string())
13        .client_x509_cert_url(
14            "https://www.googleapis.com/robot/v1/metadata/x509/$CLIENT_EMAIL".to_string(),
15        )
16        .cloud_run_revision_filters(vec!["dr:dre".to_string()])
17        .host_filters("key:value,filter:example".to_string())
18        .is_cspm_enabled(true)
19        .is_resource_change_collection_enabled(true)
20        .is_security_command_center_enabled(true)
21        .private_key("private_key".to_string())
22        .private_key_id("123456789abcdefghi123456789abcdefghijklm".to_string())
23        .project_id("datadog-apitest".to_string())
24        .resource_collection_enabled(true)
25        .token_uri("https://accounts.google.com/o/oauth2/token".to_string())
26        .type_("service_account".to_string());
27    let configuration = datadog::Configuration::new();
28    let api = GCPIntegrationAPI::with_config(configuration);
29    let resp = api.create_gcp_integration(body).await;
30    if let Ok(value) = resp {
31        println!("{:#?}", value);
32    } else {
33        println!("{:#?}", resp.unwrap_err());
34    }
35}