Skip to content

Commit 21e2942

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Exposing set action on Terraform V2 (#2862)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 5a85097 commit 21e2942

File tree

65 files changed

+1459
-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

+1459
-193
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-06-03 09:24:13.392752",
8-
"spec_repo_commit": "5906d277"
7+
"regenerated": "2025-06-04 09:10:40.276658",
8+
"spec_repo_commit": "6c99bb98"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-06-03 09:24:13.409905",
13-
"spec_repo_commit": "5906d277"
12+
"regenerated": "2025-06-04 09:10:40.296099",
13+
"spec_repo_commit": "6c99bb98"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7526,6 +7526,50 @@ components:
75267526
type: string
75277527
kill:
75287528
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleKill'
7529+
metadata:
7530+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionMetadata'
7531+
set:
7532+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionSet'
7533+
type: object
7534+
CloudWorkloadSecurityAgentRuleActionMetadata:
7535+
description: The metadata action applied on the scope matching the rule
7536+
properties:
7537+
image_tag:
7538+
description: The image tag of the metadata action
7539+
type: string
7540+
service:
7541+
description: The service of the metadata action
7542+
type: string
7543+
short_image:
7544+
description: The short image of the metadata action
7545+
type: string
7546+
type: object
7547+
CloudWorkloadSecurityAgentRuleActionSet:
7548+
description: The set action applied on the scope matching the rule
7549+
properties:
7550+
append:
7551+
description: Whether the value should be appended to the field
7552+
type: boolean
7553+
field:
7554+
description: The field of the set action
7555+
type: string
7556+
name:
7557+
description: The name of the set action
7558+
type: string
7559+
scope:
7560+
description: The scope of the set action
7561+
type: string
7562+
size:
7563+
description: The size of the set action
7564+
format: int64
7565+
type: integer
7566+
ttl:
7567+
description: The time to live of the set action
7568+
format: int64
7569+
type: integer
7570+
value:
7571+
description: The value of the set action
7572+
type: string
75297573
type: object
75307574
CloudWorkloadSecurityAgentRuleActions:
75317575
description: The array of actions the rule can perform if triggered
@@ -7541,6 +7585,11 @@ components:
75417585
agentConstraint:
75427586
description: The version of the Agent
75437587
type: string
7588+
blocking:
7589+
description: The blocking policies that the rule belongs to
7590+
items:
7591+
type: string
7592+
type: array
75447593
category:
75457594
description: The category of the Agent rule
75467595
example: Process Activity
@@ -7564,6 +7613,11 @@ components:
75647613
description: The description of the Agent rule
75657614
example: My Agent rule
75667615
type: string
7616+
disabled:
7617+
description: The disabled policies that the rule belongs to
7618+
items:
7619+
type: string
7620+
type: array
75677621
enabled:
75687622
description: Whether the Agent rule is enabled
75697623
example: true
@@ -7577,6 +7631,11 @@ components:
75777631
items:
75787632
type: string
75797633
type: array
7634+
monitoring:
7635+
description: The monitoring policies that the rule belongs to
7636+
items:
7637+
type: string
7638+
type: array
75807639
name:
75817640
description: The name of the Agent rule
75827641
example: my_agent_rule
@@ -7611,10 +7670,22 @@ components:
76117670
CloudWorkloadSecurityAgentRuleCreateAttributes:
76127671
description: Create a new Cloud Workload Security Agent rule.
76137672
properties:
7673+
actions:
7674+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
7675+
blocking:
7676+
description: The blocking policies that the rule belongs to
7677+
items:
7678+
type: string
7679+
type: array
76147680
description:
76157681
description: The description of the Agent rule.
76167682
example: My Agent rule
76177683
type: string
7684+
disabled:
7685+
description: The disabled policies that the rule belongs to
7686+
items:
7687+
type: string
7688+
type: array
76187689
enabled:
76197690
description: Whether the Agent rule is enabled
76207691
example: true
@@ -7628,6 +7699,11 @@ components:
76287699
items:
76297700
type: string
76307701
type: array
7702+
monitoring:
7703+
description: The monitoring policies that the rule belongs to
7704+
items:
7705+
type: string
7706+
type: array
76317707
name:
76327708
description: The name of the Agent rule.
76337709
example: my_agent_rule
@@ -7718,10 +7794,22 @@ components:
77187794
CloudWorkloadSecurityAgentRuleUpdateAttributes:
77197795
description: Update an existing Cloud Workload Security Agent rule
77207796
properties:
7797+
actions:
7798+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
7799+
blocking:
7800+
description: The blocking policies that the rule belongs to
7801+
items:
7802+
type: string
7803+
type: array
77217804
description:
77227805
description: The description of the Agent rule
77237806
example: My Agent rule
77247807
type: string
7808+
disabled:
7809+
description: The disabled policies that the rule belongs to
7810+
items:
7811+
type: string
7812+
type: array
77257813
enabled:
77267814
description: Whether the Agent rule is enabled
77277815
example: true
@@ -7730,6 +7818,11 @@ components:
77307818
description: The SECL expression of the Agent rule
77317819
example: exec.file.name == "sh"
77327820
type: string
7821+
monitoring:
7822+
description: The monitoring policies that the rule belongs to
7823+
items:
7824+
type: string
7825+
type: array
77337826
policy_id:
77347827
description: The ID of the policy where the Agent rule is saved
77357828
example: a8c8e364-6556-434d-b798-a4c23de29c0b
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Create a Workload Protection agent rule with set action returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.CsmThreatsApi;
6+
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleAction;
7+
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleActionSet;
8+
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleCreateAttributes;
9+
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleCreateData;
10+
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleCreateRequest;
11+
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleResponse;
12+
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleType;
13+
import java.util.Collections;
14+
15+
public class Example {
16+
public static void main(String[] args) {
17+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
18+
CsmThreatsApi apiInstance = new CsmThreatsApi(defaultClient);
19+
20+
// there is a valid "policy_rc" in the system
21+
String POLICY_DATA_ID = System.getenv("POLICY_DATA_ID");
22+
23+
CloudWorkloadSecurityAgentRuleCreateRequest body =
24+
new CloudWorkloadSecurityAgentRuleCreateRequest()
25+
.data(
26+
new CloudWorkloadSecurityAgentRuleCreateData()
27+
.attributes(
28+
new CloudWorkloadSecurityAgentRuleCreateAttributes()
29+
.description("My Agent rule with set action")
30+
.enabled(true)
31+
.expression("""
32+
exec.file.name == "sh"
33+
""")
34+
.name("examplecsmthreat")
35+
.policyId(POLICY_DATA_ID)
36+
.actions(
37+
Collections.singletonList(
38+
new CloudWorkloadSecurityAgentRuleAction()
39+
.set(
40+
new CloudWorkloadSecurityAgentRuleActionSet()
41+
.name("test_set")
42+
.value("test_value")
43+
.scope("process")))))
44+
.type(CloudWorkloadSecurityAgentRuleType.AGENT_RULE));
45+
46+
try {
47+
CloudWorkloadSecurityAgentRuleResponse result = apiInstance.createCSMThreatsAgentRule(body);
48+
System.out.println(result);
49+
} catch (ApiException e) {
50+
System.err.println("Exception when calling CsmThreatsApi#createCSMThreatsAgentRule");
51+
System.err.println("Status code: " + e.getCode());
52+
System.err.println("Reason: " + e.getResponseBody());
53+
System.err.println("Response headers: " + e.getResponseHeaders());
54+
e.printStackTrace();
55+
}
56+
}
57+
}

src/main/java/com/datadog/api/client/v2/model/CloudWorkloadSecurityAgentRuleAction.java

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
/** The action the rule can perform if triggered */
2020
@JsonPropertyOrder({
2121
CloudWorkloadSecurityAgentRuleAction.JSON_PROPERTY_FILTER,
22-
CloudWorkloadSecurityAgentRuleAction.JSON_PROPERTY_KILL
22+
CloudWorkloadSecurityAgentRuleAction.JSON_PROPERTY_KILL,
23+
CloudWorkloadSecurityAgentRuleAction.JSON_PROPERTY_METADATA,
24+
CloudWorkloadSecurityAgentRuleAction.JSON_PROPERTY_SET
2325
})
2426
@jakarta.annotation.Generated(
2527
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
@@ -31,6 +33,12 @@ public class CloudWorkloadSecurityAgentRuleAction {
3133
public static final String JSON_PROPERTY_KILL = "kill";
3234
private CloudWorkloadSecurityAgentRuleKill kill;
3335

36+
public static final String JSON_PROPERTY_METADATA = "metadata";
37+
private CloudWorkloadSecurityAgentRuleActionMetadata metadata;
38+
39+
public static final String JSON_PROPERTY_SET = "set";
40+
private CloudWorkloadSecurityAgentRuleActionSet set;
41+
3442
public CloudWorkloadSecurityAgentRuleAction filter(String filter) {
3543
this.filter = filter;
3644
return this;
@@ -74,6 +82,51 @@ public void setKill(CloudWorkloadSecurityAgentRuleKill kill) {
7482
this.kill = kill;
7583
}
7684

85+
public CloudWorkloadSecurityAgentRuleAction metadata(
86+
CloudWorkloadSecurityAgentRuleActionMetadata metadata) {
87+
this.metadata = metadata;
88+
this.unparsed |= metadata.unparsed;
89+
return this;
90+
}
91+
92+
/**
93+
* The metadata action applied on the scope matching the rule
94+
*
95+
* @return metadata
96+
*/
97+
@jakarta.annotation.Nullable
98+
@JsonProperty(JSON_PROPERTY_METADATA)
99+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
100+
public CloudWorkloadSecurityAgentRuleActionMetadata getMetadata() {
101+
return metadata;
102+
}
103+
104+
public void setMetadata(CloudWorkloadSecurityAgentRuleActionMetadata metadata) {
105+
this.metadata = metadata;
106+
}
107+
108+
public CloudWorkloadSecurityAgentRuleAction set(CloudWorkloadSecurityAgentRuleActionSet set) {
109+
this.set = set;
110+
this.unparsed |= set.unparsed;
111+
return this;
112+
}
113+
114+
/**
115+
* The set action applied on the scope matching the rule
116+
*
117+
* @return set
118+
*/
119+
@jakarta.annotation.Nullable
120+
@JsonProperty(JSON_PROPERTY_SET)
121+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
122+
public CloudWorkloadSecurityAgentRuleActionSet getSet() {
123+
return set;
124+
}
125+
126+
public void setSet(CloudWorkloadSecurityAgentRuleActionSet set) {
127+
this.set = set;
128+
}
129+
77130
/**
78131
* A container for additional, undeclared properties. This is a holder for any undeclared
79132
* properties as specified with the 'additionalProperties' keyword in the OAS document.
@@ -133,13 +186,15 @@ public boolean equals(Object o) {
133186
(CloudWorkloadSecurityAgentRuleAction) o;
134187
return Objects.equals(this.filter, cloudWorkloadSecurityAgentRuleAction.filter)
135188
&& Objects.equals(this.kill, cloudWorkloadSecurityAgentRuleAction.kill)
189+
&& Objects.equals(this.metadata, cloudWorkloadSecurityAgentRuleAction.metadata)
190+
&& Objects.equals(this.set, cloudWorkloadSecurityAgentRuleAction.set)
136191
&& Objects.equals(
137192
this.additionalProperties, cloudWorkloadSecurityAgentRuleAction.additionalProperties);
138193
}
139194

140195
@Override
141196
public int hashCode() {
142-
return Objects.hash(filter, kill, additionalProperties);
197+
return Objects.hash(filter, kill, metadata, set, additionalProperties);
143198
}
144199

145200
@Override
@@ -148,6 +203,8 @@ public String toString() {
148203
sb.append("class CloudWorkloadSecurityAgentRuleAction {\n");
149204
sb.append(" filter: ").append(toIndentedString(filter)).append("\n");
150205
sb.append(" kill: ").append(toIndentedString(kill)).append("\n");
206+
sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n");
207+
sb.append(" set: ").append(toIndentedString(set)).append("\n");
151208
sb.append(" additionalProperties: ")
152209
.append(toIndentedString(additionalProperties))
153210
.append("\n");

0 commit comments

Comments
 (0)