From 2d79bbc39d07d55f6c4f0052d637d72ff51608cc Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 8 Jan 2025 14:04:21 +0000 Subject: [PATCH] Regenerate client from commit 1920836f of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 74 ++++++ .../ListAwsScanOptions.java | 24 ++ .../client/v2/api/AgentlessScanningApi.java | 155 +++++++++++++ .../v2/model/AwsScanOptionsAttributes.java | 218 ++++++++++++++++++ .../client/v2/model/AwsScanOptionsData.java | 196 ++++++++++++++++ .../v2/model/AwsScanOptionsResponse.java | 149 ++++++++++++ .../client/v2/model/AwsScanOptionsType.java | 55 +++++ ...WS_Scan_Options_returns_OK_response.freeze | 1 + ..._AWS_Scan_Options_returns_OK_response.json | 28 +++ .../client/v2/api/agentless_scanning.feature | 16 ++ .../com/datadog/api/client/v2/api/undo.json | 6 + 12 files changed, 926 insertions(+), 4 deletions(-) create mode 100644 examples/v2/agentless-scanning/ListAwsScanOptions.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/AgentlessScanningApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsType.java create mode 100644 src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.json create mode 100644 src/test/resources/com/datadog/api/client/v2/api/agentless_scanning.feature diff --git a/.apigentools-info b/.apigentools-info index e07099800cf..e7dd4e2644f 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-07 19:53:49.892944", - "spec_repo_commit": "d63fa330" + "regenerated": "2025-01-08 14:02:25.501612", + "spec_repo_commit": "1920836f" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-07 19:53:49.909013", - "spec_repo_commit": "d63fa330" + "regenerated": "2025-01-08 14:02:25.524422", + "spec_repo_commit": "1920836f" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ede090899d5..fadab8d3ec6 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2732,6 +2732,57 @@ components: $ref: '#/components/schemas/AwsCURConfig' type: array type: object + AwsScanOptionsAttributes: + description: Attributes for the AWS scan options. + 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 + AwsScanOptionsData: + description: Single AWS Scan Options entry. + properties: + attributes: + $ref: '#/components/schemas/AwsScanOptionsAttributes' + id: + description: The ID of the AWS account. + example: '184366314700' + type: string + type: + $ref: '#/components/schemas/AwsScanOptionsType' + type: object + AwsScanOptionsResponse: + description: Response object that includes a list of AWS scan options. + properties: + data: + description: A list of AWS scan options. + items: + $ref: '#/components/schemas/AwsScanOptionsData' + type: array + type: object + AwsScanOptionsType: + default: aws_scan_options + description: The type of the resource. The value should always be `aws_scan_options`. + enum: + - aws_scan_options + example: aws_scan_options + type: string + x-enum-varnames: + - AWS_SCAN_OPTIONS AzureUCConfig: description: Azure config. properties: @@ -30222,6 +30273,24 @@ info: version: '1.0' openapi: 3.0.0 paths: + /api/v2/agentless_scanning/accounts/aws: + get: + description: Fetches the scan options configured for AWS accounts. + operationId: ListAwsScanOptions + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AwsScanOptionsResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get AWS Scan Options + tags: + - Agentless Scanning /api/v2/api_keys: get: description: List all API keys available for your account. @@ -48131,6 +48200,11 @@ tags: externalDocs: url: https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection name: AWS Logs Integration +- description: "Datadog Agentless Scanning provides visibility into risks and vulnerabilities\nwithin + your hosts, running containers, and serverless functions\u2014all without\nrequiring + teams to install Agents on every host or where Agents cannot be installed.\nGo + to https://www.datadoghq.com/blog/agentless-scanning/ to learn more" + name: Agentless Scanning - description: Datadog App Builder provides a low-code solution to rapidly develop and integrate secure, customized applications into your monitoring stack that are built to accelerate remediation at scale. These API endpoints allow you to diff --git a/examples/v2/agentless-scanning/ListAwsScanOptions.java b/examples/v2/agentless-scanning/ListAwsScanOptions.java new file mode 100644 index 00000000000..fd3b2204fe9 --- /dev/null +++ b/examples/v2/agentless-scanning/ListAwsScanOptions.java @@ -0,0 +1,24 @@ +// Get AWS Scan Options 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.AwsScanOptionsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + AgentlessScanningApi apiInstance = new AgentlessScanningApi(defaultClient); + + try { + AwsScanOptionsResponse result = apiInstance.listAwsScanOptions(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentlessScanningApi#listAwsScanOptions"); + 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 new file mode 100644 index 00000000000..686f83a6e22 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/AgentlessScanningApi.java @@ -0,0 +1,155 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +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.AwsScanOptionsResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AgentlessScanningApi { + private ApiClient apiClient; + + public AgentlessScanningApi() { + this(ApiClient.getDefaultApiClient()); + } + + public AgentlessScanningApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get AWS Scan Options. + * + *

