diff --git a/.apigentools-info b/.apigentools-info index 923d410162a..6b6859a2179 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-02-28 17:49:26.181107", - "spec_repo_commit": "59e6a448" + "regenerated": "2025-03-03 16:04:33.892853", + "spec_repo_commit": "c17ef1e9" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-02-28 17:49:26.196379", - "spec_repo_commit": "59e6a448" + "regenerated": "2025-03-03 16:04:33.910855", + "spec_repo_commit": "c17ef1e9" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e078fc79453..b86802b4656 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -162,6 +162,14 @@ components: required: true schema: type: string + AwsAccountId: + description: The ID of an AWS account. + example: '123456789012' + in: path + name: account_id + required: true + schema: + type: string CaseIDPathParameter: description: Case's UUID or key example: f98a5a5b-e0ff-45d4-b2f5-afe6e74de504 @@ -1742,6 +1750,10 @@ components: type: string type: array type: object + AccountId: + description: The ID of the AWS account. + example: '184366314700' + type: string ActionConnectionAttributes: description: The definition of `ActionConnectionAttributes` object. properties: @@ -2879,6 +2891,10 @@ components: type: string x-enum-varnames: - AUTHN_MAPPINGS + AwsAccountId: + description: The ID of an AWS account. + example: '123456789012' + type: string AwsCURConfig: description: AWS CUR config. properties: @@ -3104,6 +3120,28 @@ components: example: true type: boolean type: object + AwsScanOptionsCreateData: + description: Object for the scan options of a single AWS account. + properties: + attributes: + $ref: '#/components/schemas/AwsScanOptionsAttributes' + id: + $ref: '#/components/schemas/AwsAccountId' + type: + $ref: '#/components/schemas/AwsScanOptionsType' + required: + - id + - attributes + - type + type: object + AwsScanOptionsCreateRequest: + description: Request object that includes the scan options to create. + properties: + data: + $ref: '#/components/schemas/AwsScanOptionsCreateData' + required: + - data + type: object AwsScanOptionsData: description: Single AWS Scan Options entry. properties: @@ -3116,7 +3154,7 @@ components: type: $ref: '#/components/schemas/AwsScanOptionsType' type: object - AwsScanOptionsResponse: + AwsScanOptionsListResponse: description: Response object that includes a list of AWS scan options. properties: data: @@ -3125,6 +3163,12 @@ components: $ref: '#/components/schemas/AwsScanOptionsData' type: array type: object + AwsScanOptionsResponse: + description: Response object that includes the scan options of an AWS account. + properties: + data: + $ref: '#/components/schemas/AwsScanOptionsData' + type: object AwsScanOptionsType: default: aws_scan_options description: The type of the resource. The value should always be `aws_scan_options`. @@ -3134,6 +3178,48 @@ components: type: string x-enum-varnames: - AWS_SCAN_OPTIONS + AwsScanOptionsUpdateAttributes: + description: Attributes for the AWS scan options to update. + properties: + lambda: + description: Indicates if scanning of Lambda functions is enabled. + example: true + type: boolean + sensitive_data: + description: Indicates if scanning for sensitive data is enabled. + example: false + type: boolean + vuln_containers_os: + description: Indicates if scanning for vulnerabilities in containers is + enabled. + example: true + type: boolean + vuln_host_os: + description: Indicates if scanning for vulnerabilities in hosts is enabled. + example: true + type: boolean + type: object + AwsScanOptionsUpdateData: + description: Object for the scan options of a single AWS account. + properties: + attributes: + $ref: '#/components/schemas/AwsScanOptionsUpdateAttributes' + id: + $ref: '#/components/schemas/AccountId' + type: + $ref: '#/components/schemas/AwsScanOptionsType' + required: + - attributes + - type + type: object + AwsScanOptionsUpdateRequest: + description: Request object that includes the scan options to update. + properties: + data: + $ref: '#/components/schemas/AwsScanOptionsUpdateData' + required: + - data + type: object AzureUCConfig: description: Azure config. properties: @@ -32639,7 +32725,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AwsScanOptionsResponse' + $ref: '#/components/schemas/AwsScanOptionsListResponse' description: OK '403': $ref: '#/components/responses/NotAuthorizedResponse' @@ -32648,6 +32734,82 @@ paths: summary: Get AWS Scan Options tags: - Agentless Scanning + post: + description: Activate Agentless scan options for an AWS account. + operationId: CreateAwsScanOptions + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AwsScanOptionsCreateRequest' + description: The definition of the new scan options. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/AwsScanOptionsResponse' + description: Agentless scan options enabled successfully. + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Post AWS Scan Options + tags: + - Agentless Scanning + x-codegen-request-body-name: body + /api/v2/agentless_scanning/accounts/aws/{account_id}: + delete: + description: Delete Agentless scan options for an AWS account. + operationId: DeleteAwsScanOptions + parameters: + - $ref: '#/components/parameters/AwsAccountId' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete AWS Scan Options + tags: + - Agentless Scanning + patch: + description: Update the Agentless scan options for an activated account. + operationId: UpdateAwsScanOptions + parameters: + - $ref: '#/components/parameters/AwsAccountId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AwsScanOptionsUpdateRequest' + description: New definition of the scan options. + required: true + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Patch AWS Scan Options + tags: + - Agentless Scanning + x-codegen-request-body-name: body /api/v2/api_keys: get: description: List all API keys available for your account. @@ -51408,7 +51570,7 @@ tags: - description: "Datadog Agentless Scanning provides visibility into risks and vulnerabilities\nwithin your hosts, running containers, and serverless functions\u2014all without\nrequiring teams to install Agents on every host or where Agents cannot be installed.\nGo - to https://www.datadoghq.com/blog/agentless-scanning/ to learn more" + to https://www.datadoghq.com/blog/agentless-scanning/ to learn more." name: Agentless Scanning - description: Datadog App Builder provides a low-code solution to rapidly develop and integrate secure, customized applications into your monitoring stack that diff --git a/examples/v2/agentless-scanning/CreateAwsScanOptions.java b/examples/v2/agentless-scanning/CreateAwsScanOptions.java new file mode 100644 index 00000000000..3bc0e992e9d --- /dev/null +++ b/examples/v2/agentless-scanning/CreateAwsScanOptions.java @@ -0,0 +1,41 @@ +// Post AWS Scan Options returns "Agentless scan options enabled successfully." response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.AgentlessScanningApi; +import com.datadog.api.client.v2.model.AwsScanOptionsAttributes; +import com.datadog.api.client.v2.model.AwsScanOptionsCreateData; +import com.datadog.api.client.v2.model.AwsScanOptionsCreateRequest; +import com.datadog.api.client.v2.model.AwsScanOptionsResponse; +import com.datadog.api.client.v2.model.AwsScanOptionsType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + AgentlessScanningApi apiInstance = new AgentlessScanningApi(defaultClient); + + AwsScanOptionsCreateRequest body = + new AwsScanOptionsCreateRequest() + .data( + new AwsScanOptionsCreateData() + .id("000000000003") + .type(AwsScanOptionsType.AWS_SCAN_OPTIONS) + .attributes( + new AwsScanOptionsAttributes() + .lambda(true) + .sensitiveData(false) + .vulnContainersOs(true) + .vulnHostOs(true))); + + try { + AwsScanOptionsResponse result = apiInstance.createAwsScanOptions(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentlessScanningApi#createAwsScanOptions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/agentless-scanning/DeleteAwsScanOptions.java b/examples/v2/agentless-scanning/DeleteAwsScanOptions.java new file mode 100644 index 00000000000..d48ade7ebe6 --- /dev/null +++ b/examples/v2/agentless-scanning/DeleteAwsScanOptions.java @@ -0,0 +1,22 @@ +// Delete AWS Scan Options returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.AgentlessScanningApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + AgentlessScanningApi apiInstance = new AgentlessScanningApi(defaultClient); + + try { + apiInstance.deleteAwsScanOptions("account_id"); + } catch (ApiException e) { + System.err.println("Exception when calling AgentlessScanningApi#deleteAwsScanOptions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/agentless-scanning/ListAwsScanOptions.java b/examples/v2/agentless-scanning/ListAwsScanOptions.java index fd3b2204fe9..a45cdb43a1b 100644 --- a/examples/v2/agentless-scanning/ListAwsScanOptions.java +++ b/examples/v2/agentless-scanning/ListAwsScanOptions.java @@ -3,7 +3,7 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; import com.datadog.api.client.v2.api.AgentlessScanningApi; -import com.datadog.api.client.v2.model.AwsScanOptionsResponse; +import com.datadog.api.client.v2.model.AwsScanOptionsListResponse; public class Example { public static void main(String[] args) { @@ -11,7 +11,7 @@ public static void main(String[] args) { AgentlessScanningApi apiInstance = new AgentlessScanningApi(defaultClient); try { - AwsScanOptionsResponse result = apiInstance.listAwsScanOptions(); + AwsScanOptionsListResponse result = apiInstance.listAwsScanOptions(); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling AgentlessScanningApi#listAwsScanOptions"); diff --git a/examples/v2/agentless-scanning/UpdateAwsScanOptions.java b/examples/v2/agentless-scanning/UpdateAwsScanOptions.java new file mode 100644 index 00000000000..48dd3204523 --- /dev/null +++ b/examples/v2/agentless-scanning/UpdateAwsScanOptions.java @@ -0,0 +1,38 @@ +// Patch AWS Scan Options returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.AgentlessScanningApi; +import com.datadog.api.client.v2.model.AwsScanOptionsType; +import com.datadog.api.client.v2.model.AwsScanOptionsUpdateAttributes; +import com.datadog.api.client.v2.model.AwsScanOptionsUpdateData; +import com.datadog.api.client.v2.model.AwsScanOptionsUpdateRequest; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + AgentlessScanningApi apiInstance = new AgentlessScanningApi(defaultClient); + + AwsScanOptionsUpdateRequest body = + new AwsScanOptionsUpdateRequest() + .data( + new AwsScanOptionsUpdateData() + .type(AwsScanOptionsType.AWS_SCAN_OPTIONS) + .id("000000000002") + .attributes( + new AwsScanOptionsUpdateAttributes() + .vulnHostOs(true) + .vulnContainersOs(true) + .lambda(false))); + + try { + apiInstance.updateAwsScanOptions("000000000002", body); + } catch (ApiException e) { + System.err.println("Exception when calling AgentlessScanningApi#updateAwsScanOptions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/AgentlessScanningApi.java b/src/main/java/com/datadog/api/client/v2/api/AgentlessScanningApi.java index 686f83a6e22..976f4cb395c 100644 --- a/src/main/java/com/datadog/api/client/v2/api/AgentlessScanningApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/AgentlessScanningApi.java @@ -4,7 +4,10 @@ import com.datadog.api.client.ApiException; import com.datadog.api.client.ApiResponse; import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.AwsScanOptionsCreateRequest; +import com.datadog.api.client.v2.model.AwsScanOptionsListResponse; import com.datadog.api.client.v2.model.AwsScanOptionsResponse; +import com.datadog.api.client.v2.model.AwsScanOptionsUpdateRequest; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -43,15 +46,283 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Post AWS Scan Options. + * + *

