Skip to content

Commit 4290115

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Microsoft Sentinel Public API support (#729)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent b7344d4 commit 4290115

13 files changed

+684
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-06-23 07:59:26.601798",
8-
"spec_repo_commit": "74866a53"
7+
"regenerated": "2025-06-23 13:26:50.467749",
8+
"spec_repo_commit": "2e491415"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-06-23 07:59:26.619809",
13-
"spec_repo_commit": "74866a53"
12+
"regenerated": "2025-06-23 13:26:50.483970",
13+
"spec_repo_commit": "2e491415"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10590,6 +10590,7 @@ components:
1059010590
- $ref: '#/components/schemas/CustomDestinationForwardDestinationHttp'
1059110591
- $ref: '#/components/schemas/CustomDestinationForwardDestinationSplunk'
1059210592
- $ref: '#/components/schemas/CustomDestinationForwardDestinationElasticsearch'
10593+
- $ref: '#/components/schemas/CustomDestinationForwardDestinationMicrosoftSentinel'
1059310594
CustomDestinationForwardDestinationElasticsearch:
1059410595
description: The Elasticsearch destination.
1059510596
properties:
@@ -10674,6 +10675,49 @@ components:
1067410675
type: string
1067510676
x-enum-varnames:
1067610677
- HTTP
10678+
CustomDestinationForwardDestinationMicrosoftSentinel:
10679+
description: The Microsoft Sentinel destination.
10680+
properties:
10681+
client_id:
10682+
description: Client ID from the Datadog Azure integration.
10683+
example: 9a2f4d83-2b5e-429e-a35a-2b3c4182db71
10684+
type: string
10685+
data_collection_endpoint:
10686+
description: Azure data collection endpoint.
10687+
example: https://my-dce-5kyl.eastus-1.ingest.monitor.azure.com
10688+
type: string
10689+
data_collection_rule_id:
10690+
description: Azure data collection rule ID.
10691+
example: dcr-000a00a000a00000a000000aa000a0aa
10692+
type: string
10693+
stream_name:
10694+
description: Azure stream name.
10695+
example: Custom-MyTable
10696+
type: string
10697+
writeOnly: true
10698+
tenant_id:
10699+
description: Tenant ID from the Datadog Azure integration.
10700+
example: f3c9a8a1-4c2e-4d2e-b911-9f3c28c3c8b2
10701+
type: string
10702+
type:
10703+
$ref: '#/components/schemas/CustomDestinationForwardDestinationMicrosoftSentinelType'
10704+
required:
10705+
- type
10706+
- tenant_id
10707+
- client_id
10708+
- data_collection_endpoint
10709+
- data_collection_rule_id
10710+
- stream_name
10711+
type: object
10712+
CustomDestinationForwardDestinationMicrosoftSentinelType:
10713+
default: microsoft_sentinel
10714+
description: Type of the Microsoft Sentinel destination.
10715+
enum:
10716+
- microsoft_sentinel
10717+
example: microsoft_sentinel
10718+
type: string
10719+
x-enum-varnames:
10720+
- MICROSOFT_SENTINEL
1067710721
CustomDestinationForwardDestinationSplunk:
1067810722
description: The Splunk HTTP Event Collector (HEC) destination.
1067910723
properties:
@@ -10849,6 +10893,7 @@ components:
1084910893
- $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationHttp'
1085010894
- $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationSplunk'
1085110895
- $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationElasticsearch'
10896+
- $ref: '#/components/schemas/CustomDestinationResponseForwardDestinationMicrosoftSentinel'
1085210897
CustomDestinationResponseForwardDestinationElasticsearch:
1085310898
description: The Elasticsearch destination.
1085410899
properties:
@@ -10933,6 +10978,49 @@ components:
1093310978
type: string
1093410979
x-enum-varnames:
1093510980
- HTTP
10981+
CustomDestinationResponseForwardDestinationMicrosoftSentinel:
10982+
description: The Microsoft Sentinel destination.
10983+
properties:
10984+
client_id:
10985+
description: Client ID from the Datadog Azure integration.
10986+
example: 9a2f4d83-2b5e-429e-a35a-2b3c4182db71
10987+
type: string
10988+
data_collection_endpoint:
10989+
description: Azure data collection endpoint.
10990+
example: https://my-dce-5kyl.eastus-1.ingest.monitor.azure.com
10991+
type: string
10992+
data_collection_rule_id:
10993+
description: Azure data collection rule ID.
10994+
example: dcr-000a00a000a00000a000000aa000a0aa
10995+
type: string
10996+
stream_name:
10997+
description: Azure stream name.
10998+
example: Custom-MyTable
10999+
type: string
11000+
writeOnly: true
11001+
tenant_id:
11002+
description: Tenant ID from the Datadog Azure integration.
11003+
example: f3c9a8a1-4c2e-4d2e-b911-9f3c28c3c8b2
11004+
type: string
11005+
type:
11006+
$ref: '#/components/schemas/CustomDestinationResponseForwardDestinationMicrosoftSentinelType'
11007+
required:
11008+
- type
11009+
- tenant_id
11010+
- client_id
11011+
- data_collection_endpoint
11012+
- data_collection_rule_id
11013+
- stream_name
11014+
type: object
11015+
CustomDestinationResponseForwardDestinationMicrosoftSentinelType:
11016+
default: microsoft_sentinel
11017+
description: Type of the Microsoft Sentinel destination.
11018+
enum:
11019+
- microsoft_sentinel
11020+
example: microsoft_sentinel
11021+
type: string
11022+
x-enum-varnames:
11023+
- MICROSOFT_SENTINEL
1093611024
CustomDestinationResponseForwardDestinationSplunk:
1093711025
description: The Splunk HTTP Event Collector (HEC) destination.
1093811026
properties:
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Create a Microsoft Sentinel custom destination returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI;
4+
use datadog_api_client::datadogV2::model::CustomDestinationAttributeTagsRestrictionListType;
5+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest;
6+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes;
7+
use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition;
8+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination;
9+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationMicrosoftSentinel;
10+
use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationMicrosoftSentinelType;
11+
use datadog_api_client::datadogV2::model::CustomDestinationType;
12+
13+
#[tokio::main]
14+
async 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+
}

