Skip to content

Commit 16079a8

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit ebeec66b of spec repo
1 parent de95394 commit 16079a8

21 files changed

+841
-46
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-05-13 01:19:31.172553",
8-
"spec_repo_commit": "dc3b522f"
7+
"regenerated": "2025-05-13 11:46:16.526970",
8+
"spec_repo_commit": "ebeec66b"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-05-13 01:19:31.189716",
13-
"spec_repo_commit": "dc3b522f"
12+
"regenerated": "2025-05-13 11:46:16.542904",
13+
"spec_repo_commit": "ebeec66b"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7318,6 +7318,8 @@ components:
73187318
CloudWorkloadSecurityAgentPolicyCreateAttributes:
73197319
description: Create a new Cloud Workload Security Agent policy
73207320
properties:
7321+
actions:
7322+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
73217323
description:
73227324
description: The description of the policy
73237325
example: My agent policy
@@ -7399,6 +7401,8 @@ components:
73997401
CloudWorkloadSecurityAgentPolicyUpdateAttributes:
74007402
description: Update an existing Cloud Workload Security Agent policy
74017403
properties:
7404+
actions:
7405+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
74027406
description:
74037407
description: The description of the policy
74047408
example: My agent policy
@@ -7469,6 +7473,59 @@ components:
74697473
type: string
74707474
kill:
74717475
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleKill'
7476+
metadata:
7477+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionMetadata'
7478+
set:
7479+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionSet'
7480+
type: object
7481+
CloudWorkloadSecurityAgentRuleActionMetadata:
7482+
description: The metadata action applied on the scope matching the rule
7483+
properties:
7484+
image_tag:
7485+
description: The image tag of the metadata action
7486+
type: string
7487+
service:
7488+
description: The service of the metadata action
7489+
type: string
7490+
short_image:
7491+
description: The short image of the metadata action
7492+
type: string
7493+
type: object
7494+
CloudWorkloadSecurityAgentRuleActionSet:
7495+
description: The set action applied on the scope matching the rule
7496+
properties:
7497+
append:
7498+
description: Whether the value should be appended to the field
7499+
type: boolean
7500+
field:
7501+
description: The field of the set action
7502+
type: string
7503+
name:
7504+
description: The name of the set action
7505+
type: string
7506+
scope:
7507+
description: The scope of the set action
7508+
type: string
7509+
size:
7510+
description: The size of the set action
7511+
format: int64
7512+
type: integer
7513+
ttl:
7514+
description: The time to live of the set action
7515+
format: int64
7516+
type: integer
7517+
value:
7518+
anyOf:
7519+
- type: string
7520+
- format: double
7521+
type: number
7522+
- format: int64
7523+
type: integer
7524+
- type: boolean
7525+
- items: {}
7526+
type: array
7527+
- type: object
7528+
description: The value of the set action
74727529
type: object
74737530
CloudWorkloadSecurityAgentRuleActions:
74747531
description: The array of actions the rule can perform if triggered
@@ -7554,6 +7611,8 @@ components:
75547611
CloudWorkloadSecurityAgentRuleCreateAttributes:
75557612
description: Create a new Cloud Workload Security Agent rule.
75567613
properties:
7614+
actions:
7615+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
75577616
description:
75587617
description: The description of the Agent rule.
75597618
example: My Agent rule
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Create a CSM Threats Agent rule with set action returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_csm_threats::CSMThreatsAPI;
4+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleAction;
5+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleActionSet;
6+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleCreateAttributes;
7+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleCreateData;
8+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleCreateRequest;
9+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleType;
10+
use serde_json::Value;
11+
12+
#[tokio::main]
13+
async fn main() {
14+
// there is a valid "policy_rc" in the system
15+
let policy_data_id = std::env::var("POLICY_DATA_ID").unwrap();
16+
let body = CloudWorkloadSecurityAgentRuleCreateRequest::new(
17+
CloudWorkloadSecurityAgentRuleCreateData::new(
18+
CloudWorkloadSecurityAgentRuleCreateAttributes::new(
19+
r#"exec.file.name == "sh""#.to_string(),
20+
"examplecsmthreat".to_string(),
21+
)
22+
.actions(Some(vec![CloudWorkloadSecurityAgentRuleAction::new().set(
23+
CloudWorkloadSecurityAgentRuleActionSet::new()
24+
.name("test_set".to_string())
25+
.scope("process".to_string())
26+
.value(Value::from("test_value")),
27+
)]))
28+
.description("My Agent rule with set action".to_string())
29+
.enabled(true)
30+
.filters(vec![])
31+
.policy_id(policy_data_id.clone())
32+
.product_tags(vec![]),
33+
CloudWorkloadSecurityAgentRuleType::AGENT_RULE,
34+
),
35+
);
36+
let configuration = datadog::Configuration::new();
37+
let api = CSMThreatsAPI::with_config(configuration);
38+
let resp = api.create_csm_threats_agent_rule(body).await;
39+
if let Ok(value) = resp {
40+
println!("{:#?}", value);
41+
} else {
42+
println!("{:#?}", resp.unwrap_err());
43+
}
44+
}

