From cc1b100e23b8a8b28a74f82cf3d58148290224d8 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 28 Aug 2025 11:57:41 +0000 Subject: [PATCH] Regenerate client from commit 092c127 of spec repo --- .generator/schemas/v2/openapi.yaml | 25 ++++++- ...WS-Scan-Options-returns-OK-response.frozen | 1 - ...ptions-returns-Bad-Request-response.frozen | 1 + ...n-options-returns-Bad-Request-response.yml | 21 ++++++ ...-options-returns-Not-Found-response.frozen | 1 + ...can-options-returns-Not-Found-response.yml | 21 ++++++ ...WS-scan-options-returns-OK-response.frozen | 1 + ...t-AWS-scan-options-returns-OK-response.yml | 38 ++++++++++ ...WS-Scan-Options-returns-OK-response.frozen | 1 + ...-AWS-Scan-Options-returns-OK-response.yml} | 4 +- .../agentless-scanning/GetAwsScanOptions.rb | 8 +++ .../agentless-scanning/ListAwsScanOptions.rb | 2 +- features/scenarios_model_mapping.rb | 3 + features/v2/agentless_scanning.feature | 26 ++++++- features/v2/given.json | 7 ++ features/v2/undo.json | 6 ++ .../v2/api/agentless_scanning_api.rb | 69 ++++++++++++++++++- 17 files changed, 227 insertions(+), 8 deletions(-) delete mode 100644 cassettes/features/v2/agentless_scanning/Get-AWS-Scan-Options-returns-OK-response.frozen create mode 100644 cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-OK-response.frozen create mode 100644 cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-OK-response.yml create mode 100644 cassettes/features/v2/agentless_scanning/List-AWS-Scan-Options-returns-OK-response.frozen rename cassettes/features/v2/agentless_scanning/{Get-AWS-Scan-Options-returns-OK-response.yml => List-AWS-Scan-Options-returns-OK-response.yml} (67%) create mode 100644 examples/v2/agentless-scanning/GetAwsScanOptions.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 19e228a115b2..d40e489dc619 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/cassettes/features/v2/agentless_scanning/Get-AWS-Scan-Options-returns-OK-response.frozen b/cassettes/features/v2/agentless_scanning/Get-AWS-Scan-Options-returns-OK-response.frozen deleted file mode 100644 index 32d16d343888..000000000000 --- a/cassettes/features/v2/agentless_scanning/Get-AWS-Scan-Options-returns-OK-response.frozen +++ /dev/null @@ -1 +0,0 @@ -2025-03-01T20:02:08.552Z \ No newline at end of file diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Bad-Request-response.frozen b/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..28d29b168711 --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/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/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Bad-Request-response.yml b/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..c760102bbff2 --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Bad-Request-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Wed, 27 Aug 2025 13:04:35 GMT + 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: + encoding: UTF-8 + 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 +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Not-Found-response.frozen b/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..c80e2170c097 --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/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/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Not-Found-response.yml b/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Not-Found-response.yml new file mode 100644 index 000000000000..cbb843ee973d --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-Not-Found-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Wed, 27 Aug 2025 01:14:07 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws/404404404404 + response: + body: + encoding: UTF-8 + 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 +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-OK-response.frozen b/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-OK-response.frozen new file mode 100644 index 000000000000..ee5eda5cdcc7 --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-08-27T01:14:24.197Z \ No newline at end of file diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-OK-response.yml b/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-OK-response.yml new file mode 100644 index 000000000000..d12164b5cb09 --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-scan-options-returns-OK-response.yml @@ -0,0 +1,38 @@ +http_interactions: +- recorded_at: Wed, 27 Aug 2025 01:14:24 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws + response: + body: + encoding: UTF-8 + 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 +- recorded_at: Wed, 27 Aug 2025 01:14:24 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/agentless_scanning/accounts/aws/000000000002 + response: + body: + encoding: UTF-8 + 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 + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/agentless_scanning/List-AWS-Scan-Options-returns-OK-response.frozen b/cassettes/features/v2/agentless_scanning/List-AWS-Scan-Options-returns-OK-response.frozen new file mode 100644 index 000000000000..da7be2c8ff4d --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/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/cassettes/features/v2/agentless_scanning/Get-AWS-Scan-Options-returns-OK-response.yml b/cassettes/features/v2/agentless_scanning/List-AWS-Scan-Options-returns-OK-response.yml similarity index 67% rename from cassettes/features/v2/agentless_scanning/Get-AWS-Scan-Options-returns-OK-response.yml rename to cassettes/features/v2/agentless_scanning/List-AWS-Scan-Options-returns-OK-response.yml index 07468770eedd..bdca67f99206 100644 --- a/cassettes/features/v2/agentless_scanning/Get-AWS-Scan-Options-returns-OK-response.yml +++ b/cassettes/features/v2/agentless_scanning/List-AWS-Scan-Options-returns-OK-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Sat, 01 Mar 2025 20:02:08 GMT +- recorded_at: Sun, 24 Aug 2025 22:53:40 GMT request: body: null headers: @@ -10,7 +10,7 @@ http_interactions: response: body: encoding: UTF-8 - 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 diff --git a/examples/v2/agentless-scanning/GetAwsScanOptions.rb b/examples/v2/agentless-scanning/GetAwsScanOptions.rb new file mode 100644 index 000000000000..68b129675b74 --- /dev/null +++ b/examples/v2/agentless-scanning/GetAwsScanOptions.rb @@ -0,0 +1,8 @@ +# Get AWS scan options returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::AgentlessScanningAPI.new + +# there is a valid "aws_scan_options" in the system +AWS_SCAN_OPTIONS_ID = ENV["AWS_SCAN_OPTIONS_ID"] +p api_instance.get_aws_scan_options(AWS_SCAN_OPTIONS_ID) diff --git a/examples/v2/agentless-scanning/ListAwsScanOptions.rb b/examples/v2/agentless-scanning/ListAwsScanOptions.rb index 51d788ea311f..e7434ff422fa 100644 --- a/examples/v2/agentless-scanning/ListAwsScanOptions.rb +++ b/examples/v2/agentless-scanning/ListAwsScanOptions.rb @@ -1,4 +1,4 @@ -# Get AWS Scan Options returns "OK" response +# List AWS Scan Options returns "OK" response require "datadog_api_client" api_instance = DatadogAPIClient::V2::AgentlessScanningAPI.new diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index e1bd7f875de1..93b43d1c1d96 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -871,6 +871,9 @@ "v2.DeleteAwsScanOptions" => { "account_id" => "String", }, + "v2.GetAwsScanOptions" => { + "account_id" => "String", + }, "v2.UpdateAwsScanOptions" => { "account_id" => "String", "body" => "AwsScanOptionsUpdateRequest", diff --git a/features/v2/agentless_scanning.feature b/features/v2/agentless_scanning.feature index e0b10496eba5..f5f66c57cca0 100644 --- a/features/v2/agentless_scanning.feature +++ b/features/v2/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/features/v2/given.json b/features/v2/given.json index b6097093658a..fbeea567872f 100644 --- a/features/v2/given.json +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 444ec9d07dcc..ec94e15e11da 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -79,6 +79,12 @@ "type": "idempotent" } }, + "GetAwsScanOptions": { + "tag": "Agentless Scanning", + "undo": { + "type": "safe" + } + }, "UpdateAwsScanOptions": { "tag": "Agentless Scanning", "undo": { diff --git a/lib/datadog_api_client/v2/api/agentless_scanning_api.rb b/lib/datadog_api_client/v2/api/agentless_scanning_api.rb index 8a94babe8cad..225d07a6dff2 100644 --- a/lib/datadog_api_client/v2/api/agentless_scanning_api.rb +++ b/lib/datadog_api_client/v2/api/agentless_scanning_api.rb @@ -287,6 +287,71 @@ def get_aws_on_demand_task_with_http_info(task_id, opts = {}) return data, status_code, headers end + # Get AWS scan options. + # + # @see #get_aws_scan_options_with_http_info + def get_aws_scan_options(account_id, opts = {}) + data, _status_code, _headers = get_aws_scan_options_with_http_info(account_id, opts) + data + end + + # Get AWS scan options. + # + # Fetches the Agentless scan options for an activated account. + # + # @param account_id [String] The ID of an AWS account. + # @param opts [Hash] the optional parameters + # @return [Array<(AwsScanOptionsResponse, Integer, Hash)>] AwsScanOptionsResponse data, response status code and response headers + def get_aws_scan_options_with_http_info(account_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AgentlessScanningAPI.get_aws_scan_options ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling AgentlessScanningAPI.get_aws_scan_options" + end + # resource path + local_var_path = '/api/v2/agentless_scanning/accounts/aws/{account_id}'.sub('{account_id}', CGI.escape(account_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # 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] || 'AwsScanOptionsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_aws_scan_options, + :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: AgentlessScanningAPI#get_aws_scan_options\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get AWS On Demand tasks. # # @see #list_aws_on_demand_tasks_with_http_info @@ -347,7 +412,7 @@ def list_aws_on_demand_tasks_with_http_info(opts = {}) return data, status_code, headers end - # Get AWS Scan Options. + # List AWS Scan Options. # # @see #list_aws_scan_options_with_http_info def list_aws_scan_options(opts = {}) @@ -355,7 +420,7 @@ def list_aws_scan_options(opts = {}) data end - # Get AWS Scan Options. + # List AWS Scan Options. # # Fetches the scan options configured for AWS accounts. #