src/datadogV2/model/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,10 @@ pub mod model_custom_destination_response_forward_destination_elasticsearch;
22722272
pub use self::model_custom_destination_response_forward_destination_elasticsearch::CustomDestinationResponseForwardDestinationElasticsearch;
22732273
pub mod model_custom_destination_response_forward_destination_elasticsearch_type;
22742274
pub use self::model_custom_destination_response_forward_destination_elasticsearch_type::CustomDestinationResponseForwardDestinationElasticsearchType;
2275+
pub mod model_custom_destination_response_forward_destination_microsoft_sentinel;
2276+
pub use self::model_custom_destination_response_forward_destination_microsoft_sentinel::CustomDestinationResponseForwardDestinationMicrosoftSentinel;
2277+
pub mod model_custom_destination_response_forward_destination_microsoft_sentinel_type;
2278+
pub use self::model_custom_destination_response_forward_destination_microsoft_sentinel_type::CustomDestinationResponseForwardDestinationMicrosoftSentinelType;
22752279
pub mod model_custom_destination_response_forward_destination;
22762280
pub use self::model_custom_destination_response_forward_destination::CustomDestinationResponseForwardDestination;
22772281
pub mod model_custom_destination_type;
@@ -2306,6 +2310,10 @@ pub mod model_custom_destination_elasticsearch_destination_auth;
23062310
pub use self::model_custom_destination_elasticsearch_destination_auth::CustomDestinationElasticsearchDestinationAuth;
23072311
pub mod model_custom_destination_forward_destination_elasticsearch_type;
23082312
pub use self::model_custom_destination_forward_destination_elasticsearch_type::CustomDestinationForwardDestinationElasticsearchType;
2313+
pub mod model_custom_destination_forward_destination_microsoft_sentinel;
2314+
pub use self::model_custom_destination_forward_destination_microsoft_sentinel::CustomDestinationForwardDestinationMicrosoftSentinel;
2315+
pub mod model_custom_destination_forward_destination_microsoft_sentinel_type;
2316+
pub use self::model_custom_destination_forward_destination_microsoft_sentinel_type::CustomDestinationForwardDestinationMicrosoftSentinelType;
23092317
pub mod model_custom_destination_forward_destination;
23102318
pub use self::model_custom_destination_forward_destination::CustomDestinationForwardDestination;
23112319
pub mod model_custom_destination_response;

