diff --git a/.apigentools-info b/.apigentools-info index eacfffbd5e5..3f67f7a4b38 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-03-05 14:38:26.282976", - "spec_repo_commit": "0c376cca" + "regenerated": "2025-03-05 15:56:05.282215", + "spec_repo_commit": "fe5af5dc" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-03-05 14:38:26.302710", - "spec_repo_commit": "0c376cca" + "regenerated": "2025-03-05 15:56:05.298364", + "spec_repo_commit": "fe5af5dc" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 35f18bce723..9f21c1aa9db 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -554,6 +554,14 @@ components: required: false schema: type: string + OnDemandTaskId: + description: The UUID of the task. + example: 6d09294c-9ad9-42fd-a759-a0c1599b4828 + in: path + name: task_id + required: true + schema: + type: string OpsgenieServiceIDPathParameter: description: The UUID of the service. in: path @@ -1750,10 +1758,6 @@ 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: @@ -3093,7 +3097,7 @@ components: x-enum-varnames: - AUTHN_MAPPINGS AwsAccountId: - description: The ID of an AWS account. + description: The ID of the AWS account. example: '123456789012' type: string AwsCURConfig: @@ -3300,6 +3304,100 @@ components: $ref: '#/components/schemas/AwsCURConfig' type: array type: object + AwsOnDemandAttributes: + description: Attributes for the AWS on demand task. + properties: + arn: + description: The arn of the resource to scan. + example: arn:aws:ec2:us-east-1:727000456123:instance/i-0eabb50529b67a1ba + type: string + assigned_at: + description: Specifies the assignment timestamp if the task has been already + assigned to a scanner. + example: '2025-02-11T18:25:04.550564Z' + type: string + created_at: + description: The task submission timestamp. + example: '2025-02-11T18:13:24.576915Z' + type: string + status: + description: 'Indicates the status of the task. + + QUEUED: the task has been submitted successfully and the resource has + not been assigned to a scanner yet. + + ASSIGNED: the task has been assigned. + + ABORTED: the scan has been aborted after a period of time due to technical + reasons, such as resource not found, insufficient permissions, or the + absence of a configured scanner.' + example: QUEUED + type: string + type: object + AwsOnDemandCreateAttributes: + description: Attributes for the AWS on demand task. + properties: + arn: + description: The arn of the resource to scan. Agentless supports the scan + of EC2 instances, lambda functions, AMI, ECR, RDS and S3 buckets. + example: arn:aws:ec2:us-east-1:727000456123:instance/i-0eabb50529b67a1ba + type: string + type: object + AwsOnDemandCreateData: + description: Object for a single AWS on demand task. + properties: + attributes: + $ref: '#/components/schemas/AwsOnDemandCreateAttributes' + type: + $ref: '#/components/schemas/AwsOnDemandType' + required: + - type + - attributes + type: object + AwsOnDemandCreateRequest: + description: Request object that includes the on demand task to submit. + properties: + data: + $ref: '#/components/schemas/AwsOnDemandCreateData' + required: + - data + type: object + AwsOnDemandData: + description: Single AWS on demand task. + properties: + attributes: + $ref: '#/components/schemas/AwsOnDemandAttributes' + id: + description: The UUID of the task. + example: 6d09294c-9ad9-42fd-a759-a0c1599b4828 + type: string + type: + $ref: '#/components/schemas/AwsOnDemandType' + type: object + AwsOnDemandListResponse: + description: Response object that includes a list of AWS on demand tasks. + properties: + data: + description: A list of on demand tasks. + items: + $ref: '#/components/schemas/AwsOnDemandData' + type: array + type: object + AwsOnDemandResponse: + description: Response object that includes an AWS on demand task. + properties: + data: + $ref: '#/components/schemas/AwsOnDemandData' + type: object + AwsOnDemandType: + default: aws_resource + description: The type of the on demand task. The value should always be `aws_resource`. + enum: + - aws_resource + example: aws_resource + type: string + x-enum-varnames: + - AWS_RESOURCE AwsScanOptionsAttributes: description: Attributes for the AWS scan options. properties: @@ -3321,19 +3419,40 @@ components: example: true type: boolean type: object + AwsScanOptionsCreateAttributes: + description: Attributes for the AWS scan options to create. + 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 AwsScanOptionsCreateData: description: Object for the scan options of a single AWS account. properties: attributes: - $ref: '#/components/schemas/AwsScanOptionsAttributes' + $ref: '#/components/schemas/AwsScanOptionsCreateAttributes' id: $ref: '#/components/schemas/AwsAccountId' type: $ref: '#/components/schemas/AwsScanOptionsType' required: - id - - attributes - type + - attributes type: object AwsScanOptionsCreateRequest: description: Request object that includes the scan options to create. @@ -3406,12 +3525,13 @@ components: attributes: $ref: '#/components/schemas/AwsScanOptionsUpdateAttributes' id: - $ref: '#/components/schemas/AccountId' + $ref: '#/components/schemas/AwsAccountId' type: $ref: '#/components/schemas/AwsScanOptionsType' required: - - attributes + - id - type + - attributes type: object AwsScanOptionsUpdateRequest: description: Request object that includes the scan options to update. @@ -33059,6 +33179,87 @@ paths: tags: - Agentless Scanning x-codegen-request-body-name: body + /api/v2/agentless_scanning/ondemand/aws: + get: + description: Fetches the most recent 1000 AWS on demand tasks. + operationId: ListAwsOnDemandTasks + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AwsOnDemandListResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get AWS On Demand tasks + tags: + - Agentless Scanning + x-permission: + operator: OR + permissions: + - security_monitoring_findings_read + post: + description: Trigger the scan of an AWS resource with a high priority. + operationId: CreateAwsOnDemandTask + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AwsOnDemandCreateRequest' + description: The definition of the on demand task. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/AwsOnDemandResponse' + description: AWS on demand task created successfully. + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Post an AWS on demand task + tags: + - Agentless Scanning + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - security_monitoring_findings_write + /api/v2/agentless_scanning/ondemand/aws/{task_id}: + get: + description: Fetch the data of a specific on demand task. + operationId: RetrieveAwsOnDemandTask + parameters: + - $ref: '#/components/parameters/OnDemandTaskId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AwsOnDemandResponse' + description: OK. + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get AWS On Demand task by id + tags: + - Agentless Scanning + x-permission: + operator: OR + permissions: + - security_monitoring_findings_read /api/v2/api_keys: get: description: List all API keys available for your account. diff --git a/examples/v2/agentless-scanning/CreateAwsOnDemandTask.java b/examples/v2/agentless-scanning/CreateAwsOnDemandTask.java new file mode 100644 index 00000000000..5d82600d1f9 --- /dev/null +++ b/examples/v2/agentless-scanning/CreateAwsOnDemandTask.java @@ -0,0 +1,38 @@ +// Post an AWS on demand task returns "AWS on demand task created 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.AwsOnDemandCreateAttributes; +import com.datadog.api.client.v2.model.AwsOnDemandCreateData; +import com.datadog.api.client.v2.model.AwsOnDemandCreateRequest; +import com.datadog.api.client.v2.model.AwsOnDemandResponse; +import com.datadog.api.client.v2.model.AwsOnDemandType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + AgentlessScanningApi apiInstance = new AgentlessScanningApi(defaultClient); + + AwsOnDemandCreateRequest body = + new AwsOnDemandCreateRequest() + .data( + new AwsOnDemandCreateData() + .attributes( + new AwsOnDemandCreateAttributes() + .arn( + "arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test")) + .type(AwsOnDemandType.AWS_RESOURCE)); + + try { + AwsOnDemandResponse result = apiInstance.createAwsOnDemandTask(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentlessScanningApi#createAwsOnDemandTask"); + 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/CreateAwsScanOptions.java b/examples/v2/agentless-scanning/CreateAwsScanOptions.java index 3bc0e992e9d..22130912958 100644 --- a/examples/v2/agentless-scanning/CreateAwsScanOptions.java +++ b/examples/v2/agentless-scanning/CreateAwsScanOptions.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.AwsScanOptionsAttributes; +import com.datadog.api.client.v2.model.AwsScanOptionsCreateAttributes; import com.datadog.api.client.v2.model.AwsScanOptionsCreateData; import com.datadog.api.client.v2.model.AwsScanOptionsCreateRequest; import com.datadog.api.client.v2.model.AwsScanOptionsResponse; @@ -21,7 +21,7 @@ public static void main(String[] args) { .id("000000000003") .type(AwsScanOptionsType.AWS_SCAN_OPTIONS) .attributes( - new AwsScanOptionsAttributes() + new AwsScanOptionsCreateAttributes() .lambda(true) .sensitiveData(false) .vulnContainersOs(true) diff --git a/examples/v2/agentless-scanning/ListAwsOnDemandTasks.java b/examples/v2/agentless-scanning/ListAwsOnDemandTasks.java new file mode 100644 index 00000000000..89b1a4101a1 --- /dev/null +++ b/examples/v2/agentless-scanning/ListAwsOnDemandTasks.java @@ -0,0 +1,24 @@ +// Get AWS On Demand tasks returns "OK" 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.AwsOnDemandListResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + AgentlessScanningApi apiInstance = new AgentlessScanningApi(defaultClient); + + try { + AwsOnDemandListResponse result = apiInstance.listAwsOnDemandTasks(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentlessScanningApi#listAwsOnDemandTasks"); + 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/RetrieveAwsOnDemandTask.java b/examples/v2/agentless-scanning/RetrieveAwsOnDemandTask.java new file mode 100644 index 00000000000..4e64885bb55 --- /dev/null +++ b/examples/v2/agentless-scanning/RetrieveAwsOnDemandTask.java @@ -0,0 +1,25 @@ +// Get AWS On Demand task by id returns "OK." 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.AwsOnDemandResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + AgentlessScanningApi apiInstance = new AgentlessScanningApi(defaultClient); + + try { + AwsOnDemandResponse result = + apiInstance.retrieveAwsOnDemandTask("63d6b4f5-e5d0-4d90-824a-9580f05f026a"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentlessScanningApi#retrieveAwsOnDemandTask"); + 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 976f4cb395c..dbadff510d5 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,6 +4,9 @@ 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.AwsOnDemandCreateRequest; +import com.datadog.api.client.v2.model.AwsOnDemandListResponse; +import com.datadog.api.client.v2.model.AwsOnDemandResponse; import com.datadog.api.client.v2.model.AwsScanOptionsCreateRequest; import com.datadog.api.client.v2.model.AwsScanOptionsListResponse; import com.datadog.api.client.v2.model.AwsScanOptionsResponse; @@ -46,6 +49,139 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Post an AWS on demand task. + * + *

