Skip to content

Commit b860eb8

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 2ebeb89 of spec repo
1 parent bea00be commit b860eb8

File tree

59 files changed

+5777
-4217
lines changed

Some content is hidden

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

59 files changed

+5777
-4217
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/CreateCSMThreatsAgentRule.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
description="My Agent rule",
2626
enabled=True,
2727
expression='exec.file.name == "sh"',
28+
agent_version="> 7.60",
2829
filters=[],
2930
name="examplecsmthreat",
3031
policy_id=POLICY_DATA_ID,

examples/v2/csm-threats/CreateCSMThreatsAgentRule_1295653933.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
name="test_set",
4343
value="test_value",
4444
scope="process",
45+
inherited=True,
4546
),
4647
),
4748
CloudWorkloadSecurityAgentRuleAction(
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
"""
2+
Create a Workload Protection agent rule with set action with expression 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 with expression",
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+
expression="open.file.path",
41+
default_value="/dev/null",
42+
scope="process",
43+
),
44+
),
45+
],
46+
),
47+
type=CloudWorkloadSecurityAgentRuleType.AGENT_RULE,
48+
),
49+
)
50+
51+
configuration = Configuration()
52+
with ApiClient(configuration) as api_client:
53+
api_instance = CSMThreatsApi(api_client)
54+
response = api_instance.create_csm_threats_agent_rule(body=body)
55+
56+
print(response)

src/datadog_api_client/v2/model/cloud_workload_security_agent_policy_attributes.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
from datadog_api_client.v2.model.cloud_workload_security_agent_policy_updater_attributes import (
1818
CloudWorkloadSecurityAgentPolicyUpdaterAttributes,
1919
)
20+
from datadog_api_client.v2.model.cloud_workload_security_agent_policy_version import (
21+
CloudWorkloadSecurityAgentPolicyVersion,
22+
)
2023

2124

2225
class CloudWorkloadSecurityAgentPolicyAttributes(ModelNormal):
@@ -40,6 +43,9 @@ def openapi_types(_):
4043
from datadog_api_client.v2.model.cloud_workload_security_agent_policy_updater_attributes import (
4144
CloudWorkloadSecurityAgentPolicyUpdaterAttributes,
4245
)
46+
from datadog_api_client.v2.model.cloud_workload_security_agent_policy_version import (
47+
CloudWorkloadSecurityAgentPolicyVersion,
48+
)
4349

4450
return {
4551
"blocking_rules_count": (int,),
@@ -51,12 +57,14 @@ def openapi_types(_):
5157
"host_tags_lists": ([[str]],),
5258
"monitoring_rules_count": (int,),
5359
"name": (str,),
60+
"pinned": (bool,),
5461
"policy_version": (str,),
5562
"priority": (int,),
5663
"rule_count": (int,),
5764
"update_date": (int,),
5865
"updated_at": (int,),
5966
"updater": (CloudWorkloadSecurityAgentPolicyUpdaterAttributes,),
67+
"versions": ([CloudWorkloadSecurityAgentPolicyVersion],),
6068
}
6169

6270
attribute_map = {
@@ -69,12 +77,14 @@ def openapi_types(_):
6977
"host_tags_lists": "hostTagsLists",
7078
"monitoring_rules_count": "monitoringRulesCount",
7179
"name": "name",
80+
"pinned": "pinned",
7281
"policy_version": "policyVersion",
7382
"priority": "priority",
7483
"rule_count": "ruleCount",
7584
"update_date": "updateDate",
7685
"updated_at": "updatedAt",
7786
"updater": "updater",
87+
"versions": "versions",
7888
}
7989

8090
def __init__(
@@ -88,12 +98,14 @@ def __init__(
8898
host_tags_lists: Union[List[List[str]], UnsetType] = unset,
8999
monitoring_rules_count: Union[int, UnsetType] = unset,
90100
name: Union[str, UnsetType] = unset,
101+
pinned: Union[bool, UnsetType] = unset,
91102
policy_version: Union[str, UnsetType] = unset,
92103
priority: Union[int, UnsetType] = unset,
93104
rule_count: Union[int, UnsetType] = unset,
94105
update_date: Union[int, UnsetType] = unset,
95106
updated_at: Union[int, UnsetType] = unset,
96107
updater: Union[CloudWorkloadSecurityAgentPolicyUpdaterAttributes, UnsetType] = unset,
108+
versions: Union[List[CloudWorkloadSecurityAgentPolicyVersion], UnsetType] = unset,
97109
**kwargs,
98110
):
99111
"""
@@ -126,6 +138,9 @@ def __init__(
126138
:param name: The name of the policy
127139
:type name: str, optional
128140
141+
:param pinned: Whether the policy is pinned
142+
:type pinned: bool, optional
143+
129144
:param policy_version: The version of the policy
130145
:type policy_version: str, optional
131146
@@ -143,6 +158,9 @@ def __init__(
143158
144159
:param updater: The attributes of the user who last updated the policy
145160
:type updater: CloudWorkloadSecurityAgentPolicyUpdaterAttributes, optional
161+
162+
:param versions: The versions of the policy
163+
:type versions: [CloudWorkloadSecurityAgentPolicyVersion], optional
146164
"""
147165
if blocking_rules_count is not unset:
148166
kwargs["blocking_rules_count"] = blocking_rules_count
@@ -162,6 +180,8 @@ def __init__(
162180
kwargs["monitoring_rules_count"] = monitoring_rules_count
163181
if name is not unset:
164182
kwargs["name"] = name
183+
if pinned is not unset:
184+
kwargs["pinned"] = pinned
165185
if policy_version is not unset:
166186
kwargs["policy_version"] = policy_version
167187
if priority is not unset:
@@ -174,4 +194,6 @@ def __init__(
174194
kwargs["updated_at"] = updated_at
175195
if updater is not unset:
176196
kwargs["updater"] = updater
197+
if versions is not unset:
198+
kwargs["versions"] = versions
177199
super().__init__(kwargs)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
none_type,
12+
unset,
13+
UnsetType,
14+
)
15+
16+
17+
class CloudWorkloadSecurityAgentPolicyVersion(ModelNormal):
18+
@cached_property
19+
def openapi_types(_):
20+
return {
21+
"date": (str, none_type),
22+
"name": (str,),
23+
}
24+
25+
attribute_map = {
26+
"date": "Date",
27+
"name": "Name",
28+
}
29+
30+
def __init__(self_, date: Union[str, none_type, UnsetType] = unset, name: Union[str, UnsetType] = unset, **kwargs):
31+
"""
32+
The versions of the policy
33+
34+
:param date: The date and time the version was created
35+
:type date: str, none_type, optional
36+
37+
:param name: The version of the policy
38+
:type name: str, optional
39+
"""
40+
if date is not unset:
41+
kwargs["date"] = date
42+
if name is not unset:
43+
kwargs["name"] = name
44+
super().__init__(kwargs)

0 commit comments

Comments
 (0)