Skip to content

Commit a601848

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 8f16f04b of spec repo
1 parent 5d9c95a commit a601848

File tree

7 files changed

+150
-4
lines changed

7 files changed

+150
-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": "2024-10-07 14:32:07.351355",
8-
"spec_repo_commit": "ef7c2778"
7+
"regenerated": "2024-10-07 15:40:46.984706",
8+
"spec_repo_commit": "8f16f04b"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-07 14:32:07.365583",
13-
"spec_repo_commit": "ef7c2778"
12+
"regenerated": "2024-10-07 15:40:46.999308",
13+
"spec_repo_commit": "8f16f04b"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9230,6 +9230,8 @@ components:
92309230
$ref: '#/components/schemas/FindingStatus'
92319231
tags:
92329232
$ref: '#/components/schemas/FindingTags'
9233+
vulnerability_type:
9234+
$ref: '#/components/schemas/FindingVulnerabilityType'
92339235
type: object
92349236
FindingEvaluation:
92359237
description: The evaluation of the finding.
@@ -9363,6 +9365,20 @@ components:
93639365
type: string
93649366
x-enum-varnames:
93659367
- FINDING
9368+
FindingVulnerabilityType:
9369+
description: The vulnerability type of the finding.
9370+
enum:
9371+
- misconfiguration
9372+
- attack_path
9373+
- identity_risk
9374+
- api_security
9375+
example: misconfiguration
9376+
type: string
9377+
x-enum-varnames:
9378+
- MISCONFIGURATION
9379+
- ATTACK_PATH
9380+
- IDENTITY_RISK
9381+
- API_SECURITY
93669382
FormulaLimit:
93679383
description: 'Message for specifying limits to the number of values returned
93689384
by a query.
@@ -34371,6 +34387,16 @@ paths:
3437134387
required: false
3437234388
schema:
3437334389
$ref: '#/components/schemas/FindingStatus'
34390+
- description: Return findings that match the selected vulnerability types (repeatable).
34391+
example:
34392+
- misconfiguration
34393+
in: query
34394+
name: filter[vulnerability_type]
34395+
required: false
34396+
schema:
34397+
items:
34398+
$ref: '#/components/schemas/FindingVulnerabilityType'
34399+
type: array
3437434400
responses:
3437534401
'200':
3437634402
content:

src/datadogV2/api/api_security_monitoring.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ pub struct ListFindingsOptionalParams {
5757
pub filter_evaluation: Option<crate::datadogV2::model::FindingEvaluation>,
5858
/// Return only findings with the specified status.
5959
pub filter_status: Option<crate::datadogV2::model::FindingStatus>,
60+
/// Return findings that match the selected vulnerability types (repeatable).
61+
pub filter_vulnerability_type: Option<Vec<crate::datadogV2::model::FindingVulnerabilityType>>,
6062
}
6163

6264
impl ListFindingsOptionalParams {
@@ -120,6 +122,14 @@ impl ListFindingsOptionalParams {
120122
self.filter_status = Some(value);
121123
self
122124
}
125+
/// Return findings that match the selected vulnerability types (repeatable).
126+
pub fn filter_vulnerability_type(
127+
mut self,
128+
value: Vec<crate::datadogV2::model::FindingVulnerabilityType>,
129+
) -> Self {
130+
self.filter_vulnerability_type = Some(value);
131+
self
132+
}
123133
}
124134