src/datadogV2/model/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3138,6 +3138,12 @@ pub mod model_cloud_workload_security_agent_rule_action;
31383138
pub use self::model_cloud_workload_security_agent_rule_action::CloudWorkloadSecurityAgentRuleAction;
31393139
pub mod model_cloud_workload_security_agent_rule_kill;
31403140
pub use self::model_cloud_workload_security_agent_rule_kill::CloudWorkloadSecurityAgentRuleKill;
3141+
pub mod model_cloud_workload_security_agent_rule_action_metadata;
3142+
pub use self::model_cloud_workload_security_agent_rule_action_metadata::CloudWorkloadSecurityAgentRuleActionMetadata;
3143+
pub mod model_cloud_workload_security_agent_rule_action_set;
3144+
pub use self::model_cloud_workload_security_agent_rule_action_set::CloudWorkloadSecurityAgentRuleActionSet;
3145+
pub mod model_cloud_workload_security_agent_rule_action_set_value;
3146+
pub use self::model_cloud_workload_security_agent_rule_action_set_value::CloudWorkloadSecurityAgentRuleActionSetValue;
31413147
pub mod model_cloud_workload_security_agent_rule_creator_attributes;
31423148
pub use self::model_cloud_workload_security_agent_rule_creator_attributes::CloudWorkloadSecurityAgentRuleCreatorAttributes;
31433149
pub mod model_cloud_workload_security_agent_rule_updater_attributes;

