diff --git a/.apigentools-info b/.apigentools-info index 8a11e7a5f5df..2f4a429fb721 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-07-09 16:47:17.991240", - "spec_repo_commit": "d0906173" + "regenerated": "2025-07-10 19:43:12.636369", + "spec_repo_commit": "fb5c5947" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-07-09 16:47:18.007275", - "spec_repo_commit": "d0906173" + "regenerated": "2025-07-10 19:43:12.654258", + "spec_repo_commit": "fb5c5947" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 8ab2278d0006..5f2203d96976 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3575,6 +3575,14 @@ components: $ref: '#/components/schemas/AssetOperatingSystem' risks: $ref: '#/components/schemas/AssetRisks' + teams: + description: List of teams that own the asset. + example: + - compute + items: + example: compute + type: string + type: array type: $ref: '#/components/schemas/AssetType' version: @@ -20340,6 +20348,21 @@ components: format: int64 type: integer type: object + ListAssetsSBOMsResponse: + description: The expected response schema when listing assets SBOMs. + properties: + data: + description: List of assets SBOMs. + items: + $ref: '#/components/schemas/SBOM' + type: array + links: + $ref: '#/components/schemas/Links' + meta: + $ref: '#/components/schemas/Metadata' + required: + - data + type: object ListDevicesResponse: description: List devices response. properties: @@ -32395,6 +32418,11 @@ components: items: $ref: '#/components/schemas/SBOMComponent' type: array + dependencies: + description: List of dependencies between components of the SBOM. + items: + $ref: '#/components/schemas/SBOMComponentDependency' + type: array metadata: $ref: '#/components/schemas/SBOMMetadata' serialNumber: @@ -32418,6 +32446,7 @@ components: - metadata - serialNumber - version + - dependencies type: object SBOMComponent: description: Software or hardware component. @@ -32427,16 +32456,28 @@ components: elsewhere in the BOM. example: pkg:golang/google.golang.org/grpc@1.68.1 type: string + licenses: + description: The software licenses of the SBOM component. + items: + $ref: '#/components/schemas/SBOMComponentLicense' + type: array name: description: The name of the component. This will often be a shortened, single name of the component. example: google.golang.org/grpc type: string + properties: + description: The custom properties of the component of the SBOM. + items: + $ref: '#/components/schemas/SBOMComponentProperty' + type: array purl: description: Specifies the package-url (purl). The purl, if specified, MUST be valid and conform to the [specification](https://github.com/package-url/purl-spec). example: pkg:golang/google.golang.org/grpc@1.68.1 type: string + supplier: + $ref: '#/components/schemas/SBOMComponentSupplier' type: $ref: '#/components/schemas/SBOMComponentType' version: @@ -32447,6 +32488,89 @@ components: - type - name - version + - supplier + type: object + SBOMComponentDependency: + description: The dependencies of a component of the SBOM. + properties: + dependsOn: + description: The components that are dependencies of the ref component. + items: + example: pkg:golang/google.golang.org/grpc@1.68.1 + type: string + required: + - ref + - dependsOn + type: array + ref: + description: The identifier for the related component. + example: Repository|github.com/datadog/datadog-agent + type: string + type: object + SBOMComponentLicense: + description: The software license of the component of the SBOM. + properties: + license: + $ref: '#/components/schemas/SBOMComponentLicenseLicense' + required: + - license + type: object + SBOMComponentLicenseLicense: + description: The software license of the component of the SBOM. + properties: + name: + description: The name of the software license of the component of the SBOM. + example: MIT + type: string + required: + - name + type: object + SBOMComponentLicenseType: + description: The SBOM component license type. + enum: + - network_strong_copyleft + - non_standard_copyleft + - other_non_free + - other_non_standard + - permissive + - public_domain + - strong_copyleft + - weak_copyleft + example: application + type: string + x-enum-varnames: + - NETWORK_STRONG_COPYLEFT + - NON_STANDARD_COPYLEFT + - OTHER_NON_FREE + - OTHER_NON_STANDARD + - PERMISSIVE + - PUBLIC_DOMAIN + - STRONG_COPYLEFT + - WEAK_COPYLEFT + SBOMComponentProperty: + description: The custom property of the component of the SBOM. + properties: + name: + description: The name of the custom property of the component of the SBOM. + example: license_type + type: string + value: + description: The value of the custom property of the component of the SBOM. + example: permissive + type: string + required: + - name + - value + type: object + SBOMComponentSupplier: + description: The supplier of the component. + properties: + name: + description: Identifier of the supplier of the component. + example: https://go.dev + type: string + required: + - name type: object SBOMComponentType: description: The SBOM component type @@ -32481,8 +32605,25 @@ components: SBOMMetadata: description: Provides additional information about a BOM. properties: + authors: + description: List of authors of the SBOM. + items: + $ref: '#/components/schemas/SBOMMetadataAuthor' + type: array component: $ref: '#/components/schemas/SBOMMetadataComponent' + timestamp: + description: The timestamp of the SBOM creation. + example: '2025-07-08T07:24:53Z' + type: string + type: object + SBOMMetadataAuthor: + description: Author of the SBOM. + properties: + name: + description: The identifier of the Author of the SBOM. + example: Datadog, Inc. + type: string type: object SBOMMetadataComponent: description: The component that the BOM describes. @@ -41438,6 +41579,14 @@ components: type: string library: $ref: '#/components/schemas/Library' + origin: + description: Vulnerability origin. + example: + - agentless-scanner + items: + example: agentless-scanner + type: string + type: array remediations: description: List of remediations. items: @@ -41477,6 +41626,7 @@ components: - exposure_time - remediations - fix_available + - origin type: object VulnerabilityCvss: description: Vulnerability severities. @@ -58257,6 +58407,13 @@ paths: required: false schema: type: string + - description: Filter by teams. + example: compute + in: query + name: filter[teams] + required: false + schema: + type: string - description: Filter by architecture. example: arm64 in: query @@ -58350,6 +58507,133 @@ paths: operator: OR permissions: - security_monitoring_cws_agent_rules_read + /api/v2/security/sboms: + get: + description: 'Get a list of assets SBOMs for an organization. + + + ### Pagination + + + Please review the [Pagination section](#pagination) for the "List Vulnerabilities" + endpoint. + + + ### Filtering + + + Please review the [Filtering section](#filtering) for the "List Vulnerabilities" + endpoint. + + + ### Metadata + + + Please review the [Metadata section](#metadata) for the "List Vulnerabilities" + endpoint.' + operationId: ListAssetsSBOMs + parameters: + - description: Its value must come from the `links` section of the response + of the first request. Do not manually edit it. + example: b82cef018aab81ed1d4bb4xb35xxfc065da7efa685fbcecdbd338f3015e3afabbbfa3a911b4984_721ee28a-zecb-4e45-9960-c42065b574f4 + in: query + name: page[token] + required: false + schema: + type: string + - description: The page number to be retrieved. It should be equal to or greater + than 1. + example: 1 + in: query + name: page[number] + required: false + schema: + format: int64 + minimum: 1 + type: integer + - description: The type of the assets for the SBOM request. + example: Repository + in: query + name: filter[asset_type] + required: false + schema: + $ref: '#/components/schemas/AssetType' + - description: The name of the asset for the SBOM request. + example: github.com/datadog/datadog-agent + in: query + name: filter[asset_name] + required: false + schema: + type: string + - description: The name of the component that is a dependency of an asset. + example: opentelemetry-api + in: query + name: filter[package_name] + required: false + schema: + type: string + - description: The version of the component that is a dependency of an asset. + example: 1.33.1 + in: query + name: filter[package_version] + required: false + schema: + type: string + - description: The software license name of the component that is a dependency + of an asset. + example: Apache-2.0 + in: query + name: filter[license_name] + required: false + schema: + type: string + - description: The software license type of the component that is a dependency + of an asset. + example: network_strong_copyleft + in: query + name: filter[license_type] + required: false + schema: + $ref: '#/components/schemas/SBOMComponentLicenseType' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListAssetsSBOMsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: 'Bad request: The server cannot process the request due to + invalid syntax in the request.' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: 'Forbidden: Access denied' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: 'Not found: asset not found' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - appsec_vm_read + summary: List assets SBOMs + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint is a private preview. + + If you are interested in accessing this API, [fill out this form](https://forms.gle/kMYC1sDr6WDUBDsx9).' /api/v2/security/sboms/{asset_type}: get: description: 'Get a single SBOM related to an asset by its type and name. @@ -58841,6 +59125,13 @@ paths: required: false schema: type: string + - description: Filter by origin. + example: agentless-scanner + in: query + name: filter[origin] + required: false + schema: + type: string - description: Filter by asset name. example: datadog-agent in: query @@ -58920,6 +59211,13 @@ paths: required: false schema: type: string + - description: Filter by asset teams. + example: compute + in: query + name: filter[asset.teams] + required: false + schema: + type: string - description: Filter by asset architecture. example: arm64 in: query diff --git a/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.frozen b/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.frozen new file mode 100644 index 000000000000..691734389915 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.frozen @@ -0,0 +1 @@ +2025-07-10T10:13:27.247Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.yml b/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.yml new file mode 100644 index 000000000000..115f88725c8d --- /dev/null +++ b/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Thu, 10 Jul 2025 10:13:27 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/security/sboms?page%5Btoken%5D=unknown&page%5Bnumber%5D=1 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Unexpected internal error"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-OK-response.frozen b/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-OK-response.frozen new file mode 100644 index 000000000000..c142d99dc723 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-07-10T10:11:37.540Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-OK-response.yml b/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-OK-response.yml new file mode 100644 index 000000000000..172f856bd4b8 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/List-assets-SBOMs-returns-OK-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Thu, 10 Jul 2025 10:11:37 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/security/sboms?filter%5Bpackage_name%5D=pandas&filter%5Basset_type%5D=Service + response: + body: + encoding: UTF-8 + string: '{"data":[]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v2/security-monitoring/ListAssetsSBOMs.rb b/examples/v2/security-monitoring/ListAssetsSBOMs.rb new file mode 100644 index 000000000000..42b96395ff88 --- /dev/null +++ b/examples/v2/security-monitoring/ListAssetsSBOMs.rb @@ -0,0 +1,12 @@ +# List assets SBOMs returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_assets_sbo_ms".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new +opts = { + filter_package_name: "pandas", + filter_asset_type: AssetType::SERVICE, +} +p api_instance.list_assets_sbo_ms(opts) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index dc22ab35d1d3..ea53e25aad69 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1239,10 +1239,21 @@ "filter_risks_has_privileged_access" => "Boolean", "filter_risks_has_access_to_sensitive_data" => "Boolean", "filter_environments" => "String", + "filter_teams" => "String", "filter_arch" => "String", "filter_operating_system_name" => "String", "filter_operating_system_version" => "String", }, + "v2.ListAssetsSBOMs" => { + "page_token" => "String", + "page_number" => "Integer", + "filter_asset_type" => "AssetType", + "filter_asset_name" => "String", + "filter_package_name" => "String", + "filter_package_version" => "String", + "filter_license_name" => "String", + "filter_license_type" => "SBOMComponentLicenseType", + }, "v2.GetSBOM" => { "asset_type" => "AssetType", "filter_asset_name" => "String", @@ -1288,6 +1299,7 @@ "filter_code_location_method" => "String", "filter_fix_available" => "Boolean", "filter_repo_digests" => "String", + "filter_origin" => "String", "filter_asset_name" => "String", "filter_asset_type" => "AssetType", "filter_asset_version_first" => "String", @@ -1299,6 +1311,7 @@ "filter_asset_risks_has_privileged_access" => "Boolean", "filter_asset_risks_has_access_to_sensitive_data" => "Boolean", "filter_asset_environments" => "String", + "filter_asset_teams" => "String", "filter_asset_arch" => "String", "filter_asset_operating_system_name" => "String", "filter_asset_operating_system_version" => "String", diff --git a/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index 21524e249a16..1ec6ed14e58c 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/security_monitoring.feature @@ -818,6 +818,38 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 The list of notification rules. + @generated @skip @team:DataDog/asm-vm + Scenario: List assets SBOMs returns "Bad request: The server cannot process the request due to invalid syntax in the request." response + Given operation "ListAssetsSBOMs" enabled + And new "ListAssetsSBOMs" request + 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: List assets SBOMs returns "Not found: There is no request associated with the provided token." response + Given operation "ListAssetsSBOMs" enabled + And new "ListAssetsSBOMs" request + And request contains "page[token]" parameter with value "unknown" + And request contains "page[number]" parameter with value 1 + When the request is sent + Then the response status is 404 Not found: There is no request associated with the provided token. + + @generated @skip @team:DataDog/asm-vm + Scenario: List assets SBOMs returns "Not found: asset not found" response + Given operation "ListAssetsSBOMs" enabled + And new "ListAssetsSBOMs" request + When the request is sent + Then the response status is 404 Not found: asset not found + + @team:DataDog/asm-vm + Scenario: List assets SBOMs returns "OK" response + Given operation "ListAssetsSBOMs" enabled + And new "ListAssetsSBOMs" request + And request contains "filter[package_name]" parameter with value "pandas" + And request contains "filter[asset_type]" parameter with value "Service" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-security-posture-management Scenario: List findings returns "Bad Request: The server cannot process the request due to invalid syntax in the request." response Given operation "ListFindings" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index b93f6b777af9..5b4f718bb953 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2730,6 +2730,12 @@ "type": "safe" } }, + "ListAssetsSBOMs": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "GetSBOM": { "tag": "Security Monitoring", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 9329a7a5632a..02a24f7e53c3 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -201,6 +201,7 @@ def initialize "v2.get_historical_job": false, "v2.get_rule_version_history": false, "v2.get_sbom": false, + "v2.list_assets_sbo_ms": false, "v2.list_findings": false, "v2.list_historical_jobs": false, "v2.list_vulnerabilities": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 40538312056f..6e464807afd7 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2138,6 +2138,7 @@ def overrides "v2.list_apps_response_data_items_relationships" => "ListAppsResponseDataItemsRelationships", "v2.list_apps_response_meta" => "ListAppsResponseMeta", "v2.list_apps_response_meta_page" => "ListAppsResponseMetaPage", + "v2.list_assets_sbo_ms_response" => "ListAssetsSBOMsResponse", "v2.list_devices_response" => "ListDevicesResponse", "v2.list_devices_response_metadata" => "ListDevicesResponseMetadata", "v2.list_devices_response_metadata_page" => "ListDevicesResponseMetadataPage", @@ -2941,8 +2942,15 @@ def overrides "v2.sbom" => "SBOM", "v2.sbom_attributes" => "SBOMAttributes", "v2.sbom_component" => "SBOMComponent", + "v2.sbom_component_dependency" => "SBOMComponentDependency", + "v2.sbom_component_license" => "SBOMComponentLicense", + "v2.sbom_component_license_license" => "SBOMComponentLicenseLicense", + "v2.sbom_component_license_type" => "SBOMComponentLicenseType", + "v2.sbom_component_property" => "SBOMComponentProperty", + "v2.sbom_component_supplier" => "SBOMComponentSupplier", "v2.sbom_component_type" => "SBOMComponentType", "v2.sbom_metadata" => "SBOMMetadata", + "v2.sbom_metadata_author" => "SBOMMetadataAuthor", "v2.sbom_metadata_component" => "SBOMMetadataComponent", "v2.sbom_type" => "SBOMType", "v2.scalar_column" => "ScalarColumn", diff --git a/lib/datadog_api_client/v2/api/security_monitoring_api.rb b/lib/datadog_api_client/v2/api/security_monitoring_api.rb index f66e87a3536c..056c0915744e 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -2344,6 +2344,111 @@ def get_vulnerability_notification_rules_with_http_info(opts = {}) return data, status_code, headers end + # List assets SBOMs. + # + # @see #list_assets_sbo_ms_with_http_info + def list_assets_sbo_ms(opts = {}) + data, _status_code, _headers = list_assets_sbo_ms_with_http_info(opts) + data + end + + # List assets SBOMs. + # + # Get a list of assets SBOMs for an organization. + # + # ### Pagination + # + # Please review the [Pagination section](#pagination) for the "List Vulnerabilities" endpoint. + # + # ### Filtering + # + # Please review the [Filtering section](#filtering) for the "List Vulnerabilities" endpoint. + # + # ### Metadata + # + # Please review the [Metadata section](#metadata) for the "List Vulnerabilities" endpoint. + # + # @param opts [Hash] the optional parameters + # @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. + # @option opts [Integer] :page_number The page number to be retrieved. It should be equal to or greater than 1. + # @option opts [AssetType] :filter_asset_type The type of the assets for the SBOM request. + # @option opts [String] :filter_asset_name The name of the asset for the SBOM request. + # @option opts [String] :filter_package_name The name of the component that is a dependency of an asset. + # @option opts [String] :filter_package_version The version of the component that is a dependency of an asset. + # @option opts [String] :filter_license_name The software license name of the component that is a dependency of an asset. + # @option opts [SBOMComponentLicenseType] :filter_license_type The software license type of the component that is a dependency of an asset. + # @return [Array<(ListAssetsSBOMsResponse, Integer, Hash)>] ListAssetsSBOMsResponse data, response status code and response headers + def list_assets_sbo_ms_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_assets_sbo_ms".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_assets_sbo_ms") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_assets_sbo_ms")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.list_assets_sbo_ms ...' + end + if @api_client.config.client_side_validation && !opts[:'page_number'].nil? && opts[:'page_number'] < 1 + fail ArgumentError, 'invalid value for "opts[:"page_number"]" when calling SecurityMonitoringAPI.list_assets_sbo_ms, must be greater than or equal to 1.' + end + allowable_values = ['Repository', 'Service', 'Host', 'HostImage', 'Image'] + if @api_client.config.client_side_validation && opts[:'filter_asset_type'] && !allowable_values.include?(opts[:'filter_asset_type']) + fail ArgumentError, "invalid value for \"filter_asset_type\", must be one of #{allowable_values}" + end + allowable_values = ['network_strong_copyleft', 'non_standard_copyleft', 'other_non_free', 'other_non_standard', 'permissive', 'public_domain', 'strong_copyleft', 'weak_copyleft'] + if @api_client.config.client_side_validation && opts[:'filter_license_type'] && !allowable_values.include?(opts[:'filter_license_type']) + fail ArgumentError, "invalid value for \"filter_license_type\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/api/v2/security/sboms' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[token]'] = opts[:'page_token'] if !opts[:'page_token'].nil? + query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? + query_params[:'filter[asset_type]'] = opts[:'filter_asset_type'] if !opts[:'filter_asset_type'].nil? + query_params[:'filter[asset_name]'] = opts[:'filter_asset_name'] if !opts[:'filter_asset_name'].nil? + query_params[:'filter[package_name]'] = opts[:'filter_package_name'] if !opts[:'filter_package_name'].nil? + query_params[:'filter[package_version]'] = opts[:'filter_package_version'] if !opts[:'filter_package_version'].nil? + query_params[:'filter[license_name]'] = opts[:'filter_license_name'] if !opts[:'filter_license_name'].nil? + query_params[:'filter[license_type]'] = opts[:'filter_license_type'] if !opts[:'filter_license_type'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListAssetsSBOMsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_assets_sbo_ms, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#list_assets_sbo_ms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List findings. # # @see #list_findings_with_http_info @@ -2999,6 +3104,7 @@ def list_vulnerabilities(opts = {}) # @option opts [String] :filter_code_location_method Filter by method. # @option opts [Boolean] :filter_fix_available Filter by fix availability. # @option opts [String] :filter_repo_digests Filter by vulnerability `repo_digest` (when the vulnerability is related to `Image` asset). + # @option opts [String] :filter_origin Filter by origin. # @option opts [String] :filter_asset_name Filter by asset name. # @option opts [AssetType] :filter_asset_type Filter by asset type. # @option opts [String] :filter_asset_version_first Filter by the first version of the asset this vulnerability has been detected on. @@ -3010,6 +3116,7 @@ def list_vulnerabilities(opts = {}) # @option opts [Boolean] :filter_asset_risks_has_privileged_access Filter whether the asset is publicly accessible or not. # @option opts [Boolean] :filter_asset_risks_has_access_to_sensitive_data Filter whether the asset has access to sensitive data or not. # @option opts [String] :filter_asset_environments Filter by asset environments. + # @option opts [String] :filter_asset_teams Filter by asset teams. # @option opts [String] :filter_asset_arch Filter by asset architecture. # @option opts [String] :filter_asset_operating_system_name Filter by asset operating system name. # @option opts [String] :filter_asset_operating_system_version Filter by asset operating system version. @@ -3109,6 +3216,7 @@ def list_vulnerabilities_with_http_info(opts = {}) query_params[:'filter[code_location.method]'] = opts[:'filter_code_location_method'] if !opts[:'filter_code_location_method'].nil? query_params[:'filter[fix_available]'] = opts[:'filter_fix_available'] if !opts[:'filter_fix_available'].nil? query_params[:'filter[repo_digests]'] = opts[:'filter_repo_digests'] if !opts[:'filter_repo_digests'].nil? + query_params[:'filter[origin]'] = opts[:'filter_origin'] if !opts[:'filter_origin'].nil? query_params[:'filter[asset.name]'] = opts[:'filter_asset_name'] if !opts[:'filter_asset_name'].nil? query_params[:'filter[asset.type]'] = opts[:'filter_asset_type'] if !opts[:'filter_asset_type'].nil? query_params[:'filter[asset.version.first]'] = opts[:'filter_asset_version_first'] if !opts[:'filter_asset_version_first'].nil? @@ -3120,6 +3228,7 @@ def list_vulnerabilities_with_http_info(opts = {}) query_params[:'filter[asset.risks.has_privileged_access]'] = opts[:'filter_asset_risks_has_privileged_access'] if !opts[:'filter_asset_risks_has_privileged_access'].nil? query_params[:'filter[asset.risks.has_access_to_sensitive_data]'] = opts[:'filter_asset_risks_has_access_to_sensitive_data'] if !opts[:'filter_asset_risks_has_access_to_sensitive_data'].nil? query_params[:'filter[asset.environments]'] = opts[:'filter_asset_environments'] if !opts[:'filter_asset_environments'].nil? + query_params[:'filter[asset.teams]'] = opts[:'filter_asset_teams'] if !opts[:'filter_asset_teams'].nil? query_params[:'filter[asset.arch]'] = opts[:'filter_asset_arch'] if !opts[:'filter_asset_arch'].nil? query_params[:'filter[asset.operating_system.name]'] = opts[:'filter_asset_operating_system_name'] if !opts[:'filter_asset_operating_system_name'].nil? query_params[:'filter[asset.operating_system.version]'] = opts[:'filter_asset_operating_system_version'] if !opts[:'filter_asset_operating_system_version'].nil? @@ -3198,6 +3307,7 @@ def list_vulnerable_assets(opts = {}) # @option opts [Boolean] :filter_risks_has_privileged_access Filter whether the asset (Host) has privileged access or not. # @option opts [Boolean] :filter_risks_has_access_to_sensitive_data Filter whether the asset (Host) has access to sensitive data or not. # @option opts [String] :filter_environments Filter by environment. + # @option opts [String] :filter_teams Filter by teams. # @option opts [String] :filter_arch Filter by architecture. # @option opts [String] :filter_operating_system_name Filter by operating system name. # @option opts [String] :filter_operating_system_version Filter by operating system version. @@ -3238,6 +3348,7 @@ def list_vulnerable_assets_with_http_info(opts = {}) query_params[:'filter[risks.has_privileged_access]'] = opts[:'filter_risks_has_privileged_access'] if !opts[:'filter_risks_has_privileged_access'].nil? query_params[:'filter[risks.has_access_to_sensitive_data]'] = opts[:'filter_risks_has_access_to_sensitive_data'] if !opts[:'filter_risks_has_access_to_sensitive_data'].nil? query_params[:'filter[environments]'] = opts[:'filter_environments'] if !opts[:'filter_environments'].nil? + query_params[:'filter[teams]'] = opts[:'filter_teams'] if !opts[:'filter_teams'].nil? query_params[:'filter[arch]'] = opts[:'filter_arch'] if !opts[:'filter_arch'].nil? query_params[:'filter[operating_system.name]'] = opts[:'filter_operating_system_name'] if !opts[:'filter_operating_system_name'].nil? query_params[:'filter[operating_system.version]'] = opts[:'filter_operating_system_version'] if !opts[:'filter_operating_system_version'].nil? diff --git a/lib/datadog_api_client/v2/models/asset_attributes.rb b/lib/datadog_api_client/v2/models/asset_attributes.rb index 01b5081a61f4..2db823e67e67 100644 --- a/lib/datadog_api_client/v2/models/asset_attributes.rb +++ b/lib/datadog_api_client/v2/models/asset_attributes.rb @@ -36,6 +36,9 @@ class AssetAttributes # Asset risks. attr_reader :risks + # List of teams that own the asset. + attr_accessor :teams + # The asset type attr_reader :type @@ -53,6 +56,7 @@ def self.attribute_map :'name' => :'name', :'operating_system' => :'operating_system', :'risks' => :'risks', + :'teams' => :'teams', :'type' => :'type', :'version' => :'version' } @@ -67,6 +71,7 @@ def self.openapi_types :'name' => :'String', :'operating_system' => :'AssetOperatingSystem', :'risks' => :'AssetRisks', + :'teams' => :'Array', :'type' => :'AssetType', :'version' => :'AssetVersion' } @@ -112,6 +117,12 @@ def initialize(attributes = {}) self.risks = attributes[:'risks'] end + if attributes.key?(:'teams') + if (value = attributes[:'teams']).is_a?(Array) + self.teams = value + end + end + if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -203,6 +214,7 @@ def ==(o) name == o.name && operating_system == o.operating_system && risks == o.risks && + teams == o.teams && type == o.type && version == o.version && additional_properties == o.additional_properties @@ -212,7 +224,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [arch, environments, name, operating_system, risks, type, version, additional_properties].hash + [arch, environments, name, operating_system, risks, teams, type, version, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/list_assets_sbo_ms_response.rb b/lib/datadog_api_client/v2/models/list_assets_sbo_ms_response.rb new file mode 100644 index 000000000000..eb049d9fa19e --- /dev/null +++ b/lib/datadog_api_client/v2/models/list_assets_sbo_ms_response.rb @@ -0,0 +1,145 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The expected response schema when listing assets SBOMs. + class ListAssetsSBOMsResponse + include BaseGenericModel + + # List of assets SBOMs. + attr_reader :data + + # The JSON:API links related to pagination. + attr_accessor :links + + # The metadata related to this request. + attr_accessor :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'links' => :'links', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'links' => :'Links', + :'meta' => :'Metadata' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ListAssetsSBOMsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'links') + self.links = attributes[:'links'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + links == o.links && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, links, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/sbom_attributes.rb b/lib/datadog_api_client/v2/models/sbom_attributes.rb index 7c02a0e62246..e5572f30e69e 100644 --- a/lib/datadog_api_client/v2/models/sbom_attributes.rb +++ b/lib/datadog_api_client/v2/models/sbom_attributes.rb @@ -27,6 +27,9 @@ class SBOMAttributes # A list of software and hardware components. attr_reader :components + # List of dependencies between components of the SBOM. + attr_reader :dependencies + # Provides additional information about a BOM. attr_reader :metadata @@ -47,6 +50,7 @@ def self.attribute_map { :'bom_format' => :'bomFormat', :'components' => :'components', + :'dependencies' => :'dependencies', :'metadata' => :'metadata', :'serial_number' => :'serialNumber', :'spec_version' => :'specVersion', @@ -60,6 +64,7 @@ def self.openapi_types { :'bom_format' => :'String', :'components' => :'Array', + :'dependencies' => :'Array', :'metadata' => :'SBOMMetadata', :'serial_number' => :'String', :'spec_version' => :'SpecVersion', @@ -95,6 +100,12 @@ def initialize(attributes = {}) end end + if attributes.key?(:'dependencies') + if (value = attributes[:'dependencies']).is_a?(Array) + self.dependencies = value + end + end + if attributes.key?(:'metadata') self.metadata = attributes[:'metadata'] end @@ -118,6 +129,7 @@ def initialize(attributes = {}) def valid? return false if @bom_format.nil? return false if @components.nil? + return false if @dependencies.nil? return false if @metadata.nil? return false if @serial_number.nil? return false if @spec_version.nil? @@ -145,6 +157,16 @@ def components=(components) @components = components end + # Custom attribute writer method with validation + # @param dependencies [Object] Object to be assigned + # @!visibility private + def dependencies=(dependencies) + if dependencies.nil? + fail ArgumentError, 'invalid value for "dependencies", dependencies cannot be nil.' + end + @dependencies = dependencies + end + # Custom attribute writer method with validation # @param metadata [Object] Object to be assigned # @!visibility private @@ -213,6 +235,7 @@ def ==(o) self.class == o.class && bom_format == o.bom_format && components == o.components && + dependencies == o.dependencies && metadata == o.metadata && serial_number == o.serial_number && spec_version == o.spec_version && @@ -224,7 +247,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [bom_format, components, metadata, serial_number, spec_version, version, additional_properties].hash + [bom_format, components, dependencies, metadata, serial_number, spec_version, version, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/sbom_component.rb b/lib/datadog_api_client/v2/models/sbom_component.rb index 98afbbf34f9f..4cfdbeb27f80 100644 --- a/lib/datadog_api_client/v2/models/sbom_component.rb +++ b/lib/datadog_api_client/v2/models/sbom_component.rb @@ -24,12 +24,21 @@ class SBOMComponent # An optional identifier that can be used to reference the component elsewhere in the BOM. attr_accessor :bom_ref + # The software licenses of the SBOM component. + attr_accessor :licenses + # The name of the component. This will often be a shortened, single name of the component. attr_reader :name + # The custom properties of the component of the SBOM. + attr_accessor :properties + # Specifies the package-url (purl). The purl, if specified, MUST be valid and conform to the [specification](https://github.com/package-url/purl-spec). attr_accessor :purl + # The supplier of the component. + attr_reader :supplier + # The SBOM component type attr_reader :type @@ -43,8 +52,11 @@ class SBOMComponent def self.attribute_map { :'bom_ref' => :'bom-ref', + :'licenses' => :'licenses', :'name' => :'name', + :'properties' => :'properties', :'purl' => :'purl', + :'supplier' => :'supplier', :'type' => :'type', :'version' => :'version' } @@ -55,8 +67,11 @@ def self.attribute_map def self.openapi_types { :'bom_ref' => :'String', + :'licenses' => :'Array', :'name' => :'String', + :'properties' => :'Array', :'purl' => :'String', + :'supplier' => :'SBOMComponentSupplier', :'type' => :'SBOMComponentType', :'version' => :'String' } @@ -84,14 +99,30 @@ def initialize(attributes = {}) self.bom_ref = attributes[:'bom_ref'] end + if attributes.key?(:'licenses') + if (value = attributes[:'licenses']).is_a?(Array) + self.licenses = value + end + end + if attributes.key?(:'name') self.name = attributes[:'name'] end + if attributes.key?(:'properties') + if (value = attributes[:'properties']).is_a?(Array) + self.properties = value + end + end + if attributes.key?(:'purl') self.purl = attributes[:'purl'] end + if attributes.key?(:'supplier') + self.supplier = attributes[:'supplier'] + end + if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -106,6 +137,7 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if @name.nil? + return false if @supplier.nil? return false if @type.nil? return false if @version.nil? true @@ -121,6 +153,16 @@ def name=(name) @name = name end + # Custom attribute writer method with validation + # @param supplier [Object] Object to be assigned + # @!visibility private + def supplier=(supplier) + if supplier.nil? + fail ArgumentError, 'invalid value for "supplier", supplier cannot be nil.' + end + @supplier = supplier + end + # Custom attribute writer method with validation # @param type [Object] Object to be assigned # @!visibility private @@ -168,8 +210,11 @@ def ==(o) return true if self.equal?(o) self.class == o.class && bom_ref == o.bom_ref && + licenses == o.licenses && name == o.name && + properties == o.properties && purl == o.purl && + supplier == o.supplier && type == o.type && version == o.version && additional_properties == o.additional_properties @@ -179,7 +224,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [bom_ref, name, purl, type, version, additional_properties].hash + [bom_ref, licenses, name, properties, purl, supplier, type, version, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/sbom_component_dependency.rb b/lib/datadog_api_client/v2/models/sbom_component_dependency.rb new file mode 100644 index 000000000000..5c8d0bd0cddd --- /dev/null +++ b/lib/datadog_api_client/v2/models/sbom_component_dependency.rb @@ -0,0 +1,117 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The dependencies of a component of the SBOM. + class SBOMComponentDependency + include BaseGenericModel + + # The components that are dependencies of the ref component. + attr_accessor :depends_on + + # The identifier for the related component. + attr_accessor :ref + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'depends_on' => :'dependsOn', + :'ref' => :'ref' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'depends_on' => :'Array', + :'ref' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SBOMComponentDependency` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'depends_on') + if (value = attributes[:'depends_on']).is_a?(Array) + self.depends_on = value + end + end + + if attributes.key?(:'ref') + self.ref = attributes[:'ref'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + depends_on == o.depends_on && + ref == o.ref && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [depends_on, ref, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/sbom_component_license.rb b/lib/datadog_api_client/v2/models/sbom_component_license.rb new file mode 100644 index 000000000000..a3e0ec26f5a2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/sbom_component_license.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The software license of the component of the SBOM. + class SBOMComponentLicense + include BaseGenericModel + + # The software license of the component of the SBOM. + attr_reader :license + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'license' => :'license' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'license' => :'SBOMComponentLicenseLicense' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SBOMComponentLicense` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'license') + self.license = attributes[:'license'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @license.nil? + true + end + + # Custom attribute writer method with validation + # @param license [Object] Object to be assigned + # @!visibility private + def license=(license) + if license.nil? + fail ArgumentError, 'invalid value for "license", license cannot be nil.' + end + @license = license + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + license == o.license && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [license, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/sbom_component_license_license.rb b/lib/datadog_api_client/v2/models/sbom_component_license_license.rb new file mode 100644 index 000000000000..d8c3972b274c --- /dev/null +++ b/lib/datadog_api_client/v2/models/sbom_component_license_license.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The software license of the component of the SBOM. + class SBOMComponentLicenseLicense + include BaseGenericModel + + # The name of the software license of the component of the SBOM. + attr_reader :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SBOMComponentLicenseLicense` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @name.nil? + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/sbom_component_license_type.rb b/lib/datadog_api_client/v2/models/sbom_component_license_type.rb new file mode 100644 index 000000000000..84b11429c49d --- /dev/null +++ b/lib/datadog_api_client/v2/models/sbom_component_license_type.rb @@ -0,0 +1,33 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The SBOM component license type. + class SBOMComponentLicenseType + include BaseEnumModel + + NETWORK_STRONG_COPYLEFT = "network_strong_copyleft".freeze + NON_STANDARD_COPYLEFT = "non_standard_copyleft".freeze + OTHER_NON_FREE = "other_non_free".freeze + OTHER_NON_STANDARD = "other_non_standard".freeze + PERMISSIVE = "permissive".freeze + PUBLIC_DOMAIN = "public_domain".freeze + STRONG_COPYLEFT = "strong_copyleft".freeze + WEAK_COPYLEFT = "weak_copyleft".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/sbom_component_property.rb b/lib/datadog_api_client/v2/models/sbom_component_property.rb new file mode 100644 index 000000000000..d002d6749dc5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/sbom_component_property.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The custom property of the component of the SBOM. + class SBOMComponentProperty + include BaseGenericModel + + # The name of the custom property of the component of the SBOM. + attr_reader :name + + # The value of the custom property of the component of the SBOM. + attr_reader :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'value' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SBOMComponentProperty` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @name.nil? + return false if @value.nil? + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param value [Object] Object to be assigned + # @!visibility private + def value=(value) + if value.nil? + fail ArgumentError, 'invalid value for "value", value cannot be nil.' + end + @value = value + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/sbom_component_supplier.rb b/lib/datadog_api_client/v2/models/sbom_component_supplier.rb new file mode 100644 index 000000000000..738e7b180a5b --- /dev/null +++ b/lib/datadog_api_client/v2/models/sbom_component_supplier.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The supplier of the component. + class SBOMComponentSupplier + include BaseGenericModel + + # Identifier of the supplier of the component. + attr_reader :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SBOMComponentSupplier` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @name.nil? + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/sbom_metadata.rb b/lib/datadog_api_client/v2/models/sbom_metadata.rb index 000116dcee31..f4a33bcc2b26 100644 --- a/lib/datadog_api_client/v2/models/sbom_metadata.rb +++ b/lib/datadog_api_client/v2/models/sbom_metadata.rb @@ -21,16 +21,24 @@ module DatadogAPIClient::V2 class SBOMMetadata include BaseGenericModel + # List of authors of the SBOM. + attr_accessor :authors + # The component that the BOM describes. attr_accessor :component + # The timestamp of the SBOM creation. + attr_accessor :timestamp + attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map { - :'component' => :'component' + :'authors' => :'authors', + :'component' => :'component', + :'timestamp' => :'timestamp' } end @@ -38,7 +46,9 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'component' => :'SBOMMetadataComponent' + :'authors' => :'Array', + :'component' => :'SBOMMetadataComponent', + :'timestamp' => :'String' } end @@ -60,9 +70,19 @@ def initialize(attributes = {}) end } + if attributes.key?(:'authors') + if (value = attributes[:'authors']).is_a?(Array) + self.authors = value + end + end + if attributes.key?(:'component') self.component = attributes[:'component'] end + + if attributes.key?(:'timestamp') + self.timestamp = attributes[:'timestamp'] + end end # Returns the object in the form of hash, with additionalProperties support. @@ -91,7 +111,9 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && + authors == o.authors && component == o.component && + timestamp == o.timestamp && additional_properties == o.additional_properties end @@ -99,7 +121,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [component, additional_properties].hash + [authors, component, timestamp, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/sbom_metadata_author.rb b/lib/datadog_api_client/v2/models/sbom_metadata_author.rb new file mode 100644 index 000000000000..e8fbb44cff23 --- /dev/null +++ b/lib/datadog_api_client/v2/models/sbom_metadata_author.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Author of the SBOM. + class SBOMMetadataAuthor + include BaseGenericModel + + # The identifier of the Author of the SBOM. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SBOMMetadataAuthor` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/vulnerability_attributes.rb b/lib/datadog_api_client/v2/models/vulnerability_attributes.rb index 2a34636a3732..d2ee0d7e014b 100644 --- a/lib/datadog_api_client/v2/models/vulnerability_attributes.rb +++ b/lib/datadog_api_client/v2/models/vulnerability_attributes.rb @@ -60,6 +60,9 @@ class VulnerabilityAttributes # Vulnerability library. attr_accessor :library + # Vulnerability origin. + attr_reader :origin + # List of remediations. attr_reader :remediations @@ -100,6 +103,7 @@ def self.attribute_map :'language' => :'language', :'last_detection' => :'last_detection', :'library' => :'library', + :'origin' => :'origin', :'remediations' => :'remediations', :'repo_digests' => :'repo_digests', :'risks' => :'risks', @@ -127,6 +131,7 @@ def self.openapi_types :'language' => :'String', :'last_detection' => :'String', :'library' => :'Library', + :'origin' => :'Array', :'remediations' => :'Array', :'repo_digests' => :'Array', :'risks' => :'VulnerabilityRisks', @@ -209,6 +214,12 @@ def initialize(attributes = {}) self.library = attributes[:'library'] end + if attributes.key?(:'origin') + if (value = attributes[:'origin']).is_a?(Array) + self.origin = value + end + end + if attributes.key?(:'remediations') if (value = attributes[:'remediations']).is_a?(Array) self.remediations = value @@ -254,6 +265,7 @@ def valid? return false if @fix_available.nil? return false if @language.nil? return false if @last_detection.nil? + return false if @origin.nil? return false if @remediations.nil? return false if @risks.nil? return false if @status.nil? @@ -343,6 +355,16 @@ def last_detection=(last_detection) @last_detection = last_detection end + # Custom attribute writer method with validation + # @param origin [Object] Object to be assigned + # @!visibility private + def origin=(origin) + if origin.nil? + fail ArgumentError, 'invalid value for "origin", origin cannot be nil.' + end + @origin = origin + end + # Custom attribute writer method with validation # @param remediations [Object] Object to be assigned # @!visibility private @@ -442,6 +464,7 @@ def ==(o) language == o.language && last_detection == o.last_detection && library == o.library && + origin == o.origin && remediations == o.remediations && repo_digests == o.repo_digests && risks == o.risks && @@ -456,7 +479,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [advisory_id, code_location, cve_list, cvss, dependency_locations, description, ecosystem, exposure_time, first_detection, fix_available, language, last_detection, library, remediations, repo_digests, risks, status, title, tool, type, additional_properties].hash + [advisory_id, code_location, cve_list, cvss, dependency_locations, description, ecosystem, exposure_time, first_detection, fix_available, language, last_detection, library, origin, remediations, repo_digests, risks, status, title, tool, type, additional_properties].hash end end end