Skip to content

Commit 8cd5489

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 138fc77c of spec repo
1 parent fcf212f commit 8cd5489

13 files changed

+357
-11
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": "2024-09-23 19:10:18.896643",
8-
"spec_repo_commit": "41592dc6"
7+
"regenerated": "2024-09-23 20:18:30.802349",
8+
"spec_repo_commit": "138fc77c"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-09-23 19:10:18.910900",
13-
"spec_repo_commit": "41592dc6"
12+
"regenerated": "2024-09-23 20:18:30.817643",
13+
"spec_repo_commit": "138fc77c"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19130,6 +19130,25 @@ components:
1913019130
meta:
1913119131
$ref: '#/components/schemas/ResponseMetaAttributes'
1913219132
type: object
19133+
SecurityMonitoringReferenceTable:
19134+
description: Reference table for the rule.
19135+
properties:
19136+
checkPresence:
19137+
description: Whether to include or exclude the matched values.
19138+
type: boolean
19139+
columnName:
19140+
description: The name of the column in the reference table.
19141+
type: string
19142+
logFieldPath:
19143+
description: The field in the log to match against the reference table.
19144+
type: string
19145+
ruleQueryName:
19146+
description: The name of the rule query to apply the reference table to.
19147+
type: string
19148+
tableName:
19149+
description: The name of the reference table.
19150+
type: string
19151+
type: object
1913319152
SecurityMonitoringRuleCase:
1913419153
description: Case when signal is generated.
1913519154
properties:
@@ -19635,6 +19654,11 @@ components:
1963519654
items:
1963619655
$ref: '#/components/schemas/SecurityMonitoringRuleQuery'
1963719656
type: array
19657+
referenceTables:
19658+
description: Reference tables for the rule.
19659+
items:
19660+
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
19661+
type: array
1963819662
tags:
1963919663
description: Tags for generated signals.
1964019664
items:
@@ -20339,6 +20363,11 @@ components:
2033920363
items:
2034020364
$ref: '#/components/schemas/SecurityMonitoringStandardRuleQuery'
2034120365
type: array
20366+
referenceTables:
20367+
description: Reference tables for the rule.
20368+
items:
20369+
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
20370+
type: array
2034220371
tags:
2034320372
description: Tags for generated signals.
2034420373
example:
@@ -20406,6 +20435,11 @@ components:
2040620435
items:
2040720436
$ref: '#/components/schemas/SecurityMonitoringStandardRuleQuery'
2040820437
type: array
20438+
referenceTables:
20439+
description: Reference tables for the rule.
20440+
items:
20441+
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
20442+
type: array
2040920443
tags:
2041020444
description: Tags for generated signals.
2041120445
example:
@@ -20546,6 +20580,11 @@ components:
2054620580
items:
2054720581
$ref: '#/components/schemas/SecurityMonitoringStandardRuleQuery'
2054820582
type: array
20583+
referenceTables:
20584+
description: Reference tables for the rule.
20585+
items:
20586+
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
20587+
type: array
2054920588
tags:
2055020589
description: Tags for generated signals.
2055120590
items:
@@ -20610,6 +20649,11 @@ components:
2061020649
items:
2061120650
$ref: '#/components/schemas/SecurityMonitoringStandardRuleQuery'
2061220651
type: array
20652+
referenceTables:
20653+
description: Reference tables for the rule.
20654+
items:
20655+
$ref: '#/components/schemas/SecurityMonitoringReferenceTable'
20656+
type: array
2061320657
tags:
2061420658
description: Tags for generated signals.
2061520659
example:

examples/v2_security-monitoring_CreateSecurityMonitoringRule.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Create a detection rule returns "OK" response
22
use datadog_api_client::datadog;
33
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
4+
use datadog_api_client::datadogV2::model::SecurityMonitoringReferenceTable;
45
use datadog_api_client::datadogV2::model::SecurityMonitoringRuleCaseCreate;
56
use datadog_api_client::datadogV2::model::SecurityMonitoringRuleCreatePayload;
67
use datadog_api_client::datadogV2::model::SecurityMonitoringRuleEvaluationWindow;
@@ -39,6 +40,12 @@ async fn main() {
3940
.query("@test:true".to_string())],
4041
)
4142
.filters(vec![])
43+
.reference_tables(vec![SecurityMonitoringReferenceTable::new()
44+
.check_presence(true)
45+
.column_name("value".to_string())
46+
.log_field_path("testtag".to_string())
47+
.rule_query_name("a".to_string())
48+
.table_name("synthetics_test_reference_table_dont_delete".to_string())])
4249
.tags(vec![])
4350
.type_(SecurityMonitoringRuleTypeCreate::LOG_DETECTION),
4451
));

