Skip to content

Commit 3b08c91

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 34036f7 of spec repo
1 parent 3a0ec26 commit 3b08c91

File tree

65 files changed

+727
-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.

65 files changed

+727
-193
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9338,6 +9338,10 @@ components:
93389338
description: The name of the policy
93399339
example: my_agent_policy
93409340
type: string
9341+
pinned:
9342+
description: Whether the policy is pinned
9343+
example: false
9344+
type: boolean
93419345
policyVersion:
93429346
description: The version of the policy
93439347
example: '1'
@@ -9365,6 +9369,8 @@ components:
93659369
type: integer
93669370
updater:
93679371
$ref: '#/components/schemas/CloudWorkloadSecurityAgentPolicyUpdaterAttributes'
9372+
versions:
9373+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentPolicyVersions'
93689374
type: object
93699375
CloudWorkloadSecurityAgentPolicyCreateAttributes:
93709376
description: Create a new Cloud Workload Security Agent policy
@@ -9511,6 +9517,23 @@ components:
95119517
nullable: true
95129518
type: string
95139519
type: object
9520+
CloudWorkloadSecurityAgentPolicyVersion:
9521+
description: The versions of the policy
9522+
properties:
9523+
Date:
9524+
description: The date and time the version was created
9525+
nullable: true
9526+
type: string
9527+
Name:
9528+
description: The version of the policy
9529+
example: 1.47.0-rc2
9530+
type: string
9531+
type: object
9532+
CloudWorkloadSecurityAgentPolicyVersions:
9533+
description: The versions of the policy
9534+
items:
9535+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentPolicyVersion'
9536+
type: array
95149537
CloudWorkloadSecurityAgentRuleAction:
95159538
description: The action the rule can perform if triggered
95169539
properties:
@@ -9548,23 +9571,32 @@ components:
95489571
description: The set action applied on the scope matching the rule
95499572
properties:
95509573
append:
9551-
description: Whether the value should be appended to the field
9574+
description: Whether the value should be appended to the field.
95529575
type: boolean
9576+
default_value:
9577+
description: The default value of the set action
9578+
type: string
9579+
expression:
9580+
description: The expression of the set action.
9581+
type: string
95539582
field:
95549583
description: The field of the set action
95559584
type: string
9585+
inherited:
9586+
description: Whether the value should be inherited.
9587+
type: boolean
95569588
name:
95579589
description: The name of the set action
95589590
type: string
95599591
scope:
9560-
description: The scope of the set action
9592+
description: The scope of the set action.
95619593
type: string
95629594
size:
9563-
description: The size of the set action
9595+
description: The size of the set action.
95649596
format: int64
95659597
type: integer
95669598
ttl:
9567-
description: The time to live of the set action
9599+
description: The time to live of the set action.
95689600
format: int64
95699601
type: integer
95709602
value:
@@ -9645,6 +9677,10 @@ components:
96459677
items:
96469678
type: string
96479679
type: array
9680+
silent:
9681+
description: Whether the rule is silent.
9682+
example: false
9683+
type: boolean
96489684
updateAuthorUuId:
96499685
description: The ID of the user who updated the rule
96509686
example: e51c9744-d158-11ec-ad23-da7ad0900002
@@ -9672,8 +9708,11 @@ components:
96729708
properties:
96739709
actions:
96749710
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
9711+
agent_version:
9712+
description: Constrain the rule to specific versions of the Datadog Agent.
9713+
type: string
96759714
blocking:
9676-
description: The blocking policies that the rule belongs to
9715+
description: The blocking policies that the rule belongs to.
96779716
items:
96789717
type: string
96799718
type: array
@@ -9682,25 +9721,25 @@ components:
96829721
example: My Agent rule
96839722
type: string
96849723
disabled:
9685-
description: The disabled policies that the rule belongs to
9724+
description: The disabled policies that the rule belongs to.
96869725
items:
96879726
type: string
96889727
type: array
96899728
enabled:
9690-
description: Whether the Agent rule is enabled
9729+
description: Whether the Agent rule is enabled.
96919730
example: true
96929731
type: boolean
96939732
expression:
96949733
description: The SECL expression of the Agent rule.
96959734
example: exec.file.name == "sh"
96969735
type: string
96979736
filters:
9698-
description: The platforms the Agent rule is supported on
9737+
description: The platforms the Agent rule is supported on.
96999738
items:
97009739
type: string
97019740
type: array
97029741
monitoring:
9703-
description: The monitoring policies that the rule belongs to
9742+
description: The monitoring policies that the rule belongs to.
97049743
items:
97059744
type: string
97069745
type: array
@@ -9709,14 +9748,18 @@ components:
97099748
example: my_agent_rule
97109749
type: string
97119750
policy_id:
9712-
description: The ID of the policy where the Agent rule is saved
9751+
description: The ID of the policy where the Agent rule is saved.
97139752
example: a8c8e364-6556-434d-b798-a4c23de29c0b
97149753
type: string
97159754
product_tags:
9716-
description: The list of product tags associated with the rule
9755+
description: The list of product tags associated with the rule.
97179756
items:
97189757
type: string
97199758
type: array
9759+
silent:
9760+
description: Whether the rule is silent.
9761+
example: false
9762+
type: boolean
97209763
required:
97219764
- name
97229765
- expression
@@ -9796,6 +9839,9 @@ components:
97969839
properties:
97979840
actions:
97989841
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
9842+
agent_version:
9843+
description: Constrain the rule to specific versions of the Datadog Agent
9844+
type: string
97999845
blocking:
98009846
description: The blocking policies that the rule belongs to
98019847
items:
@@ -9832,6 +9878,10 @@ components:
98329878
items:
98339879
type: string
98349880
type: array
9881+
silent:
9882+
description: Whether the rule is silent.
9883+
example: false
9884+
type: boolean
98359885
type: object
98369886
CloudWorkloadSecurityAgentRuleUpdateData:
98379887
description: Object for a single Agent rule

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
@@ -4362,6 +4362,8 @@ pub mod model_cloud_workload_security_agent_policy_attributes;
43624362
pub use self::model_cloud_workload_security_agent_policy_attributes::CloudWorkloadSecurityAgentPolicyAttributes;
43634363
pub mod model_cloud_workload_security_agent_policy_updater_attributes;
43644364
pub use self::model_cloud_workload_security_agent_policy_updater_attributes::CloudWorkloadSecurityAgentPolicyUpdaterAttributes;
4365+
pub mod model_cloud_workload_security_agent_policy_version;
4366+
pub use self::model_cloud_workload_security_agent_policy_version::CloudWorkloadSecurityAgentPolicyVersion;
43654367
pub mod model_cloud_workload_security_agent_policy_type;
43664368
pub use self::model_cloud_workload_security_agent_policy_type::CloudWorkloadSecurityAgentPolicyType;
43674369
pub mod model_cloud_workload_security_agent_policy_create_request;