See {@link #createAwsScanOptionsWithHttpInfo}. + * + * @param body The definition of the new scan options. (required) + * @return AwsScanOptionsResponse + * @throws ApiException if fails to make API call + */ + public AwsScanOptionsResponse createAwsScanOptions(AwsScanOptionsCreateRequest body) + throws ApiException { + return createAwsScanOptionsWithHttpInfo(body).getData(); + } + + /** + * Post AWS Scan Options. + * + *

See {@link #createAwsScanOptionsWithHttpInfoAsync}. + * + * @param body The definition of the new scan options. (required) + * @return CompletableFuture<AwsScanOptionsResponse> + */ + public CompletableFuture createAwsScanOptionsAsync( + AwsScanOptionsCreateRequest body) { + return createAwsScanOptionsWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Activate Agentless scan options for an AWS account. + * + * @param body The definition of the new scan options. (required) + * @return ApiResponse<AwsScanOptionsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Agentless scan options enabled successfully. -
400 Bad Request -
403 Not Authorized -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse createAwsScanOptionsWithHttpInfo( + AwsScanOptionsCreateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createAwsScanOptions"); + } + // create path and map variables + String localVarPath = "/api/v2/agentless_scanning/accounts/aws"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.createAwsScanOptions", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Post AWS Scan Options. + * + *

See {@link #createAwsScanOptionsWithHttpInfo}. + * + * @param body The definition of the new scan options. (required) + * @return CompletableFuture<ApiResponse<AwsScanOptionsResponse>> + */ + public CompletableFuture> + createAwsScanOptionsWithHttpInfoAsync(AwsScanOptionsCreateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createAwsScanOptions")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/agentless_scanning/accounts/aws"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.createAwsScanOptions", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Delete AWS Scan Options. + * + *

See {@link #deleteAwsScanOptionsWithHttpInfo}. + * + * @param accountId The ID of an AWS account. (required) + * @throws ApiException if fails to make API call + */ + public void deleteAwsScanOptions(String accountId) throws ApiException { + deleteAwsScanOptionsWithHttpInfo(accountId); + } + + /** + * Delete AWS Scan Options. + * + *

See {@link #deleteAwsScanOptionsWithHttpInfoAsync}. + * + * @param accountId The ID of an AWS account. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteAwsScanOptionsAsync(String accountId) { + return deleteAwsScanOptionsWithHttpInfoAsync(accountId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete Agentless scan options for an AWS account. + * + * @param accountId The ID of an AWS account. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
403 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteAwsScanOptionsWithHttpInfo(String accountId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException( + 400, "Missing the required parameter 'accountId' when calling deleteAwsScanOptions"); + } + // create path and map variables + String localVarPath = + "/api/v2/agentless_scanning/accounts/aws/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.deleteAwsScanOptions", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete AWS Scan Options. + * + *

See {@link #deleteAwsScanOptionsWithHttpInfo}. + * + * @param accountId The ID of an AWS account. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteAwsScanOptionsWithHttpInfoAsync( + String accountId) { + Object localVarPostBody = null; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'accountId' when calling deleteAwsScanOptions")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/agentless_scanning/accounts/aws/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.deleteAwsScanOptions", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Get AWS Scan Options. * *

See {@link #listAwsScanOptionsWithHttpInfo}. * - * @return AwsScanOptionsResponse + * @return AwsScanOptionsListResponse * @throws ApiException if fails to make API call */ - public AwsScanOptionsResponse listAwsScanOptions() throws ApiException { + public AwsScanOptionsListResponse listAwsScanOptions() throws ApiException { return listAwsScanOptionsWithHttpInfo().getData(); } @@ -60,9 +331,9 @@ public AwsScanOptionsResponse listAwsScanOptions() throws ApiException { * *

See {@link #listAwsScanOptionsWithHttpInfoAsync}. * - * @return CompletableFuture<AwsScanOptionsResponse> + * @return CompletableFuture<AwsScanOptionsListResponse> */ - public CompletableFuture listAwsScanOptionsAsync() { + public CompletableFuture listAwsScanOptionsAsync() { return listAwsScanOptionsWithHttpInfoAsync() .thenApply( response -> { @@ -73,7 +344,7 @@ public CompletableFuture listAwsScanOptionsAsync() { /** * Fetches the scan options configured for AWS accounts. * - * @return ApiResponse<AwsScanOptionsResponse> + * @return ApiResponse<AwsScanOptionsListResponse> * @throws ApiException if fails to make API call * @http.response.details * @@ -84,7 +355,8 @@ public CompletableFuture listAwsScanOptionsAsync() { * *
429 Too many requests -
*/ - public ApiResponse listAwsScanOptionsWithHttpInfo() throws ApiException { + public ApiResponse listAwsScanOptionsWithHttpInfo() + throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/api/v2/agentless_scanning/accounts/aws"; @@ -108,7 +380,7 @@ public ApiResponse listAwsScanOptionsWithHttpInfo() thro localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** @@ -116,9 +388,9 @@ public ApiResponse listAwsScanOptionsWithHttpInfo() thro * *

See {@link #listAwsScanOptionsWithHttpInfo}. * - * @return CompletableFuture<ApiResponse<AwsScanOptionsResponse>> + * @return CompletableFuture<ApiResponse<AwsScanOptionsListResponse>> */ - public CompletableFuture> + public CompletableFuture> listAwsScanOptionsWithHttpInfoAsync() { Object localVarPostBody = null; // create path and map variables @@ -138,7 +410,7 @@ public ApiResponse listAwsScanOptionsWithHttpInfo() thro new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -150,6 +422,162 @@ public ApiResponse listAwsScanOptionsWithHttpInfo() thro localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); + } + + /** + * Patch AWS Scan Options. + * + *

See {@link #updateAwsScanOptionsWithHttpInfo}. + * + * @param accountId The ID of an AWS account. (required) + * @param body New definition of the scan options. (required) + * @throws ApiException if fails to make API call + */ + public void updateAwsScanOptions(String accountId, AwsScanOptionsUpdateRequest body) + throws ApiException { + updateAwsScanOptionsWithHttpInfo(accountId, body); + } + + /** + * Patch AWS Scan Options. + * + *

See {@link #updateAwsScanOptionsWithHttpInfoAsync}. + * + * @param accountId The ID of an AWS account. (required) + * @param body New definition of the scan options. (required) + * @return CompletableFuture + */ + public CompletableFuture updateAwsScanOptionsAsync( + String accountId, AwsScanOptionsUpdateRequest body) { + return updateAwsScanOptionsWithHttpInfoAsync(accountId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update the Agentless scan options for an activated account. + * + * @param accountId The ID of an AWS account. (required) + * @param body New definition of the scan options. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
403 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateAwsScanOptionsWithHttpInfo( + String accountId, AwsScanOptionsUpdateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException( + 400, "Missing the required parameter 'accountId' when calling updateAwsScanOptions"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateAwsScanOptions"); + } + // create path and map variables + String localVarPath = + "/api/v2/agentless_scanning/accounts/aws/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.updateAwsScanOptions", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Patch AWS Scan Options. + * + *

See {@link #updateAwsScanOptionsWithHttpInfo}. + * + * @param accountId The ID of an AWS account. (required) + * @param body New definition of the scan options. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> updateAwsScanOptionsWithHttpInfoAsync( + String accountId, AwsScanOptionsUpdateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'accountId' when calling updateAwsScanOptions")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateAwsScanOptions")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/agentless_scanning/accounts/aws/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.updateAwsScanOptions", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); } } diff --git a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateData.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateData.java new file mode 100644 index 00000000000..59bec89eccb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateData.java @@ -0,0 +1,209 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Object for the scan options of a single AWS account. */ +@JsonPropertyOrder({ + AwsScanOptionsCreateData.JSON_PROPERTY_ATTRIBUTES, + AwsScanOptionsCreateData.JSON_PROPERTY_ID, + AwsScanOptionsCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsScanOptionsCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AwsScanOptionsAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AwsScanOptionsType type = AwsScanOptionsType.AWS_SCAN_OPTIONS; + + public AwsScanOptionsCreateData() {} + + @JsonCreator + public AwsScanOptionsCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AwsScanOptionsAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AwsScanOptionsType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AwsScanOptionsCreateData attributes(AwsScanOptionsAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for the AWS scan options. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AwsScanOptionsAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AwsScanOptionsAttributes attributes) { + this.attributes = attributes; + } + + public AwsScanOptionsCreateData id(String id) { + this.id = id; + return this; + } + + /** + * The ID of an AWS account. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AwsScanOptionsCreateData type(AwsScanOptionsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the resource. The value should always be aws_scan_options. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AwsScanOptionsType getType() { + return type; + } + + public void setType(AwsScanOptionsType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AwsScanOptionsCreateData + */ + @JsonAnySetter + public AwsScanOptionsCreateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AwsScanOptionsCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsScanOptionsCreateData awsScanOptionsCreateData = (AwsScanOptionsCreateData) o; + return Objects.equals(this.attributes, awsScanOptionsCreateData.attributes) + && Objects.equals(this.id, awsScanOptionsCreateData.id) + && Objects.equals(this.type, awsScanOptionsCreateData.type) + && Objects.equals(this.additionalProperties, awsScanOptionsCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsScanOptionsCreateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateRequest.java new file mode 100644 index 00000000000..5a15d59d351 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateRequest.java @@ -0,0 +1,146 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request object that includes the scan options to create. */ +@JsonPropertyOrder({AwsScanOptionsCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsScanOptionsCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AwsScanOptionsCreateData data; + + public AwsScanOptionsCreateRequest() {} + + @JsonCreator + public AwsScanOptionsCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) AwsScanOptionsCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AwsScanOptionsCreateRequest data(AwsScanOptionsCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Object for the scan options of a single AWS account. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AwsScanOptionsCreateData getData() { + return data; + } + + public void setData(AwsScanOptionsCreateData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AwsScanOptionsCreateRequest + */ + @JsonAnySetter + public AwsScanOptionsCreateRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AwsScanOptionsCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsScanOptionsCreateRequest awsScanOptionsCreateRequest = (AwsScanOptionsCreateRequest) o; + return Objects.equals(this.data, awsScanOptionsCreateRequest.data) + && Objects.equals( + this.additionalProperties, awsScanOptionsCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsScanOptionsCreateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsListResponse.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsListResponse.java new file mode 100644 index 00000000000..5157b025b2d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsListResponse.java @@ -0,0 +1,150 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response object that includes a list of AWS scan options. */ +@JsonPropertyOrder({AwsScanOptionsListResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsScanOptionsListResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public AwsScanOptionsListResponse data(List data) { + this.data = data; + for (AwsScanOptionsData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AwsScanOptionsListResponse addDataItem(AwsScanOptionsData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * A list of AWS scan options. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AwsScanOptionsListResponse + */ + @JsonAnySetter + public AwsScanOptionsListResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AwsScanOptionsListResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsScanOptionsListResponse awsScanOptionsListResponse = (AwsScanOptionsListResponse) o; + return Objects.equals(this.data, awsScanOptionsListResponse.data) + && Objects.equals( + this.additionalProperties, awsScanOptionsListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsScanOptionsListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsResponse.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsResponse.java index 1460723d8e5..8a1dda03676 100644 --- a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsResponse.java +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsResponse.java @@ -12,51 +12,38 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Objects; -/** Response object that includes a list of AWS scan options. */ +/** Response object that includes the scan options of an AWS account. */ @JsonPropertyOrder({AwsScanOptionsResponse.JSON_PROPERTY_DATA}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class AwsScanOptionsResponse { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_DATA = "data"; - private List data = null; + private AwsScanOptionsData data; - public AwsScanOptionsResponse data(List data) { + public AwsScanOptionsResponse data(AwsScanOptionsData data) { this.data = data; - for (AwsScanOptionsData item : data) { - this.unparsed |= item.unparsed; - } - return this; - } - - public AwsScanOptionsResponse addDataItem(AwsScanOptionsData dataItem) { - if (this.data == null) { - this.data = new ArrayList<>(); - } - this.data.add(dataItem); - this.unparsed |= dataItem.unparsed; + this.unparsed |= data.unparsed; return this; } /** - * A list of AWS scan options. + * Single AWS Scan Options entry. * * @return data */ @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_DATA) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getData() { + public AwsScanOptionsData getData() { return data; } - public void setData(List data) { + public void setData(AwsScanOptionsData data) { this.data = data; } diff --git a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsUpdateAttributes.java new file mode 100644 index 00000000000..c9d9c24bebd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsUpdateAttributes.java @@ -0,0 +1,220 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes for the AWS scan options to update. */ +@JsonPropertyOrder({ + AwsScanOptionsUpdateAttributes.JSON_PROPERTY_LAMBDA, + AwsScanOptionsUpdateAttributes.JSON_PROPERTY_SENSITIVE_DATA, + AwsScanOptionsUpdateAttributes.JSON_PROPERTY_VULN_CONTAINERS_OS, + AwsScanOptionsUpdateAttributes.JSON_PROPERTY_VULN_HOST_OS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsScanOptionsUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_LAMBDA = "lambda"; + private Boolean lambda; + + public static final String JSON_PROPERTY_SENSITIVE_DATA = "sensitive_data"; + private Boolean sensitiveData; + + public static final String JSON_PROPERTY_VULN_CONTAINERS_OS = "vuln_containers_os"; + private Boolean vulnContainersOs; + + public static final String JSON_PROPERTY_VULN_HOST_OS = "vuln_host_os"; + private Boolean vulnHostOs; + + public AwsScanOptionsUpdateAttributes lambda(Boolean lambda) { + this.lambda = lambda; + return this; + } + + /** + * Indicates if scanning of Lambda functions is enabled. + * + * @return lambda + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAMBDA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getLambda() { + return lambda; + } + + public void setLambda(Boolean lambda) { + this.lambda = lambda; + } + + public AwsScanOptionsUpdateAttributes sensitiveData(Boolean sensitiveData) { + this.sensitiveData = sensitiveData; + return this; + } + + /** + * Indicates if scanning for sensitive data is enabled. + * + * @return sensitiveData + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SENSITIVE_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getSensitiveData() { + return sensitiveData; + } + + public void setSensitiveData(Boolean sensitiveData) { + this.sensitiveData = sensitiveData; + } + + public AwsScanOptionsUpdateAttributes vulnContainersOs(Boolean vulnContainersOs) { + this.vulnContainersOs = vulnContainersOs; + return this; + } + + /** + * Indicates if scanning for vulnerabilities in containers is enabled. + * + * @return vulnContainersOs + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VULN_CONTAINERS_OS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getVulnContainersOs() { + return vulnContainersOs; + } + + public void setVulnContainersOs(Boolean vulnContainersOs) { + this.vulnContainersOs = vulnContainersOs; + } + + public AwsScanOptionsUpdateAttributes vulnHostOs(Boolean vulnHostOs) { + this.vulnHostOs = vulnHostOs; + return this; + } + + /** + * Indicates if scanning for vulnerabilities in hosts is enabled. + * + * @return vulnHostOs + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VULN_HOST_OS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getVulnHostOs() { + return vulnHostOs; + } + + public void setVulnHostOs(Boolean vulnHostOs) { + this.vulnHostOs = vulnHostOs; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AwsScanOptionsUpdateAttributes + */ + @JsonAnySetter + public AwsScanOptionsUpdateAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AwsScanOptionsUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsScanOptionsUpdateAttributes awsScanOptionsUpdateAttributes = + (AwsScanOptionsUpdateAttributes) o; + return Objects.equals(this.lambda, awsScanOptionsUpdateAttributes.lambda) + && Objects.equals(this.sensitiveData, awsScanOptionsUpdateAttributes.sensitiveData) + && Objects.equals(this.vulnContainersOs, awsScanOptionsUpdateAttributes.vulnContainersOs) + && Objects.equals(this.vulnHostOs, awsScanOptionsUpdateAttributes.vulnHostOs) + && Objects.equals( + this.additionalProperties, awsScanOptionsUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(lambda, sensitiveData, vulnContainersOs, vulnHostOs, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsScanOptionsUpdateAttributes {\n"); + sb.append(" lambda: ").append(toIndentedString(lambda)).append("\n"); + sb.append(" sensitiveData: ").append(toIndentedString(sensitiveData)).append("\n"); + sb.append(" vulnContainersOs: ").append(toIndentedString(vulnContainersOs)).append("\n"); + sb.append(" vulnHostOs: ").append(toIndentedString(vulnHostOs)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsUpdateData.java new file mode 100644 index 00000000000..0890007e096 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsUpdateData.java @@ -0,0 +1,208 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Object for the scan options of a single AWS account. */ +@JsonPropertyOrder({ + AwsScanOptionsUpdateData.JSON_PROPERTY_ATTRIBUTES, + AwsScanOptionsUpdateData.JSON_PROPERTY_ID, + AwsScanOptionsUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsScanOptionsUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AwsScanOptionsUpdateAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AwsScanOptionsType type = AwsScanOptionsType.AWS_SCAN_OPTIONS; + + public AwsScanOptionsUpdateData() {} + + @JsonCreator + public AwsScanOptionsUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AwsScanOptionsUpdateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AwsScanOptionsType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AwsScanOptionsUpdateData attributes(AwsScanOptionsUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for the AWS scan options to update. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AwsScanOptionsUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AwsScanOptionsUpdateAttributes attributes) { + this.attributes = attributes; + } + + public AwsScanOptionsUpdateData id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the AWS account. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AwsScanOptionsUpdateData type(AwsScanOptionsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the resource. The value should always be aws_scan_options. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AwsScanOptionsType getType() { + return type; + } + + public void setType(AwsScanOptionsType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AwsScanOptionsUpdateData + */ + @JsonAnySetter + public AwsScanOptionsUpdateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AwsScanOptionsUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsScanOptionsUpdateData awsScanOptionsUpdateData = (AwsScanOptionsUpdateData) o; + return Objects.equals(this.attributes, awsScanOptionsUpdateData.attributes) + && Objects.equals(this.id, awsScanOptionsUpdateData.id) + && Objects.equals(this.type, awsScanOptionsUpdateData.type) + && Objects.equals(this.additionalProperties, awsScanOptionsUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsScanOptionsUpdateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsUpdateRequest.java new file mode 100644 index 00000000000..35d953c288b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsUpdateRequest.java @@ -0,0 +1,146 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request object that includes the scan options to update. */ +@JsonPropertyOrder({AwsScanOptionsUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsScanOptionsUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AwsScanOptionsUpdateData data; + + public AwsScanOptionsUpdateRequest() {} + + @JsonCreator + public AwsScanOptionsUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) AwsScanOptionsUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AwsScanOptionsUpdateRequest data(AwsScanOptionsUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Object for the scan options of a single AWS account. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AwsScanOptionsUpdateData getData() { + return data; + } + + public void setData(AwsScanOptionsUpdateData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AwsScanOptionsUpdateRequest + */ + @JsonAnySetter + public AwsScanOptionsUpdateRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AwsScanOptionsUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsScanOptionsUpdateRequest awsScanOptionsUpdateRequest = (AwsScanOptionsUpdateRequest) o; + return Objects.equals(this.data, awsScanOptionsUpdateRequest.data) + && Objects.equals( + this.additionalProperties, awsScanOptionsUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsScanOptionsUpdateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/cassettes/features/v2/Create_AWS_Scan_Options_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Create_AWS_Scan_Options_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..8fff480d85b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_AWS_Scan_Options_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-02-27T17:01:48.802Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_AWS_Scan_Options_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Create_AWS_Scan_Options_returns_Bad_Request_response.json new file mode 100644 index 00000000000..84e459c193d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_AWS_Scan_Options_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"lambda\":true,\"sensitive_data\":false,\"vuln_containers_os\":true,\"vuln_host_os\":true},\"id\":\"184366314700\",\"type\":\"incorrect_type\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/agentless_scanning/accounts/aws", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"got type \\\"incorrect_type\\\" expected one of \\\"aws_scan_options\\\"\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "cda83741-6ea8-52c8-0a5c-04b219ec4b12" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..78fae12acd2 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-03-01T20:02:07.570Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Bad_Request_response.json new file mode 100644 index 00000000000..7261f654385 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Bad_Request_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/agentless_scanning/accounts/aws/incorrectId", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"missing or invalid url parameter 'accountId', expected uuid format '123456789012'\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d3b4d0d9-5fe6-9597-8cf7-7021c515a8c1" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..7766046ed52 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-03-01T20:02:08.096Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Not_Found_response.json new file mode 100644 index 00000000000..25bad8461c5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_AWS_Scan_Options_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/agentless_scanning/accounts/aws/000000000005", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"detail\":\"no aws scan options found for subscription 000000000005\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "3eb659ae-49b8-dcd6-f081-1bc7715de733" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.freeze index 1b7d36049b7..32d16d34388 100644 --- a/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.freeze @@ -1 +1 @@ -2024-12-18T15:40:11.636Z \ No newline at end of file +2025-03-01T20:02:08.552Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.json index 498f4bfa926..5e8232dcc92 100644 --- a/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.json @@ -8,7 +8,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":[]}", + "body": "{\"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/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..21876efaa7b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-03-01T19:45:09.823Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response.json new file mode 100644 index 00000000000..5dc6ed71c05 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "PATCH", + "path": "/api/v2/agentless_scanning/accounts/aws/000000000003", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"unexpected end of JSON input\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e763923b-d6b8-1f3c-df1c-455c5d136e8d" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response_2.freeze b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response_2.freeze new file mode 100644 index 00000000000..c5eb948b37c --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response_2.freeze @@ -0,0 +1 @@ +2025-03-01T20:02:08.892Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response_2.json b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response_2.json new file mode 100644 index 00000000000..2ebfbdcfa75 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Bad_Request_response_2.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"vuln_containers_os\":true,\"vuln_host_os\":true},\"id\":\"000000000005\",\"type\":\"aws_scan_options\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/agentless_scanning/accounts/aws/000000000003", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"data id must be equal to the id provided in the url path\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c6af96d1-87d1-3cd6-0d2d-71631b85bb77" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_No_Content_response.freeze b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_No_Content_response.freeze new file mode 100644 index 00000000000..78b433fe72d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2025-03-01T20:02:09.340Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_No_Content_response.json b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_No_Content_response.json new file mode 100644 index 00000000000..0a176ee003e --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_No_Content_response.json @@ -0,0 +1,27 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"lambda\":false,\"vuln_containers_os\":true,\"vuln_host_os\":true},\"id\":\"000000000002\",\"type\":\"aws_scan_options\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/agentless_scanning/accounts/aws/000000000002", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "0f485c8a-a29e-ebed-3836-545f90bc9457" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..87b3efdb1ca --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-03-01T20:02:09.818Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Not_Found_response.json new file mode 100644 index 00000000000..b7a03b8dff7 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"vuln_containers_os\":true,\"vuln_host_os\":true},\"id\":\"000000000005\",\"type\":\"aws_scan_options\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/agentless_scanning/accounts/aws/000000000005", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"detail\":\"no aws scan options found for subscription 000000000005\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5b9334b2-8fb1-87b5-4ca9-1a0b54abb8b2" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_OK_response.freeze new file mode 100644 index 00000000000..2fa1877f75f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-03-01T15:34:48.555Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_OK_response.json new file mode 100644 index 00000000000..974c53ce63d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Patch_AWS_Scan_Options_returns_OK_response.json @@ -0,0 +1,27 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"lambda\":false,\"vuln_containers_os\":true,\"vuln_host_os\":true},\"id\":\"000000000002\",\"type\":\"aws_scan_options\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/agentless_scanning/accounts/aws/000000000002", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "0f485c8a-a29e-ebed-3836-545f90bc9456" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Agentless_scan_options_enabled_successfully_response.freeze b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Agentless_scan_options_enabled_successfully_response.freeze new file mode 100644 index 00000000000..8789c61d725 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Agentless_scan_options_enabled_successfully_response.freeze @@ -0,0 +1 @@ +2025-03-01T15:19:57.464Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Agentless_scan_options_enabled_successfully_response.json b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Agentless_scan_options_enabled_successfully_response.json new file mode 100644 index 00000000000..858d36f9769 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Agentless_scan_options_enabled_successfully_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"lambda\":false,\"vuln_containers_os\":true,\"vuln_host_os\":true},\"id\":\"000000000003\",\"type\":\"aws_scan_options\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/agentless_scanning/accounts/aws", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"000000000003\",\"type\":\"aws_scan_options\",\"attributes\":{\"lambda\":false,\"vuln_containers_os\":true,\"vuln_host_os\":true}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "2964f942-a0f9-4d27-cd35-eee4ba525a3a" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/agentless_scanning/accounts/aws/000000000003", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "49ae287a-8cc5-118a-4b1c-2dbceae02055" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..59207fca5c0 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-03-01T20:02:10.180Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Bad_Request_response.json new file mode 100644 index 00000000000..fb2bbc86068 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"lambda\":true,\"sensitive_data\":false,\"vuln_containers_os\":true,\"vuln_host_os\":true},\"id\":\"123\",\"type\":\"aws_scan_options\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/agentless_scanning/accounts/aws", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"the provided Aws account id is not valid\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e2891484-5e4d-166a-c2fe-dce7aead5f70" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Conflict_response.freeze b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Conflict_response.freeze new file mode 100644 index 00000000000..10fcf78da0d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Conflict_response.freeze @@ -0,0 +1 @@ +2025-03-01T20:02:10.630Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Conflict_response.json b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Conflict_response.json new file mode 100644 index 00000000000..0227baa06f9 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_Conflict_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"lambda\":false,\"vuln_containers_os\":true,\"vuln_host_os\":true},\"id\":\"000000000002\",\"type\":\"aws_scan_options\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/agentless_scanning/accounts/aws", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"409\",\"detail\":\"aws scan options already exist for subscription 000000000002\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 409, + "reasonPhrase": "Conflict" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "686a593a-4dba-37de-e65b-a2748ae8e100" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_OK_response.freeze new file mode 100644 index 00000000000..f0529cf60d7 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-03-01T15:32:48.267Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_OK_response.json new file mode 100644 index 00000000000..08f556111f9 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_AWS_Scan_Options_returns_OK_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"lambda\":true,\"sensitive_data\":false,\"vuln_containers_os\":true,\"vuln_host_os\":true},\"id\":\"000000000003\",\"type\":\"aws_scan_options\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/agentless_scanning/accounts/aws", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"000000000003\",\"type\":\"aws_scan_options\",\"attributes\":{\"lambda\":true,\"sensitive_data\":false,\"vuln_containers_os\":true,\"vuln_host_os\":true}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "06877dc0-2279-5d8f-922d-c2ba2c477c6a" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/agentless_scanning/accounts/aws/000000000003", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "49ae287a-8cc5-118a-4b1c-2dbceae02054" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/agentless_scanning.feature b/src/test/resources/com/datadog/api/client/v2/api/agentless_scanning.feature index d37dfee5eef..2152f133526 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/agentless_scanning.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/agentless_scanning.feature @@ -4,13 +4,88 @@ Feature: Agentless Scanning vulnerabilities within your hosts, running containers, and serverless functions—all without requiring teams to install Agents on every host or where Agents cannot be installed. Go to - https://www.datadoghq.com/blog/agentless-scanning/ to learn more + https://www.datadoghq.com/blog/agentless-scanning/ to learn more. - @team:DataDog/k9-cloud-security-platform - Scenario: Get AWS Scan Options returns "OK" response + Background: Given a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system And an instance of "AgentlessScanning" API - And new "ListAwsScanOptions" request + + @team:DataDog/k9-cloud-security-platform + Scenario: Delete AWS Scan Options returns "Bad Request" response + Given new "DeleteAwsScanOptions" request + And request contains "account_id" parameter with value "incorrectId" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-cloud-security-platform + Scenario: Delete AWS Scan Options returns "No Content" response + Given new "DeleteAwsScanOptions" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @team:DataDog/k9-cloud-security-platform + Scenario: Delete AWS Scan Options returns "Not Found" response + Given new "DeleteAwsScanOptions" request + And request contains "account_id" parameter with value "000000000005" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-cloud-security-platform + Scenario: Get AWS Scan Options returns "OK" response + Given new "ListAwsScanOptions" request When the request is sent Then the response status is 200 OK + + @skip @team:DataDog/k9-cloud-security-platform + Scenario: Patch AWS Scan Options returns "Bad Request" response + Given new "UpdateAwsScanOptions" request + And request contains "account_id" parameter with value "000000000003" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-cloud-security-platform + Scenario: Patch AWS Scan Options returns "Bad Request" response 2 + Given new "UpdateAwsScanOptions" request + And request contains "account_id" parameter with value "000000000003" + And body with value {"data":{"type":"aws_scan_options","id":"000000000005","attributes":{"vuln_host_os":true,"vuln_containers_os":true}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-cloud-security-platform + Scenario: Patch AWS Scan Options returns "No Content" response + Given new "UpdateAwsScanOptions" request + And request contains "account_id" parameter with value "000000000002" + And body with value {"data":{"type":"aws_scan_options","id":"000000000002","attributes":{"vuln_host_os":true,"vuln_containers_os":true,"lambda":false}}} + When the request is sent + Then the response status is 204 No Content + + @team:DataDog/k9-cloud-security-platform + Scenario: Patch AWS Scan Options returns "Not Found" response + Given new "UpdateAwsScanOptions" request + And request contains "account_id" parameter with value "000000000005" + And body with value {"data":{"type":"aws_scan_options","id":"000000000005","attributes":{"vuln_host_os":true,"vuln_containers_os":true}}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/k9-cloud-security-platform + Scenario: Post AWS Scan Options returns "Agentless scan options enabled successfully." response + Given new "CreateAwsScanOptions" request + And body with value {"data": {"id": "000000000003", "type": "aws_scan_options", "attributes": {"lambda": true, "sensitive_data": false, "vuln_containers_os": true, "vuln_host_os": true}}} + When the request is sent + Then the response status is 201 Created + + @team:DataDog/k9-cloud-security-platform + Scenario: Post AWS Scan Options returns "Bad Request" response + Given new "CreateAwsScanOptions" request + And body with value {"data": {"id": "123", "type": "aws_scan_options", "attributes": {"lambda": true, "sensitive_data": false, "vuln_containers_os": true, "vuln_host_os": true}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-cloud-security-platform + Scenario: Post AWS Scan Options returns "Conflict" response + Given new "CreateAwsScanOptions" request + And body with value {"data":{"type":"aws_scan_options","id":"000000000002","attributes":{"vuln_host_os":true,"vuln_containers_os":true,"lambda":false}}} + When the request is sent + Then the response status is 409 Conflict diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index fa6d0273dd2..c54fe630b56 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -36,6 +36,31 @@ "type": "safe" } }, + "CreateAwsScanOptions": { + "tag": "Agentless Scanning", + "undo": { + "operationId": "DeleteAwsScanOptions", + "parameters": [ + { + "name": "account_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteAwsScanOptions": { + "tag": "Agentless Scanning", + "undo": { + "type": "idempotent" + } + }, + "UpdateAwsScanOptions": { + "tag": "Agentless Scanning", + "undo": { + "type": "idempotent" + } + }, "ListAPIKeys": { "tag": "Key Management", "undo": {