Skip to content

Commit 13a2477

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add some missing Workload Protection agent rule fields (#943)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 4626683 commit 13a2477

File tree

66 files changed

+736
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+736
-193
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9472,6 +9472,10 @@ components:
94729472
description: The name of the policy
94739473
example: my_agent_policy
94749474
type: string
9475+
pinned:
9476+
description: Whether the policy is pinned
9477+
example: false
9478+
type: boolean
94759479
policyVersion:
94769480
description: The version of the policy
94779481
example: '1'
@@ -9499,6 +9503,8 @@ components:
94999503
type: integer
95009504
updater:
95019505
$ref: '#/components/schemas/CloudWorkloadSecurityAgentPolicyUpdaterAttributes'
9506+
versions:
9507+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentPolicyVersions'
95029508
type: object
95039509
CloudWorkloadSecurityAgentPolicyCreateAttributes:
95049510
description: Create a new Cloud Workload Security Agent policy
@@ -9645,6 +9651,23 @@ components:
96459651
nullable: true
96469652
type: string
96479653
type: object
9654+
CloudWorkloadSecurityAgentPolicyVersion:
9655+
description: The versions of the policy
9656+
properties:
9657+
Date:
9658+
description: The date and time the version was created
9659+
nullable: true
9660+
type: string
9661+
Name:
9662+
description: The version of the policy
9663+
example: 1.47.0-rc2
9664+
type: string
9665+
type: object
9666+
CloudWorkloadSecurityAgentPolicyVersions:
9667+
description: The versions of the policy
9668+
items:
9669+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentPolicyVersion'
9670+
type: array
96489671
CloudWorkloadSecurityAgentRuleAction:
96499672
description: The action the rule can perform if triggered
96509673
properties:
@@ -9682,23 +9705,32 @@ components:
96829705
description: The set action applied on the scope matching the rule
96839706
properties:
96849707
append:
9685-
description: Whether the value should be appended to the field
9708+
description: Whether the value should be appended to the field.
96869709
type: boolean
9710+
default_value:
9711+
description: The default value of the set action
9712+
type: string
9713+
expression:
9714+
description: The expression of the set action.
9715+
type: string
96879716
field:
96889717
description: The field of the set action
96899718
type: string
9719+
inherited:
9720+
description: Whether the value should be inherited.
9721+
type: boolean
96909722
name:
96919723
description: The name of the set action
96929724
type: string
96939725
scope:
9694-
description: The scope of the set action
9726+
description: The scope of the set action.
96959727
type: string
96969728
size:
9697-
description: The size of the set action
9729+
description: The size of the set action.
96989730
format: int64
96999731
type: integer
97009732
ttl:
9701-
description: The time to live of the set action
9733+
description: The time to live of the set action.
97029734
format: int64
97039735
type: integer
97049736
value:
@@ -9779,6 +9811,10 @@ components:
97799811
items:
97809812
type: string
97819813
type: array
9814+
silent:
9815+
description: Whether the rule is silent.
9816+
example: false
9817+
type: boolean
97829818
updateAuthorUuId:
97839819
description: The ID of the user who updated the rule
97849820
example: e51c9744-d158-11ec-ad23-da7ad0900002
@@ -9806,8 +9842,11 @@ components:
98069842
properties:
98079843
actions:
98089844
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
9845+
agent_version:
9846+
description: Constrain the rule to specific versions of the Datadog Agent.
9847+
type: string
98099848
blocking:
9810-
description: The blocking policies that the rule belongs to
9849+
description: The blocking policies that the rule belongs to.
98119850
items:
98129851
type: string
98139852
type: array
@@ -9816,25 +9855,25 @@ components:
98169855
example: My Agent rule
98179856
type: string
98189857
disabled:
9819-
description: The disabled policies that the rule belongs to
9858+
description: The disabled policies that the rule belongs to.
98209859
items:
98219860
type: string
98229861
type: array
98239862
enabled:
9824-
description: Whether the Agent rule is enabled
9863+
description: Whether the Agent rule is enabled.
98259864
example: true
98269865
type: boolean
98279866
expression:
98289867
description: The SECL expression of the Agent rule.
98299868
example: exec.file.name == "sh"
98309869
type: string
98319870
filters:
9832-
description: The platforms the Agent rule is supported on
9871+
description: The platforms the Agent rule is supported on.
98339872
items:
98349873
type: string
98359874
type: array
98369875
monitoring:
9837-
description: The monitoring policies that the rule belongs to
9876+
description: The monitoring policies that the rule belongs to.
98389877
items:
98399878
type: string
98409879
type: array
@@ -9843,14 +9882,18 @@ components:
98439882
example: my_agent_rule
98449883
type: string
98459884
policy_id:
9846-
description: The ID of the policy where the Agent rule is saved
9885+
description: The ID of the policy where the Agent rule is saved.
98479886
example: a8c8e364-6556-434d-b798-a4c23de29c0b
98489887
type: string
98499888
product_tags:
9850-
description: The list of product tags associated with the rule
9889+
description: The list of product tags associated with the rule.
98519890
items:
98529891
type: string
98539892
type: array
9893+
silent:
9894+
description: Whether the rule is silent.
9895+
example: false
9896+
type: boolean
98549897
required:
98559898
- name
98569899
- expression
@@ -9930,6 +9973,9 @@ components:
99309973
properties:
99319974
actions:
99329975
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
9976+
agent_version:
9977+
description: Constrain the rule to specific versions of the Datadog Agent
9978+
type: string
99339979
blocking:
99349980
description: The blocking policies that the rule belongs to
99359981
items:
@@ -9966,6 +10012,10 @@ components:
996610012
items:
996710013
type: string
996810014
type: array
10015+
silent:
10016+
description: Whether the rule is silent.
10017+
example: false
10018+
type: boolean
996910019
type: object
997010020
CloudWorkloadSecurityAgentRuleUpdateData:
997110021
description: Object for a single Agent rule

LICENSE-3rdparty.csv

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,23 @@ windows-strings,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The wi
187187
windows-sys,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
188188
windows-sys,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows-sys Authors
189189
windows-targets,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
190+
windows-targets,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows-targets Authors
190191
windows_aarch64_gnullvm,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
192+
windows_aarch64_gnullvm,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows_aarch64_gnullvm Authors
191193
windows_aarch64_msvc,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
194+
windows_aarch64_msvc,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows_aarch64_msvc Authors
192195
windows_i686_gnu,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
196+
windows_i686_gnu,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows_i686_gnu Authors
193197
windows_i686_gnullvm,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
198+
windows_i686_gnullvm,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows_i686_gnullvm Authors
194199
windows_i686_msvc,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
200+
windows_i686_msvc,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows_i686_msvc Authors
195201
windows_x86_64_gnu,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
202+
windows_x86_64_gnu,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows_x86_64_gnu Authors
196203
windows_x86_64_gnullvm,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
204+
windows_x86_64_gnullvm,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows_x86_64_gnullvm Authors
197205
windows_x86_64_msvc,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
206+
windows_x86_64_msvc,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows_x86_64_msvc Authors
198207
winreg,https://github.com/gentoo90/winreg-rs,MIT,Igor Shaula <gentoo90@gmail.com>
199208
wit-bindgen,https://github.com/bytecodealliance/wit-bindgen,Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT,Alex Crichton <alex@alexcrichton.com>
200209
writeable,https://github.com/unicode-org/icu4x,Unicode-3.0,The ICU4X Project Developers

examples/v2_csm-threats_CreateCSMThreatsAgentPolicy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentPolicyType;
1010
async fn main() {
1111
let body = CloudWorkloadSecurityAgentPolicyCreateRequest::new(
1212
CloudWorkloadSecurityAgentPolicyCreateData::new(
13-
CloudWorkloadSecurityAgentPolicyCreateAttributes::new("my_agent_policy".to_string())
13+
CloudWorkloadSecurityAgentPolicyCreateAttributes::new("my_agent_policy_2".to_string())
1414
.description("My agent policy".to_string())
1515
.enabled(true)
1616
.host_tags_lists(vec![vec!["env:test".to_string()]]),

examples/v2_csm-threats_CreateCSMThreatsAgentRule.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ async fn main() {
1616
r#"exec.file.name == "sh""#.to_string(),
1717
"examplecsmthreat".to_string(),
1818
)
19+
.agent_version("> 7.60".to_string())
1920
.description("My Agent rule".to_string())
2021
.enabled(true)
2122
.filters(vec![])

examples/v2_csm-threats_CreateCSMThreatsAgentRule_1295653933.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ async fn main() {
2222
.actions(Some(vec![
2323
CloudWorkloadSecurityAgentRuleAction::new().set(
2424
CloudWorkloadSecurityAgentRuleActionSet::new()
25+
.inherited(true)
2526
.name("test_set".to_string())
2627
.scope("process".to_string())
2728
.value("test_value".to_string()),
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Create a Workload Protection agent rule with set action with expression returns
2+
// "OK" response
3+
use datadog_api_client::datadog;
4+
use datadog_api_client::datadogV2::api_csm_threats::CSMThreatsAPI;
5+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleAction;
6+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleActionSet;
7+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleCreateAttributes;
8+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleCreateData;
9+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleCreateRequest;
10+
use datadog_api_client::datadogV2::model::CloudWorkloadSecurityAgentRuleType;
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+
.default_value("/dev/null".to_string())
25+
.expression("open.file.path".to_string())
26+
.name("test_set".to_string())
27+
.scope("process".to_string()),
28+
)]))
29+
.description("My Agent rule with set action with expression".to_string())
30+
.enabled(true)
31+
.filters(vec![])
32+
.policy_id(policy_data_id.clone())
33+
.product_tags(vec![]),
34+
CloudWorkloadSecurityAgentRuleType::AGENT_RULE,
35+
),
36+
);
37+
let configuration = datadog::Configuration::new();
38+
let api = CSMThreatsAPI::with_config(configuration);
39+
let resp = api.create_csm_threats_agent_rule(body).await;
40+
if let Ok(value) = resp {
41+
println!("{:#?}", value);
42+
} else {
43+
println!("{:#?}", resp.unwrap_err());
44+
}
45+
}

src/datadogV2/model/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4364,6 +4364,8 @@ pub mod model_cloud_workload_security_agent_policy_attributes;
43644364
pub use self::model_cloud_workload_security_agent_policy_attributes::CloudWorkloadSecurityAgentPolicyAttributes;
43654365
pub mod model_cloud_workload_security_agent_policy_updater_attributes;
43664366
pub use self::model_cloud_workload_security_agent_policy_updater_attributes::CloudWorkloadSecurityAgentPolicyUpdaterAttributes;
4367+
pub mod model_cloud_workload_security_agent_policy_version;
4368+
pub use self::model_cloud_workload_security_agent_policy_version::CloudWorkloadSecurityAgentPolicyVersion;
43674369
pub mod model_cloud_workload_security_agent_policy_type;
43684370
pub use self::model_cloud_workload_security_agent_policy_type::CloudWorkloadSecurityAgentPolicyType;
43694371
pub mod model_cloud_workload_security_agent_policy_create_request;

0 commit comments

Comments
 (0)