Skip to content

Commit a5bc0bb

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit a7a536f2 of spec repo
1 parent 46b5a8b commit a5bc0bb

72 files changed

Lines changed: 693 additions & 3904 deletions

File tree

Some content is hidden

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

.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-26 12:46:05.900228",
8-
"spec_repo_commit": "a6954c1c"
7+
"regenerated": "2025-05-27 10:30:18.619352",
8+
"spec_repo_commit": "a7a536f2"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-05-26 12:46:05.916628",
13-
"spec_repo_commit": "a6954c1c"
12+
"regenerated": "2025-05-27 10:30:18.634587",
13+
"spec_repo_commit": "a7a536f2"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7375,6 +7375,8 @@ components:
73757375
CloudWorkloadSecurityAgentPolicyCreateAttributes:
73767376
description: Create a new Cloud Workload Security Agent policy
73777377
properties:
7378+
actions:
7379+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
73787380
description:
73797381
description: The description of the policy
73807382
example: My agent policy
@@ -7456,6 +7458,8 @@ components:
74567458
CloudWorkloadSecurityAgentPolicyUpdateAttributes:
74577459
description: Update an existing Cloud Workload Security Agent policy
74587460
properties:
7461+
actions:
7462+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
74597463
description:
74607464
description: The description of the policy
74617465
example: My agent policy
@@ -7526,6 +7530,50 @@ components:
75267530
type: string
75277531
kill:
75287532
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleKill'
7533+
metadata:
7534+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionMetadata'
7535+
set:
7536+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionSet'
7537+
type: object
7538+
CloudWorkloadSecurityAgentRuleActionMetadata:
7539+
description: The metadata action applied on the scope matching the rule
7540+
properties:
7541+
image_tag:
7542+
description: The image tag of the metadata action
7543+
type: string
7544+
service:
7545+
description: The service of the metadata action
7546+
type: string
7547+
short_image:
7548+
description: The short image of the metadata action
7549+
type: string
7550+
type: object
7551+
CloudWorkloadSecurityAgentRuleActionSet:
7552+
description: The set action applied on the scope matching the rule
7553+
properties:
7554+
append:
7555+
description: Whether the value should be appended to the field
7556+
type: boolean
7557+
field:
7558+
description: The field of the set action
7559+
type: string
7560+
name:
7561+
description: The name of the set action
7562+
type: string
7563+
scope:
7564+
description: The scope of the set action
7565+
type: string
7566+
size:
7567+
description: The size of the set action
7568+
format: int64
7569+
type: integer
7570+
ttl:
7571+
description: The time to live of the set action
7572+
format: int64
7573+
type: integer
7574+
value:
7575+
description: The value of the set action
7576+
type: string
75297577
type: object
75307578
CloudWorkloadSecurityAgentRuleActions:
75317579
description: The array of actions the rule can perform if triggered
@@ -7541,6 +7589,11 @@ components:
75417589
agentConstraint:
75427590
description: The version of the Agent
75437591
type: string
7592+
blocking:
7593+
description: The blocking policies that the rule belongs to
7594+
items:
7595+
type: string
7596+
type: array
75447597
category:
75457598
description: The category of the Agent rule
75467599
example: Process Activity
@@ -7564,6 +7617,11 @@ components:
75647617
description: The description of the Agent rule
75657618
example: My Agent rule
75667619
type: string
7620+
disabled:
7621+
description: The disabled policies that the rule belongs to
7622+
items:
7623+
type: string
7624+
type: array
75677625
enabled:
75687626
description: Whether the Agent rule is enabled
75697627
example: true
@@ -7577,6 +7635,11 @@ components:
75777635
items:
75787636
type: string
75797637
type: array
7638+
monitoring:
7639+
description: The monitoring policies that the rule belongs to
7640+
items:
7641+
type: string
7642+
type: array
75807643
name:
75817644
description: The name of the Agent rule
75827645
example: my_agent_rule
@@ -7611,10 +7674,22 @@ components:
76117674
CloudWorkloadSecurityAgentRuleCreateAttributes:
76127675
description: Create a new Cloud Workload Security Agent rule.
76137676
properties:
7677+
actions:
7678+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
7679+
blocking:
7680+
description: The blocking policies that the rule belongs to
7681+
items:
7682+
type: string
7683+
type: array
76147684
description:
76157685
description: The description of the Agent rule.
76167686
example: My Agent rule
76177687
type: string
7688+
disabled:
7689+
description: The disabled policies that the rule belongs to
7690+
items:
7691+
type: string
7692+
type: array
76187693
enabled:
76197694
description: Whether the Agent rule is enabled
76207695
example: true
@@ -7628,6 +7703,11 @@ components:
76287703
items:
76297704
type: string
76307705
type: array
7706+
monitoring:
7707+
description: The monitoring policies that the rule belongs to
7708+
items:
7709+
type: string
7710+
type: array
76317711
name:
76327712
description: The name of the Agent rule.
76337713
example: my_agent_rule
@@ -7718,10 +7798,20 @@ components:
77187798
CloudWorkloadSecurityAgentRuleUpdateAttributes:
77197799
description: Update an existing Cloud Workload Security Agent rule
77207800
properties:
7801+
blocking:
7802+
description: The blocking policies that the rule belongs to
7803+
items:
7804+
type: string
7805+
type: array
77217806
description:
77227807
description: The description of the Agent rule
77237808
example: My Agent rule
77247809
type: string
7810+
disabled:
7811+
description: The disabled policies that the rule belongs to
7812+
items:
7813+
type: string
7814+
type: array
77257815
enabled:
77267816
description: Whether the Agent rule is enabled
77277817
example: true
@@ -7730,6 +7820,11 @@ components:
77307820
description: The SECL expression of the Agent rule
77317821
example: exec.file.name == "sh"
77327822
type: string
7823+
monitoring:
7824+
description: The monitoring policies that the rule belongs to
7825+
items:
7826+
type: string
7827+
type: array
77337828
policy_id:
77347829
description: The ID of the policy where the Agent rule is saved
77357830
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_policy_create_attributes.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,32 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import List, Union
6+
from typing import List, Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
1010
cached_property,
11+
none_type,
1112
unset,
1213
UnsetType,
1314
)
1415

