Skip to content

Commit fdcd9fa

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Update ListAssetsSBOMs spec - require asset_type on first page, add ServerlessFunction asset type (#1813)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 74965e9 commit fdcd9fa

8 files changed

Lines changed: 31 additions & 10 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10502,6 +10502,7 @@ components:
1050210502
- Host
1050310503
- HostImage
1050410504
- Image
10505+
- ServerlessFunction
1050510506
example: Repository
1050610507
type: string
1050710508
x-enum-varnames:
@@ -10510,6 +10511,7 @@ components:
1051010511
- HOST
1051110512
- HOSTIMAGE
1051210513
- IMAGE
10514+
- SERVERLESSFUNCTION
1051310515
AssetVersion:
1051410516
description: Asset version.
1051510517
properties:
@@ -175616,6 +175618,11 @@ paths:
175616175618
description: |-
175617175619
Get a list of assets SBOMs for an organization.
175618175620

175621+
The `filter[asset_type]` parameter is required for initial requests (when no `page[token]` is provided).
175622+
Subsequent pages encode the asset type in the pagination token, so `filter[asset_type]` is not required
175623+
for paginated requests. Mixing infrastructure asset types (`Host`, `HostImage`, `Image`, `ServerlessFunction`)
175624+
with code asset types (`Repository`, `Service`) in the same request is not supported and returns a 400 error.
175625+
175619175626
### Pagination
175620175627

175621175628
Please review the [Pagination section](#pagination) for the "List Vulnerabilities" endpoint.
@@ -175645,7 +175652,8 @@ paths:
175645175652
format: int64
175646175653
minimum: 1
175647175654
type: integer
175648-
- description: The type of the assets for the SBOM request.
175655+
- description: >-
175656+
The type of the assets for the SBOM request. Required for initial requests (when no `page[token]` is provided). Infrastructure types (`Host`, `HostImage`, `Image`, `ServerlessFunction`) and code types (`Repository`, `Service`) cannot be mixed in the same request.
175649175657
example: Repository
175650175658
in: query
175651175659
name: filter[asset_type]

src/datadogV2/api/api_security_monitoring.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ pub struct ListAssetsSBOMsOptionalParams {
383383
pub page_token: Option<String>,
384384
/// The page number to be retrieved. It should be equal to or greater than 1.
385385
pub page_number: Option<i64>,
386-
/// The type of the assets for the SBOM request.
386+
/// The type of the assets for the SBOM request. Required for initial requests (when no `page[token]` is provided). Infrastructure types (`Host`, `HostImage`, `Image`, `ServerlessFunction`) and code types (`Repository`, `Service`) cannot be mixed in the same request.
387387
pub filter_asset_type: Option<crate::datadogV2::model::AssetType>,
388388
/// The name of the asset for the SBOM request.
389389
pub filter_asset_name: Option<String>,
@@ -408,7 +408,7 @@ impl ListAssetsSBOMsOptionalParams {
408408
self.page_number = Some(value);
409409
self
410410
}
411-
/// The type of the assets for the SBOM request.
411+
/// The type of the assets for the SBOM request. Required for initial requests (when no `page[token]` is provided). Infrastructure types (`Host`, `HostImage`, `Image`, `ServerlessFunction`) and code types (`Repository`, `Service`) cannot be mixed in the same request.
412412
pub fn filter_asset_type(mut self, value: crate::datadogV2::model::AssetType) -> Self {
413413
self.filter_asset_type = Some(value);
414414
self
@@ -16650,6 +16650,11 @@ impl SecurityMonitoringAPI {
1665016650

1665116651
/// Get a list of assets SBOMs for an organization.
1665216652
///
16653+
/// The `filter[asset_type]` parameter is required for initial requests (when no `page[token]` is provided).
16654+
/// Subsequent pages encode the asset type in the pagination token, so `filter[asset_type]` is not required
16655+
/// for paginated requests. Mixing infrastructure asset types (`Host`, `HostImage`, `Image`, `ServerlessFunction`)
16656+
/// with code asset types (`Repository`, `Service`) in the same request is not supported and returns a 400 error.
16657+
///
1665316658
/// ### Pagination
1665416659
///
1665516660
/// Please review the [Pagination section](#pagination) for the "List Vulnerabilities" endpoint.
@@ -16684,6 +16689,11 @@ impl SecurityMonitoringAPI {
1668416689

1668516690
/// Get a list of assets SBOMs for an organization.
1668616691
///
16692+
/// The `filter[asset_type]` parameter is required for initial requests (when no `page[token]` is provided).
16693+
/// Subsequent pages encode the asset type in the pagination token, so `filter[asset_type]` is not required
16694+
/// for paginated requests. Mixing infrastructure asset types (`Host`, `HostImage`, `Image`, `ServerlessFunction`)
16695+
/// with code asset types (`Repository`, `Service`) in the same request is not supported and returns a 400 error.
16696+
///
1668716697
/// ### Pagination
1668816698
///
1668916699
/// Please review the [Pagination section](#pagination) for the "List Vulnerabilities" endpoint.

src/datadogV2/model/model_asset_type.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub enum AssetType {
1212
HOST,
1313
HOSTIMAGE,
1414
IMAGE,
15+
SERVERLESSFUNCTION,
1516
UnparsedObject(crate::datadog::UnparsedObject),
1617
}
1718

@@ -23,6 +24,7 @@ impl ToString for AssetType {
2324
Self::HOST => String::from("Host"),
2425
Self::HOSTIMAGE => String::from("HostImage"),
2526
Self::IMAGE => String::from("Image"),
27+
Self::SERVERLESSFUNCTION => String::from("ServerlessFunction"),
2628
Self::UnparsedObject(v) => v.value.to_string(),
2729
}
2830
}
@@ -52,6 +54,7 @@ impl<'de> Deserialize<'de> for AssetType {
5254
"Host" => Self::HOST,
5355
"HostImage" => Self::HOSTIMAGE,
5456
"Image" => Self::IMAGE,
57+
"ServerlessFunction" => Self::SERVERLESSFUNCTION,
5558
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
5659
value: serde_json::Value::String(s.into()),
5760
}),
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2026-07-06T19:25:16.964Z
1+
2026-07-07T14:35:06.517Z

tests/scenarios/cassettes/v2/security_monitoring/List-assets-SBOMs-returns-Bad-request-Invalid-pagination-token-response.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
]
1010
},
1111
"method": "get",
12-
"uri": "https://api.datadoghq.com/api/v2/security/sboms?page%5Btoken%5D=unknown&page%5Bnumber%5D=1"
12+
"uri": "https://api.datadoghq.com/api/v2/security/sboms?page%5Btoken%5D=SERVICE%3Aunknown&page%5Bnumber%5D=1"
1313
},
1414
"response": {
1515
"body": {
16-
"string": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad request: asset_type\",\"detail\":\"asset_type filter is required\"}]}",
16+
"string": "{\"errors\":[{\"status\":\"400\",\"title\":\"Unexpected internal error\"}]}",
1717
"encoding": null
1818
},
1919
"headers": {
@@ -26,7 +26,7 @@
2626
"message": "Bad Request"
2727
}
2828
},
29-
"recorded_at": "Mon, 06 Jul 2026 19:25:16 GMT"
29+
"recorded_at": "Tue, 07 Jul 2026 14:35:06 GMT"
3030
}
3131
],
3232
"recorded_with": "VCR 6.0.0"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2026-01-20T08:27:19.760Z
1+
2026-07-07T14:35:10.638Z

tests/scenarios/cassettes/v2/security_monitoring/List-assets-SBOMs-returns-OK-response.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"message": "OK"
2727
}
2828
},
29-
"recorded_at": "Tue, 20 Jan 2026 08:27:19 GMT"
29+
"recorded_at": "Tue, 07 Jul 2026 14:35:10 GMT"
3030
}
3131
],
3232
"recorded_with": "VCR 6.0.0"

tests/scenarios/features/v2/security_monitoring.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2369,7 +2369,7 @@ Feature: Security Monitoring
23692369
@team:DataDog/k9-cloud-vm
23702370
Scenario: List assets SBOMs returns "Bad request: Invalid pagination token." response
23712371
Given new "ListAssetsSBOMs" request
2372-
And request contains "page[token]" parameter with value "unknown"
2372+
And request contains "page[token]" parameter with value "SERVICE:unknown"
23732373
And request contains "page[number]" parameter with value 1
23742374
When the request is sent
23752375
Then the response status is 400 Bad request: Invalid pagination token.

0 commit comments

Comments
 (0)