src/datadogV2/model/model_cloud_workload_security_agent_policy_create_attributes.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct CloudWorkloadSecurityAgentPolicyCreateAttributes {
14+
/// The array of actions the rule can perform if triggered
15+
#[serde(
16+
rename = "actions",
17+
default,
18+
with = "::serde_with::rust::double_option"
19+
)]
20+
pub actions: Option<Option<Vec<crate::datadogV2::model::CloudWorkloadSecurityAgentRuleAction>>>,
1421
/// The description of the policy
1522
#[serde(rename = "description")]
1623
pub description: Option<String>,
@@ -36,6 +43,7 @@ pub struct CloudWorkloadSecurityAgentPolicyCreateAttributes {
3643
impl CloudWorkloadSecurityAgentPolicyCreateAttributes {
3744
pub fn new(name: String) -> CloudWorkloadSecurityAgentPolicyCreateAttributes {
3845
CloudWorkloadSecurityAgentPolicyCreateAttributes {
46+
actions: None,
3947
description: None,
4048
enabled: None,
4149
host_tags: None,
@@ -46,6 +54,14 @@ impl CloudWorkloadSecurityAgentPolicyCreateAttributes {
4654
}
4755
}
4856

57+
pub fn actions(
58+
mut self,
59+
value: Option<Vec<crate::datadogV2::model::CloudWorkloadSecurityAgentRuleAction>>,
60+
) -> Self {
61+
self.actions = Some(value);
62+
self
63+
}
64+
4965
pub fn description(mut self, value: String) -> Self {
5066
self.description = Some(value);
5167
self
@@ -92,6 +108,9 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentPolicyCreateAttributes
92108
where
93109
M: MapAccess<'a>,
94110
{
111+
let mut actions: Option<
112+
Option<Vec<crate::datadogV2::model::CloudWorkloadSecurityAgentRuleAction>>,
113+
> = None;
95114
let mut description: Option<String> = None;
96115
let mut enabled: Option<bool> = None;
97116
let mut host_tags: Option<Vec<String>> = None;
@@ -105,6 +124,9 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentPolicyCreateAttributes
105124

106125
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
107126
match k.as_str() {
127+
"actions" => {
128+
actions = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
129+
}
108130
"description" => {
109131
if v.is_null() {
110132
continue;
@@ -144,6 +166,7 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentPolicyCreateAttributes
144166
let name = name.ok_or_else(|| M::Error::missing_field("name"))?;
145167

146168
let content = CloudWorkloadSecurityAgentPolicyCreateAttributes {
169+
actions,
147170
description,
148171
enabled,
149172
host_tags,

src/datadogV2/model/model_cloud_workload_security_agent_policy_update_attributes.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct CloudWorkloadSecurityAgentPolicyUpdateAttributes {
14+
/// The array of actions the rule can perform if triggered
15+
#[serde(
16+
rename = "actions",
17+
default,
18+
with = "::serde_with::rust::double_option"
19+
)]
20+
pub actions: Option<Option<Vec<crate::datadogV2::model::CloudWorkloadSecurityAgentRuleAction>>>,
1421
/// The description of the policy
1522
#[serde(rename = "description")]
1623
pub description: Option<String>,
@@ -36,6 +43,7 @@ pub struct CloudWorkloadSecurityAgentPolicyUpdateAttributes {
3643
impl CloudWorkloadSecurityAgentPolicyUpdateAttributes {
3744
pub fn new() -> CloudWorkloadSecurityAgentPolicyUpdateAttributes {
3845
CloudWorkloadSecurityAgentPolicyUpdateAttributes {
46+
actions: None,
3947
description: None,
4048
enabled: None,
4149
host_tags: None,
@@ -46,6 +54,14 @@ impl CloudWorkloadSecurityAgentPolicyUpdateAttributes {
4654
}
4755
}
4856

57+
pub fn actions(
58+
mut self,
59+
value: Option<Vec<crate::datadogV2::model::CloudWorkloadSecurityAgentRuleAction>>,
60+
) -> Self {
61+
self.actions = Some(value);
62+
self
63+
}
64+
4965
pub fn description(mut self, value: String) -> Self {
5066
self.description = Some(value);
5167
self
@@ -103,6 +119,9 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentPolicyUpdateAttributes
103119
where
104120
M: MapAccess<'a>,
105121
{
122+
let mut actions: Option<
123+
Option<Vec<crate::datadogV2::model::CloudWorkloadSecurityAgentRuleAction>>,
124+
> = None;
106125
let mut description: Option<String> = None;
107126
let mut enabled: Option<bool> = None;
108127
let mut host_tags: Option<Vec<String>> = None;
@@ -116,6 +135,9 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentPolicyUpdateAttributes
116135

117136
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
118137
match k.as_str() {
138+
"actions" => {
139+
actions = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
140+
}
119141
"description" => {
120142
if v.is_null() {
121143
continue;
@@ -157,6 +179,7 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentPolicyUpdateAttributes
157179
}
158180

159181
let content = CloudWorkloadSecurityAgentPolicyUpdateAttributes {
182+
actions,
160183
description,
161184
enabled,
162185
host_tags,

src/datadogV2/model/model_cloud_workload_security_agent_rule_action.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ pub struct CloudWorkloadSecurityAgentRuleAction {
1717
/// Kill system call applied on the container matching the rule
1818
#[serde(rename = "kill")]
1919
pub kill: Option<crate::datadogV2::model::CloudWorkloadSecurityAgentRuleKill>,
20+
/// The metadata action applied on the scope matching the rule
21+
#[serde(rename = "metadata")]
22+
pub metadata: Option<crate::datadogV2::model::CloudWorkloadSecurityAgentRuleActionMetadata>,
23+
/// The set action applied on the scope matching the rule
24+
#[serde(rename = "set")]
25+
pub set: Option<crate::datadogV2::model::CloudWorkloadSecurityAgentRuleActionSet>,
2026
#[serde(flatten)]
2127
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
2228
#[serde(skip)]
@@ -29,6 +35,8 @@ impl CloudWorkloadSecurityAgentRuleAction {
2935
CloudWorkloadSecurityAgentRuleAction {
3036
filter: None,
3137
kill: None,
38+
metadata: None,
39+
set: None,
3240
additional_properties: std::collections::BTreeMap::new(),
3341
_unparsed: false,
3442
}
@@ -47,6 +55,22 @@ impl CloudWorkloadSecurityAgentRuleAction {
4755
self
4856
}
4957

58+
pub fn metadata(
59+
mut self,
60+
value: crate::datadogV2::model::CloudWorkloadSecurityAgentRuleActionMetadata,
61+
) -> Self {
62+
self.metadata = Some(value);
63+
self
64+
}
65+
66+
pub fn set(
67+
mut self,
68+
value: crate::datadogV2::model::CloudWorkloadSecurityAgentRuleActionSet,
69+
) -> Self {
70+
self.set = Some(value);
71+
self
72+
}
73+
5074
pub fn additional_properties(
5175
mut self,
5276
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -82,6 +106,12 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentRuleAction {
82106
let mut filter: Option<String> = None;
83107
let mut kill: Option<crate::datadogV2::model::CloudWorkloadSecurityAgentRuleKill> =
84108
None;
109+
let mut metadata: Option<
110+
crate::datadogV2::model::CloudWorkloadSecurityAgentRuleActionMetadata,
111+
> = None;
112+
let mut set: Option<
113+
crate::datadogV2::model::CloudWorkloadSecurityAgentRuleActionSet,
114+
> = None;
85115
let mut additional_properties: std::collections::BTreeMap<
86116
String,
87117
serde_json::Value,
@@ -102,6 +132,18 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentRuleAction {
102132
}
103133
kill = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
104134
}
135+
"metadata" => {
136+
if v.is_null() {
137+
continue;
138+
}
139+
metadata = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
140+
}
141+
"set" => {
142+
if v.is_null() {
143+
continue;
144+
}
145+
set = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
146+
}
105147
&_ => {
106148
if let Ok(value) = serde_json::from_value(v.clone()) {
107149
additional_properties.insert(k, value);
@@ -113,6 +155,8 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentRuleAction {
113155
let content = CloudWorkloadSecurityAgentRuleAction {
114156
filter,
115157
kill,
158+
metadata,
159+
set,
116160
additional_properties,
117161
_unparsed,
118162
};

0 commit comments

Comments
 (0)