125135
/// ListSecurityMonitoringRulesOptionalParams is a struct for passing parameters to the method [`SecurityMonitoringAPI::list_security_monitoring_rules`]
@@ -2749,6 +2759,7 @@ impl SecurityMonitoringAPI {
27492759
let filter_discovery_timestamp = params.filter_discovery_timestamp;
27502760
let filter_evaluation = params.filter_evaluation;
27512761
let filter_status = params.filter_status;
2762+
let filter_vulnerability_type = params.filter_vulnerability_type;
27522763

27532764
let local_client = &self.client;
27542765

@@ -2811,6 +2822,17 @@ impl SecurityMonitoringAPI {
28112822
local_req_builder =
28122823
local_req_builder.query(&[("filter[status]", &local_query_param.to_string())]);
28132824
};
2825+
if let Some(ref local) = filter_vulnerability_type {
2826+
local_req_builder = local_req_builder.query(&[(
2827+
"filter[vulnerability_type]",
2828+
&local
2829+
.iter()
2830+
.map(|p| p.to_string())
2831+
.collect::<Vec<String>>()
2832+
.join(",")
2833+
.to_string(),
2834+
)]);
2835+
};
28142836

28152837
// build headers
28162838
let mut headers = HeaderMap::new();

src/datadogV2/model/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,8 @@ pub mod model_finding_evaluation;
19601960
pub use self::model_finding_evaluation::FindingEvaluation;
19611961
pub mod model_finding_status;
19621962
pub use self::model_finding_status::FindingStatus;
1963+
pub mod model_finding_vulnerability_type;
1964+
pub use self::model_finding_vulnerability_type::FindingVulnerabilityType;
19631965
pub mod model_list_findings_response;
19641966
pub use self::model_list_findings_response::ListFindingsResponse;
19651967
pub mod model_finding;

src/datadogV2/model/model_finding_attributes.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ pub struct FindingAttributes {
3838
/// The tags associated with this finding.
3939
#[serde(rename = "tags")]
4040
pub tags: Option<Vec<String>>,
41+
/// The vulnerability type of the finding.
42+
#[serde(rename = "vulnerability_type")]
43+
pub vulnerability_type: Option<crate::datadogV2::model::FindingVulnerabilityType>,
4144
#[serde(flatten)]
4245
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
4346
#[serde(skip)]
@@ -57,6 +60,7 @@ impl FindingAttributes {
5760
rule: None,
5861
status: None,
5962
tags: None,
63+
vulnerability_type: None,
6064
additional_properties: std::collections::BTreeMap::new(),
6165
_unparsed: false,
6266
}
@@ -107,6 +111,14 @@ impl FindingAttributes {
107111
self
108112
}
109113

114+
pub fn vulnerability_type(
115+
mut self,
116+
value: crate::datadogV2::model::FindingVulnerabilityType,
117+
) -> Self {
118+
self.vulnerability_type = Some(value);
119+
self
120+
}
121+
110122
pub fn additional_properties(
111123
mut self,
112124
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -148,6 +160,9 @@ impl<'de> Deserialize<'de> for FindingAttributes {
148160
let mut rule: Option<crate::datadogV2::model::FindingRule> = None;
149161
let mut status: Option<crate::datadogV2::model::FindingStatus> = None;
150162
let mut tags: Option<Vec<String>> = None;
163+
let mut vulnerability_type: Option<
164+
crate::datadogV2::model::FindingVulnerabilityType,
165+
> = None;
151166
let mut additional_properties: std::collections::BTreeMap<
152167
String,
153168
serde_json::Value,
@@ -233,6 +248,21 @@ impl<'de> Deserialize<'de> for FindingAttributes {
233248
}
234249
tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
235250
}
251+
"vulnerability_type" => {
252+
if v.is_null() {
253+
continue;
254+
}
255+
vulnerability_type =
256+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
257+
if let Some(ref _vulnerability_type) = vulnerability_type {
258+
match _vulnerability_type {
259+
crate::datadogV2::model::FindingVulnerabilityType::UnparsedObject(_vulnerability_type) => {
260+
_unparsed = true;
261+
},
262+
_ => {}
263+
}
264+
}
265+
}
236266
&_ => {
237267
if let Ok(value) = serde_json::from_value(v.clone()) {
238268
additional_properties.insert(k, value);
@@ -251,6 +281,7 @@ impl<'de> Deserialize<'de> for FindingAttributes {
251281
rule,
252282
status,
253283
tags,
284+
vulnerability_type,
254285
additional_properties,
255286
_unparsed,
256287
};
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
5+
use serde::{Deserialize, Deserializer, Serialize, Serializer};
6+
7+
#[non_exhaustive]
8+
#[derive(Clone, Debug, Eq, PartialEq)]
9+
pub enum FindingVulnerabilityType {
10+
MISCONFIGURATION,
11+
ATTACK_PATH,
12+
IDENTITY_RISK,
13+
API_SECURITY,
14+
UnparsedObject(crate::datadog::UnparsedObject),
15+
}
16+
17+
impl ToString for FindingVulnerabilityType {
18+
fn to_string(&self) -> String {
19+
match self {
20+
Self::MISCONFIGURATION => String::from("misconfiguration"),
21+
Self::ATTACK_PATH => String::from("attack_path"),
22+
Self::IDENTITY_RISK => String::from("identity_risk"),
23+
Self::API_SECURITY => String::from("api_security"),
24+
Self::UnparsedObject(v) => v.value.to_string(),
25+
}
26+
}
27+
}
28+
29+
impl Serialize for FindingVulnerabilityType {
30+
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31+
where
32+
S: Serializer,
33+
{
34+
match self {
35+
Self::UnparsedObject(v) => v.serialize(serializer),
36+
_ => serializer.serialize_str(self.to_string().as_str()),
37+
}
38+
}
39+
}
40+
41+
impl<'de> Deserialize<'de> for FindingVulnerabilityType {
42+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
43+
where
44+
D: Deserializer<'de>,
45+
{
46+
let s: String = String::deserialize(deserializer)?;
47+
Ok(match s.as_str() {
48+
"misconfiguration" => Self::MISCONFIGURATION,
49+
"attack_path" => Self::ATTACK_PATH,
50+
"identity_risk" => Self::IDENTITY_RISK,
51+
"api_security" => Self::API_SECURITY,
52+
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
53+
value: serde_json::Value::String(s.into()),
54+
}),
55+
})
56+
}
57+
}

tests/scenarios/function_mappings.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18251,6 +18251,9 @@ fn test_v2_list_findings(world: &mut DatadogWorld, _parameters: &HashMap<String,
1825118251
let filter_status = _parameters
1825218252
.get("filter[status]")
1825318253
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
18254+
let filter_vulnerability_type = _parameters
18255+
.get("filter[vulnerability_type]")
18256+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
1825418257
let mut params = datadogV2::api_security_monitoring::ListFindingsOptionalParams::default();
1825518258
params.page_limit = page_limit;
1825618259
params.snapshot_timestamp = snapshot_timestamp;
@@ -18264,6 +18267,7 @@ fn test_v2_list_findings(world: &mut DatadogWorld, _parameters: &HashMap<String,
1826418267
params.filter_discovery_timestamp = filter_discovery_timestamp;
1826518268
params.filter_evaluation = filter_evaluation;
1826618269
params.filter_status = filter_status;
18270+
params.filter_vulnerability_type = filter_vulnerability_type;
1826718271
let response = match block_on(api.list_findings_with_http_info(params)) {
1826818272
Ok(response) => response,
1826918273
Err(error) => {
@@ -18326,6 +18330,9 @@ fn test_v2_list_findings_with_pagination(
1832618330
let filter_status = _parameters
1832718331
.get("filter[status]")
1832818332
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
18333+
let filter_vulnerability_type = _parameters
18334+
.get("filter[vulnerability_type]")
18335+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
1832918336
let mut params = datadogV2::api_security_monitoring::ListFindingsOptionalParams::default();
1833018337
params.page_limit = page_limit;
1833118338
params.snapshot_timestamp = snapshot_timestamp;
@@ -18339,6 +18346,7 @@ fn test_v2_list_findings_with_pagination(
1833918346
params.filter_discovery_timestamp = filter_discovery_timestamp;
1834018347
params.filter_evaluation = filter_evaluation;
1834118348
params.filter_status = filter_status;
18349+
params.filter_vulnerability_type = filter_vulnerability_type;
1834218350
let response = api.list_findings_with_pagination(params);
1834318351
let mut result = Vec::new();
1834418352

0 commit comments

Comments
 (0)