v2_logs_custom_destinations_CreateLogsCustomDestination_1735989579/
v2_logs-custom-destinations_CreateLogsCustomDestination_1735989579.rs1use datadog_api_client::datadog;
3use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
4use datadog_api_client::datadogV2::model::CustomDestinationAttributeTagsRestrictionListType;
5use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest;
6use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes;
7use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition;
8use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
9use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationMicrosoftSentinel;
10use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationMicrosoftSentinelType;
11use datadog_api_client::datadogV2::model::CustomDestinationType;
12
13#[tokio::main]
14async fn main() {
15 let body =
16 CustomDestinationCreateRequest
17 ::new().data(
18 CustomDestinationCreateRequestDefinition::new(
19 CustomDestinationCreateRequestAttributes::new(
20 CustomDestinationForwardDestination::CustomDestinationForwardDestinationMicrosoftSentinel(
21 Box::new(
22 CustomDestinationForwardDestinationMicrosoftSentinel::new(
23 "9a2f4d83-2b5e-429e-a35a-2b3c4182db71".to_string(),
24 "https://my-dce-5kyl.eastus-1.ingest.monitor.azure.com".to_string(),
25 "dcr-000a00a000a00000a000000aa000a0aa".to_string(),
26 "Custom-MyTable".to_string(),
27 "f3c9a8a1-4c2e-4d2e-b911-9f3c28c3c8b2".to_string(),
28 CustomDestinationForwardDestinationMicrosoftSentinelType::MICROSOFT_SENTINEL,
29 ),
30 ),
31 ),
32 "Nginx logs".to_string(),
33 )
34 .enabled(false)
35 .forward_tags(false)
36 .forward_tags_restriction_list(vec!["datacenter".to_string(), "host".to_string()])
37 .forward_tags_restriction_list_type(CustomDestinationAttributeTagsRestrictionListType::ALLOW_LIST)
38 .query("source:nginx".to_string()),
39 CustomDestinationType::CUSTOM_DESTINATION,
40 ),
41 );
42 let configuration = datadog::Configuration::new();
43 let api = LogsCustomDestinationsAPI::with_config(configuration);
44 let resp = api.create_logs_custom_destination(body).await;
45 if let Ok(value) = resp {
46 println!("{:#?}", value);
47 } else {
48 println!("{:#?}", resp.unwrap_err());
49 }
50}