src/datadogV2/model/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,6 +2438,8 @@ pub mod model_security_monitoring_standard_rule_query;
24382438
pub use self::model_security_monitoring_standard_rule_query::SecurityMonitoringStandardRuleQuery;
24392439
pub mod model_security_monitoring_rule_query_aggregation;
24402440
pub use self::model_security_monitoring_rule_query_aggregation::SecurityMonitoringRuleQueryAggregation;
2441+
pub mod model_security_monitoring_reference_table;
2442+
pub use self::model_security_monitoring_reference_table::SecurityMonitoringReferenceTable;
24412443
pub mod model_security_monitoring_third_party_rule_case;
24422444
pub use self::model_security_monitoring_third_party_rule_case::SecurityMonitoringThirdPartyRuleCase;
24432445
pub mod model_security_monitoring_rule_type_read;
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
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+
/// Reference table for the rule.
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct SecurityMonitoringReferenceTable {
14+
/// Whether to include or exclude the matched values.
15+
#[serde(rename = "checkPresence")]
16+
pub check_presence: Option<bool>,
17+
/// The name of the column in the reference table.
18+
#[serde(rename = "columnName")]
19+
pub column_name: Option<String>,
20+
/// The field in the log to match against the reference table.
21+
#[serde(rename = "logFieldPath")]
22+
pub log_field_path: Option<String>,
23+
/// The name of the rule query to apply the reference table to.
24+
#[serde(rename = "ruleQueryName")]
25+
pub rule_query_name: Option<String>,
26+
/// The name of the reference table.
27+
#[serde(rename = "tableName")]
28+
pub table_name: Option<String>,
29+
#[serde(flatten)]
30+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
31+
#[serde(skip)]
32+
#[serde(default)]
33+
pub(crate) _unparsed: bool,
34+
}
35+
36+
impl SecurityMonitoringReferenceTable {
37+
pub fn new() -> SecurityMonitoringReferenceTable {
38+
SecurityMonitoringReferenceTable {
39+
check_presence: None,
40+
column_name: None,
41+
log_field_path: None,
42+
rule_query_name: None,
43+
table_name: None,
44+
additional_properties: std::collections::BTreeMap::new(),
45+
_unparsed: false,
46+
}
47+
}
48+
49+
pub fn check_presence(mut self, value: bool) -> Self {
50+
self.check_presence = Some(value);
51+
self
52+
}
53+
54+
pub fn column_name(mut self, value: String) -> Self {
55+
self.column_name = Some(value);
56+
self
57+
}
58+
59+
pub fn log_field_path(mut self, value: String) -> Self {
60+
self.log_field_path = Some(value);
61+
self
62+
}
63+
64+
pub fn rule_query_name(mut self, value: String) -> Self {
65+
self.rule_query_name = Some(value);
66+
self
67+
}
68+
69+
pub fn table_name(mut self, value: String) -> Self {
70+
self.table_name = Some(value);
71+
self
72+
}
73+
74+
pub fn additional_properties(
75+
mut self,
76+
value: std::collections::BTreeMap<String, serde_json::Value>,
77+
) -> Self {
78+
self.additional_properties = value;
79+
self
80+
}
81+
}
82+
83+
impl Default for SecurityMonitoringReferenceTable {
84+
fn default() -> Self {
85+
Self::new()
86+
}
87+
}
88+
89+
impl<'de> Deserialize<'de> for SecurityMonitoringReferenceTable {
90+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
91+
where
92+
D: Deserializer<'de>,
93+
{
94+
struct SecurityMonitoringReferenceTableVisitor;
95+
impl<'a> Visitor<'a> for SecurityMonitoringReferenceTableVisitor {
96+
type Value = SecurityMonitoringReferenceTable;
97+
98+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
99+
f.write_str("a mapping")
100+
}
101+
102+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
103+
where
104+
M: MapAccess<'a>,
105+
{
106+
let mut check_presence: Option<bool> = None;
107+
let mut column_name: Option<String> = None;
108+
let mut log_field_path: Option<String> = None;
109+
let mut rule_query_name: Option<String> = None;
110+
let mut table_name: Option<String> = None;
111+
let mut additional_properties: std::collections::BTreeMap<
112+
String,
113+
serde_json::Value,
114+
> = std::collections::BTreeMap::new();
115+
let mut _unparsed = false;
116+
117+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
118+
match k.as_str() {
119+
"checkPresence" => {
120+
if v.is_null() {
121+
continue;
122+
}
123+
check_presence =
124+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
125+
}
126+
"columnName" => {
127+
if v.is_null() {
128+
continue;
129+
}
130+
column_name =
131+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
132+
}
133+
"logFieldPath" => {
134+
if v.is_null() {
135+
continue;
136+
}
137+
log_field_path =
138+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
139+
}
140+
"ruleQueryName" => {
141+
if v.is_null() {
142+
continue;
143+
}
144+
rule_query_name =
145+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
146+
}
147+
"tableName" => {
148+
if v.is_null() {
149+
continue;
150+
}
151+
table_name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
152+
}
153+
&_ => {
154+
if let Ok(value) = serde_json::from_value(v.clone()) {
155+
additional_properties.insert(k, value);
156+
}
157+
}
158+
}
159+
}
160+
161+
let content = SecurityMonitoringReferenceTable {
162+
check_presence,
163+
column_name,
164+
log_field_path,
165+
rule_query_name,
166+
table_name,
167+
additional_properties,
168+
_unparsed,
169+
};
170+
171+
Ok(content)
172+
}
173+
}
174+
175+
deserializer.deserialize_any(SecurityMonitoringReferenceTableVisitor)
176+
}
177+
}

