|
63 | 63 | import com.datadog.api.client.v2.model.SecurityMonitoringCriticalAssetsResponse; |
64 | 64 | import com.datadog.api.client.v2.model.SecurityMonitoringListRulesResponse; |
65 | 65 | import com.datadog.api.client.v2.model.SecurityMonitoringPaginatedSuppressionsResponse; |
| 66 | +import com.datadog.api.client.v2.model.SecurityMonitoringRuleBulkExportPayload; |
66 | 67 | import com.datadog.api.client.v2.model.SecurityMonitoringRuleConvertPayload; |
67 | 68 | import com.datadog.api.client.v2.model.SecurityMonitoringRuleConvertResponse; |
68 | 69 | import com.datadog.api.client.v2.model.SecurityMonitoringRuleCreatePayload; |
|
98 | 99 | import com.datadog.api.client.v2.model.VulnerabilityType; |
99 | 100 | import jakarta.ws.rs.client.Invocation; |
100 | 101 | import jakarta.ws.rs.core.GenericType; |
| 102 | +import java.io.File; |
101 | 103 | import java.time.OffsetDateTime; |
102 | 104 | import java.util.ArrayList; |
103 | 105 | import java.util.HashMap; |
@@ -445,6 +447,145 @@ public CompletableFuture<ApiResponse<FindingCaseResponse>> attachJiraIssueWithHt |
445 | 447 | new GenericType<FindingCaseResponse>() {}); |
446 | 448 | } |
447 | 449 |
|
| 450 | + /** |
| 451 | + * Bulk export security monitoring rules. |
| 452 | + * |
| 453 | + * <p>See {@link #bulkExportSecurityMonitoringRulesWithHttpInfo}. |
| 454 | + * |
| 455 | + * @param body (required) |
| 456 | + * @return File |
| 457 | + * @throws ApiException if fails to make API call |
| 458 | + */ |
| 459 | + public File bulkExportSecurityMonitoringRules(SecurityMonitoringRuleBulkExportPayload body) |
| 460 | + throws ApiException { |
| 461 | + return bulkExportSecurityMonitoringRulesWithHttpInfo(body).getData(); |
| 462 | + } |
| 463 | + |
| 464 | + /** |
| 465 | + * Bulk export security monitoring rules. |
| 466 | + * |
| 467 | + * <p>See {@link #bulkExportSecurityMonitoringRulesWithHttpInfoAsync}. |
| 468 | + * |
| 469 | + * @param body (required) |
| 470 | + * @return CompletableFuture<File> |
| 471 | + */ |
| 472 | + public CompletableFuture<File> bulkExportSecurityMonitoringRulesAsync( |
| 473 | + SecurityMonitoringRuleBulkExportPayload body) { |
| 474 | + return bulkExportSecurityMonitoringRulesWithHttpInfoAsync(body) |
| 475 | + .thenApply( |
| 476 | + response -> { |
| 477 | + return response.getData(); |
| 478 | + }); |
| 479 | + } |
| 480 | + |
| 481 | + /** |
| 482 | + * Export a list of security monitoring rules as a ZIP file containing JSON rule definitions. The |
| 483 | + * endpoint accepts a list of rule IDs and returns a ZIP archive where each rule is saved as a |
| 484 | + * separate JSON file named after the rule. |
| 485 | + * |
| 486 | + * @param body (required) |
| 487 | + * @return ApiResponse<File> |
| 488 | + * @throws ApiException if fails to make API call |
| 489 | + * @http.response.details |
| 490 | + * <table border="1"> |
| 491 | + * <caption>Response details</caption> |
| 492 | + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> |
| 493 | + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> |
| 494 | + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> |
| 495 | + * <tr><td> 403 </td><td> Not Authorized </td><td> - </td></tr> |
| 496 | + * <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> |
| 497 | + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> |
| 498 | + * </table> |
| 499 | + */ |
| 500 | + public ApiResponse<File> bulkExportSecurityMonitoringRulesWithHttpInfo( |
| 501 | + SecurityMonitoringRuleBulkExportPayload body) throws ApiException { |
| 502 | + Object localVarPostBody = body; |
| 503 | + |
| 504 | + // verify the required parameter 'body' is set |
| 505 | + if (body == null) { |
| 506 | + throw new ApiException( |
| 507 | + 400, |
| 508 | + "Missing the required parameter 'body' when calling bulkExportSecurityMonitoringRules"); |
| 509 | + } |
| 510 | + // create path and map variables |
| 511 | + String localVarPath = "/api/v2/security_monitoring/rules/bulk_export"; |
| 512 | + |
| 513 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 514 | + |
| 515 | + Invocation.Builder builder = |
| 516 | + apiClient.createBuilder( |
| 517 | + "v2.SecurityMonitoringApi.bulkExportSecurityMonitoringRules", |
| 518 | + localVarPath, |
| 519 | + new ArrayList<Pair>(), |
| 520 | + localVarHeaderParams, |
| 521 | + new HashMap<String, String>(), |
| 522 | + new String[] {"application/zip", "application/json"}, |
| 523 | + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); |
| 524 | + return apiClient.invokeAPI( |
| 525 | + "POST", |
| 526 | + builder, |
| 527 | + localVarHeaderParams, |
| 528 | + new String[] {"application/json"}, |
| 529 | + localVarPostBody, |
| 530 | + new HashMap<String, Object>(), |
| 531 | + false, |
| 532 | + new GenericType<File>() {}); |
| 533 | + } |
| 534 | + |
| 535 | + /** |
| 536 | + * Bulk export security monitoring rules. |
| 537 | + * |
| 538 | + * <p>See {@link #bulkExportSecurityMonitoringRulesWithHttpInfo}. |
| 539 | + * |
| 540 | + * @param body (required) |
| 541 | + * @return CompletableFuture<ApiResponse<File>> |
| 542 | + */ |
| 543 | + public CompletableFuture<ApiResponse<File>> bulkExportSecurityMonitoringRulesWithHttpInfoAsync( |
| 544 | + SecurityMonitoringRuleBulkExportPayload body) { |
| 545 | + Object localVarPostBody = body; |
| 546 | + |
| 547 | + // verify the required parameter 'body' is set |
| 548 | + if (body == null) { |
| 549 | + CompletableFuture<ApiResponse<File>> result = new CompletableFuture<>(); |
| 550 | + result.completeExceptionally( |
| 551 | + new ApiException( |
| 552 | + 400, |
| 553 | + "Missing the required parameter 'body' when calling" |
| 554 | + + " bulkExportSecurityMonitoringRules")); |
| 555 | + return result; |
| 556 | + } |
| 557 | + // create path and map variables |
| 558 | + String localVarPath = "/api/v2/security_monitoring/rules/bulk_export"; |
| 559 | + |
| 560 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 561 | + |
| 562 | + Invocation.Builder builder; |
| 563 | + try { |
| 564 | + builder = |
| 565 | + apiClient.createBuilder( |
| 566 | + "v2.SecurityMonitoringApi.bulkExportSecurityMonitoringRules", |
| 567 | + localVarPath, |
| 568 | + new ArrayList<Pair>(), |
| 569 | + localVarHeaderParams, |
| 570 | + new HashMap<String, String>(), |
| 571 | + new String[] {"application/zip", "application/json"}, |
| 572 | + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); |
| 573 | + } catch (ApiException ex) { |
| 574 | + CompletableFuture<ApiResponse<File>> result = new CompletableFuture<>(); |
| 575 | + result.completeExceptionally(ex); |
| 576 | + return result; |
| 577 | + } |
| 578 | + return apiClient.invokeAPIAsync( |
| 579 | + "POST", |
| 580 | + builder, |
| 581 | + localVarHeaderParams, |
| 582 | + new String[] {"application/json"}, |
| 583 | + localVarPostBody, |
| 584 | + new HashMap<String, Object>(), |
| 585 | + false, |
| 586 | + new GenericType<File>() {}); |
| 587 | + } |
| 588 | + |
448 | 589 | /** |
449 | 590 | * Cancel a threat hunting job. |
450 | 591 | * |
|
0 commit comments