See {@link #listAwsScanOptionsWithHttpInfo}. + * + * @return AwsScanOptionsResponse + * @throws ApiException if fails to make API call + */ + public AwsScanOptionsResponse listAwsScanOptions() throws ApiException { + return listAwsScanOptionsWithHttpInfo().getData(); + } + + /** + * Get AWS Scan Options. + * + *

See {@link #listAwsScanOptionsWithHttpInfoAsync}. + * + * @return CompletableFuture<AwsScanOptionsResponse> + */ + public CompletableFuture listAwsScanOptionsAsync() { + return listAwsScanOptionsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Fetches the scan options configured for AWS accounts. + * + * @return ApiResponse<AwsScanOptionsResponse> + * @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 listAwsScanOptionsWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/agentless_scanning/accounts/aws"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.listAwsScanOptions", + 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 Scan Options. + * + *

See {@link #listAwsScanOptionsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<AwsScanOptionsResponse>> + */ + public CompletableFuture> + listAwsScanOptionsWithHttpInfoAsync() { + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/agentless_scanning/accounts/aws"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.AgentlessScanningApi.listAwsScanOptions", + 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() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsAttributes.java new file mode 100644 index 00000000000..fdfc0682452 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsAttributes.java @@ -0,0 +1,218 @@ +/* + * 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. */ +@JsonPropertyOrder({ + AwsScanOptionsAttributes.JSON_PROPERTY_LAMBDA, + AwsScanOptionsAttributes.JSON_PROPERTY_SENSITIVE_DATA, + AwsScanOptionsAttributes.JSON_PROPERTY_VULN_CONTAINERS_OS, + AwsScanOptionsAttributes.JSON_PROPERTY_VULN_HOST_OS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsScanOptionsAttributes { + @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 AwsScanOptionsAttributes 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 AwsScanOptionsAttributes 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 AwsScanOptionsAttributes 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 AwsScanOptionsAttributes 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 AwsScanOptionsAttributes + */ + @JsonAnySetter + public AwsScanOptionsAttributes 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 AwsScanOptionsAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsScanOptionsAttributes awsScanOptionsAttributes = (AwsScanOptionsAttributes) o; + return Objects.equals(this.lambda, awsScanOptionsAttributes.lambda) + && Objects.equals(this.sensitiveData, awsScanOptionsAttributes.sensitiveData) + && Objects.equals(this.vulnContainersOs, awsScanOptionsAttributes.vulnContainersOs) + && Objects.equals(this.vulnHostOs, awsScanOptionsAttributes.vulnHostOs) + && Objects.equals(this.additionalProperties, awsScanOptionsAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(lambda, sensitiveData, vulnContainersOs, vulnHostOs, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsScanOptionsAttributes {\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/AwsScanOptionsData.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsData.java new file mode 100644 index 00000000000..28b5d34d7ef --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsData.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 Scan Options entry. */ +@JsonPropertyOrder({ + AwsScanOptionsData.JSON_PROPERTY_ATTRIBUTES, + AwsScanOptionsData.JSON_PROPERTY_ID, + AwsScanOptionsData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsScanOptionsData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AwsScanOptionsAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AwsScanOptionsType type = AwsScanOptionsType.AWS_SCAN_OPTIONS; + + public AwsScanOptionsData attributes(AwsScanOptionsAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for the AWS scan options. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AwsScanOptionsAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AwsScanOptionsAttributes attributes) { + this.attributes = attributes; + } + + public AwsScanOptionsData id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the AWS account. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AwsScanOptionsData type(AwsScanOptionsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the resource. The value should always be aws_scan_options. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AwsScanOptionsType getType() { + return type; + } + + public void setType(AwsScanOptionsType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AwsScanOptionsData + */ + @JsonAnySetter + public AwsScanOptionsData 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 AwsScanOptionsData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsScanOptionsData awsScanOptionsData = (AwsScanOptionsData) o; + return Objects.equals(this.attributes, awsScanOptionsData.attributes) + && Objects.equals(this.id, awsScanOptionsData.id) + && Objects.equals(this.type, awsScanOptionsData.type) + && Objects.equals(this.additionalProperties, awsScanOptionsData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsScanOptionsData {\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/AwsScanOptionsResponse.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsResponse.java new file mode 100644 index 00000000000..1460723d8e5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsResponse.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 scan options. */ +@JsonPropertyOrder({AwsScanOptionsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AwsScanOptionsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public AwsScanOptionsResponse data(List data) { + this.data = data; + for (AwsScanOptionsData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AwsScanOptionsResponse addDataItem(AwsScanOptionsData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * A list of AWS scan options. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AwsScanOptionsResponse + */ + @JsonAnySetter + public AwsScanOptionsResponse 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 AwsScanOptionsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AwsScanOptionsResponse awsScanOptionsResponse = (AwsScanOptionsResponse) o; + return Objects.equals(this.data, awsScanOptionsResponse.data) + && Objects.equals(this.additionalProperties, awsScanOptionsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AwsScanOptionsResponse {\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/AwsScanOptionsType.java b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsType.java new file mode 100644 index 00000000000..90d8bc6afa6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AwsScanOptionsType.java @@ -0,0 +1,55 @@ +/* + * 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 resource. The value should always be aws_scan_options. */ +@JsonSerialize(using = AwsScanOptionsType.AwsScanOptionsTypeSerializer.class) +public class AwsScanOptionsType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("aws_scan_options")); + + public static final AwsScanOptionsType AWS_SCAN_OPTIONS = + new AwsScanOptionsType("aws_scan_options"); + + AwsScanOptionsType(String value) { + super(value, allowedValues); + } + + public static class AwsScanOptionsTypeSerializer extends StdSerializer { + public AwsScanOptionsTypeSerializer(Class t) { + super(t); + } + + public AwsScanOptionsTypeSerializer() { + this(null); + } + + @Override + public void serialize(AwsScanOptionsType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AwsScanOptionsType fromValue(String value) { + return new AwsScanOptionsType(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.freeze new file mode 100644 index 00000000000..1b7d36049b7 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-12-18T15:40:11.636Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.json new file mode 100644 index 00000000000..498f4bfa926 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_AWS_Scan_Options_returns_OK_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/agentless_scanning/accounts/aws", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "2cb6ecfe-386c-3349-2689-26da480a6b5d" + } +] \ 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 new file mode 100644 index 00000000000..d37dfee5eef --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/agentless_scanning.feature @@ -0,0 +1,16 @@ +@endpoint(agentless-scanning) @endpoint(agentless-scanning-v2) +Feature: Agentless Scanning + Datadog Agentless Scanning provides visibility into risks and + vulnerabilities within your hosts, running containers, and serverless + functions—all without requiring teams to install Agents on every host or + where Agents cannot be installed. Go to + https://www.datadoghq.com/blog/agentless-scanning/ to learn more + + @team:DataDog/k9-cloud-security-platform + Scenario: Get AWS Scan Options returns "OK" response + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "AgentlessScanning" API + And new "ListAwsScanOptions" request + When the request is sent + Then the response status is 200 OK 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 80ce197c931..d6c6e9de87c 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 @@ -1,4 +1,10 @@ { + "ListAwsScanOptions": { + "tag": "Agentless Scanning", + "undo": { + "type": "safe" + } + }, "ListAPIKeys": { "tag": "Key Management", "undo": {