src/datadogV2/model/model_security_monitoring_rule_update_payload.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ pub struct SecurityMonitoringRuleUpdatePayload {
3939
/// Queries for selecting logs which are part of the rule.
4040
#[serde(rename = "queries")]
4141
pub queries: Option<Vec<crate::datadogV2::model::SecurityMonitoringRuleQuery>>,
42+
/// Reference tables for the rule.
43+
#[serde(rename = "referenceTables")]
44+
pub reference_tables: Option<Vec<crate::datadogV2::model::SecurityMonitoringReferenceTable>>,
4245
/// Tags for generated signals.
4346
#[serde(rename = "tags")]
4447
pub tags: Option<Vec<String>>,
@@ -68,6 +71,7 @@ impl SecurityMonitoringRuleUpdatePayload {
6871
name: None,
6972
options: None,
7073
queries: None,
74+
reference_tables: None,
7175
tags: None,
7276
third_party_cases: None,
7377
version: None,
@@ -136,6 +140,14 @@ impl SecurityMonitoringRuleUpdatePayload {
136140
self
137141
}
138142

143+
pub fn reference_tables(
144+
mut self,
145+
value: Vec<crate::datadogV2::model::SecurityMonitoringReferenceTable>,
146+
) -> Self {
147+
self.reference_tables = Some(value);
148+
self
149+
}
150+
139151
pub fn tags(mut self, value: Vec<String>) -> Self {
140152
self.tags = Some(value);
141153
self
@@ -201,6 +213,9 @@ impl<'de> Deserialize<'de> for SecurityMonitoringRuleUpdatePayload {
201213
None;
202214
let mut queries: Option<Vec<crate::datadogV2::model::SecurityMonitoringRuleQuery>> =
203215
None;
216+
let mut reference_tables: Option<
217+
Vec<crate::datadogV2::model::SecurityMonitoringReferenceTable>,
218+
> = None;
204219
let mut tags: Option<Vec<String>> = None;
205220
let mut third_party_cases: Option<
206221
Vec<crate::datadogV2::model::SecurityMonitoringThirdPartyRuleCase>,
@@ -270,6 +285,13 @@ impl<'de> Deserialize<'de> for SecurityMonitoringRuleUpdatePayload {
270285
}
271286
queries = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
272287
}
288+
"referenceTables" => {
289+
if v.is_null() {
290+
continue;
291+
}
292+
reference_tables =
293+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
294+
}
273295
"tags" => {
274296
if v.is_null() {
275297
continue;
@@ -307,6 +329,7 @@ impl<'de> Deserialize<'de> for SecurityMonitoringRuleUpdatePayload {
307329
name,
308330
options,
309331
queries,
332+
reference_tables,
310333
tags,
311334
third_party_cases,
312335
version,

0 commit comments

Comments
 (0)