1516

17+
if TYPE_CHECKING:
18+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action import (
19+
CloudWorkloadSecurityAgentRuleAction,
20+
)
21+
22+
1623
class CloudWorkloadSecurityAgentPolicyCreateAttributes(ModelNormal):
1724
@cached_property
1825
def openapi_types(_):
26+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action import (
27+
CloudWorkloadSecurityAgentRuleAction,
28+
)
29+
1930
return {
31+
"actions": ([CloudWorkloadSecurityAgentRuleAction],),
2032
"description": (str,),
2133
"enabled": (bool,),
2234
"host_tags": ([str],),
@@ -25,6 +37,7 @@ def openapi_types(_):
2537
}
2638

2739
attribute_map = {
40+
"actions": "actions",
2841
"description": "description",
2942
"enabled": "enabled",
3043
"host_tags": "hostTags",
@@ -35,6 +48,7 @@ def openapi_types(_):
3548
def __init__(
3649
self_,
3750
name: str,
51+
actions: Union[List[CloudWorkloadSecurityAgentRuleAction], none_type, UnsetType] = unset,
3852
description: Union[str, UnsetType] = unset,
3953
enabled: Union[bool, UnsetType] = unset,
4054
host_tags: Union[List[str], UnsetType] = unset,
@@ -44,6 +58,9 @@ def __init__(
4458
"""
4559
Create a new Cloud Workload Security Agent policy
4660
61+
:param actions: The array of actions the rule can perform if triggered
62+
:type actions: [CloudWorkloadSecurityAgentRuleAction], none_type, optional
63+
4764
:param description: The description of the policy
4865
:type description: str, optional
4966
@@ -59,6 +76,8 @@ def __init__(
5976
:param name: The name of the policy
6077
:type name: str
6178
"""
79+
if actions is not unset:
80+
kwargs["actions"] = actions
6281
if description is not unset:
6382
kwargs["description"] = description
6483
if enabled is not unset:

0 commit comments

Comments
 (0)