src/datadogV2/model/model_cloud_workload_security_agent_policy_attributes.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ pub struct CloudWorkloadSecurityAgentPolicyAttributes {
3838
/// The name of the policy
3939
#[serde(rename = "name")]
4040
pub name: Option<String>,
41+
/// Whether the policy is pinned
42+
#[serde(rename = "pinned")]
43+
pub pinned: Option<bool>,
4144
/// The version of the policy
4245
#[serde(rename = "policyVersion")]
4346
pub policy_version: Option<String>,
@@ -56,6 +59,9 @@ pub struct CloudWorkloadSecurityAgentPolicyAttributes {
5659
/// The attributes of the user who last updated the policy
5760
#[serde(rename = "updater")]
5861
pub updater: Option<crate::datadogV2::model::CloudWorkloadSecurityAgentPolicyUpdaterAttributes>,
62+
/// The versions of the policy
63+
#[serde(rename = "versions")]
64+
pub versions: Option<Vec<crate::datadogV2::model::CloudWorkloadSecurityAgentPolicyVersion>>,
5965
#[serde(flatten)]
6066
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
6167
#[serde(skip)]
@@ -75,12 +81,14 @@ impl CloudWorkloadSecurityAgentPolicyAttributes {
7581
host_tags_lists: None,
7682
monitoring_rules_count: None,
7783
name: None,
84+
pinned: None,
7885
policy_version: None,
7986
priority: None,
8087
rule_count: None,
8188
update_date: None,
8289
updated_at: None,
8390
updater: None,
91+
versions: None,
8492
additional_properties: std::collections::BTreeMap::new(),
8593
_unparsed: false,
8694
}
@@ -131,6 +139,11 @@ impl CloudWorkloadSecurityAgentPolicyAttributes {
131139
self
132140
}
133141

142+
pub fn pinned(mut self, value: bool) -> Self {
143+
self.pinned = Some(value);
144+
self
145+
}
146+
134147
pub fn policy_version(mut self, value: String) -> Self {
135148
self.policy_version = Some(value);
136149
self
@@ -164,6 +177,14 @@ impl CloudWorkloadSecurityAgentPolicyAttributes {
164177
self
165178
}
166179

180+
pub fn versions(
181+
mut self,
182+
value: Vec<crate::datadogV2::model::CloudWorkloadSecurityAgentPolicyVersion>,
183+
) -> Self {
184+
self.versions = Some(value);
185+
self
186+
}
187+
167188
pub fn additional_properties(
168189
mut self,
169190
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -205,6 +226,7 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentPolicyAttributes {
205226
let mut host_tags_lists: Option<Vec<Vec<String>>> = None;
206227
let mut monitoring_rules_count: Option<i32> = None;
207228
let mut name: Option<String> = None;
229+
let mut pinned: Option<bool> = None;
208230
let mut policy_version: Option<String> = None;
209231
let mut priority: Option<i64> = None;
210232
let mut rule_count: Option<i32> = None;
@@ -213,6 +235,9 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentPolicyAttributes {
213235
let mut updater: Option<
214236
crate::datadogV2::model::CloudWorkloadSecurityAgentPolicyUpdaterAttributes,
215237
> = None;
238+
let mut versions: Option<
239+
Vec<crate::datadogV2::model::CloudWorkloadSecurityAgentPolicyVersion>,
240+
> = None;
216241
let mut additional_properties: std::collections::BTreeMap<
217242
String,
218243
serde_json::Value,
@@ -281,6 +306,12 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentPolicyAttributes {
281306
}
282307
name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
283308
}
309+
"pinned" => {
310+
if v.is_null() {
311+
continue;
312+
}
313+
pinned = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
314+
}
284315
"policyVersion" => {
285316
if v.is_null() {
286317
continue;
@@ -319,6 +350,12 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentPolicyAttributes {
319350
}
320351
updater = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
321352
}
353+
"versions" => {
354+
if v.is_null() {
355+
continue;
356+
}
357+
versions = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
358+
}
322359
&_ => {
323360
if let Ok(value) = serde_json::from_value(v.clone()) {
324361
additional_properties.insert(k, value);
@@ -337,12 +374,14 @@ impl<'de> Deserialize<'de> for CloudWorkloadSecurityAgentPolicyAttributes {
337374
host_tags_lists,
338375
monitoring_rules_count,
339376
name,
377+
pinned,
340378
policy_version,
341379
priority,
342380
rule_count,
343381
update_date,
344382
updated_at,
345383
updater,
384+
versions,
346385
additional_properties,
347386
_unparsed,
348387
};

0 commit comments

Comments
 (0)