diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9f43840f754..0d0a0d67f3d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -9188,6 +9188,18 @@ components: required: - type type: object + CloudAssetType: + description: The cloud asset type + enum: + - Host + - HostImage + - Image + example: Host + type: string + x-enum-varnames: + - HOST + - HOST_IMAGE + - IMAGE CloudConfigurationComplianceRuleOptions: additionalProperties: {} description: 'Options for cloud_configuration rules. @@ -41130,6 +41142,16 @@ components: - MACHINE_LEARNING_MODEL - OPERATING_SYSTEM - PLATFORM + SBOMFormat: + description: The SBOM standard + enum: + - CycloneDX + - SPDX + example: CycloneDX + type: string + x-enum-varnames: + - CYCLONEDX + - SPDX SBOMMetadata: description: Provides additional information about a BOM. properties: @@ -41395,6 +41417,86 @@ components: type: $ref: '#/components/schemas/ScalarFormulaResponseType' type: object + ScannedAssetMetadata: + description: The metadata of a scanned asset. + properties: + attributes: + $ref: '#/components/schemas/ScannedAssetMetadataAttributes' + id: + description: The ID of the scanned asset metadata. + example: Host|i-0fc7edef1ab26d7ef + type: string + required: + - id + - attributes + type: object + ScannedAssetMetadataAsset: + description: The asset of a scanned asset metadata. + properties: + name: + description: The name of the asset. + example: i-0fc7edef1ab26d7ef + type: string + type: + $ref: '#/components/schemas/CloudAssetType' + required: + - type + - name + type: object + ScannedAssetMetadataAttributes: + description: The attributes of a scanned asset metadata. + properties: + asset: + $ref: '#/components/schemas/ScannedAssetMetadataAsset' + first_success_timestamp: + description: The timestamp when the scan of the asset was performed for + the first time. + example: '2025-07-08T07:24:53Z' + type: string + last_success: + $ref: '#/components/schemas/ScannedAssetMetadataLastSuccess' + required: + - asset + - last_success + - first_success_timestamp + type: object + ScannedAssetMetadataLastSuccess: + description: Metadata for the last successful scan of an asset. + properties: + env: + description: The environment of the last success scan of the asset. + example: prod + type: string + origin: + description: The list of origins of the last success scan of the asset. + example: + - production + items: + example: production + type: string + type: array + timestamp: + description: The timestamp of the last success scan of the asset. + example: '2025-07-08T07:24:53Z' + type: string + required: + - timestamp + type: object + ScannedAssetsMetadata: + description: The expected response schema when listing scanned assets metadata. + properties: + data: + description: List of scanned assets metadata. + items: + $ref: '#/components/schemas/ScannedAssetMetadata' + type: array + links: + $ref: '#/components/schemas/Links' + meta: + $ref: '#/components/schemas/Metadata' + required: + - data + type: object Schedule: description: Top-level container for a schedule object, including both the `data` payload and any related `included` resources (such as teams, layers, or members). @@ -51590,9 +51692,29 @@ components: - attributes - relationships type: object + VulnerabilityAdvisory: + description: Advisory associated with the vulnerability. + properties: + id: + description: Vulnerability advisory ID. + example: TRIVY-CVE-2023-0615 + type: string + last_modification_date: + description: Vulnerability advisory last modification date. + example: 2024-09-19 21:23:08+00:00 + type: string + publish_date: + description: Vulnerability advisory publish date. + example: 2024-09-19 21:23:08+00:00 + type: string + required: + - id + type: object VulnerabilityAttributes: description: The JSON:API attributes of the vulnerability. properties: + advisory: + $ref: '#/components/schemas/VulnerabilityAdvisory' advisory_id: description: Vulnerability advisory ID. example: TRIVY-CVE-2023-0615 @@ -71238,194 +71360,6 @@ paths: x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' - /api/v2/security/assets: - get: - description: 'Get a list of vulnerable assets. - - - ### Pagination - - - Please review the [Pagination section for the "List Vulnerabilities"](#pagination) - endpoint. - - - ### Filtering - - - Please review the [Filtering section for the "List Vulnerabilities"](#filtering) - endpoint. - - - ### Metadata - - - Please review the [Metadata section for the "List Vulnerabilities"](#metadata) - endpoint.' - operationId: ListVulnerableAssets - 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 or greater - than `1` - example: 1 - in: query - name: page[number] - required: false - schema: - format: int64 - minimum: 1 - type: integer - - description: Filter by name. - example: datadog-agent - in: query - name: filter[name] - required: false - schema: - type: string - - description: Filter by type. - example: Host - in: query - name: filter[type] - required: false - schema: - $ref: '#/components/schemas/AssetType' - - description: Filter by the first version of the asset since it has been vulnerable. - example: v1.15.1 - in: query - name: filter[version.first] - required: false - schema: - type: string - - description: Filter by the last detected version of the asset. - example: v1.15.1 - in: query - name: filter[version.last] - required: false - schema: - type: string - - description: Filter by the repository url associated to the asset. - example: github.com/DataDog/datadog-agent.git - in: query - name: filter[repository_url] - required: false - schema: - type: string - - description: Filter whether the asset is in production or not. - example: false - in: query - name: filter[risks.in_production] - required: false - schema: - type: boolean - - description: Filter whether the asset (Service) is under attack or not. - example: false - in: query - name: filter[risks.under_attack] - required: false - schema: - type: boolean - - description: Filter whether the asset (Host) is publicly accessible or not. - example: false - in: query - name: filter[risks.is_publicly_accessible] - required: false - schema: - type: boolean - - description: Filter whether the asset (Host) has privileged access or not. - example: false - in: query - name: filter[risks.has_privileged_access] - required: false - schema: - type: boolean - - description: Filter whether the asset (Host) has access to sensitive data - or not. - example: false - in: query - name: filter[risks.has_access_to_sensitive_data] - required: false - schema: - type: boolean - - description: Filter by environment. - example: staging - in: query - name: filter[environments] - 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 - name: filter[arch] - required: false - schema: - type: string - - description: Filter by operating system name. - example: ubuntu - in: query - name: filter[operating_system.name] - required: false - schema: - type: string - - description: Filter by operating system version. - example: '24.04' - in: query - name: filter[operating_system.version] - required: false - schema: - type: string - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/ListVulnerableAssetsResponse' - 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: There is no request associated with the provided - token.' - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - security: - - apiKeyAuth: [] - appKeyAuth: [] - summary: List vulnerable assets - 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/cloud_workload/policy/download: get: description: 'The download endpoint generates a Workload Protection policy file @@ -71610,6 +71544,13 @@ paths: required: false schema: type: string + - description: The standard of the SBOM. + example: CycloneDX + in: query + name: ext:format + required: false + schema: + $ref: '#/components/schemas/SBOMFormat' responses: '200': content: @@ -71647,6 +71588,120 @@ paths: 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/scanned-assets-metadata: + get: + description: "Get a list of security scanned assets metadata for an organization.\n\n### + Pagination\n\nFor the \"List Vulnerabilities\" endpoint, see the [Pagination + section](#pagination).\n\n### Filtering\n\nFor the \"List Vulnerabilities\" + endpoint, see the [Filtering section](#filtering).\n\n### Metadata\n\n For + the \"List Vulnerabilities\" endpoint, see the [Metadata section](#metadata).\n\n### + Related endpoints\n\nThis endpoint returns additional metadata for cloud resources + that is not available from the standard resource endpoints. To access a richer + dataset, call this endpoint together with the relevant resource endpoint(s) + and merge (join) their results using the resource identifier.\n\n**Hosts**\n\nTo + 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:\n\n| ENDPOINT | JOIN KEY | TYPE |\n| --- | --- | --- + |\n| [/api/v1/hosts](https://docs.datadoghq.com/api/latest/hosts/) | host_list.host_name + | string |\n| /api/v2/security/scanned-assets-metadata | data.attributes.asset.name + | string |\n\n**Host Images**\n\nTo 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:\n\n| ENDPOINT | JOIN KEY | TYPE |\n| --- | --- | --- |\n| [/api/v1/hosts](https://docs.datadoghq.com/api/latest/hosts/) + | host_list.tags_by_source[\"Amazon Web Services\"][\"image\"] | string |\n| + /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string + |\n\n**Container Images**\n\nTo 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:\n\n| ENDPOINT | JOIN KEY | TYPE |\n| --- | --- | --- + |\n| [/api/v2/container_images](https://docs.datadoghq.com/api/latest/container-images/) + | `data.attributes.name`@`data.attributes.repo_digest` | string |\n| /api/v2/security/scanned-assets-metadata + | data.attributes.asset.name | string |" + operationId: ListScannedAssetsMetadata + 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 scanned asset. + example: Host + in: query + name: filter[asset.type] + required: false + schema: + $ref: '#/components/schemas/CloudAssetType' + - description: The name of the scanned asset. + example: i-0fc7edef1ab26d7ef + in: query + name: filter[asset.name] + required: false + schema: + type: string + - description: The origin of last success scan. + example: agent + in: query + name: filter[last_success.origin] + required: false + schema: + type: string + - description: The environment of last success scan. + example: prod + in: query + name: filter[last_success.env] + required: false + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ScannedAssetsMetadata' + 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: [] + summary: List scanned assets metadata + 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/signals/notification_rules: get: description: Returns the list of notification rules for security signals. @@ -71837,27 +71892,34 @@ paths: consider a request to be the first request when there is no `page[token]` parameter.\n\nThe response of this first request contains the newly created token in the `links` section.\n\nThis token can then be used in the subsequent - paginated requests.\n\n#### Subsequent requests\n\nAny request containing + paginated requests.\n\n*Note: The first request may take longer to complete + than subsequent requests.*\n\n#### Subsequent requests\n\nAny request containing valid `page[token]` and `page[number]` parameters will be considered a subsequent request.\n\nIf the `token` is invalid, a `404` response will be returned.\n\nIf - the page `number` is invalid, a `400` response will be returned.\n\n### Filtering\n\nThe - 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.\n\nAll filters can include multiple values, where data - will be filtered with an OR clause: `filter[title]=Title1,Title2` will filter - all vulnerabilities where title is equal to `Title1` OR `Title2`.\n\nString - filters are case sensitive.\n\nBoolean filters accept `true` or `false` as - values.\n\nNumber filters must include an operator as a second filter input: - `filter[$prop_name][$operator]`. For example, for the vulnerabilities endpoint: - `filter[cvss.base.score][lte]=8`.\n\nAvailable operators are: `eq` (==), `lt` - (<), `lte` (<=), `gt` (>) and `gte` (>=).\n\n### Metadata\n\nFollowing [JSON:API - format](https://jsonapi.org/format/#document-meta), object including non-standard - meta-information.\n\nThis endpoint includes the meta member in the response. - For more details on each of the properties included in this section, check - the endpoints response tables.\n\n```JSON\n{\n \"data\": [...],\n \"meta\": - {\n \"total\": 1500,\n \"count\": 18732,\n \"token\": \"some_token\"\n - \ },\n \"links\": {...}\n}\n```" + the page `number` is invalid, a `400` response will be returned.\n\nThe returned + `token` is valid for all requests in the pagination sequence. To send paginated + requests in parallel, reuse the same `token` and change only the `page[number]` + parameter.\n\n### Filtering\n\nThe 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.\n\nAll + filters can include multiple values, where data will be filtered with an OR + clause: `filter[title]=Title1,Title2` will filter all vulnerabilities where + title is equal to `Title1` OR `Title2`.\n\nString filters are case sensitive.\n\nBoolean + filters accept `true` or `false` as values.\n\nNumber filters must include + an operator as a second filter input: `filter[$prop_name][$operator]`. For + example, for the vulnerabilities endpoint: `filter[cvss.base.score][lte]=8`.\n\nAvailable + operators are: `eq` (==), `lt` (<), `lte` (<=), `gt` (>) and `gte` (>=).\n\n### + Metadata\n\nFollowing [JSON:API format](https://jsonapi.org/format/#document-meta), + object including non-standard meta-information.\n\nThis endpoint includes + the meta member in the response. For more details on each of the properties + included in this section, check the endpoints response tables.\n\n```JSON\n{\n + \ \"data\": [...],\n \"meta\": {\n \"total\": 1500,\n \"count\": 18732,\n + \ \"token\": \"some_token\"\n },\n \"links\": {...}\n}\n```\n### Extensions\n\nRequests + may include extensions to modify the behavior of the requested endpoint. The + filter parameters follow the [JSON:API format](https://jsonapi.org/extensions/#extensions) + format: `ext:$extension_name`, where `extension_name` is the name of the modifier + that is being applied.\n\nExtensions can only include one value: `ext:modifier=value`." operationId: ListVulnerabilities parameters: - description: Its value must come from the `links` section of the response @@ -71963,9 +72025,9 @@ paths: schema: type: string - description: Filter by advisory ID. - example: TRIVY-CVE-2023-0615 + example: CVE-2023-0615 in: query - name: filter[advisory_id] + name: filter[advisory.id] required: false schema: type: string @@ -72065,7 +72127,8 @@ paths: required: false schema: type: string - - description: Filter by asset name. + - description: Filter by asset name. This field supports the usage of wildcards + (*). example: datadog-agent in: query name: filter[asset.name] @@ -72380,6 +72443,194 @@ paths: operator: OR permissions: - security_monitoring_notification_profiles_write + /api/v2/security/vulnerable-assets: + get: + description: 'Get a list of vulnerable assets. + + + ### Pagination + + + Please review the [Pagination section for the "List Vulnerabilities"](#pagination) + endpoint. + + + ### Filtering + + + Please review the [Filtering section for the "List Vulnerabilities"](#filtering) + endpoint. + + + ### Metadata + + + Please review the [Metadata section for the "List Vulnerabilities"](#metadata) + endpoint.' + operationId: ListVulnerableAssets + 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 or greater + than `1` + example: 1 + in: query + name: page[number] + required: false + schema: + format: int64 + minimum: 1 + type: integer + - description: Filter by name. This field supports the usage of wildcards (*). + example: datadog-agent + in: query + name: filter[name] + required: false + schema: + type: string + - description: Filter by type. + example: Host + in: query + name: filter[type] + required: false + schema: + $ref: '#/components/schemas/AssetType' + - description: Filter by the first version of the asset since it has been vulnerable. + example: v1.15.1 + in: query + name: filter[version.first] + required: false + schema: + type: string + - description: Filter by the last detected version of the asset. + example: v1.15.1 + in: query + name: filter[version.last] + required: false + schema: + type: string + - description: Filter by the repository url associated to the asset. + example: github.com/DataDog/datadog-agent.git + in: query + name: filter[repository_url] + required: false + schema: + type: string + - description: Filter whether the asset is in production or not. + example: false + in: query + name: filter[risks.in_production] + required: false + schema: + type: boolean + - description: Filter whether the asset (Service) is under attack or not. + example: false + in: query + name: filter[risks.under_attack] + required: false + schema: + type: boolean + - description: Filter whether the asset (Host) is publicly accessible or not. + example: false + in: query + name: filter[risks.is_publicly_accessible] + required: false + schema: + type: boolean + - description: Filter whether the asset (Host) has privileged access or not. + example: false + in: query + name: filter[risks.has_privileged_access] + required: false + schema: + type: boolean + - description: Filter whether the asset (Host) has access to sensitive data + or not. + example: false + in: query + name: filter[risks.has_access_to_sensitive_data] + required: false + schema: + type: boolean + - description: Filter by environment. + example: staging + in: query + name: filter[environments] + 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 + name: filter[arch] + required: false + schema: + type: string + - description: Filter by operating system name. + example: ubuntu + in: query + name: filter[operating_system.name] + required: false + schema: + type: string + - description: Filter by operating system version. + example: '24.04' + in: query + name: filter[operating_system.version] + required: false + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListVulnerableAssetsResponse' + 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: There is no request associated with the provided + token.' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List vulnerable assets + 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_monitoring/cloud_workload_security/agent_rules: get: description: 'Get the list of agent rules. diff --git a/cassettes/features/v2/security_monitoring/List-scanned-assets-metadata-returns-Not-found-asset-not-found-response.frozen b/cassettes/features/v2/security_monitoring/List-scanned-assets-metadata-returns-Not-found-asset-not-found-response.frozen new file mode 100644 index 00000000000..69589f13912 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/List-scanned-assets-metadata-returns-Not-found-asset-not-found-response.frozen @@ -0,0 +1 @@ +2025-10-15T08:41:14.545Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/List-scanned-assets-metadata-returns-Not-found-asset-not-found-response.yml b/cassettes/features/v2/security_monitoring/List-scanned-assets-metadata-returns-Not-found-asset-not-found-response.yml new file mode 100644 index 00000000000..4c51d84cb9b --- /dev/null +++ b/cassettes/features/v2/security_monitoring/List-scanned-assets-metadata-returns-Not-found-asset-not-found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Wed, 15 Oct 2025 08:41:14 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/security/scanned-assets-metadata?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-scanned-assets-metadata-returns-OK-response.frozen b/cassettes/features/v2/security_monitoring/List-scanned-assets-metadata-returns-OK-response.frozen new file mode 100644 index 00000000000..98659e71883 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/List-scanned-assets-metadata-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-10-15T08:42:14.735Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/List-scanned-assets-metadata-returns-OK-response.yml b/cassettes/features/v2/security_monitoring/List-scanned-assets-metadata-returns-OK-response.yml new file mode 100644 index 00000000000..518c7be14e3 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/List-scanned-assets-metadata-returns-OK-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Wed, 15 Oct 2025 08:42:14 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/security/scanned-assets-metadata + 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/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.frozen b/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.frozen index 7b1371734cd..f78ea7dd7b7 100644 --- a/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.frozen +++ b/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.frozen @@ -1 +1 @@ -2025-01-31T12:04:52.159Z \ No newline at end of file +2025-10-14T13:43:32.350Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.yml b/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.yml index dc21126b6fb..dd980d3aba8 100644 --- a/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.yml +++ b/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-Not-found-There-is-no-request-associated-with-the-provided-token-response.yml @@ -1,17 +1,16 @@ http_interactions: -- recorded_at: Fri, 31 Jan 2025 12:04:52 GMT +- recorded_at: Tue, 14 Oct 2025 13:43:32 GMT request: body: null headers: Accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v2/security/assets?page%5Btoken%5D=unknown&page%5Bnumber%5D=1 + uri: https://api.datadoghq.com/api/v2/security/vulnerable-assets?page%5Btoken%5D=unknown&page%5Bnumber%5D=1 response: body: encoding: UTF-8 - string: '{"errors":[{"title":"Generic Error","detail":"rpc error: code = Internal - desc = no cached result set found for queryID: unknown"}]}' + string: '{"errors":[{"status":"404","title":"Unexpected internal error"}]}' headers: Content-Type: - application/vnd.api+json diff --git a/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-OK-response.frozen b/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-OK-response.frozen index 2131f54a8a2..ecb5cae4f92 100644 --- a/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-OK-response.frozen +++ b/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-OK-response.frozen @@ -1 +1 @@ -2025-01-31T12:05:04.773Z \ No newline at end of file +2025-10-14T13:43:52.800Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-OK-response.yml b/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-OK-response.yml index 0bc3584a463..2f7d4afe2c5 100644 --- a/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-OK-response.yml +++ b/cassettes/features/v2/security_monitoring/List-vulnerable-assets-returns-OK-response.yml @@ -1,12 +1,12 @@ http_interactions: -- recorded_at: Fri, 31 Jan 2025 12:05:04 GMT +- recorded_at: Tue, 14 Oct 2025 13:43:52 GMT request: body: null headers: Accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v2/security/assets?filter%5Btype%5D=Host&filter%5Brepository_url%5D=github.com%2Fdatadog%2Fdd-go&filter%5Brisks.in_production%5D=true + uri: https://api.datadoghq.com/api/v2/security/vulnerable-assets?filter%5Btype%5D=Host&filter%5Brepository_url%5D=github.com%2Fdatadog%2Fdd-go&filter%5Brisks.in_production%5D=true response: body: encoding: UTF-8 diff --git a/examples/v2/security-monitoring/ListScannedAssetsMetadata.rb b/examples/v2/security-monitoring/ListScannedAssetsMetadata.rb new file mode 100644 index 00000000000..44f09467fe5 --- /dev/null +++ b/examples/v2/security-monitoring/ListScannedAssetsMetadata.rb @@ -0,0 +1,8 @@ +# List scanned assets metadata returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_scanned_assets_metadata".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new +p api_instance.list_scanned_assets_metadata() diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 5866757e87b..b48e5d9630f 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1296,25 +1296,6 @@ "finding_id" => "String", "snapshot_timestamp" => "Integer", }, - "v2.ListVulnerableAssets" => { - "page_token" => "String", - "page_number" => "Integer", - "filter_name" => "String", - "filter_type" => "AssetType", - "filter_version_first" => "String", - "filter_version_last" => "String", - "filter_repository_url" => "String", - "filter_risks_in_production" => "Boolean", - "filter_risks_under_attack" => "Boolean", - "filter_risks_is_publicly_accessible" => "Boolean", - "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", @@ -1329,6 +1310,15 @@ "asset_type" => "AssetType", "filter_asset_name" => "String", "filter_repo_digest" => "String", + "ext_format" => "SBOMFormat", + }, + "v2.ListScannedAssetsMetadata" => { + "page_token" => "String", + "page_number" => "Integer", + "filter_asset_type" => "CloudAssetType", + "filter_asset_name" => "String", + "filter_last_success_origin" => "String", + "filter_last_success_env" => "String", }, "v2.CreateSignalNotificationRule" => { "body" => "CreateNotificationRuleParameters", @@ -1400,6 +1390,25 @@ "id" => "String", "body" => "PatchNotificationRuleParameters", }, + "v2.ListVulnerableAssets" => { + "page_token" => "String", + "page_number" => "Integer", + "filter_name" => "String", + "filter_type" => "AssetType", + "filter_version_first" => "String", + "filter_version_last" => "String", + "filter_repository_url" => "String", + "filter_risks_in_production" => "Boolean", + "filter_risks_under_attack" => "Boolean", + "filter_risks_is_publicly_accessible" => "Boolean", + "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.CreateSecurityFilter" => { "body" => "SecurityFilterCreateRequest", }, diff --git a/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index c83348e6898..8e5e22baade 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/security_monitoring.feature @@ -1065,6 +1065,29 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @skip @team:DataDog/asm-vm + Scenario: List scanned assets metadata returns "Bad request: The server cannot process the request due to invalid syntax in the request." response + Given operation "ListScannedAssetsMetadata" enabled + And new "ListScannedAssetsMetadata" 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 scanned assets metadata returns "Not found: asset not found" response + Given operation "ListScannedAssetsMetadata" enabled + And new "ListScannedAssetsMetadata" 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: asset not found + + @team:DataDog/asm-vm + Scenario: List scanned assets metadata returns "OK" response + Given operation "ListScannedAssetsMetadata" enabled + And new "ListScannedAssetsMetadata" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/asm-vm Scenario: List vulnerabilities returns "Bad request: The server cannot process the request due to invalid syntax in the request." response Given operation "ListVulnerabilities" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index 76bc60f80eb..6e05ad8acd5 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -3223,12 +3223,6 @@ "type": "idempotent" } }, - "ListVulnerableAssets": { - "tag": "Security Monitoring", - "undo": { - "type": "safe" - } - }, "DownloadCloudWorkloadPolicyFile": { "tag": "CSM Threats", "undo": { @@ -3247,6 +3241,12 @@ "type": "safe" } }, + "ListScannedAssetsMetadata": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "GetSignalNotificationRules": { "tag": "Security Monitoring", "undo": { @@ -3327,6 +3327,12 @@ "type": "idempotent" } }, + "ListVulnerableAssets": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "ListCloudWorkloadSecurityAgentRules": { "tag": "CSM Threats", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index f6cb0bb0f1a..e61054d98dc 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -206,6 +206,7 @@ def initialize "v2.list_assets_sbo_ms": false, "v2.list_findings": false, "v2.list_historical_jobs": false, + "v2.list_scanned_assets_metadata": false, "v2.list_security_monitoring_histsignals": false, "v2.list_vulnerabilities": false, "v2.list_vulnerable_assets": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index bc911b531de..be4b3067476 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1439,6 +1439,7 @@ def overrides "v2.clickup_integration" => "ClickupIntegration", "v2.clickup_integration_type" => "ClickupIntegrationType", "v2.clickup_integration_update" => "ClickupIntegrationUpdate", + "v2.cloud_asset_type" => "CloudAssetType", "v2.cloud_configuration_compliance_rule_options" => "CloudConfigurationComplianceRuleOptions", "v2.cloud_configuration_rego_rule" => "CloudConfigurationRegoRule", "v2.cloud_configuration_rule_case_create" => "CloudConfigurationRuleCaseCreate", @@ -3512,6 +3513,7 @@ def overrides "v2.sbom_component_property" => "SBOMComponentProperty", "v2.sbom_component_supplier" => "SBOMComponentSupplier", "v2.sbom_component_type" => "SBOMComponentType", + "v2.sbom_format" => "SBOMFormat", "v2.sbom_metadata" => "SBOMMetadata", "v2.sbom_metadata_author" => "SBOMMetadataAuthor", "v2.sbom_metadata_component" => "SBOMMetadataComponent", @@ -3529,6 +3531,11 @@ def overrides "v2.scalar_meta" => "ScalarMeta", "v2.scalar_query" => "ScalarQuery", "v2.scalar_response" => "ScalarResponse", + "v2.scanned_asset_metadata" => "ScannedAssetMetadata", + "v2.scanned_asset_metadata_asset" => "ScannedAssetMetadataAsset", + "v2.scanned_asset_metadata_attributes" => "ScannedAssetMetadataAttributes", + "v2.scanned_asset_metadata_last_success" => "ScannedAssetMetadataLastSuccess", + "v2.scanned_assets_metadata" => "ScannedAssetsMetadata", "v2.schedule" => "Schedule", "v2.schedule_create_request" => "ScheduleCreateRequest", "v2.schedule_create_request_data" => "ScheduleCreateRequestData", @@ -4172,6 +4179,7 @@ def overrides "v2.virus_total_integration_update" => "VirusTotalIntegrationUpdate", "v2.vulnerabilities_type" => "VulnerabilitiesType", "v2.vulnerability" => "Vulnerability", + "v2.vulnerability_advisory" => "VulnerabilityAdvisory", "v2.vulnerability_attributes" => "VulnerabilityAttributes", "v2.vulnerability_cvss" => "VulnerabilityCvss", "v2.vulnerability_dependency_locations" => "VulnerabilityDependencyLocations", 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 1a3d828a5fe..66dc6a35854 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -1762,6 +1762,7 @@ def get_sbom(asset_type, filter_asset_name, opts = {}) # @param filter_asset_name [String] The name of the asset for the SBOM request. # @param opts [Hash] the optional parameters # @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. + # @option opts [SBOMFormat] :ext_format The standard of the SBOM. # @return [Array<(GetSBOMResponse, Integer, Hash)>] GetSBOMResponse data, response status code and response headers def get_sbom_with_http_info(asset_type, filter_asset_name, opts = {}) unstable_enabled = @api_client.config.unstable_operations["v2.get_sbom".to_sym] @@ -1787,6 +1788,10 @@ def get_sbom_with_http_info(asset_type, filter_asset_name, opts = {}) if @api_client.config.client_side_validation && filter_asset_name.nil? fail ArgumentError, "Missing the required parameter 'filter_asset_name' when calling SecurityMonitoringAPI.get_sbom" end + allowable_values = ['CycloneDX', 'SPDX'] + if @api_client.config.client_side_validation && opts[:'ext_format'] && !allowable_values.include?(opts[:'ext_format']) + fail ArgumentError, "invalid value for \"ext_format\", must be one of #{allowable_values}" + end # resource path local_var_path = '/api/v2/security/sboms/{asset_type}'.sub('{asset_type}', CGI.escape(asset_type.to_s).gsub('%2F', '/')) @@ -1794,6 +1799,7 @@ def get_sbom_with_http_info(asset_type, filter_asset_name, opts = {}) query_params = opts[:query_params] || {} query_params[:'filter[asset_name]'] = filter_asset_name query_params[:'filter[repo_digest]'] = opts[:'filter_repo_digest'] if !opts[:'filter_repo_digest'].nil? + query_params[:'ext:format'] = opts[:'ext_format'] if !opts[:'ext_format'].nil? # header parameters header_params = opts[:header_params] || {} @@ -2993,6 +2999,134 @@ def list_historical_jobs_with_http_info(opts = {}) return data, status_code, headers end + # List scanned assets metadata. + # + # @see #list_scanned_assets_metadata_with_http_info + def list_scanned_assets_metadata(opts = {}) + data, _status_code, _headers = list_scanned_assets_metadata_with_http_info(opts) + data + end + + # List scanned assets metadata. + # + # Get a list of security scanned assets metadata for an organization. + # + # ### Pagination + # + # For the "List Vulnerabilities" endpoint, see the [Pagination section](#pagination). + # + # ### Filtering + # + # For the "List Vulnerabilities" endpoint, see the [Filtering section](#filtering). + # + # ### Metadata + # + # For the "List Vulnerabilities" endpoint, see the [Metadata section](#metadata). + # + # ### Related endpoints + # + # This endpoint returns additional metadata for cloud resources that is not available from the standard resource endpoints. To access a richer dataset, call this endpoint together with the relevant resource endpoint(s) and merge (join) their results using the resource identifier. + # + # **Hosts** + # + # 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: + # + # | ENDPOINT | JOIN KEY | TYPE | + # | --- | --- | --- | + # | [/api/v1/hosts](https://docs.datadoghq.com/api/latest/hosts/) | host_list.host_name | string | + # | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | + # + # **Host Images** + # + # 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: + # + # | ENDPOINT | JOIN KEY | TYPE | + # | --- | --- | --- | + # | [/api/v1/hosts](https://docs.datadoghq.com/api/latest/hosts/) | host_list.tags_by_source["Amazon Web Services"]["image"] | string | + # | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | + # + # **Container Images** + # + # 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: + # + # | ENDPOINT | JOIN KEY | TYPE | + # | --- | --- | --- | + # | [/api/v2/container_images](https://docs.datadoghq.com/api/latest/container-images/) | `data.attributes.name`@`data.attributes.repo_digest` | string | + # | /api/v2/security/scanned-assets-metadata | data.attributes.asset.name | string | + # + # @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 [CloudAssetType] :filter_asset_type The type of the scanned asset. + # @option opts [String] :filter_asset_name The name of the scanned asset. + # @option opts [String] :filter_last_success_origin The origin of last success scan. + # @option opts [String] :filter_last_success_env The environment of last success scan. + # @return [Array<(ScannedAssetsMetadata, Integer, Hash)>] ScannedAssetsMetadata data, response status code and response headers + def list_scanned_assets_metadata_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_scanned_assets_metadata".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_scanned_assets_metadata") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_scanned_assets_metadata")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.list_scanned_assets_metadata ...' + 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_scanned_assets_metadata, must be greater than or equal to 1.' + end + allowable_values = ['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 + # resource path + local_var_path = '/api/v2/security/scanned-assets-metadata' + + # 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[last_success.origin]'] = opts[:'filter_last_success_origin'] if !opts[:'filter_last_success_origin'].nil? + query_params[:'filter[last_success.env]'] = opts[:'filter_last_success_env'] if !opts[:'filter_last_success_env'].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] || 'ScannedAssetsMetadata' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_scanned_assets_metadata, + :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_scanned_assets_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get all security filters. # # @see #list_security_filters_with_http_info @@ -3417,6 +3551,8 @@ def list_vulnerabilities(opts = {}) # # This token can then be used in the subsequent paginated requests. # + # *Note: The first request may take longer to complete than subsequent requests.* + # # #### Subsequent requests # # Any request containing valid `page[token]` and `page[number]` parameters will be considered a subsequent request. @@ -3425,6 +3561,8 @@ def list_vulnerabilities(opts = {}) # # If the page `number` is invalid, a `400` response will be returned. # + # The returned `token` is valid for all requests in the pagination sequence. To send paginated requests in parallel, reuse the same `token` and change only the `page[number]` parameter. + # # ### Filtering # # 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 = {}) # "links": {...} # } # ``` + # ### Extensions + # + # Requests may include extensions to modify the behavior of the requested endpoint. The filter parameters follow the [JSON:API format](https://jsonapi.org/extensions/#extensions) format: `ext:$extension_name`, where `extension_name` is the name of the modifier that is being applied. + # + # Extensions can only include one value: `ext:modifier=value`. # # @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. @@ -3485,7 +3628,7 @@ def list_vulnerabilities(opts = {}) # @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 [String] :filter_asset_name Filter by asset name. This field supports the usage of wildcards (*). # @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. # @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 = {}) query_params[:'filter[tool]'] = opts[:'filter_tool'] if !opts[:'filter_tool'].nil? query_params[:'filter[library.name]'] = opts[:'filter_library_name'] if !opts[:'filter_library_name'].nil? query_params[:'filter[library.version]'] = opts[:'filter_library_version'] if !opts[:'filter_library_version'].nil? - query_params[:'filter[advisory_id]'] = opts[:'filter_advisory_id'] if !opts[:'filter_advisory_id'].nil? + query_params[:'filter[advisory.id]'] = opts[:'filter_advisory_id'] if !opts[:'filter_advisory_id'].nil? query_params[:'filter[risks.exploitation_probability]'] = opts[:'filter_risks_exploitation_probability'] if !opts[:'filter_risks_exploitation_probability'].nil? query_params[:'filter[risks.poc_exploit_available]'] = opts[:'filter_risks_poc_exploit_available'] if !opts[:'filter_risks_poc_exploit_available'].nil? 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 = {}) # @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 or greater than `1` - # @option opts [String] :filter_name Filter by name. + # @option opts [String] :filter_name Filter by name. This field supports the usage of wildcards (*). # @option opts [AssetType] :filter_type Filter by type. # @option opts [String] :filter_version_first Filter by the first version of the asset since it has been vulnerable. # @option opts [String] :filter_version_last Filter by the last detected version of the asset. @@ -3710,7 +3853,7 @@ def list_vulnerable_assets_with_http_info(opts = {}) fail ArgumentError, "invalid value for \"filter_type\", must be one of #{allowable_values}" end # resource path - local_var_path = '/api/v2/security/assets' + local_var_path = '/api/v2/security/vulnerable-assets' # query parameters query_params = opts[:query_params] || {} diff --git a/lib/datadog_api_client/v2/models/cloud_asset_type.rb b/lib/datadog_api_client/v2/models/cloud_asset_type.rb new file mode 100644 index 00000000000..8b35d8d9383 --- /dev/null +++ b/lib/datadog_api_client/v2/models/cloud_asset_type.rb @@ -0,0 +1,28 @@ +=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 cloud asset type + class CloudAssetType + include BaseEnumModel + + HOST = "Host".freeze + HOST_IMAGE = "HostImage".freeze + IMAGE = "Image".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/sbom_format.rb b/lib/datadog_api_client/v2/models/sbom_format.rb new file mode 100644 index 00000000000..f42e74f16e1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/sbom_format.rb @@ -0,0 +1,27 @@ +=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 standard + class SBOMFormat + include BaseEnumModel + + CYCLONEDX = "CycloneDX".freeze + SPDX = "SPDX".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/scanned_asset_metadata.rb b/lib/datadog_api_client/v2/models/scanned_asset_metadata.rb new file mode 100644 index 00000000000..b492387cdd2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/scanned_asset_metadata.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 metadata of a scanned asset. + class ScannedAssetMetadata + include BaseGenericModel + + # The attributes of a scanned asset metadata. + attr_reader :attributes + + # The ID of the scanned asset metadata. + attr_reader :id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ScannedAssetMetadataAttributes', + :'id' => :'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::ScannedAssetMetadata` 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?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + 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 @attributes.nil? + return false if @id.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + 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 && + attributes == o.attributes && + id == o.id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/scanned_asset_metadata_asset.rb b/lib/datadog_api_client/v2/models/scanned_asset_metadata_asset.rb new file mode 100644 index 00000000000..6ee605851f9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/scanned_asset_metadata_asset.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 asset of a scanned asset metadata. + class ScannedAssetMetadataAsset + include BaseGenericModel + + # The name of the asset. + attr_reader :name + + # The cloud asset type + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'type' => :'CloudAssetType' + } + 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::ScannedAssetMetadataAsset` 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?(:'type') + self.type = attributes[:'type'] + 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 @type.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 type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + 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 && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/scanned_asset_metadata_attributes.rb b/lib/datadog_api_client/v2/models/scanned_asset_metadata_attributes.rb new file mode 100644 index 00000000000..05537a23c49 --- /dev/null +++ b/lib/datadog_api_client/v2/models/scanned_asset_metadata_attributes.rb @@ -0,0 +1,165 @@ +=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 attributes of a scanned asset metadata. + class ScannedAssetMetadataAttributes + include BaseGenericModel + + # The asset of a scanned asset metadata. + attr_reader :asset + + # The timestamp when the scan of the asset was performed for the first time. + attr_reader :first_success_timestamp + + # Metadata for the last successful scan of an asset. + attr_reader :last_success + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'asset' => :'asset', + :'first_success_timestamp' => :'first_success_timestamp', + :'last_success' => :'last_success' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'asset' => :'ScannedAssetMetadataAsset', + :'first_success_timestamp' => :'String', + :'last_success' => :'ScannedAssetMetadataLastSuccess' + } + 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::ScannedAssetMetadataAttributes` 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?(:'asset') + self.asset = attributes[:'asset'] + end + + if attributes.key?(:'first_success_timestamp') + self.first_success_timestamp = attributes[:'first_success_timestamp'] + end + + if attributes.key?(:'last_success') + self.last_success = attributes[:'last_success'] + 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 @asset.nil? + return false if @first_success_timestamp.nil? + return false if @last_success.nil? + true + end + + # Custom attribute writer method with validation + # @param asset [Object] Object to be assigned + # @!visibility private + def asset=(asset) + if asset.nil? + fail ArgumentError, 'invalid value for "asset", asset cannot be nil.' + end + @asset = asset + end + + # Custom attribute writer method with validation + # @param first_success_timestamp [Object] Object to be assigned + # @!visibility private + def first_success_timestamp=(first_success_timestamp) + if first_success_timestamp.nil? + fail ArgumentError, 'invalid value for "first_success_timestamp", first_success_timestamp cannot be nil.' + end + @first_success_timestamp = first_success_timestamp + end + + # Custom attribute writer method with validation + # @param last_success [Object] Object to be assigned + # @!visibility private + def last_success=(last_success) + if last_success.nil? + fail ArgumentError, 'invalid value for "last_success", last_success cannot be nil.' + end + @last_success = last_success + 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 && + asset == o.asset && + first_success_timestamp == o.first_success_timestamp && + last_success == o.last_success && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [asset, first_success_timestamp, last_success, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/scanned_asset_metadata_last_success.rb b/lib/datadog_api_client/v2/models/scanned_asset_metadata_last_success.rb new file mode 100644 index 00000000000..0527609629a --- /dev/null +++ b/lib/datadog_api_client/v2/models/scanned_asset_metadata_last_success.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 + # Metadata for the last successful scan of an asset. + class ScannedAssetMetadataLastSuccess + include BaseGenericModel + + # The environment of the last success scan of the asset. + attr_accessor :env + + # The list of origins of the last success scan of the asset. + attr_accessor :origin + + # The timestamp of the last success scan of the asset. + attr_reader :timestamp + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'env' => :'env', + :'origin' => :'origin', + :'timestamp' => :'timestamp' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'env' => :'String', + :'origin' => :'Array', + :'timestamp' => :'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::ScannedAssetMetadataLastSuccess` 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?(:'env') + self.env = attributes[:'env'] + end + + if attributes.key?(:'origin') + if (value = attributes[:'origin']).is_a?(Array) + self.origin = value + end + end + + if attributes.key?(:'timestamp') + self.timestamp = attributes[:'timestamp'] + 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 @timestamp.nil? + true + end + + # Custom attribute writer method with validation + # @param timestamp [Object] Object to be assigned + # @!visibility private + def timestamp=(timestamp) + if timestamp.nil? + fail ArgumentError, 'invalid value for "timestamp", timestamp cannot be nil.' + end + @timestamp = timestamp + 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 && + env == o.env && + origin == o.origin && + timestamp == o.timestamp && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [env, origin, timestamp, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/scanned_assets_metadata.rb b/lib/datadog_api_client/v2/models/scanned_assets_metadata.rb new file mode 100644 index 00000000000..46efaa73044 --- /dev/null +++ b/lib/datadog_api_client/v2/models/scanned_assets_metadata.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 scanned assets metadata. + class ScannedAssetsMetadata + include BaseGenericModel + + # List of scanned assets metadata. + 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::ScannedAssetsMetadata` 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/vulnerability_advisory.rb b/lib/datadog_api_client/v2/models/vulnerability_advisory.rb new file mode 100644 index 00000000000..cae62f05181 --- /dev/null +++ b/lib/datadog_api_client/v2/models/vulnerability_advisory.rb @@ -0,0 +1,143 @@ +=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 + # Advisory associated with the vulnerability. + class VulnerabilityAdvisory + include BaseGenericModel + + # Vulnerability advisory ID. + attr_reader :id + + # Vulnerability advisory last modification date. + attr_accessor :last_modification_date + + # Vulnerability advisory publish date. + attr_accessor :publish_date + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'last_modification_date' => :'last_modification_date', + :'publish_date' => :'publish_date' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'last_modification_date' => :'String', + :'publish_date' => :'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::VulnerabilityAdvisory` 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'last_modification_date') + self.last_modification_date = attributes[:'last_modification_date'] + end + + if attributes.key?(:'publish_date') + self.publish_date = attributes[:'publish_date'] + 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 @id.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + 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 && + id == o.id && + last_modification_date == o.last_modification_date && + publish_date == o.publish_date && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, last_modification_date, publish_date, 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 d2ee0d7e014..f28cac3f68c 100644 --- a/lib/datadog_api_client/v2/models/vulnerability_attributes.rb +++ b/lib/datadog_api_client/v2/models/vulnerability_attributes.rb @@ -21,6 +21,9 @@ module DatadogAPIClient::V2 class VulnerabilityAttributes include BaseGenericModel + # Advisory associated with the vulnerability. + attr_accessor :advisory + # Vulnerability advisory ID. attr_accessor :advisory_id @@ -90,6 +93,7 @@ class VulnerabilityAttributes # @!visibility private def self.attribute_map { + :'advisory' => :'advisory', :'advisory_id' => :'advisory_id', :'code_location' => :'code_location', :'cve_list' => :'cve_list', @@ -118,6 +122,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'advisory' => :'VulnerabilityAdvisory', :'advisory_id' => :'String', :'code_location' => :'CodeLocation', :'cve_list' => :'Array', @@ -160,6 +165,10 @@ def initialize(attributes = {}) end } + if attributes.key?(:'advisory') + self.advisory = attributes[:'advisory'] + end + if attributes.key?(:'advisory_id') self.advisory_id = attributes[:'advisory_id'] end @@ -451,6 +460,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && + advisory == o.advisory && advisory_id == o.advisory_id && code_location == o.code_location && cve_list == o.cve_list && @@ -479,7 +489,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, origin, remediations, repo_digests, risks, status, title, tool, type, additional_properties].hash + [advisory, 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