Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13006,6 +13006,30 @@ components:
$ref: '#/components/schemas/GetInterfacesData'
type: array
type: object
GetRuleVersionHistoryData:
description: Data for the rule version history.
properties:
attributes:
$ref: '#/components/schemas/RuleVersionHistory'
id:
description: ID of the rule.
type: string
type:
$ref: '#/components/schemas/GetRuleVersionHistoryDataType'
type: object
GetRuleVersionHistoryDataType:
description: Type of data.
enum:
- GetRuleVersionHistoryResponse
type: string
x-enum-varnames:
- GETRULEVERSIONHISTORYRESPONSE
GetRuleVersionHistoryResponse:
description: Response for getting the rule version history.
properties:
data:
$ref: '#/components/schemas/GetRuleVersionHistoryData'
type: object
GetSBOMResponse:
description: The expected response schema when getting an SBOM.
properties:
Expand Down Expand Up @@ -23825,6 +23849,57 @@ components:
example: John Doe
type: string
type: object
RuleVersionHistory:
description: Response object containing the version history of a rule.
properties:
count:
description: The number of rule versions.
format: int32
maximum: 2147483647
type: integer
data:
additionalProperties:
$ref: '#/components/schemas/RuleVersions'
description: A rule version with a list of updates.
description: The `RuleVersionHistory` `data`.
type: object
type: object
RuleVersionUpdate:
description: A change in a rule version.
properties:
change:
description: The new value of the field.
example: cloud_provider:aws
type: string
field:
description: The field that was changed.
example: Tags
type: string
type:
$ref: '#/components/schemas/RuleVersionUpdateType'
type: object
RuleVersionUpdateType:
description: The type of change.
enum:
- create
- update
- delete
type: string
x-enum-varnames:
- CREATE
- UPDATE
- DELETE
RuleVersions:
description: A rule version with a list of updates.
properties:
changes:
description: A list of changes.
items:
$ref: '#/components/schemas/RuleVersionUpdate'
type: array
rule:
$ref: '#/components/schemas/SecurityMonitoringRuleResponse'
type: object
RumMetricCompute:
description: The compute rule to compute the rum-based metric.
properties:
Expand Down Expand Up @@ -46712,6 +46787,42 @@ paths:
operator: OR
permissions:
- security_monitoring_rules_write
/api/v2/security_monitoring/rules/{rule_id}/version_history:
get:
description: Get a rule's version history.
operationId: GetRuleVersionHistory
parameters:
- $ref: '#/components/parameters/SecurityMonitoringRuleID'
- $ref: '#/components/parameters/PageSize'
- $ref: '#/components/parameters/PageNumber'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/GetRuleVersionHistoryResponse'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/NotAuthorizedResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- security_monitoring_rules_read
summary: Get a rule's version history
tags:
- Security Monitoring
x-permission:
operator: OR
permissions:
- security_monitoring_rules_read
x-unstable: '**Note**: This endpoint is in beta and may be subject to changes.'
/api/v2/security_monitoring/signals:
get:
description: 'The list endpoint returns security signals that match a search
Expand Down
25 changes: 25 additions & 0 deletions examples/v2/security-monitoring/GetRuleVersionHistory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Get a rule's version history returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SecurityMonitoringApi;
import com.datadog.api.client.v2.model.GetRuleVersionHistoryResponse;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.getRuleVersionHistory", true);
SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);

try {
GetRuleVersionHistoryResponse result = apiInstance.getRuleVersionHistory("rule_id");
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SecurityMonitoringApi#getRuleVersionHistory");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Get rule version history returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SecurityMonitoringApi;
import com.datadog.api.client.v2.model.GetRuleVersionHistoryResponse;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.getRuleVersionHistory", true);
SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);

// there is a valid "security_rule" in the system
String SECURITY_RULE_ID = System.getenv("SECURITY_RULE_ID");

try {
GetRuleVersionHistoryResponse result = apiInstance.getRuleVersionHistory(SECURITY_RULE_ID);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SecurityMonitoringApi#getRuleVersionHistory");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ public class ApiClient {
put("v2.deleteHistoricalJob", false);
put("v2.getFinding", false);
put("v2.getHistoricalJob", false);
put("v2.getRuleVersionHistory", false);
put("v2.listFindings", false);
put("v2.listHistoricalJobs", false);
put("v2.muteFindings", false);
Expand Down
Loading