Skip to content

Commit b75f41c

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Add support for new CRUD agent rules endpoints (#1892)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 86fc754 commit b75f41c

File tree

64 files changed

+5024
-1650
lines changed

Some content is hidden

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

64 files changed

+5024
-1650
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": "2024-03-07 17:19:46.108857",
8-
"spec_repo_commit": "52e6d7fb"
7+
"regenerated": "2024-03-08 14:49:36.540934",
8+
"spec_repo_commit": "f5ed7e52"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-03-07 17:19:46.151702",
13-
"spec_repo_commit": "52e6d7fb"
12+
"regenerated": "2024-03-08 14:49:36.567217",
13+
"spec_repo_commit": "f5ed7e52"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3919,9 +3919,27 @@ components:
39193919
type: string
39203920
x-enum-varnames:
39213921
- CLOUD_COST_ACTIVITY
3922+
CloudWorkloadSecurityAgentRuleAction:
3923+
description: The action the rule can perform if triggered.
3924+
properties:
3925+
filter:
3926+
description: SECL expression used to target the container to apply the action
3927+
on
3928+
type: string
3929+
kill:
3930+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleKill'
3931+
type: object
3932+
CloudWorkloadSecurityAgentRuleActions:
3933+
description: The array of actions the rule can perform if triggered.
3934+
items:
3935+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleAction'
3936+
nullable: true
3937+
type: array
39223938
CloudWorkloadSecurityAgentRuleAttributes:
39233939
description: A Cloud Workload Security Agent rule returned by the API.
39243940
properties:
3941+
actions:
3942+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActions'
39253943
agentConstraint:
39263944
description: The version of the agent.
39273945
type: string
@@ -4054,6 +4072,17 @@ components:
40544072
type:
40554073
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleType'
40564074
type: object
4075+
CloudWorkloadSecurityAgentRuleID:
4076+
description: The ID of the agent rule.
4077+
example: 3dd-0uc-h1s
4078+
type: string
4079+
CloudWorkloadSecurityAgentRuleKill:
4080+
description: Kill system call applied on the container matching the rule
4081+
properties:
4082+
signal:
4083+
description: Supported signals for the kill system call.
4084+
type: string
4085+
type: object
40574086
CloudWorkloadSecurityAgentRuleResponse:
40584087
description: Response object that includes an Agent rule.
40594088
properties:
@@ -4090,6 +4119,8 @@ components:
40904119
properties:
40914120
attributes:
40924121
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleUpdateAttributes'
4122+
id:
4123+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleID'
40934124
type:
40944125
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleType'
40954126
required:
@@ -29582,6 +29613,154 @@ paths:
2958229613
We are gradually onboarding support for more sources. If you have any
2958329614

2958429615
feedback, contact [Datadog Support](https://docs.datadoghq.com/help/).'
29616+
/api/v2/remote_config/products/cws/agent_rules:
29617+
get:
29618+
description: Get the list of Cloud Security Management Threats Agent rules.
29619+
operationId: ListCSMThreatsAgentRules
29620+
responses:
29621+
'200':
29622+
content:
29623+
application/json:
29624+
schema:
29625+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRulesListResponse'
29626+
description: OK
29627+
'403':
29628+
$ref: '#/components/responses/NotAuthorizedResponse'
29629+
'429':
29630+
$ref: '#/components/responses/TooManyRequestsResponse'
29631+
summary: Get all CSM Threats Agent rules
29632+
tags:
29633+
- Cloud Workload Security
29634+
post:
29635+
description: Create a new Cloud Security Management Threats Agent rule with
29636+
the given parameters.
29637+
operationId: CreateCSMThreatsAgentRule
29638+
requestBody:
29639+
content:
29640+
application/json:
29641+
schema:
29642+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleCreateRequest'
29643+
description: The definition of the new Agent rule.
29644+
required: true
29645+
responses:
29646+
'200':
29647+
content:
29648+
application/json:
29649+
schema:
29650+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleResponse'
29651+
description: OK
29652+
'400':
29653+
$ref: '#/components/responses/BadRequestResponse'
29654+
'403':
29655+
$ref: '#/components/responses/NotAuthorizedResponse'
29656+
'409':
29657+
$ref: '#/components/responses/ConflictResponse'
29658+
'429':
29659+
$ref: '#/components/responses/TooManyRequestsResponse'
29660+
summary: Create a CSM Threats Agent rule
29661+
tags:
29662+
- Cloud Workload Security
29663+
x-codegen-request-body-name: body
29664+
/api/v2/remote_config/products/cws/agent_rules/{agent_rule_id}:
29665+
delete:
29666+
description: Delete a specific Cloud Security Management Threats Agent rule.
29667+
operationId: DeleteCSMThreatsAgentRule
29668+
parameters:
29669+
- $ref: '#/components/parameters/CloudWorkloadSecurityAgentRuleID'
29670+
responses:
29671+
'204':
29672+
description: OK
29673+
'403':
29674+
$ref: '#/components/responses/NotAuthorizedResponse'
29675+
'404':
29676+
$ref: '#/components/responses/NotFoundResponse'
29677+
'429':
29678+
$ref: '#/components/responses/TooManyRequestsResponse'
29679+
summary: Delete a CSM Threats Agent rule
29680+
tags:
29681+
- Cloud Workload Security
29682+
get:
29683+
description: Get the details of a specific Cloud Security Management Threats
29684+
Agent rule.
29685+
operationId: GetCSMThreatsAgentRule
29686+
parameters:
29687+
- $ref: '#/components/parameters/CloudWorkloadSecurityAgentRuleID'
29688+
responses:
29689+
'200':
29690+
content:
29691+
application/json:
29692+
schema:
29693+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleResponse'
29694+
description: OK
29695+
'403':
29696+
$ref: '#/components/responses/NotAuthorizedResponse'
29697+
'404':
29698+
$ref: '#/components/responses/NotFoundResponse'
29699+
'429':
29700+
$ref: '#/components/responses/TooManyRequestsResponse'
29701+
summary: Get a CSM Threats Agent rule
29702+
tags:
29703+
- Cloud Workload Security
29704+
patch:
29705+
description: 'Update a specific Cloud Security Management Threats Agent rule.
29706+
29707+
Returns the Agent rule object when the request is successful.'
29708+
operationId: UpdateCSMThreatsAgentRule
29709+
parameters:
29710+
- $ref: '#/components/parameters/CloudWorkloadSecurityAgentRuleID'
29711+
requestBody:
29712+
content:
29713+
application/json:
29714+
schema:
29715+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleUpdateRequest'
29716+
description: New definition of the Agent rule.
29717+
required: true
29718+
responses:
29719+
'200':
29720+
content:
29721+
application/json:
29722+
schema:
29723+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleResponse'
29724+
description: OK
29725+
'400':
29726+
$ref: '#/components/responses/BadRequestResponse'
29727+
'403':
29728+
$ref: '#/components/responses/NotAuthorizedResponse'
29729+
'404':
29730+
$ref: '#/components/responses/NotFoundResponse'
29731+
'409':
29732+
$ref: '#/components/responses/ConcurrentModificationResponse'
29733+
'429':
29734+
$ref: '#/components/responses/TooManyRequestsResponse'
29735+
summary: Update a CSM Threats Agent rule
29736+
tags:
29737+
- Cloud Workload Security
29738+
x-codegen-request-body-name: body
29739+
/api/v2/remote_config/products/cws/policy/download:
29740+
get:
29741+
description: 'The download endpoint generates a CSM Threats policy file from
29742+
your currently active
29743+
29744+
CSM Threats rules, and downloads them as a `.policy` file. This file can then
29745+
be deployed to
29746+
29747+
your Agents to update the policy running in your environment.'
29748+
operationId: DownloadCSMThreatsPolicy
29749+
responses:
29750+
'200':
29751+
content:
29752+
application/zip:
29753+
schema:
29754+
format: binary
29755+
type: string
29756+
description: OK
29757+
'403':
29758+
$ref: '#/components/responses/NotAuthorizedResponse'
29759+
'429':
29760+
$ref: '#/components/responses/TooManyRequestsResponse'
29761+
summary: Get the latest CSM Threats policy
29762+
tags:
29763+
- Cloud Workload Security
2958529764
/api/v2/restriction_policy/{resource_id}:
2958629765
delete:
2958729766
description: Deletes the restriction policy associated with a specified resource.
@@ -34821,6 +35000,11 @@ tags:
3482135000
[Test Visibility in Datadog page](https://docs.datadoghq.com/tests/) for more
3482235001
information.
3482335002
name: CI Visibility Tests
35003+
- description: Cloud Security Management Threats (CSM Threats) monitors file, network,
35004+
and process activity across your environment to detect real-time threats to your
35005+
infrastructure. See [Cloud Security Management Threats](https://docs.datadoghq.com/security/threats/)
35006+
for more information on setting up CSM Threats.
35007+
name: CSM Threats
3482435008
- description: View and manage cases and projects within Case Management. See the
3482535009
[Case Management page](https://docs.datadoghq.com/service_management/case_management/)
3482635010
for more information.

docs/datadog_api_client.v2.model.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,13 @@ cloud\_cost\_activity\_type
14921492
:members:
14931493
:show-inheritance:
14941494

1495+
cloud\_workload\_security\_agent\_rule\_action
1496+
----------------------------------------------
1497+
1498+
.. automodule:: datadog_api_client.v2.model.cloud_workload_security_agent_rule_action
1499+
:members:
1500+
:show-inheritance:
1501+
14951502
cloud\_workload\_security\_agent\_rule\_attributes
14961503
--------------------------------------------------
14971504

@@ -1534,6 +1541,13 @@ cloud\_workload\_security\_agent\_rule\_data
15341541
:members:
15351542
:show-inheritance:
15361543

1544+
cloud\_workload\_security\_agent\_rule\_kill
1545+
--------------------------------------------
1546+
1547+
.. automodule:: datadog_api_client.v2.model.cloud_workload_security_agent_rule_kill
1548+
:members:
1549+
:show-inheritance:
1550+
15371551
cloud\_workload\_security\_agent\_rule\_response
15381552
------------------------------------------------
15391553

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
Create a CSM Threats Agent rule returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.cloud_workload_security_api import CloudWorkloadSecurityApi
7+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_create_attributes import (
8+
CloudWorkloadSecurityAgentRuleCreateAttributes,
9+
)
10+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_create_data import (
11+
CloudWorkloadSecurityAgentRuleCreateData,
12+
)
13+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_create_request import (
14+
CloudWorkloadSecurityAgentRuleCreateRequest,
15+
)
16+
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_type import CloudWorkloadSecurityAgentRuleType
17+
18+
body = CloudWorkloadSecurityAgentRuleCreateRequest(
19+
data=CloudWorkloadSecurityAgentRuleCreateData(
20+
attributes=CloudWorkloadSecurityAgentRuleCreateAttributes(
21+
description="My Agent rule",
22+
enabled=True,
23+
expression='exec.file.name == "sh"',
24+
name="my_agent_rule",
25+
),
26+
type=CloudWorkloadSecurityAgentRuleType.AGENT_RULE,
27+
),
28+
)
29+
30+
configuration = Configuration()
31+
with ApiClient(configuration) as api_client:
32+
api_instance = CloudWorkloadSecurityApi(api_client)
33+
response = api_instance.create_csm_threats_agent_rule(body=body)
34+
35+
print(response)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
Delete a CSM Threats Agent rule 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.cloud_workload_security_api import CloudWorkloadSecurityApi
8+
9+
# there is a valid "agent_rule_rc" in the system
10+
AGENT_RULE_DATA_ID = environ["AGENT_RULE_DATA_ID"]
11+
12+
configuration = Configuration()
13+
with ApiClient(configuration) as api_client:
14+
api_instance = CloudWorkloadSecurityApi(api_client)
15+
api_instance.delete_csm_threats_agent_rule(
16+
agent_rule_id=AGENT_RULE_DATA_ID,
17+
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Get the latest CSM Threats policy returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.cloud_workload_security_api import CloudWorkloadSecurityApi
7+
8+
configuration = Configuration()
9+
with ApiClient(configuration) as api_client:
10+
api_instance = CloudWorkloadSecurityApi(api_client)
11+
response = api_instance.download_csm_threats_policy()
12+
13+
print(response.read())
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
Get a CSM Threats Agent rule 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.cloud_workload_security_api import CloudWorkloadSecurityApi
8+
9+
# there is a valid "agent_rule_rc" in the system
10+
AGENT_RULE_DATA_ID = environ["AGENT_RULE_DATA_ID"]
11+
12+
configuration = Configuration()
13+
with ApiClient(configuration) as api_client:
14+
api_instance = CloudWorkloadSecurityApi(api_client)
15+
response = api_instance.get_csm_threats_agent_rule(
16+
agent_rule_id=AGENT_RULE_DATA_ID,
17+
)
18+
19+
print(response)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Get all CSM Threats Agent rules returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.cloud_workload_security_api import CloudWorkloadSecurityApi
7+
8+
configuration = Configuration()
9+
with ApiClient(configuration) as api_client:
10+
api_instance = CloudWorkloadSecurityApi(api_client)
11+
response = api_instance.list_csm_threats_agent_rules()
12+
13+
print(response)

0 commit comments

Comments
 (0)