Skip to content

Commit 7bc8c05

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Exposing set action on Terraform V2 (#2568)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent f2fa297 commit 7bc8c05

File tree

67 files changed

+2720
-1921
lines changed

Some content is hidden

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

67 files changed

+2720
-1921
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:16.469657",
8-
"spec_repo_commit": "5906d277"
7+
"regenerated": "2025-06-04 09:10:40.335493",
8+
"spec_repo_commit": "6c99bb98"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-06-03 09:24:16.484530",
13-
"spec_repo_commit": "5906d277"
12+
"regenerated": "2025-06-04 09:10:40.351166",
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

docs/datadog_api_client.v2.model.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,6 +2839,20 @@ datadog\_api\_client.v2.model.cloud\_workload\_security\_agent\_rule\_action mod
28392839
:members:
28402840
:show-inheritance:
28412841

2842+
datadog\_api\_client.v2.model.cloud\_workload\_security\_agent\_rule\_action\_metadata module
2843+
---------------------------------------------------------------------------------------------
2844+
2845+
.. automodule:: datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_metadata
2846+
:members:
2847+
:show-inheritance:
2848+
2849+
datadog\_api\_client.v2.model.cloud\_workload\_security\_agent\_rule\_action\_set module
2850+
----------------------------------------------------------------------------------------
2851+
2852+
.. automodule:: datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_set
2853+
:members:
2854+
:show-inheritance:
2855+
28422856
datadog\_api\_client.v2.model.cloud\_workload\_security\_agent\_rule\_attributes module
28432857
---------------------------------------------------------------------------------------
28442858

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"""
2+
Create a Workload Protection agent rule with set action returns "OK" response
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v2.api.csm_threats_api import CSMThreatsApi
8+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action import CloudWorkloadSecurityAgentRuleAction
9+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_set import (
10+
CloudWorkloadSecurityAgentRuleActionSet,
11+
)
12+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_create_attributes import (
13+
CloudWorkloadSecurityAgentRuleCreateAttributes,
14+
)
15+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_create_data import (
16+
CloudWorkloadSecurityAgentRuleCreateData,
17+
)
18+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_create_request import (
19+
CloudWorkloadSecurityAgentRuleCreateRequest,
20+
)
21+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_type import CloudWorkloadSecurityAgentRuleType
22+
23+
# there is a valid "policy_rc" in the system
24+
POLICY_DATA_ID = environ["POLICY_DATA_ID"]
25+
26+
body = CloudWorkloadSecurityAgentRuleCreateRequest(
27+
data=CloudWorkloadSecurityAgentRuleCreateData(
28+
attributes=CloudWorkloadSecurityAgentRuleCreateAttributes(
29+
description="My Agent rule with set action",
30+
enabled=True,
31+
expression='exec.file.name == "sh"',
32+
filters=[],
33+
name="examplecsmthreat",
34+
policy_id=POLICY_DATA_ID,
35+
product_tags=[],
36+
actions=[
37+
CloudWorkloadSecurityAgentRuleAction(
38+
set=CloudWorkloadSecurityAgentRuleActionSet(
39+
name="test_set",
40+
value="test_value",
41+
scope="process",
42+
),
43+
),
44+
],
45+
),
46+
type=CloudWorkloadSecurityAgentRuleType.AGENT_RULE,
47+
),
48+
)
49+
50+
configuration = Configuration()
51+
with ApiClient(configuration) as api_client:
52+
api_instance = CSMThreatsApi(api_client)
53+
response = api_instance.create_csm_threats_agent_rule(body=body)
54+
55+
print(response)

src/datadog_api_client/v2/model/cloud_workload_security_agent_rule_action.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515

1616
if TYPE_CHECKING:
1717
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_kill import CloudWorkloadSecurityAgentRuleKill
18+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_metadata import (
19+
CloudWorkloadSecurityAgentRuleActionMetadata,
20+
)
21+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_set import (
22+
CloudWorkloadSecurityAgentRuleActionSet,
23+
)
1824

1925

2026
class CloudWorkloadSecurityAgentRuleAction(ModelNormal):
@@ -23,21 +29,33 @@ def openapi_types(_):
2329
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_kill import (
2430
CloudWorkloadSecurityAgentRuleKill,
2531
)
32+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_metadata import (
33+
CloudWorkloadSecurityAgentRuleActionMetadata,
34+
)
35+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_set import (
36+
CloudWorkloadSecurityAgentRuleActionSet,
37+
)
2638

2739
return {
2840
"filter": (str,),
2941
"kill": (CloudWorkloadSecurityAgentRuleKill,),
42+
"metadata": (CloudWorkloadSecurityAgentRuleActionMetadata,),
43+
"set": (CloudWorkloadSecurityAgentRuleActionSet,),
3044
}
3145

3246
attribute_map = {
3347
"filter": "filter",
3448
"kill": "kill",
49+
"metadata": "metadata",
50+
"set": "set",
3551
}
3652

3753
def __init__(
3854
self_,
3955
filter: Union[str, UnsetType] = unset,
4056
kill: Union[CloudWorkloadSecurityAgentRuleKill, UnsetType] = unset,
57+
metadata: Union[CloudWorkloadSecurityAgentRuleActionMetadata, UnsetType] = unset,
58+
set: Union[CloudWorkloadSecurityAgentRuleActionSet, UnsetType] = unset,
4159
**kwargs,
4260
):
4361
"""
@@ -48,9 +66,19 @@ def __init__(
4866
4967
:param kill: Kill system call applied on the container matching the rule
5068
:type kill: CloudWorkloadSecurityAgentRuleKill, optional
69+
70+
:param metadata: The metadata action applied on the scope matching the rule
71+
:type metadata: CloudWorkloadSecurityAgentRuleActionMetadata, optional
72+
73+
:param set: The set action applied on the scope matching the rule
74+
:type set: CloudWorkloadSecurityAgentRuleActionSet, optional
5175
"""
5276
if filter is not unset:
5377
kwargs["filter"] = filter
5478
if kill is not unset:
5579
kwargs["kill"] = kill
80+
if metadata is not unset:
81+
kwargs["metadata"] = metadata
82+
if set is not unset:
83+
kwargs["set"] = set
5684
super().__init__(kwargs)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
from __future__ import annotations
5+
6+
from typing import Union
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
class CloudWorkloadSecurityAgentRuleActionMetadata(ModelNormal):
17+
@cached_property
18+
def openapi_types(_):
19+
return {
20+
"image_tag": (str,),
21+
"service": (str,),
22+
"short_image": (str,),
23+
}
24+
25+
attribute_map = {
26+
"image_tag": "image_tag",
27+
"service": "service",
28+
"short_image": "short_image",
29+
}
30+
31+
def __init__(
32+
self_,
33+
image_tag: Union[str, UnsetType] = unset,
34+
service: Union[str, UnsetType] = unset,
35+
short_image: Union[str, UnsetType] = unset,
36+
**kwargs,
37+
):
38+
"""
39+
The metadata action applied on the scope matching the rule
40+
41+
:param image_tag: The image tag of the metadata action
42+
:type image_tag: str, optional
43+
44+
:param service: The service of the metadata action
45+
:type service: str, optional
46+
47+
:param short_image: The short image of the metadata action
48+
:type short_image: str, optional
49+
"""
50+
if image_tag is not unset:
51+
kwargs["image_tag"] = image_tag
52+
if service is not unset:
53+
kwargs["service"] = service
54+
if short_image is not unset:
55+
kwargs["short_image"] = short_image
56+
super().__init__(kwargs)

0 commit comments

Comments
 (0)