src/datadogV2/model/model_custom_destination_forward_destination.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ pub enum CustomDestinationForwardDestination {
1717
CustomDestinationForwardDestinationElasticsearch(
1818
Box<crate::datadogV2::model::CustomDestinationForwardDestinationElasticsearch>,
1919
),
20+
CustomDestinationForwardDestinationMicrosoftSentinel(
21+
Box<crate::datadogV2::model::CustomDestinationForwardDestinationMicrosoftSentinel>,
22+
),
2023
UnparsedObject(crate::datadog::UnparsedObject),
2124
}
2225

@@ -58,6 +61,14 @@ impl<'de> Deserialize<'de> for CustomDestinationForwardDestination {
5861
return Ok(CustomDestinationForwardDestination::CustomDestinationForwardDestinationElasticsearch(_v));
5962
}
6063
}
64+
if let Ok(_v) = serde_json::from_value::<
65+
Box<crate::datadogV2::model::CustomDestinationForwardDestinationMicrosoftSentinel>,
66+
>(value.clone())
67+
{
68+
if !_v._unparsed {
69+
return Ok(CustomDestinationForwardDestination::CustomDestinationForwardDestinationMicrosoftSentinel(_v));
70+
}
71+
}
6172

6273
return Ok(CustomDestinationForwardDestination::UnparsedObject(
6374
crate::datadog::UnparsedObject { value },
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
use serde::de::{Error, MapAccess, Visitor};
5+
use serde::{Deserialize, Deserializer, Serialize};
6+
use serde_with::skip_serializing_none;
7+
use std::fmt::{self, Formatter};
8+
9+
/// The Microsoft Sentinel destination.
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct CustomDestinationForwardDestinationMicrosoftSentinel {
14+
/// Client ID from the Datadog Azure integration.
15+
#[serde(rename = "client_id")]
16+
pub client_id: String,
17+
/// Azure data collection endpoint.
18+
#[serde(rename = "data_collection_endpoint")]
19+
pub data_collection_endpoint: String,
20+
/// Azure data collection rule ID.
21+
#[serde(rename = "data_collection_rule_id")]
22+
pub data_collection_rule_id: String,
23+
/// Azure stream name.
24+
#[serde(rename = "stream_name")]
25+
pub stream_name: String,
26+
/// Tenant ID from the Datadog Azure integration.
27+
#[serde(rename = "tenant_id")]
28+
pub tenant_id: String,
29+
/// Type of the Microsoft Sentinel destination.
30+
#[serde(rename = "type")]
31+
pub type_: crate::datadogV2::model::CustomDestinationForwardDestinationMicrosoftSentinelType,
32+
#[serde(flatten)]
33+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
34+
#[serde(skip)]
35+
#[serde(default)]
36+
pub(crate) _unparsed: bool,
37+
}
38+
39+
impl CustomDestinationForwardDestinationMicrosoftSentinel {
40+
pub fn new(
41+
client_id: String,
42+
data_collection_endpoint: String,
43+
data_collection_rule_id: String,
44+
stream_name: String,
45+
tenant_id: String,
46+
type_: crate::datadogV2::model::CustomDestinationForwardDestinationMicrosoftSentinelType,
47+
) -> CustomDestinationForwardDestinationMicrosoftSentinel {
48+
CustomDestinationForwardDestinationMicrosoftSentinel {
49+
client_id,
50+
data_collection_endpoint,
51+
data_collection_rule_id,
52+
stream_name,
53+
tenant_id,
54+
type_,
55+
additional_properties: std::collections::BTreeMap::new(),
56+
_unparsed: false,
57+
}
58+
}
59+
60+
pub fn additional_properties(
61+
mut self,
62+
value: std::collections::BTreeMap<String, serde_json::Value>,
63+
) -> Self {
64+
self.additional_properties = value;
65+
self
66+
}
67+
}
68+
69+
impl<'de> Deserialize<'de> for CustomDestinationForwardDestinationMicrosoftSentinel {
70+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
71+
where
72+
D: Deserializer<'de>,
73+
{
74+
struct CustomDestinationForwardDestinationMicrosoftSentinelVisitor;
75+
impl<'a> Visitor<'a> for CustomDestinationForwardDestinationMicrosoftSentinelVisitor {
76+
type Value = CustomDestinationForwardDestinationMicrosoftSentinel;
77+
78+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
79+
f.write_str("a mapping")
80+
}
81+
82+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
83+
where
84+
M: MapAccess<'a>,
85+
{
86+
let mut client_id: Option<String> = None;
87+
let mut data_collection_endpoint: Option<String> = None;
88+
let mut data_collection_rule_id: Option<String> = None;
89+
let mut stream_name: Option<String> = None;
90+
let mut tenant_id: Option<String> = None;
91+
let mut type_: Option<crate::datadogV2::model::CustomDestinationForwardDestinationMicrosoftSentinelType> = None;
92+
let mut additional_properties: std::collections::BTreeMap<
93+
String,
94+
serde_json::Value,
95+
> = std::collections::BTreeMap::new();
96+
let mut _unparsed = false;
97+
98+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
99+
match k.as_str() {
100+
"client_id" => {
101+
client_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
102+
}
103+
"data_collection_endpoint" => {
104+
data_collection_endpoint =
105+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
106+
}
107+
"data_collection_rule_id" => {
108+
data_collection_rule_id =
109+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
110+
}
111+
"stream_name" => {
112+
stream_name =
113+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
114+
}
115+
"tenant_id" => {
116+
tenant_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
117+
}
118+
"type" => {
119+
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
120+
if let Some(ref _type_) = type_ {
121+
match _type_ {
122+
crate::datadogV2::model::CustomDestinationForwardDestinationMicrosoftSentinelType::UnparsedObject(_type_) => {
123+
_unparsed = true;
124+
},
125+
_ => {}
126+
}
127+
}
128+
}
129+
&_ => {
130+
if let Ok(value) = serde_json::from_value(v.clone()) {
131+
additional_properties.insert(k, value);
132+
}
133+
}
134+
}
135+
}
136+
let client_id = client_id.ok_or_else(|| M::Error::missing_field("client_id"))?;
137+
let data_collection_endpoint = data_collection_endpoint
138+
.ok_or_else(|| M::Error::missing_field("data_collection_endpoint"))?;
139+
let data_collection_rule_id = data_collection_rule_id
140+
.ok_or_else(|| M::Error::missing_field("data_collection_rule_id"))?;
141+
let stream_name =
142+
stream_name.ok_or_else(|| M::Error::missing_field("stream_name"))?;
143+
let tenant_id = tenant_id.ok_or_else(|| M::Error::missing_field("tenant_id"))?;
144+
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
145+
146+
let content = CustomDestinationForwardDestinationMicrosoftSentinel {
147+
client_id,
148+
data_collection_endpoint,
149+
data_collection_rule_id,
150+
stream_name,
151+
tenant_id,
152+
type_,
153+
additional_properties,
154+
_unparsed,
155+
};
156+
157+
Ok(content)
158+
}
159+
}
160+
161+
deserializer.deserialize_any(CustomDestinationForwardDestinationMicrosoftSentinelVisitor)
162+
}
163+
}

0 commit comments

Comments
 (0)