|
| 1 | +""" |
| 2 | +Create an inbox rule returns "Successfully created the inbox rule" response |
| 3 | +""" |
| 4 | + |
| 5 | +from datadog_api_client import ApiClient, Configuration |
| 6 | +from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi |
| 7 | +from datadog_api_client.v2.model.automation_rule_scope import AutomationRuleScope |
| 8 | +from datadog_api_client.v2.model.inbox_rule_action import InboxRuleAction |
| 9 | +from datadog_api_client.v2.model.inbox_rule_attributes_create import InboxRuleAttributesCreate |
| 10 | +from datadog_api_client.v2.model.inbox_rule_create_request import InboxRuleCreateRequest |
| 11 | +from datadog_api_client.v2.model.inbox_rule_data_create import InboxRuleDataCreate |
| 12 | +from datadog_api_client.v2.model.inbox_rule_type import InboxRuleType |
| 13 | +from datadog_api_client.v2.model.security_finding_type import SecurityFindingType |
| 14 | + |
| 15 | +body = InboxRuleCreateRequest( |
| 16 | + data=InboxRuleDataCreate( |
| 17 | + attributes=InboxRuleAttributesCreate( |
| 18 | + action=InboxRuleAction( |
| 19 | + description="Needs triage", |
| 20 | + ), |
| 21 | + enabled=True, |
| 22 | + name="Example-Security-Monitoring", |
| 23 | + rule=AutomationRuleScope( |
| 24 | + finding_types=[ |
| 25 | + SecurityFindingType.MISCONFIGURATION, |
| 26 | + ], |
| 27 | + query="env:staging", |
| 28 | + ), |
| 29 | + ), |
| 30 | + type=InboxRuleType.INBOX_RULES, |
| 31 | + ), |
| 32 | +) |
| 33 | + |
| 34 | +configuration = Configuration() |
| 35 | +configuration.unstable_operations["create_security_findings_automation_inbox_rule"] = True |
| 36 | +with ApiClient(configuration) as api_client: |
| 37 | + api_instance = SecurityMonitoringApi(api_client) |
| 38 | + response = api_instance.create_security_findings_automation_inbox_rule(body=body) |
| 39 | + |
| 40 | + print(response) |
0 commit comments