Skip to content

Revert GetSBOM to x-unstable #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-02-12 18:33:49.810961",
"spec_repo_commit": "6a4cfb82"
"regenerated": "2025-02-14 15:03:43.490025",
"spec_repo_commit": "a739b49f"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-02-12 18:33:49.826925",
"spec_repo_commit": "6a4cfb82"
"regenerated": "2025-02-14 15:03:43.505675",
"spec_repo_commit": "a739b49f"
}
}
}
3 changes: 3 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45225,6 +45225,9 @@ paths:
summary: Get SBOM
tags:
- Security Monitoring
x-unstable: '**Note**: This endpoint is a private preview.

If you are interested in accessing this API, please [fill out this form](https://forms.gle/kMYC1sDr6WDUBDsx9).'
/api/v2/security/signals/notification_rules:
get:
description: Returns the list of notification rules for security signals.
Expand Down
3 changes: 2 additions & 1 deletion examples/v2_security-monitoring_GetSBOM.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use datadog_api_client::datadogV2::model::AssetType;

#[tokio::main]
async fn main() {
let configuration = datadog::Configuration::new();
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.GetSBOM", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api
.get_sbom(
Expand Down
1 change: 1 addition & 0 deletions src/datadog/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ impl Default for Configuration {
("v2.get_finding".to_owned(), false),
("v2.get_historical_job".to_owned(), false),
("v2.get_rule_version_history".to_owned(), false),
("v2.get_sbom".to_owned(), false),
("v2.list_findings".to_owned(), false),
("v2.list_historical_jobs".to_owned(), false),
("v2.mute_findings".to_owned(), false),
Expand Down
8 changes: 8 additions & 0 deletions src/datadogV2/api/api_security_monitoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3943,6 +3943,14 @@ impl SecurityMonitoringAPI {
> {
let local_configuration = &self.config;
let operation_id = "v2.get_sbom";
if local_configuration.is_unstable_operation_enabled(operation_id) {
warn!("Using unstable operation {operation_id}");
} else {
let local_error = datadog::UnstableOperationDisabledError {
msg: "Operation 'v2.get_sbom' is not enabled".to_string(),
};
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
}

// unbox and build optional parameters
let filter_repo_digest = params.filter_repo_digest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025-01-31T12:04:00.490Z
2025-02-10T11:40:12.098Z
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"response": {
"body": {
"string": "{\"errors\":[{\"title\":\"Asset not found\",\"detail\":\"asset_type: 'Host' with asset_name: 'unknown-host' not found\"}]}",
"string": "{\"errors\":[{\"status\":\"404\",\"title\":\"Asset not found\",\"detail\":\"asset_type: 'Host' with asset_name: 'unknown-host' not found\"}]}",
"encoding": null
},
"headers": {
Expand All @@ -26,7 +26,7 @@
"message": "Not Found"
}
},
"recorded_at": "Fri, 31 Jan 2025 12:04:00 GMT"
"recorded_at": "Mon, 10 Feb 2025 11:40:12 GMT"
}
],
"recorded_with": "VCR 6.0.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025-01-31T12:04:14.913Z
2025-02-10T11:38:04.662Z

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions tests/scenarios/features/v2/security_monitoring.feature
Original file line number Diff line number Diff line change
Expand Up @@ -457,23 +457,26 @@ Feature: Security Monitoring

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

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

@team:DataDog/asm-vm
Scenario: Get SBOM returns "OK" response
Given new "GetSBOM" request
Given operation "GetSBOM" enabled
And new "GetSBOM" request
And request contains "asset_type" parameter with value "Repository"
And request contains "filter[asset_name]" parameter with value "github.com/datadog/datadog-agent"
When the request is sent
Expand Down
Loading