Skip to content

Commit 1704d71

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add field attribute to the Workload Protection hash action (#2972)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 0dd4d39 commit 1704d71

File tree

58 files changed

+2457
-4230
lines changed

Some content is hidden

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

58 files changed

+2457
-4230
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10258,6 +10258,10 @@ components:
1025810258
description: Whether the policy is pinned
1025910259
example: false
1026010260
type: boolean
10261+
policyType:
10262+
description: The type of the policy
10263+
example: policy
10264+
type: string
1026110265
policyVersion:
1026210266
description: The version of the policy
1026310267
example: '1'
@@ -10436,11 +10440,11 @@ components:
1043610440
CloudWorkloadSecurityAgentPolicyVersion:
1043710441
description: The versions of the policy
1043810442
properties:
10439-
Date:
10443+
date:
1044010444
description: The date and time the version was created
1044110445
nullable: true
1044210446
type: string
10443-
Name:
10447+
name:
1044410448
description: The version of the policy
1044510449
example: 1.47.0-rc2
1044610450
type: string
@@ -10467,8 +10471,11 @@ components:
1046710471
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionSet'
1046810472
type: object
1046910473
CloudWorkloadSecurityAgentRuleActionHash:
10470-
additionalProperties: {}
10471-
description: An empty object indicating the hash action
10474+
description: Hash file specified by the field attribute
10475+
properties:
10476+
field:
10477+
description: The field of the hash action
10478+
type: string
1047210479
type: object
1047310480
CloudWorkloadSecurityAgentRuleActionMetadata:
1047410481
description: The metadata action applied on the scope matching the rule
@@ -10516,9 +10523,14 @@ components:
1051610523
format: int64
1051710524
type: integer
1051810525
value:
10519-
description: The value of the set action
10520-
type: string
10526+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionSetValue'
1052110527
type: object
10528+
CloudWorkloadSecurityAgentRuleActionSetValue:
10529+
description: The value of the set action
10530+
oneOf:
10531+
- type: string
10532+
- type: integer
10533+
- type: boolean
1052210534
CloudWorkloadSecurityAgentRuleActions:
1052310535
description: The array of actions the rule can perform if triggered
1052410536
items:

docs/datadog_api_client.v2.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4071,6 +4071,13 @@ datadog\_api\_client.v2.model.cloud\_workload\_security\_agent\_rule\_action\_se
40714071
:members:
40724072
:show-inheritance:
40734073

4074+
datadog\_api\_client.v2.model.cloud\_workload\_security\_agent\_rule\_action\_set\_value module
4075+
-----------------------------------------------------------------------------------------------
4076+
4077+
.. automodule:: datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_set_value
4078+
:members:
4079+
:show-inheritance:
4080+
40744081
datadog\_api\_client.v2.model.cloud\_workload\_security\_agent\_rule\_attributes module
40754082
---------------------------------------------------------------------------------------
40764083

examples/v2/csm-threats/CreateCSMThreatsAgentRule_1295653933.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
),
4747
),
4848
CloudWorkloadSecurityAgentRuleAction(
49-
hash=CloudWorkloadSecurityAgentRuleActionHash(),
49+
hash=CloudWorkloadSecurityAgentRuleActionHash(
50+
field="exec.file",
51+
),
5052
),
5153
],
5254
),

