Skip to content

Commit 289f8e7

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 19949fa of spec repo (#3962)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 51f3479 commit 289f8e7

193 files changed

Lines changed: 1725 additions & 205 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.

.generator/schemas/v2/openapi.yaml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23518,6 +23518,8 @@ components:
2351823518
$ref: "#/components/schemas/Enabled"
2351923519
name:
2352023520
$ref: "#/components/schemas/RuleName"
23521+
routing:
23522+
$ref: "#/components/schemas/NotificationRuleRouting"
2352123523
selectors:
2352223524
$ref: "#/components/schemas/Selectors"
2352323525
targets:
@@ -59051,6 +59053,76 @@ components:
5905159053
- targets
5905259054
- version
5905359055
type: object
59056+
NotificationRulePreviewNotificationStatus:
59057+
description: The notification status for the given rule type. `SUCCESS` means a matching event was found and the notification was sent successfully. `DEFAULT` means no matching event was found and a default placeholder notification was sent instead. `ERROR` means an error occurred while sending the notification.
59058+
enum:
59059+
- SUCCESS
59060+
- DEFAULT
59061+
- ERROR
59062+
example: SUCCESS
59063+
type: string
59064+
x-enum-varnames:
59065+
- SUCCESS
59066+
- DEFAULT
59067+
- ERROR
59068+
NotificationRulePreviewResponse:
59069+
description: Response from the notification preview request.
59070+
properties:
59071+
data:
59072+
$ref: "#/components/schemas/NotificationRulePreviewResponseData"
59073+
required:
59074+
- data
59075+
type: object
59076+
NotificationRulePreviewResponseAttributes:
59077+
description: Attributes of the notification preview response.
59078+
properties:
59079+
preview_results:
59080+
$ref: "#/components/schemas/NotificationRulePreviewResults"
59081+
required:
59082+
- preview_results
59083+
type: object
59084+
NotificationRulePreviewResponseData:
59085+
description: The notification preview response data.
59086+
properties:
59087+
attributes:
59088+
$ref: "#/components/schemas/NotificationRulePreviewResponseAttributes"
59089+
id:
59090+
description: The ID of the notification preview response.
59091+
example: rka-loa-zwu
59092+
type: string
59093+
type:
59094+
$ref: "#/components/schemas/NotificationRulePreviewResponseType"
59095+
required:
59096+
- type
59097+
- attributes
59098+
type: object
59099+
NotificationRulePreviewResponseType:
59100+
description: The type of the notification preview response.
59101+
enum:
59102+
- notification_preview_response
59103+
example: notification_preview_response
59104+
type: string
59105+
x-enum-varnames:
59106+
- NOTIFICATION_PREVIEW_RESPONSE
59107+
NotificationRulePreviewResult:
59108+
description: The preview result for a single rule type.
59109+
properties:
59110+
notification_status:
59111+
$ref: "#/components/schemas/NotificationRulePreviewNotificationStatus"
59112+
rule_type:
59113+
$ref: "#/components/schemas/RuleTypesItems"
59114+
required:
59115+
- rule_type
59116+
- notification_status
59117+
type: object
59118+
NotificationRulePreviewResults:
59119+
description: List of preview results for each rule type matched by the notification rule.
59120+
example:
59121+
- notification_status: DEFAULT
59122+
rule_type: log_detection
59123+
items:
59124+
$ref: "#/components/schemas/NotificationRulePreviewResult"
59125+
type: array
5905459126
NotificationRuleQuery:
5905559127
description: The query is composed of one or several key:value pairs, which can be used to filter security issues on tags and attributes.
5905659128
example: (source:production_service OR env:prod)
@@ -59061,6 +59133,22 @@ components:
5906159133
data:
5906259134
$ref: "#/components/schemas/NotificationRule"
5906359135
type: object
59136+
NotificationRuleRouting:
59137+
description: Routing configuration for the notification rule.
59138+
properties:
59139+
mode:
59140+
$ref: "#/components/schemas/NotificationRuleRoutingMode"
59141+
required:
59142+
- mode
59143+
type: object
59144+
NotificationRuleRoutingMode:
59145+
description: The routing mode for the notification rule. `manual` sends notifications to the configured targets.
59146+
enum:
59147+
- manual
59148+
example: manual
59149+
type: string
59150+
x-enum-varnames:
59151+
- MANUAL
5906459152
NotificationRulesListResponse:
5906559153
description: The list of notification rules.
5906659154
properties:
@@ -68865,6 +68953,8 @@ components:
6886568953
$ref: "#/components/schemas/Enabled"
6886668954
name:
6886768955
$ref: "#/components/schemas/RuleName"
68956+
routing:
68957+
$ref: "#/components/schemas/NotificationRuleRouting"
6886868958
selectors:
6886968959
$ref: "#/components/schemas/Selectors"
6887068960
targets:
@@ -75597,6 +75687,7 @@ components:
7559775687
- iac_misconfiguration
7559875688
- sast_vulnerability
7559975689
- secret_vulnerability
75690+
example: log_detection
7560075691
type: string
7560175692
x-enum-varnames:
7560275693
- APPLICATION_SECURITY
@@ -164667,6 +164758,73 @@ paths:
164667164758
x-unstable: |-
164668164759
**Note**: This endpoint is in preview and is subject to change.
164669164760
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
164761+
/api/v2/security_monitoring/configuration/notification_rules/send_notification_preview:
164762+
post:
164763+
description: Send a notification preview to test that a notification rule's targets are properly configured.
164764+
operationId: SendSecurityMonitoringNotificationPreview
164765+
requestBody:
164766+
content:
164767+
application/json:
164768+
examples:
164769+
default:
164770+
value:
164771+
data:
164772+
attributes:
164773+
enabled: true
164774+
name: Rule 1
164775+
selectors:
164776+
query: env:prod
164777+
rule_types:
164778+
- log_detection
164779+
severities:
164780+
- critical
164781+
trigger_source: security_signals
164782+
targets:
164783+
- "@john.doe@email.com"
164784+
type: notification_rules
164785+
schema:
164786+
$ref: "#/components/schemas/CreateNotificationRuleParameters"
164787+
required: true
164788+
responses:
164789+
"200":
164790+
content:
164791+
application/json:
164792+
examples:
164793+
default:
164794+
value:
164795+
data:
164796+
attributes:
164797+
preview_results:
164798+
- notification_status: DEFAULT
164799+
rule_type: log_detection
164800+
id: rka-loa-zwu
164801+
type: notification_preview_response
164802+
schema:
164803+
$ref: "#/components/schemas/NotificationRulePreviewResponse"
164804+
description: OK
164805+
"400":
164806+
content:
164807+
application/json:
164808+
schema:
164809+
$ref: "#/components/schemas/JSONAPIErrorResponse"
164810+
description: Bad Request
164811+
"403":
164812+
$ref: "#/components/responses/NotAuthorizedResponse"
164813+
"429":
164814+
$ref: "#/components/responses/TooManyRequestsResponse"
164815+
security:
164816+
- apiKeyAuth: []
164817+
appKeyAuth: []
164818+
- AuthZ:
164819+
- security_monitoring_notification_profiles_write
164820+
summary: Test a notification rule
164821+
tags:
164822+
- Security Monitoring
164823+
x-codegen-request-body-name: body
164824+
"x-permission":
164825+
operator: OR
164826+
permissions:
164827+
- security_monitoring_notification_profiles_write
164670164828
/api/v2/security_monitoring/configuration/security_filters:
164671164829
get:
164672164830
description: Get the list of configured security filters with their definitions.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Test a notification rule returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.SecurityMonitoringApi;
6+
import com.datadog.api.client.v2.model.CreateNotificationRuleParameters;
7+
import com.datadog.api.client.v2.model.CreateNotificationRuleParametersData;
8+
import com.datadog.api.client.v2.model.CreateNotificationRuleParametersDataAttributes;
9+
import com.datadog.api.client.v2.model.NotificationRulePreviewResponse;
10+
import com.datadog.api.client.v2.model.NotificationRulesType;
11+
import com.datadog.api.client.v2.model.RuleSeverity;
12+
import com.datadog.api.client.v2.model.RuleTypesItems;
13+
import com.datadog.api.client.v2.model.Selectors;
14+
import com.datadog.api.client.v2.model.TriggerSource;
15+
import java.util.Collections;
16+
17+
public class Example {
18+
public static void main(String[] args) {
19+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
20+
SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);
21+
22+
CreateNotificationRuleParameters body =
23+
new CreateNotificationRuleParameters()
24+
.data(
25+
new CreateNotificationRuleParametersData()
26+
.attributes(
27+
new CreateNotificationRuleParametersDataAttributes()
28+
.enabled(true)
29+
.name("Rule 1")
30+
.selectors(
31+
new Selectors()
32+
.query("env:prod")
33+
.ruleTypes(
34+
Collections.singletonList(RuleTypesItems.LOG_DETECTION))
35+
.severities(Collections.singletonList(RuleSeverity.CRITICAL))
36+
.triggerSource(TriggerSource.SECURITY_SIGNALS))
37+
.targets(Collections.singletonList("@john.doe@email.com")))
38+
.type(NotificationRulesType.NOTIFICATION_RULES));
39+
40+
try {
41+
NotificationRulePreviewResponse result =
42+
apiInstance.sendSecurityMonitoringNotificationPreview(body);
43+
System.out.println(result);
44+
} catch (ApiException e) {
45+
System.err.println(
46+
"Exception when calling SecurityMonitoringApi#sendSecurityMonitoringNotificationPreview");
47+
System.err.println("Status code: " + e.getCode());
48+
System.err.println("Reason: " + e.getResponseBody());
49+
System.err.println("Response headers: " + e.getResponseHeaders());
50+
e.printStackTrace();
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)