See {@link #createAwsOnDemandTaskWithHttpInfo}. + * + * @param body The definition of the on demand task. (required) + * @return AwsOnDemandResponse + * @throws ApiException if fails to make API call + */ + public AwsOnDemandResponse createAwsOnDemandTask(AwsOnDemandCreateRequest body) + throws ApiException { + return createAwsOnDemandTaskWithHttpInfo(body).getData(); + } + + /** + * Post an AWS on demand task. + * + *

See {@link #createAwsOnDemandTaskWithHttpInfoAsync}. + * + * @param body The definition of the on demand task. (required) + * @return CompletableFuture<AwsOnDemandResponse> + */ + public CompletableFuture createAwsOnDemandTaskAsync( + AwsOnDemandCreateRequest body) { + return createAwsOnDemandTaskWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Trigger the scan of an AWS resource with a high priority. + * + * @param body The definition of the on demand task. (required) + * @return ApiResponse<AwsOnDemandResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 AWS on demand task created successfully. -
400 Bad Request -
403 Not Authorized -
429 Too many requests -
+ */ + public ApiResponse createAwsOnDemandTaskWithHttpInfo( + AwsOnDemandCreateRequest 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 createAwsOnDemandTask"); + } + // create path and map variables + String localVarPath = "/api/v2/agentless_scanning/ondemand/aws"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.createAwsOnDemandTask", + 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 an AWS on demand task. + * + *

See {@link #createAwsOnDemandTaskWithHttpInfo}. + * + * @param body The definition of the on demand task. (required) + * @return CompletableFuture<ApiResponse<AwsOnDemandResponse>> + */ + public CompletableFuture> createAwsOnDemandTaskWithHttpInfoAsync( + AwsOnDemandCreateRequest 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 createAwsOnDemandTask")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/agentless_scanning/ondemand/aws"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.createAwsOnDemandTask", + 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() {}); + } + /** * Post AWS Scan Options. * @@ -314,6 +450,117 @@ public CompletableFuture> deleteAwsScanOptionsWithHttpInfoAsyn null); } + /** + * Get AWS On Demand tasks. + * + *

See {@link #listAwsOnDemandTasksWithHttpInfo}. + * + * @return AwsOnDemandListResponse + * @throws ApiException if fails to make API call + */ + public AwsOnDemandListResponse listAwsOnDemandTasks() throws ApiException { + return listAwsOnDemandTasksWithHttpInfo().getData(); + } + + /** + * Get AWS On Demand tasks. + * + *

See {@link #listAwsOnDemandTasksWithHttpInfoAsync}. + * + * @return CompletableFuture<AwsOnDemandListResponse> + */ + public CompletableFuture listAwsOnDemandTasksAsync() { + return listAwsOnDemandTasksWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Fetches the most recent 1000 AWS on demand tasks. + * + * @return ApiResponse<AwsOnDemandListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Not Authorized -
429 Too many requests -
+ */ + public ApiResponse listAwsOnDemandTasksWithHttpInfo() + throws ApiException { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/agentless_scanning/ondemand/aws"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.listAwsOnDemandTasks", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get AWS On Demand tasks. + * + *

See {@link #listAwsOnDemandTasksWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<AwsOnDemandListResponse>> + */ + public CompletableFuture> + listAwsOnDemandTasksWithHttpInfoAsync() { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/agentless_scanning/ondemand/aws"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.listAwsOnDemandTasks", + 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( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Get AWS Scan Options. * @@ -425,6 +672,142 @@ public ApiResponse listAwsScanOptionsWithHttpInfo() new GenericType() {}); } + /** + * Get AWS On Demand task by id. + * + *

See {@link #retrieveAwsOnDemandTaskWithHttpInfo}. + * + * @param taskId The UUID of the task. (required) + * @return AwsOnDemandResponse + * @throws ApiException if fails to make API call + */ + public AwsOnDemandResponse retrieveAwsOnDemandTask(String taskId) throws ApiException { + return retrieveAwsOnDemandTaskWithHttpInfo(taskId).getData(); + } + + /** + * Get AWS On Demand task by id. + * + *

See {@link #retrieveAwsOnDemandTaskWithHttpInfoAsync}. + * + * @param taskId The UUID of the task. (required) + * @return CompletableFuture<AwsOnDemandResponse> + */ + public CompletableFuture retrieveAwsOnDemandTaskAsync(String taskId) { + return retrieveAwsOnDemandTaskWithHttpInfoAsync(taskId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Fetch the data of a specific on demand task. + * + * @param taskId The UUID of the task. (required) + * @return ApiResponse<AwsOnDemandResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK. -
400 Bad Request -
403 Not Authorized -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse retrieveAwsOnDemandTaskWithHttpInfo(String taskId) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'taskId' is set + if (taskId == null) { + throw new ApiException( + 400, "Missing the required parameter 'taskId' when calling retrieveAwsOnDemandTask"); + } + // create path and map variables + String localVarPath = + "/api/v2/agentless_scanning/ondemand/aws/{task_id}" + .replaceAll("\\{" + "task_id" + "\\}", apiClient.escapeString(taskId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.retrieveAwsOnDemandTask", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get AWS On Demand task by id. + * + *

See {@link #retrieveAwsOnDemandTaskWithHttpInfo}. + * + * @param taskId The UUID of the task. (required) + * @return CompletableFuture<ApiResponse<AwsOnDemandResponse>> + */ + public CompletableFuture> + retrieveAwsOnDemandTaskWithHttpInfoAsync(String taskId) { + Object localVarPostBody = null; + + // verify the required parameter 'taskId' is set + if (taskId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'taskId' when calling retrieveAwsOnDemandTask")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/agentless_scanning/ondemand/aws/{task_id}" + .replaceAll("\\{" + "task_id" + "\\}", apiClient.escapeString(taskId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.retrieveAwsOnDemandTask", + 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( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Patch AWS Scan Options. * diff --git a/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandAttributes.java new file mode 100644 index 00000000000..96237c1e9e5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandAttributes.java @@ -0,0 +1,221 @@ +/* + * 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 on demand task. */ +@JsonPropertyOrder({ + AwsOnDemandAttributes.JSON_PROPERTY_ARN, + AwsOnDemandAttributes.JSON_PROPERTY_ASSIGNED_AT, + AwsOnDemandAttributes.JSON_PROPERTY_CREATED_AT, + AwsOnDemandAttributes.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsOnDemandAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ARN = "arn"; + private String arn; + + public static final String JSON_PROPERTY_ASSIGNED_AT = "assigned_at"; + private String assignedAt; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private String createdAt; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public AwsOnDemandAttributes arn(String arn) { + this.arn = arn; + return this; + } + + /** + * The arn of the resource to scan. + * + * @return arn + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ARN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getArn() { + return arn; + } + + public void setArn(String arn) { + this.arn = arn; + } + + public AwsOnDemandAttributes assignedAt(String assignedAt) { + this.assignedAt = assignedAt; + return this; + } + + /** + * Specifies the assignment timestamp if the task has been already assigned to a scanner. + * + * @return assignedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ASSIGNED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAssignedAt() { + return assignedAt; + } + + public void setAssignedAt(String assignedAt) { + this.assignedAt = assignedAt; + } + + public AwsOnDemandAttributes createdAt(String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The task submission timestamp. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public AwsOnDemandAttributes status(String status) { + this.status = status; + return this; + } + + /** + * Indicates the status of the task. QUEUED: the task has been submitted successfully and the + * resource has not been assigned to a scanner yet. ASSIGNED: the task has been assigned. ABORTED: + * the scan has been aborted after a period of time due to technical reasons, such as resource not + * found, insufficient permissions, or the absence of a configured scanner. + * + * @return status + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + /** + * 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 AwsOnDemandAttributes + */ + @JsonAnySetter + public AwsOnDemandAttributes 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 AwsOnDemandAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsOnDemandAttributes awsOnDemandAttributes = (AwsOnDemandAttributes) o; + return Objects.equals(this.arn, awsOnDemandAttributes.arn) + && Objects.equals(this.assignedAt, awsOnDemandAttributes.assignedAt) + && Objects.equals(this.createdAt, awsOnDemandAttributes.createdAt) + && Objects.equals(this.status, awsOnDemandAttributes.status) + && Objects.equals(this.additionalProperties, awsOnDemandAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arn, assignedAt, createdAt, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsOnDemandAttributes {\n"); + sb.append(" arn: ").append(toIndentedString(arn)).append("\n"); + sb.append(" assignedAt: ").append(toIndentedString(assignedAt)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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/AwsOnDemandCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandCreateAttributes.java new file mode 100644 index 00000000000..b6cd8e99e20 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandCreateAttributes.java @@ -0,0 +1,137 @@ +/* + * 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 on demand task. */ +@JsonPropertyOrder({AwsOnDemandCreateAttributes.JSON_PROPERTY_ARN}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsOnDemandCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ARN = "arn"; + private String arn; + + public AwsOnDemandCreateAttributes arn(String arn) { + this.arn = arn; + return this; + } + + /** + * The arn of the resource to scan. Agentless supports the scan of EC2 instances, lambda + * functions, AMI, ECR, RDS and S3 buckets. + * + * @return arn + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ARN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getArn() { + return arn; + } + + public void setArn(String arn) { + this.arn = arn; + } + + /** + * 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 AwsOnDemandCreateAttributes + */ + @JsonAnySetter + public AwsOnDemandCreateAttributes 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 AwsOnDemandCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsOnDemandCreateAttributes awsOnDemandCreateAttributes = (AwsOnDemandCreateAttributes) o; + return Objects.equals(this.arn, awsOnDemandCreateAttributes.arn) + && Objects.equals( + this.additionalProperties, awsOnDemandCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arn, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsOnDemandCreateAttributes {\n"); + sb.append(" arn: ").append(toIndentedString(arn)).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/AwsOnDemandCreateData.java b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandCreateData.java new file mode 100644 index 00000000000..d9de840b528 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandCreateData.java @@ -0,0 +1,181 @@ +/* + * 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 a single AWS on demand task. */ +@JsonPropertyOrder({ + AwsOnDemandCreateData.JSON_PROPERTY_ATTRIBUTES, + AwsOnDemandCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsOnDemandCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AwsOnDemandCreateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AwsOnDemandType type = AwsOnDemandType.AWS_RESOURCE; + + public AwsOnDemandCreateData() {} + + @JsonCreator + public AwsOnDemandCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AwsOnDemandCreateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AwsOnDemandType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AwsOnDemandCreateData attributes(AwsOnDemandCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for the AWS on demand task. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AwsOnDemandCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AwsOnDemandCreateAttributes attributes) { + this.attributes = attributes; + } + + public AwsOnDemandCreateData type(AwsOnDemandType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the on demand task. The value should always be aws_resource. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AwsOnDemandType getType() { + return type; + } + + public void setType(AwsOnDemandType 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 AwsOnDemandCreateData + */ + @JsonAnySetter + public AwsOnDemandCreateData 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 AwsOnDemandCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsOnDemandCreateData awsOnDemandCreateData = (AwsOnDemandCreateData) o; + return Objects.equals(this.attributes, awsOnDemandCreateData.attributes) + && Objects.equals(this.type, awsOnDemandCreateData.type) + && Objects.equals(this.additionalProperties, awsOnDemandCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsOnDemandCreateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).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/AwsOnDemandCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandCreateRequest.java new file mode 100644 index 00000000000..43998b84a0d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandCreateRequest.java @@ -0,0 +1,145 @@ +/* + * 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 on demand task to submit. */ +@JsonPropertyOrder({AwsOnDemandCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsOnDemandCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AwsOnDemandCreateData data; + + public AwsOnDemandCreateRequest() {} + + @JsonCreator + public AwsOnDemandCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) AwsOnDemandCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AwsOnDemandCreateRequest data(AwsOnDemandCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Object for a single AWS on demand task. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AwsOnDemandCreateData getData() { + return data; + } + + public void setData(AwsOnDemandCreateData 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 AwsOnDemandCreateRequest + */ + @JsonAnySetter + public AwsOnDemandCreateRequest 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 AwsOnDemandCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsOnDemandCreateRequest awsOnDemandCreateRequest = (AwsOnDemandCreateRequest) o; + return Objects.equals(this.data, awsOnDemandCreateRequest.data) + && Objects.equals(this.additionalProperties, awsOnDemandCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsOnDemandCreateRequest {\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/AwsOnDemandData.java b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandData.java new file mode 100644 index 00000000000..b70b5560a49 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandData.java @@ -0,0 +1,196 @@ +/* + * 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; + +/** Single AWS on demand task. */ +@JsonPropertyOrder({ + AwsOnDemandData.JSON_PROPERTY_ATTRIBUTES, + AwsOnDemandData.JSON_PROPERTY_ID, + AwsOnDemandData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsOnDemandData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AwsOnDemandAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AwsOnDemandType type = AwsOnDemandType.AWS_RESOURCE; + + public AwsOnDemandData attributes(AwsOnDemandAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for the AWS on demand task. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AwsOnDemandAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AwsOnDemandAttributes attributes) { + this.attributes = attributes; + } + + public AwsOnDemandData id(String id) { + this.id = id; + return this; + } + + /** + * The UUID of the task. + * + * @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 AwsOnDemandData type(AwsOnDemandType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the on demand task. The value should always be aws_resource. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AwsOnDemandType getType() { + return type; + } + + public void setType(AwsOnDemandType 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 AwsOnDemandData + */ + @JsonAnySetter + public AwsOnDemandData 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 AwsOnDemandData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsOnDemandData awsOnDemandData = (AwsOnDemandData) o; + return Objects.equals(this.attributes, awsOnDemandData.attributes) + && Objects.equals(this.id, awsOnDemandData.id) + && Objects.equals(this.type, awsOnDemandData.type) + && Objects.equals(this.additionalProperties, awsOnDemandData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsOnDemandData {\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/AwsOnDemandListResponse.java b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandListResponse.java new file mode 100644 index 00000000000..5c32531ffc5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandListResponse.java @@ -0,0 +1,149 @@ +/* + * 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 on demand tasks. */ +@JsonPropertyOrder({AwsOnDemandListResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsOnDemandListResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public AwsOnDemandListResponse data(List data) { + this.data = data; + for (AwsOnDemandData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AwsOnDemandListResponse addDataItem(AwsOnDemandData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * A list of on demand tasks. + * + * @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 AwsOnDemandListResponse + */ + @JsonAnySetter + public AwsOnDemandListResponse 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 AwsOnDemandListResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsOnDemandListResponse awsOnDemandListResponse = (AwsOnDemandListResponse) o; + return Objects.equals(this.data, awsOnDemandListResponse.data) + && Objects.equals(this.additionalProperties, awsOnDemandListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsOnDemandListResponse {\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/AwsOnDemandResponse.java b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandResponse.java new file mode 100644 index 00000000000..341119729fd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandResponse.java @@ -0,0 +1,136 @@ +/* + * 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; + +/** Response object that includes an AWS on demand task. */ +@JsonPropertyOrder({AwsOnDemandResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsOnDemandResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AwsOnDemandData data; + + public AwsOnDemandResponse data(AwsOnDemandData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Single AWS on demand task. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AwsOnDemandData getData() { + return data; + } + + public void setData(AwsOnDemandData 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 AwsOnDemandResponse + */ + @JsonAnySetter + public AwsOnDemandResponse 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 AwsOnDemandResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsOnDemandResponse awsOnDemandResponse = (AwsOnDemandResponse) o; + return Objects.equals(this.data, awsOnDemandResponse.data) + && Objects.equals(this.additionalProperties, awsOnDemandResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsOnDemandResponse {\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/AwsOnDemandType.java b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandType.java new file mode 100644 index 00000000000..19393ebacd5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsOnDemandType.java @@ -0,0 +1,54 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of the on demand task. The value should always be aws_resource. */ +@JsonSerialize(using = AwsOnDemandType.AwsOnDemandTypeSerializer.class) +public class AwsOnDemandType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("aws_resource")); + + public static final AwsOnDemandType AWS_RESOURCE = new AwsOnDemandType("aws_resource"); + + AwsOnDemandType(String value) { + super(value, allowedValues); + } + + public static class AwsOnDemandTypeSerializer extends StdSerializer { + public AwsOnDemandTypeSerializer(Class t) { + super(t); + } + + public AwsOnDemandTypeSerializer() { + this(null); + } + + @Override + public void serialize(AwsOnDemandType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AwsOnDemandType fromValue(String value) { + return new AwsOnDemandType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateAttributes.java new file mode 100644 index 00000000000..957b05cf44c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateAttributes.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 create. */ +@JsonPropertyOrder({ + AwsScanOptionsCreateAttributes.JSON_PROPERTY_LAMBDA, + AwsScanOptionsCreateAttributes.JSON_PROPERTY_SENSITIVE_DATA, + AwsScanOptionsCreateAttributes.JSON_PROPERTY_VULN_CONTAINERS_OS, + AwsScanOptionsCreateAttributes.JSON_PROPERTY_VULN_HOST_OS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsScanOptionsCreateAttributes { + @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 AwsScanOptionsCreateAttributes 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 AwsScanOptionsCreateAttributes 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 AwsScanOptionsCreateAttributes 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 AwsScanOptionsCreateAttributes 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 AwsScanOptionsCreateAttributes + */ + @JsonAnySetter + public AwsScanOptionsCreateAttributes 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 AwsScanOptionsCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsScanOptionsCreateAttributes awsScanOptionsCreateAttributes = + (AwsScanOptionsCreateAttributes) o; + return Objects.equals(this.lambda, awsScanOptionsCreateAttributes.lambda) + && Objects.equals(this.sensitiveData, awsScanOptionsCreateAttributes.sensitiveData) + && Objects.equals(this.vulnContainersOs, awsScanOptionsCreateAttributes.vulnContainersOs) + && Objects.equals(this.vulnHostOs, awsScanOptionsCreateAttributes.vulnHostOs) + && Objects.equals( + this.additionalProperties, awsScanOptionsCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(lambda, sensitiveData, vulnContainersOs, vulnHostOs, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsScanOptionsCreateAttributes {\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/AwsScanOptionsCreateData.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateData.java index 59bec89eccb..c1393e903fb 100644 --- a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateData.java +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsCreateData.java @@ -28,7 +28,7 @@ public class AwsScanOptionsCreateData { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; - private AwsScanOptionsAttributes attributes; + private AwsScanOptionsCreateAttributes attributes; public static final String JSON_PROPERTY_ID = "id"; private String id; @@ -41,7 +41,7 @@ public AwsScanOptionsCreateData() {} @JsonCreator public AwsScanOptionsCreateData( @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) - AwsScanOptionsAttributes attributes, + AwsScanOptionsCreateAttributes attributes, @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AwsScanOptionsType type) { this.attributes = attributes; @@ -51,24 +51,24 @@ public AwsScanOptionsCreateData( this.unparsed |= !type.isValid(); } - public AwsScanOptionsCreateData attributes(AwsScanOptionsAttributes attributes) { + public AwsScanOptionsCreateData attributes(AwsScanOptionsCreateAttributes attributes) { this.attributes = attributes; this.unparsed |= attributes.unparsed; return this; } /** - * Attributes for the AWS scan options. + * Attributes for the AWS scan options to create. * * @return attributes */ @JsonProperty(JSON_PROPERTY_ATTRIBUTES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public AwsScanOptionsAttributes getAttributes() { + public AwsScanOptionsCreateAttributes getAttributes() { return attributes; } - public void setAttributes(AwsScanOptionsAttributes attributes) { + public void setAttributes(AwsScanOptionsCreateAttributes attributes) { this.attributes = attributes; } @@ -78,7 +78,7 @@ public AwsScanOptionsCreateData id(String id) { } /** - * The ID of an AWS account. + * The ID of the AWS account. * * @return id */ 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 index 0890007e096..0c8c2dde222 100644 --- a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsUpdateData.java +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsUpdateData.java @@ -42,9 +42,11 @@ public AwsScanOptionsUpdateData() {} public AwsScanOptionsUpdateData( @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) AwsScanOptionsUpdateAttributes 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(); } @@ -80,9 +82,8 @@ public AwsScanOptionsUpdateData id(String id) { * * @return id */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getId() { return id; } diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..4f8c861ebd5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-03-05T15:30:08.481Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Bad_Request_response.json new file mode 100644 index 00000000000..fe4cf251d57 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Bad_Request_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/agentless_scanning/ondemand/aws/invalid-uuid", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"missing or invalid url parameter 'taskId', expected uuid format '6d09294c-9ad9-42fd-a759-a0c1599b4843'\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4fd99083-06ab-185c-0a48-d579a5f192c1" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..53f971f7cda --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-03-05T15:30:08.801Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Not_Found_response.json new file mode 100644 index 00000000000..8f47c5e0492 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/agentless_scanning/ondemand/aws/00000000-0000-0000-824a-000000000000", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"404\",\"detail\":\"no task found with id '00000000-0000-0000-824a-000000000000'\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "fa2322eb-4e11-c229-ab3c-0bd21e1ecfe8" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_OK_response.freeze new file mode 100644 index 00000000000..aef71dff70d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-03-05T15:30:08.891Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_OK_response.json new file mode 100644 index 00000000000..957ddf094e1 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_task_by_id_returns_OK_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/agentless_scanning/ondemand/aws/63d6b4f5-e5d0-4d90-824a-9580f05f026a", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"63d6b4f5-e5d0-4d90-824a-9580f05f026a\",\"type\":\"aws_resource\",\"attributes\":{\"arn\":\"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test\",\"created_at\":\"2025-03-05T14:24:46.915915Z\",\"status\":\"QUEUED\"}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6e597e91-1a7b-26f6-97a8-b4b2658f33d9" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_tasks_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_tasks_returns_OK_response.freeze new file mode 100644 index 00000000000..80426ffe120 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_tasks_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-03-05T15:30:08.978Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_tasks_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_tasks_returns_OK_response.json new file mode 100644 index 00000000000..58d487b575b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_AWS_On_Demand_tasks_returns_OK_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/agentless_scanning/ondemand/aws", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"id\":\"32ee93e6-7433-4d86-9693-be88093efa77\",\"type\":\"aws_resource\",\"attributes\":{\"arn\":\"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test\",\"created_at\":\"2025-03-05T15:25:35.357991Z\",\"status\":\"QUEUED\"}},{\"id\":\"82b9e788-43d3-45da-a2a9-8f538436fed3\",\"type\":\"aws_resource\",\"attributes\":{\"arn\":\"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test\",\"created_at\":\"2025-03-05T15:15:23.375332Z\",\"status\":\"QUEUED\"}},{\"id\":\"63d6b4f5-e5d0-4d90-824a-9580f05f026a\",\"type\":\"aws_resource\",\"attributes\":{\"arn\":\"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test\",\"created_at\":\"2025-03-05T14:24:46.915915Z\",\"status\":\"QUEUED\"}},{\"id\":\"2c72b302-df17-47e7-9b00-3bf4e0223dc3\",\"type\":\"aws_resource\",\"attributes\":{\"arn\":\"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test\",\"created_at\":\"2025-03-05T14:24:14.313176Z\",\"status\":\"QUEUED\"}},{\"id\":\"abc87e8d-b450-4141-b596-8bf1a3883c56\",\"type\":\"aws_resource\",\"attributes\":{\"arn\":\"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test\",\"created_at\":\"2025-03-05T14:22:17.132833Z\",\"status\":\"QUEUED\"}},{\"id\":\"fbee88e3-f898-4d73-8da8-f19500efd081\",\"type\":\"aws_resource\",\"attributes\":{\"arn\":\"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test\",\"created_at\":\"2025-03-05T14:08:01.876649Z\",\"status\":\"QUEUED\"}},{\"id\":\"ed30acf1-731e-410c-8559-53c290bd37f5\",\"type\":\"aws_resource\",\"attributes\":{\"arn\":\"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test\",\"created_at\":\"2025-03-05T14:06:43.435923Z\",\"status\":\"QUEUED\"}}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "7442c701-c89c-a74b-3de9-6b4cff876178" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_AWS_on_demand_task_created_successfully_response.freeze b/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_AWS_on_demand_task_created_successfully_response.freeze new file mode 100644 index 00000000000..28fd0505ba6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_AWS_on_demand_task_created_successfully_response.freeze @@ -0,0 +1 @@ +2025-03-05T15:30:09.058Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_AWS_on_demand_task_created_successfully_response.json b/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_AWS_on_demand_task_created_successfully_response.json new file mode 100644 index 00000000000..5d07287a5a0 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_AWS_on_demand_task_created_successfully_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"arn\":\"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test\"},\"type\":\"aws_resource\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/agentless_scanning/ondemand/aws", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"aaa12247-2b39-4b70-a2fd-a804840e17f5\",\"type\":\"aws_resource\",\"attributes\":{\"arn\":\"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test\",\"created_at\":\"2025-03-05T15:30:09.129732Z\",\"status\":\"QUEUED\"}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "00ab1d14-e325-68fb-f9c3-515f72084164" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..cb96998facd --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-03-05T15:30:09.154Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_Bad_Request_response.json new file mode 100644 index 00000000000..8c36c859bc5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_an_AWS_on_demand_task_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"arn\":\"invalid-arn\"},\"type\":\"aws_resource\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/agentless_scanning/ondemand/aws", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"invalid aws resource arn\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ddc95453-e78c-c1f7-f3a9-441d29765f2e" + } +] \ 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 2152f133526..28723bdadfe 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 @@ -11,41 +11,70 @@ Feature: Agentless Scanning And a valid "appKeyAuth" key in the system And an instance of "AgentlessScanning" API - @team:DataDog/k9-cloud-security-platform + @team:DataDog/k9-agentless 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 + @generated @skip @team:DataDog/k9-agentless 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 + @team:DataDog/k9-agentless 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 + @team:DataDog/k9-agentless + Scenario: Get AWS On Demand task by id returns "Bad Request" response + Given new "RetrieveAwsOnDemandTask" request + And request contains "task_id" parameter with value "invalid-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-agentless + Scenario: Get AWS On Demand task by id returns "Not Found" response + Given new "RetrieveAwsOnDemandTask" request + And request contains "task_id" parameter with value "00000000-0000-0000-824a-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-agentless + Scenario: Get AWS On Demand task by id returns "OK." response + Given new "RetrieveAwsOnDemandTask" request + And request contains "task_id" parameter with value "63d6b4f5-e5d0-4d90-824a-9580f05f026a" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.arn" is equal to "arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test" + + @team:DataDog/k9-agentless + Scenario: Get AWS On Demand tasks returns "OK" response + Given new "ListAwsOnDemandTasks" request + When the request is sent + Then the response status is 200 OK + And the response "data[0].type" is equal to "aws_resource" + + @team:DataDog/k9-agentless 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 + @skip @team:DataDog/k9-agentless 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 + @team:DataDog/k9-agentless Scenario: Patch AWS Scan Options returns "Bad Request" response 2 Given new "UpdateAwsScanOptions" request And request contains "account_id" parameter with value "000000000003" @@ -53,7 +82,7 @@ Feature: Agentless Scanning When the request is sent Then the response status is 400 Bad Request - @team:DataDog/k9-cloud-security-platform + @team:DataDog/k9-agentless Scenario: Patch AWS Scan Options returns "No Content" response Given new "UpdateAwsScanOptions" request And request contains "account_id" parameter with value "000000000002" @@ -61,7 +90,7 @@ Feature: Agentless Scanning When the request is sent Then the response status is 204 No Content - @team:DataDog/k9-cloud-security-platform + @team:DataDog/k9-agentless Scenario: Patch AWS Scan Options returns "Not Found" response Given new "UpdateAwsScanOptions" request And request contains "account_id" parameter with value "000000000005" @@ -69,23 +98,39 @@ Feature: Agentless Scanning When the request is sent Then the response status is 404 Not Found - @skip @team:DataDog/k9-cloud-security-platform + @skip @team:DataDog/k9-agentless 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 + @team:DataDog/k9-agentless 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 + @team:DataDog/k9-agentless 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 + + @team:DataDog/k9-agentless + Scenario: Post an AWS on demand task returns "AWS on demand task created successfully." response + Given new "CreateAwsOnDemandTask" request + And body with value {"data": {"attributes": {"arn": "arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test"}, "type": "aws_resource"}} + When the request is sent + Then the response status is 201 AWS on demand task created successfully + And the response "data.attributes.arn" is equal to "arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test" + And the response "data.attributes.status" is equal to "QUEUED" + + @team:DataDog/k9-agentless + Scenario: Post an AWS on demand task returns "Bad Request" response + Given new "CreateAwsOnDemandTask" request + And body with value {"data": {"attributes": {"arn": "invalid-arn"}, "type": "aws_resource"}} + When the request is sent + Then the response status is 400 Bad Request 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 c54fe630b56..35fcbc9803e 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 @@ -61,6 +61,24 @@ "type": "idempotent" } }, + "ListAwsOnDemandTasks": { + "tag": "Agentless Scanning", + "undo": { + "type": "safe" + } + }, + "CreateAwsOnDemandTask": { + "tag": "Agentless Scanning", + "undo": { + "type": "idempotent" + } + }, + "RetrieveAwsOnDemandTask": { + "tag": "Agentless Scanning", + "undo": { + "type": "safe" + } + }, "ListAPIKeys": { "tag": "Key Management", "undo": {