examples/v2/csm-threats/CreateCSMThreatsAgentRule_1363354233.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
CloudWorkloadSecurityAgentRuleAction(
3838
set=CloudWorkloadSecurityAgentRuleActionSet(
3939
name="test_set",
40-
expression="open.file.path",
40+
expression="exec.file.path",
4141
default_value="/dev/null",
4242
scope="process",
4343
),

src/datadog_api_client/v2/model/cloud_workload_security_agent_policy_attributes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def openapi_types(_):
5858
"monitoring_rules_count": (int,),
5959
"name": (str,),
6060
"pinned": (bool,),
61+
"policy_type": (str,),
6162
"policy_version": (str,),
6263
"priority": (int,),
6364
"rule_count": (int,),
@@ -78,6 +79,7 @@ def openapi_types(_):
7879
"monitoring_rules_count": "monitoringRulesCount",
7980
"name": "name",
8081
"pinned": "pinned",
82+
"policy_type": "policyType",
8183
"policy_version": "policyVersion",
8284
"priority": "priority",
8385
"rule_count": "ruleCount",
@@ -99,6 +101,7 @@ def __init__(
99101
monitoring_rules_count: Union[int, UnsetType] = unset,
100102
name: Union[str, UnsetType] = unset,
101103
pinned: Union[bool, UnsetType] = unset,
104+
policy_type: Union[str, UnsetType] = unset,
102105
policy_version: Union[str, UnsetType] = unset,
103106
priority: Union[int, UnsetType] = unset,
104107
rule_count: Union[int, UnsetType] = unset,
@@ -141,6 +144,9 @@ def __init__(
141144
:param pinned: Whether the policy is pinned
142145
:type pinned: bool, optional
143146
147+
:param policy_type: The type of the policy
148+
:type policy_type: str, optional
149+
144150
:param policy_version: The version of the policy
145151
:type policy_version: str, optional
146152
@@ -182,6 +188,8 @@ def __init__(
182188
kwargs["name"] = name
183189
if pinned is not unset:
184190
kwargs["pinned"] = pinned
191+
if policy_type is not unset:
192+
kwargs["policy_type"] = policy_type
185193
if policy_version is not unset:
186194
kwargs["policy_version"] = policy_version
187195
if priority is not unset:

src/datadog_api_client/v2/model/cloud_workload_security_agent_policy_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def openapi_types(_):
2323
}
2424

2525
attribute_map = {
26-
"date": "Date",
27-
"name": "Name",
26+
"date": "date",
27+
"name": "name",
2828
}
2929

3030
def __init__(self_, date: Union[str, none_type, UnsetType] = unset, name: Union[str, UnsetType] = unset, **kwargs):

src/datadog_api_client/v2/model/cloud_workload_security_agent_rule_action.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(
7373
:param filter: SECL expression used to target the container to apply the action on
7474
:type filter: str, optional
7575
76-
:param hash: An empty object indicating the hash action
76+
:param hash: Hash file specified by the field attribute
7777
:type hash: CloudWorkloadSecurityAgentRuleActionHash, optional
7878
7979
:param kill: Kill system call applied on the container matching the rule

src/datadog_api_client/v2/model/cloud_workload_security_agent_rule_action_hash.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,34 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6+
from typing import Union
67

78
from datadog_api_client.model_utils import (
89
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
913
)
1014

1115

1216
class CloudWorkloadSecurityAgentRuleActionHash(ModelNormal):
13-
def __init__(self_, **kwargs):
17+
@cached_property
18+
def openapi_types(_):
19+
return {
20+
"field": (str,),
21+
}
22+
23+
attribute_map = {
24+
"field": "field",
25+
}
26+
27+
def __init__(self_, field: Union[str, UnsetType] = unset, **kwargs):
1428
"""
15-
An empty object indicating the hash action
29+
Hash file specified by the field attribute
30+
31+
:param field: The field of the hash action
32+
:type field: str, optional
1633
"""
34+
if field is not unset:
35+
kwargs["field"] = field
1736
super().__init__(kwargs)

src/datadog_api_client/v2/model/cloud_workload_security_agent_rule_action_set.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

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

88
from datadog_api_client.model_utils import (
99
ModelNormal,
@@ -13,9 +13,19 @@
1313
)
1414

1515

16+
if TYPE_CHECKING:
17+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_set_value import (
18+
CloudWorkloadSecurityAgentRuleActionSetValue,
19+
)
20+
21+
1622
class CloudWorkloadSecurityAgentRuleActionSet(ModelNormal):
1723
@cached_property
1824
def openapi_types(_):
25+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_action_set_value import (
26+
CloudWorkloadSecurityAgentRuleActionSetValue,
27+
)
28+
1929
return {
2030
"append": (bool,),
2131
"default_value": (str,),
@@ -26,7 +36,7 @@ def openapi_types(_):
2636
"scope": (str,),
2737
"size": (int,),
2838
"ttl": (int,),
29-
"value": (str,),
39+
"value": (CloudWorkloadSecurityAgentRuleActionSetValue,),
3040
}
3141

3242
attribute_map = {
@@ -53,7 +63,7 @@ def __init__(
5363
scope: Union[str, UnsetType] = unset,
5464
size: Union[int, UnsetType] = unset,
5565
ttl: Union[int, UnsetType] = unset,
56-
value: Union[str, UnsetType] = unset,
66+
value: Union[CloudWorkloadSecurityAgentRuleActionSetValue, str, int, bool, UnsetType] = unset,
5767
**kwargs,
5868
):
5969
"""
@@ -87,7 +97,7 @@ def __init__(
8797
:type ttl: int, optional
8898
8999
:param value: The value of the set action
90-
:type value: str, optional
100+
:type value: CloudWorkloadSecurityAgentRuleActionSetValue, optional
91101
"""
92102
if append is not unset:
93103
kwargs["append"] = append
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
7+
from datadog_api_client.model_utils import (
8+
ModelComposed,
9+
cached_property,
10+
)
11+
12+
13+
class CloudWorkloadSecurityAgentRuleActionSetValue(ModelComposed):
14+
def __init__(self, **kwargs):
15+
"""
16+
The value of the set action
17+
"""
18+
super().__init__(kwargs)
19+
20+
@cached_property
21+
def _composed_schemas(_):
22+
# we need this here to make our import statements work
23+
# we must store _composed_schemas in here so the code is only run
24+
# when we invoke this method. If we kept this at the class
25+
# level we would get an error because the class level
26+
# code would be run when this module is imported, and these composed
27+
# classes don't exist yet because their module has not finished
28+
# loading
29+
return {
30+
"oneOf": [
31+
str,
32+
int,
33+
bool,
34+
],
35+
}

0 commit comments

Comments
 (0)