Skip to content

Commit 5b2df0b

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Revert GetSBOM to x-unstable (#2708)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 0072b91 commit 5b2df0b

File tree

10 files changed

+36
-11
lines changed

10 files changed

+36
-11
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": "2025-02-12 18:33:46.151421",
8-
"spec_repo_commit": "6a4cfb82"
7+
"regenerated": "2025-02-14 15:03:35.352599",
8+
"spec_repo_commit": "a739b49f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-02-12 18:33:46.166854",
13-
"spec_repo_commit": "6a4cfb82"
12+
"regenerated": "2025-02-14 15:03:35.368038",
13+
"spec_repo_commit": "a739b49f"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45225,6 +45225,9 @@ paths:
4522545225
summary: Get SBOM
4522645226
tags:
4522745227
- Security Monitoring
45228+
x-unstable: '**Note**: This endpoint is a private preview.
45229+
45230+
If you are interested in accessing this API, please [fill out this form](https://forms.gle/kMYC1sDr6WDUBDsx9).'
4522845231
/api/v2/security/signals/notification_rules:
4522945232
get:
4523045233
description: Returns the list of notification rules for security signals.

examples/v2/security-monitoring/GetSBOM.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
public class Example {
1010
public static void main(String[] args) {
1111
ApiClient defaultClient = ApiClient.getDefaultApiClient();
12+
defaultClient.setUnstableOperationEnabled("v2.getSBOM", true);
1213
SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);
1314

1415
try {

src/main/java/com/datadog/api/client/ApiClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ public class ApiClient {
422422
put("v2.getFinding", false);
423423
put("v2.getHistoricalJob", false);
424424
put("v2.getRuleVersionHistory", false);
425+
put("v2.getSBOM", false);
425426
put("v2.listFindings", false);
426427
put("v2.listHistoricalJobs", false);
427428
put("v2.muteFindings", false);

src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,13 @@ public CompletableFuture<GetSBOMResponse> getSBOMAsync(
34593459
public ApiResponse<GetSBOMResponse> getSBOMWithHttpInfo(
34603460
AssetType assetType, String filterAssetName, GetSBOMOptionalParameters parameters)
34613461
throws ApiException {
3462+
// Check if unstable operation is enabled
3463+
String operationId = "getSBOM";
3464+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
3465+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
3466+
} else {
3467+
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
3468+
}
34623469
Object localVarPostBody = null;
34633470

34643471
// verify the required parameter 'assetType' is set
@@ -3518,6 +3525,16 @@ public ApiResponse<GetSBOMResponse> getSBOMWithHttpInfo(
35183525
*/
35193526
public CompletableFuture<ApiResponse<GetSBOMResponse>> getSBOMWithHttpInfoAsync(
35203527
AssetType assetType, String filterAssetName, GetSBOMOptionalParameters parameters) {
3528+
// Check if unstable operation is enabled
3529+
String operationId = "getSBOM";
3530+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
3531+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
3532+
} else {
3533+
CompletableFuture<ApiResponse<GetSBOMResponse>> result = new CompletableFuture<>();
3534+
result.completeExceptionally(
3535+
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
3536+
return result;
3537+
}
35213538
Object localVarPostBody = null;
35223539

35233540
// verify the required parameter 'assetType' is set
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025-01-31T12:04:00.490Z
1+
2025-02-10T11:40:12.098Z

src/test/resources/cassettes/features/v2/Get_SBOM_returns_Not_found_asset_not_found_response.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"secure": true
1414
},
1515
"httpResponse": {
16-
"body": "{\"errors\":[{\"title\":\"Asset not found\",\"detail\":\"asset_type: 'Host' with asset_name: 'unknown-host' not found\"}]}",
16+
"body": "{\"errors\":[{\"status\":\"404\",\"title\":\"Asset not found\",\"detail\":\"asset_type: 'Host' with asset_name: 'unknown-host' not found\"}]}",
1717
"headers": {
1818
"Content-Type": [
1919
"application/vnd.api+json"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025-01-31T12:04:14.913Z
1+
2025-02-10T11:38:04.662Z

src/test/resources/cassettes/features/v2/Get_SBOM_returns_OK_response.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,23 +457,26 @@ Feature: Security Monitoring
457457

458458
@generated @skip @team:DataDog/asm-vm
459459
Scenario: Get SBOM returns "Bad request: The server cannot process the request due to invalid syntax in the request." response
460-
Given new "GetSBOM" request
460+
Given operation "GetSBOM" enabled
461+
And new "GetSBOM" request
461462
And request contains "asset_type" parameter from "REPLACE.ME"
462463
And request contains "filter[asset_name]" parameter from "REPLACE.ME"
463464
When the request is sent
464465
Then the response status is 400 Bad request: The server cannot process the request due to invalid syntax in the request.
465466

466467
@team:DataDog/asm-vm
467468
Scenario: Get SBOM returns "Not found: asset not found" response
468-
Given new "GetSBOM" request
469+
Given operation "GetSBOM" enabled
470+
And new "GetSBOM" request
469471
And request contains "asset_type" parameter with value "Host"
470472
And request contains "filter[asset_name]" parameter with value "unknown-host"
471473
When the request is sent
472474
Then the response status is 404 Not found: asset not found
473475

474476
@team:DataDog/asm-vm
475477
Scenario: Get SBOM returns "OK" response
476-
Given new "GetSBOM" request
478+
Given operation "GetSBOM" enabled
479+
And new "GetSBOM" request
477480
And request contains "asset_type" parameter with value "Repository"
478481
And request contains "filter[asset_name]" parameter with value "github.com/datadog/datadog-agent"
479482
When the request is sent

0 commit comments

Comments
 (0)