From 8863caf6a51c854fe44efa5fb8aa253f026af470 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 28 Aug 2025 11:58:01 +0000 Subject: [PATCH] Regenerate client from commit 092c127 of spec repo --- .generator/schemas/v2/openapi.yaml | 25 ++++++++++- .../agentless-scanning/GetAwsScanOptions.py | 19 +++++++++ .../agentless-scanning/ListAwsScanOptions.py | 2 +- .../v2/api/agentless_scanning_api.py | 42 ++++++++++++++++++- ...ptions_returns_bad_request_response.frozen | 1 + ..._options_returns_bad_request_response.yaml | 19 +++++++++ ..._options_returns_not_found_response.frozen | 1 + ...an_options_returns_not_found_response.yaml | 19 +++++++++ ...ws_scan_options_returns_ok_response.frozen | 2 +- ..._aws_scan_options_returns_ok_response.yaml | 18 +++++++- ...ws_scan_options_returns_ok_response.frozen | 1 + ..._aws_scan_options_returns_ok_response.yaml | 18 ++++++++ tests/v2/features/agentless_scanning.feature | 26 +++++++++++- tests/v2/features/given.json | 7 ++++ tests/v2/features/undo.json | 6 +++ 15 files changed, 200 insertions(+), 6 deletions(-) create mode 100644 examples/v2/agentless-scanning/GetAwsScanOptions.py create mode 100644 tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_bad_request_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_bad_request_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_not_found_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_not_found_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_list_aws_scan_options_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_list_aws_scan_options_returns_ok_response.yaml diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 19e228a115..d40e489dc6 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -46152,7 +46152,7 @@ paths: $ref: '#/components/responses/NotAuthorizedResponse' '429': $ref: '#/components/responses/TooManyRequestsResponse' - summary: Get AWS Scan Options + summary: List AWS Scan Options tags: - Agentless Scanning post: @@ -46204,6 +46204,29 @@ paths: summary: Delete AWS Scan Options tags: - Agentless Scanning + get: + description: Fetches the Agentless scan options for an activated account. + operationId: GetAwsScanOptions + parameters: + - $ref: '#/components/parameters/AwsAccountId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AwsScanOptionsResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get AWS scan options + tags: + - Agentless Scanning patch: description: Update the Agentless scan options for an activated account. operationId: UpdateAwsScanOptions diff --git a/examples/v2/agentless-scanning/GetAwsScanOptions.py b/examples/v2/agentless-scanning/GetAwsScanOptions.py new file mode 100644 index 0000000000..a2f3d600b8 --- /dev/null +++ b/examples/v2/agentless-scanning/GetAwsScanOptions.py @@ -0,0 +1,19 @@ +""" +Get AWS scan options returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.agentless_scanning_api import AgentlessScanningApi + +# there is a valid "aws_scan_options" in the system +AWS_SCAN_OPTIONS_ID = environ["AWS_SCAN_OPTIONS_ID"] + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = AgentlessScanningApi(api_client) + response = api_instance.get_aws_scan_options( + account_id=AWS_SCAN_OPTIONS_ID, + ) + + print(response) diff --git a/examples/v2/agentless-scanning/ListAwsScanOptions.py b/examples/v2/agentless-scanning/ListAwsScanOptions.py index a489db0b10..8edd64a320 100644 --- a/examples/v2/agentless-scanning/ListAwsScanOptions.py +++ b/examples/v2/agentless-scanning/ListAwsScanOptions.py @@ -1,5 +1,5 @@ """ -Get AWS Scan Options returns "OK" response +List AWS Scan Options returns "OK" response """ from datadog_api_client import ApiClient, Configuration diff --git a/src/datadog_api_client/v2/api/agentless_scanning_api.py b/src/datadog_api_client/v2/api/agentless_scanning_api.py index 868e0d42ae..a4451541bd 100644 --- a/src/datadog_api_client/v2/api/agentless_scanning_api.py +++ b/src/datadog_api_client/v2/api/agentless_scanning_api.py @@ -116,6 +116,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_aws_scan_options_endpoint = _Endpoint( + settings={ + "response_type": (AwsScanOptionsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/agentless_scanning/accounts/aws/{account_id}", + "operation_id": "get_aws_scan_options", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "account_id": { + "required": True, + "openapi_types": (str,), + "attribute": "account_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_aws_on_demand_tasks_endpoint = _Endpoint( settings={ "response_type": (AwsOnDemandListResponse,), @@ -242,6 +265,23 @@ def get_aws_on_demand_task( return self._get_aws_on_demand_task_endpoint.call_with_http_info(**kwargs) + def get_aws_scan_options( + self, + account_id: str, + ) -> AwsScanOptionsResponse: + """Get AWS scan options. + + Fetches the Agentless scan options for an activated account. + + :param account_id: The ID of an AWS account. + :type account_id: str + :rtype: AwsScanOptionsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["account_id"] = account_id + + return self._get_aws_scan_options_endpoint.call_with_http_info(**kwargs) + def list_aws_on_demand_tasks( self, ) -> AwsOnDemandListResponse: @@ -257,7 +297,7 @@ def list_aws_on_demand_tasks( def list_aws_scan_options( self, ) -> AwsScanOptionsListResponse: - """Get AWS Scan Options. + """List AWS Scan Options. Fetches the scan options configured for AWS accounts. diff --git a/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_bad_request_response.frozen new file mode 100644 index 0000000000..28d29b1687 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-08-27T13:04:35.618Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_bad_request_response.yaml new file mode 100644 index 0000000000..afa874e91c --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_bad_request_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws/not-an-account-id + response: + body: + string: '{"errors":[{"title":"Generic Error","detail":"missing or invalid url + parameter ''accountId'', expected 12 digit format ''123456789012''"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_not_found_response.frozen new file mode 100644 index 0000000000..c80e2170c0 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_not_found_response.frozen @@ -0,0 +1 @@ +2025-08-27T01:14:07.103Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_not_found_response.yaml new file mode 100644 index 0000000000..bd58ca87a1 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_not_found_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws/404404404404 + response: + body: + string: '{"errors":[{"status":"404","detail":"no aws scan options found for + subscription 404404404404"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_ok_response.frozen index 32d16d3438..ee5eda5cdc 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_ok_response.frozen @@ -1 +1 @@ -2025-03-01T20:02:08.552Z \ No newline at end of file +2025-08-27T01:14:24.197Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_ok_response.yaml index 9ff818a687..bf8139eedb 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_get_aws_scan_options_returns_ok_response.yaml @@ -8,7 +8,23 @@ interactions: uri: https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws response: body: - string: '{"data":[{"id":"000000000002","type":"aws_scan_options","attributes":{"lambda":false,"sensitive_data":false,"vuln_containers_os":true,"vuln_host_os":true}}]}' + string: '{"data":[{"id":"000000000002","type":"aws_scan_options","attributes":{"lambda":false,"sensitive_data":false,"vuln_containers_os":true,"vuln_host_os":true}},{"id":"123456789012","type":"aws_scan_options","attributes":{"lambda":true,"sensitive_data":true,"vuln_containers_os":true,"vuln_host_os":true}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws/000000000002 + response: + body: + string: '{"data":{"id":"000000000002","type":"aws_scan_options","attributes":{"lambda":false,"sensitive_data":false,"vuln_containers_os":true,"vuln_host_os":true}}}' headers: content-type: - application/vnd.api+json diff --git a/tests/v2/cassettes/test_scenarios/test_list_aws_scan_options_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_aws_scan_options_returns_ok_response.frozen new file mode 100644 index 0000000000..da7be2c8ff --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_aws_scan_options_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-08-24T22:53:40.600Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_aws_scan_options_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_aws_scan_options_returns_ok_response.yaml new file mode 100644 index 0000000000..b4d0d1d40b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_aws_scan_options_returns_ok_response.yaml @@ -0,0 +1,18 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws + response: + body: + string: '{"data":[{"id":"000000000002","type":"aws_scan_options","attributes":{"lambda":false,"sensitive_data":false,"vuln_containers_os":true,"vuln_host_os":true}},{"id":"123456789012","type":"aws_scan_options","attributes":{"lambda":true,"sensitive_data":true,"vuln_containers_os":true,"vuln_host_os":true}}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/features/agentless_scanning.feature b/tests/v2/features/agentless_scanning.feature index e0b10496eb..f5f66c57cc 100644 --- a/tests/v2/features/agentless_scanning.feature +++ b/tests/v2/features/agentless_scanning.feature @@ -63,7 +63,31 @@ Feature: Agentless Scanning And the response "data[0].type" is equal to "aws_resource" @team:DataDog/k9-agentless - Scenario: Get AWS Scan Options returns "OK" response + Scenario: Get AWS scan options returns "Bad Request" response + Given new "GetAwsScanOptions" request + And request contains "account_id" parameter with value "not-an-account-id" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-agentless + Scenario: Get AWS scan options returns "Not Found" response + Given new "GetAwsScanOptions" request + And request contains "account_id" parameter with value "404404404404" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-agentless + Scenario: Get AWS scan options returns "OK" response + Given there is a valid "aws_scan_options" in the system + And new "GetAwsScanOptions" request + And request contains "account_id" parameter with value "{{ aws_scan_options.id }}" + When the request is sent + Then the response status is 200 OK + And the response "data.id" is equal to "{{ aws_scan_options.id }}" + And the response "data.type" is equal to "{{ aws_scan_options.type }}" + + @team:DataDog/k9-agentless + Scenario: List AWS Scan Options returns "OK" response Given new "ListAwsScanOptions" request When the request is sent Then the response status is 200 OK diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index b609709365..fbeea56787 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -11,6 +11,13 @@ "tag": "Action Connection", "operationId": "CreateActionConnection" }, + { + "source": "data[0]", + "step": "there is a valid \"aws_scan_options\" in the system", + "key": "aws_scan_options", + "tag": "Agentless Scanning", + "operationId": "ListAwsScanOptions" + }, { "parameters": [ { diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 444ec9d07d..ec94e15e11 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -79,6 +79,12 @@ "type": "idempotent" } }, + "GetAwsScanOptions": { + "tag": "Agentless Scanning", + "undo": { + "type": "safe" + } + }, "UpdateAwsScanOptions": { "tag": "Agentless Scanning", "undo": {