Skip to content

Commit cc532f6

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit bba3be2 of spec repo
1 parent 07c5c19 commit cc532f6

17 files changed

+1477
-23
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 322 additions & 12 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# List Scanned Assets Metadata returns "OK" response
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.list_scanned_assets_metadata".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
8+
opts = {
9+
filter_asset_type: CloudAssetType::HOST,
10+
}
11+
p api_instance.list_scanned_assets_metadata(opts)

features/scenarios_model_mapping.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,15 @@
13131313
"asset_type" => "AssetType",
13141314
"filter_asset_name" => "String",
13151315
"filter_repo_digest" => "String",
1316+
"ext_format" => "SBOMFormat",
1317+
},
1318+
"v2.ListScannedAssetsMetadata" => {
1319+
"page_token" => "String",
1320+
"page_number" => "Integer",
1321+
"filter_asset_type" => "CloudAssetType",
1322+
"filter_asset_name" => "String",
1323+
"filter_last_success_origin" => "String",
1324+
"filter_last_success_env" => "String",
13161325
},
13171326
"v2.CreateSignalNotificationRule" => {
13181327
"body" => "CreateNotificationRuleParameters",

features/v2/security_monitoring.feature

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,31 @@ Feature: Security Monitoring
923923
When the request is sent
924924
Then the response status is 200 The list of notification rules.
925925

926+
@team:DataDog/asm-vm
927+
Scenario: List Scanned Assets Metadata returns "Bad request: The server cannot process the request due to invalid syntax in the request." response
928+
Given operation "ListScannedAssetsMetadata" enabled
929+
And new "ListScannedAssetsMetadata" request
930+
And request contains "filter[asset.type]" parameter with value "HOST"
931+
When the request is sent
932+
Then the response status is 400 Bad request: The server cannot process the request due to invalid syntax in the request.
933+
934+
@team:DataDog/asm-vm
935+
Scenario: List Scanned Assets Metadata returns "Not found: asset not found" response
936+
Given operation "ListScannedAssetsMetadata" enabled
937+
And new "ListScannedAssetsMetadata" request
938+
And request contains "page[token]" parameter with value "unknown"
939+
And request contains "page[number]" parameter with value 1
940+
When the request is sent
941+
Then the response status is 404 Not found: asset not found
942+
943+
@team:DataDog/asm-vm
944+
Scenario: List Scanned Assets Metadata returns "OK" response
945+
Given operation "ListScannedAssetsMetadata" enabled
946+
And new "ListScannedAssetsMetadata" request
947+
And request contains "filter[asset.type]" parameter with value "Host"
948+
When the request is sent
949+
Then the response status is 200 OK
950+
926951
@generated @skip @team:DataDog/asm-vm
927952
Scenario: List assets SBOMs returns "Bad request: The server cannot process the request due to invalid syntax in the request." response
928953
Given operation "ListAssetsSBOMs" enabled

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,6 +3204,12 @@
32043204
"type": "safe"
32053205
}
32063206
},
3207+
"ListScannedAssetsMetadata": {
3208+
"tag": "Security Monitoring",
3209+
"undo": {
3210+
"type": "safe"
3211+
}
3212+
},
32073213
"GetSignalNotificationRules": {
32083214
"tag": "Security Monitoring",
32093215
"undo": {

lib/datadog_api_client/configuration.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ def initialize
206206
"v2.list_assets_sbo_ms": false,
207207
"v2.list_findings": false,
208208
"v2.list_historical_jobs": false,
209+
"v2.list_scanned_assets_metadata": false,
209210
"v2.list_security_monitoring_histsignals": false,
210211
"v2.list_vulnerabilities": false,
211212
"v2.list_vulnerable_assets": false,

lib/datadog_api_client/inflector.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,7 @@ def overrides
14391439
"v2.clickup_integration" => "ClickupIntegration",
14401440
"v2.clickup_integration_type" => "ClickupIntegrationType",
14411441
"v2.clickup_integration_update" => "ClickupIntegrationUpdate",
1442+
"v2.cloud_asset_type" => "CloudAssetType",
14421443
"v2.cloud_configuration_compliance_rule_options" => "CloudConfigurationComplianceRuleOptions",
14431444
"v2.cloud_configuration_rego_rule" => "CloudConfigurationRegoRule",
14441445
"v2.cloud_configuration_rule_case_create" => "CloudConfigurationRuleCaseCreate",
@@ -3502,6 +3503,7 @@ def overrides
35023503
"v2.sbom_component_property" => "SBOMComponentProperty",
35033504
"v2.sbom_component_supplier" => "SBOMComponentSupplier",
35043505
"v2.sbom_component_type" => "SBOMComponentType",
3506+
"v2.sbom_format" => "SBOMFormat",
35053507
"v2.sbom_metadata" => "SBOMMetadata",
35063508
"v2.sbom_metadata_author" => "SBOMMetadataAuthor",
35073509
"v2.sbom_metadata_component" => "SBOMMetadataComponent",
@@ -3519,6 +3521,11 @@ def overrides
35193521
"v2.scalar_meta" => "ScalarMeta",
35203522
"v2.scalar_query" => "ScalarQuery",
35213523
"v2.scalar_response" => "ScalarResponse",
3524+
"v2.scanned_asset_metadata" => "ScannedAssetMetadata",
3525+
"v2.scanned_asset_metadata_asset" => "ScannedAssetMetadataAsset",
3526+
"v2.scanned_asset_metadata_attributes" => "ScannedAssetMetadataAttributes",
3527+
"v2.scanned_asset_metadata_last_success" => "ScannedAssetMetadataLastSuccess",
3528+
"v2.scanned_assets_metadata" => "ScannedAssetsMetadata",
35223529
"v2.schedule" => "Schedule",
35233530
"v2.schedule_create_request" => "ScheduleCreateRequest",
35243531
"v2.schedule_create_request_data" => "ScheduleCreateRequestData",
@@ -4162,6 +4169,7 @@ def overrides
41624169
"v2.virus_total_integration_update" => "VirusTotalIntegrationUpdate",
41634170
"v2.vulnerabilities_type" => "VulnerabilitiesType",
41644171
"v2.vulnerability" => "Vulnerability",
4172+
"v2.vulnerability_advisory" => "VulnerabilityAdvisory",
41654173
"v2.vulnerability_attributes" => "VulnerabilityAttributes",
41664174
"v2.vulnerability_cvss" => "VulnerabilityCvss",
41674175
"v2.vulnerability_dependency_locations" => "VulnerabilityDependencyLocations",

lib/datadog_api_client/v2/api/security_monitoring_api.rb

Lines changed: 146 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,7 @@ def get_sbom(asset_type, filter_asset_name, opts = {})
17621762
# @param filter_asset_name [String] The name of the asset for the SBOM request.
17631763
# @param opts [Hash] the optional parameters
17641764
# @option opts [String] :filter_repo_digest The container image `repo_digest` for the SBOM request. When the requested asset type is 'Image', this filter is mandatory.
1765+
# @option opts [SBOMFormat] :ext_format The standard of the SBOM.
17651766
# @return [Array<(GetSBOMResponse, Integer, Hash)>] GetSBOMResponse data, response status code and response headers
17661767
def get_sbom_with_http_info(asset_type, filter_asset_name, opts = {})
17671768
unstable_enabled = @api_client.config.unstable_operations["v2.get_sbom".to_sym]
@@ -1787,13 +1788,18 @@ def get_sbom_with_http_info(asset_type, filter_asset_name, opts = {})
17871788
if @api_client.config.client_side_validation && filter_asset_name.nil?
17881789
fail ArgumentError, "Missing the required parameter 'filter_asset_name' when calling SecurityMonitoringAPI.get_sbom"
17891790
end
1791+
allowable_values = ['CycloneDX', 'SPDX']
1792+
if @api_client.config.client_side_validation && opts[:'ext_format'] && !allowable_values.include?(opts[:'ext_format'])
1793+
fail ArgumentError, "invalid value for \"ext_format\", must be one of #{allowable_values}"
1794+
end
17901795
# resource path
17911796
local_var_path = '/api/v2/security/sboms/{asset_type}'.sub('{asset_type}', CGI.escape(asset_type.to_s).gsub('%2F', '/'))
17921797

17931798
# query parameters
17941799
query_params = opts[:query_params] || {}
17951800
query_params[:'filter[asset_name]'] = filter_asset_name
17961801
query_params[:'filter[repo_digest]'] = opts[:'filter_repo_digest'] if !opts[:'filter_repo_digest'].nil?
1802+
query_params[:'ext:format'] = opts[:'ext_format'] if !opts[:'ext_format'].nil?
17971803

17981804
# header parameters
17991805
header_params = opts[:header_params] || {}
@@ -2993,6 +2999,134 @@ def list_historical_jobs_with_http_info(opts = {})
29932999
return data, status_code, headers
29943000
end
29953001

3002+
# List Scanned Assets Metadata.
3003+
#
3004+
# @see #list_scanned_assets_metadata_with_http_info
3005+
def list_scanned_assets_metadata(opts = {})
3006+
data, _status_code, _headers = list_scanned_assets_metadata_with_http_info(opts)
3007+
data
3008+
end
3009+
3010+
# List Scanned Assets Metadata.
3011+
#
3012+
# Get a list of security scanned assets metadata for an organization.
3013+
#
3014+
# ### Pagination
3015+
#
3016+
# Please review the [Pagination section](#pagination) for the "List Vulnerabilities" endpoint.
3017+
#
3018+
# ### Filtering
3019+
#
3020+
# Please review the [Filtering section](#filtering) for the "List Vulnerabilities" endpoint.
3021+
#
3022+
# ### Metadata
3023+
#
3024+
# Please review the [Metadata section](#metadata) for the "List Vulnerabilities" endpoint.
3025+
#
3026+
# ### Related endpoints
3027+
#
3028+
# This endpoint provides extra metadata for cloud resources that the standard resource endpoints do not expose. To obtain a richer dataset, call this endpoint together with the relevant resource endpoint(s) and merge (join) their results using the resource identifier.
3029+
#
3030+
# #### Hosts
3031+
#
3032+
# To enrich host data, join the response from the [Hosts](https://docs.datadoghq.com/api/latest/hosts/) endpoint with the response from the scanned-assets-metadata endpoint on the following key fields:
3033+
#
3034+
# | ENDPOINT | JOIN KEY | TYPE |
3035+
# | --- | --- | --- |
3036+
# | [/api/v1/hosts](https://docs.datadoghq.com/api/latest/hosts/) | host_list.host_name | string |
3037+
# | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string |
3038+
#
3039+
# #### Host images
3040+
#
3041+
# To enrich host image data, join the response from the [Hosts](https://docs.datadoghq.com/api/latest/hosts/) endpoint with the response from the scanned-assets-metadata endpoint on the following key fields:
3042+
#
3043+
# | ENDPOINT | JOIN KEY | TYPE |
3044+
# | --- | --- | --- |
3045+
# | [/api/v1/hosts](https://docs.datadoghq.com/api/latest/hosts/) | host_list.tags_by_source["Amazon Web Services"]["image"] | string |
3046+
# | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string |
3047+
#
3048+
# #### Container Images
3049+
#
3050+
# To enrich container image data, join the response from the [Container Images](https://docs.datadoghq.com/api/latest/container-images/) endpoint with the response from the scanned-assets-metadata endpoint on the following key fields:
3051+
#
3052+
# | ENDPOINT | JOIN KEY | TYPE |
3053+
# | --- | --- | --- |
3054+
# | [/api/v2/container_images](https://docs.datadoghq.com/api/latest/container-images/) | `data.attributes.name`@`data.attributes.repo_digest` | string |
3055+
# | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string |
3056+
#
3057+
# @param opts [Hash] the optional parameters
3058+
# @option opts [String] :page_token Its value must come from the `links` section of the response of the first request. Do not manually edit it.
3059+
# @option opts [Integer] :page_number The page number to be retrieved. It should be equal to or greater than 1.
3060+
# @option opts [CloudAssetType] :filter_asset_type The type of the scanned asset.
3061+
# @option opts [String] :filter_asset_name The name of the scanned asset.
3062+
# @option opts [String] :filter_last_success_origin The origin of last success scan.
3063+
# @option opts [String] :filter_last_success_env The environment of last success scan.
3064+
# @return [Array<(ScannedAssetsMetadata, Integer, Hash)>] ScannedAssetsMetadata data, response status code and response headers
3065+
def list_scanned_assets_metadata_with_http_info(opts = {})
3066+
unstable_enabled = @api_client.config.unstable_operations["v2.list_scanned_assets_metadata".to_sym]
3067+
if unstable_enabled
3068+
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_scanned_assets_metadata")
3069+
else
3070+
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_scanned_assets_metadata"))
3071+
end
3072+
3073+
if @api_client.config.debugging
3074+
@api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.list_scanned_assets_metadata ...'
3075+
end
3076+
if @api_client.config.client_side_validation && !opts[:'page_number'].nil? && opts[:'page_number'] < 1
3077+
fail ArgumentError, 'invalid value for "opts[:"page_number"]" when calling SecurityMonitoringAPI.list_scanned_assets_metadata, must be greater than or equal to 1.'
3078+
end
3079+
allowable_values = ['Host', 'HostImage', 'Image']
3080+
if @api_client.config.client_side_validation && opts[:'filter_asset_type'] && !allowable_values.include?(opts[:'filter_asset_type'])
3081+
fail ArgumentError, "invalid value for \"filter_asset_type\", must be one of #{allowable_values}"
3082+
end
3083+
# resource path
3084+
local_var_path = '/api/v2/security/scanned-assets-metadata'
3085+
3086+
# query parameters
3087+
query_params = opts[:query_params] || {}
3088+
query_params[:'page[token]'] = opts[:'page_token'] if !opts[:'page_token'].nil?
3089+
query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?
3090+
query_params[:'filter[asset.type]'] = opts[:'filter_asset_type'] if !opts[:'filter_asset_type'].nil?
3091+
query_params[:'filter[asset.name]'] = opts[:'filter_asset_name'] if !opts[:'filter_asset_name'].nil?
3092+
query_params[:'filter[last_success.origin]'] = opts[:'filter_last_success_origin'] if !opts[:'filter_last_success_origin'].nil?
3093+
query_params[:'filter[last_success.env]'] = opts[:'filter_last_success_env'] if !opts[:'filter_last_success_env'].nil?
3094+
3095+
# header parameters
3096+
header_params = opts[:header_params] || {}
3097+
# HTTP header 'Accept' (if needed)
3098+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3099+
3100+
# form parameters
3101+
form_params = opts[:form_params] || {}
3102+
3103+
# http body (model)
3104+
post_body = opts[:debug_body]
3105+
3106+
# return_type
3107+
return_type = opts[:debug_return_type] || 'ScannedAssetsMetadata'
3108+
3109+
# auth_names
3110+
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
3111+
3112+
new_options = opts.merge(
3113+
:operation => :list_scanned_assets_metadata,
3114+
:header_params => header_params,
3115+
:query_params => query_params,
3116+
:form_params => form_params,
3117+
:body => post_body,
3118+
:auth_names => auth_names,
3119+
:return_type => return_type,
3120+
:api_version => "V2"
3121+
)
3122+
3123+
data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
3124+
if @api_client.config.debugging
3125+
@api_client.config.logger.debug "API called: SecurityMonitoringAPI#list_scanned_assets_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3126+
end
3127+
return data, status_code, headers
3128+
end
3129+
29963130
# Get all security filters.
29973131
#
29983132
# @see #list_security_filters_with_http_info
@@ -3417,6 +3551,8 @@ def list_vulnerabilities(opts = {})
34173551
#
34183552
# This token can then be used in the subsequent paginated requests.
34193553
#
3554+
# *Note: The first request may take longer to complete than subsequent requests.*
3555+
#
34203556
# #### Subsequent requests
34213557
#
34223558
# Any request containing valid `page[token]` and `page[number]` parameters will be considered a subsequent request.
@@ -3425,6 +3561,8 @@ def list_vulnerabilities(opts = {})
34253561
#
34263562
# If the page `number` is invalid, a `400` response will be returned.
34273563
#
3564+
# The returned `token` remains valid for every request in the pagination sequence. You may send paginated requests in parallel by re-using this `token` and varying only the `page[number]` parameter.
3565+
#
34283566
# ### Filtering
34293567
#
34303568
# The request can include some filter parameters to filter the data to be retrieved. The format of the filter parameters follows the [JSON:API format](https://jsonapi.org/format/#fetching-filtering): `filter[$prop_name]`, where `prop_name` is the property name in the entity being filtered by.
@@ -3456,6 +3594,11 @@ def list_vulnerabilities(opts = {})
34563594
# "links": {...}
34573595
# }
34583596
# ```
3597+
# ### Extensions
3598+
#
3599+
# The request in some cases can include extensions to update behavior of the endpoint requested. The format of the filter parameters follows the [JSON:API format](https://jsonapi.org/extensions/#extensions): `ext:$extension_name`, where `extension_name` is the name of the modifier that is being applied.
3600+
#
3601+
# Extensions can only include one value at the moment: `ext:modifier=value`.
34593602
#
34603603
# @param opts [Hash] the optional parameters
34613604
# @option opts [String] :page_token Its value must come from the `links` section of the response of the first request. Do not manually edit it.
@@ -3485,7 +3628,7 @@ def list_vulnerabilities(opts = {})
34853628
# @option opts [Boolean] :filter_fix_available Filter by fix availability.
34863629
# @option opts [String] :filter_repo_digests Filter by vulnerability `repo_digest` (when the vulnerability is related to `Image` asset).
34873630
# @option opts [String] :filter_origin Filter by origin.
3488-
# @option opts [String] :filter_asset_name Filter by asset name.
3631+
# @option opts [String] :filter_asset_name Filter by asset name. This field supports the usage of wildcards (*).
34893632
# @option opts [AssetType] :filter_asset_type Filter by asset type.
34903633
# @option opts [String] :filter_asset_version_first Filter by the first version of the asset this vulnerability has been detected on.
34913634
# @option opts [String] :filter_asset_version_last Filter by the last version of the asset this vulnerability has been detected on.
@@ -3583,7 +3726,7 @@ def list_vulnerabilities_with_http_info(opts = {})
35833726
query_params[:'filter[tool]'] = opts[:'filter_tool'] if !opts[:'filter_tool'].nil?
35843727
query_params[:'filter[library.name]'] = opts[:'filter_library_name'] if !opts[:'filter_library_name'].nil?
35853728
query_params[:'filter[library.version]'] = opts[:'filter_library_version'] if !opts[:'filter_library_version'].nil?
3586-
query_params[:'filter[advisory_id]'] = opts[:'filter_advisory_id'] if !opts[:'filter_advisory_id'].nil?
3729+
query_params[:'filter[advisory.id]'] = opts[:'filter_advisory_id'] if !opts[:'filter_advisory_id'].nil?
35873730
query_params[:'filter[risks.exploitation_probability]'] = opts[:'filter_risks_exploitation_probability'] if !opts[:'filter_risks_exploitation_probability'].nil?
35883731
query_params[:'filter[risks.poc_exploit_available]'] = opts[:'filter_risks_poc_exploit_available'] if !opts[:'filter_risks_poc_exploit_available'].nil?
35893732
query_params[:'filter[risks.exploit_available]'] = opts[:'filter_risks_exploit_available'] if !opts[:'filter_risks_exploit_available'].nil?
@@ -3675,7 +3818,7 @@ def list_vulnerable_assets(opts = {})
36753818
# @param opts [Hash] the optional parameters
36763819
# @option opts [String] :page_token Its value must come from the `links` section of the response of the first request. Do not manually edit it.
36773820
# @option opts [Integer] :page_number The page number to be retrieved. It should be equal or greater than `1`
3678-
# @option opts [String] :filter_name Filter by name.
3821+
# @option opts [String] :filter_name Filter by name. This field supports the usage of wildcards (*).
36793822
# @option opts [AssetType] :filter_type Filter by type.
36803823
# @option opts [String] :filter_version_first Filter by the first version of the asset since it has been vulnerable.
36813824
# @option opts [String] :filter_version_last Filter by the last detected version of the asset.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# The cloud asset type
21+
class CloudAssetType
22+
include BaseEnumModel
23+
24+
HOST = "Host".freeze
25+
HOST_IMAGE = "HostImage".freeze
26+
IMAGE = "Image".freeze
27+
end
28+
end

0 commit comments

Comments
 (0)