diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e1ccda720e5..c354fca49e3 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1314,6 +1314,67 @@ components: required: true schema: type: string + RuleBasedViewFramework: + description: Compliance framework handle to filter rules and findings by. + in: query + name: framework + required: false + schema: + default: "" + example: hipaa + type: string + RuleBasedViewIncludeRulesWithoutFindings: + description: When `true`, includes rules in the response that have no associated findings. + in: query + name: include_rules_without_findings + required: false + schema: + default: false + example: false + type: boolean + RuleBasedViewIsCustom: + description: Set to `true` when the requested `framework` is a custom framework. + in: query + name: is_custom + required: false + schema: + example: false + type: boolean + RuleBasedViewQuery: + description: Additional event-platform filters applied to the underlying findings query. For example, `scored:true project_id:datadog-prod-us5`. + in: query + name: query + required: false + schema: + default: "" + example: scored:true + type: string + RuleBasedViewQueryFindingsWithoutFrameworkVersion: + description: When `true`, returns findings without a `framework_version` tag. Used for findings from custom frameworks or those created before framework versioning was introduced. + in: query + name: query_findings_without_framework_version + required: false + schema: + default: false + example: false + type: boolean + RuleBasedViewTo: + description: Timestamp of the query end, in milliseconds since the Unix epoch. + in: query + name: to + required: true + schema: + example: 1739982278000 + format: int64 + type: integer + RuleBasedViewVersion: + description: Version of the compliance framework to filter rules and findings by. + in: query + name: version + required: false + schema: + example: "1" + type: string RuleId: description: The ID of the rule. in: path @@ -60636,6 +60697,194 @@ components: example: Deployments automated via Deployment Trains type: string type: object + RuleBasedViewAttributes: + description: Attributes of the rule-based view. + properties: + count: + description: Total number of rules in the view. + example: 1 + format: int64 + type: integer + rules: + $ref: "#/components/schemas/RuleBasedViewRules" + required: + - count + - rules + type: object + RuleBasedViewComplianceFramework: + description: Compliance framework mapping for a rule. + properties: + control: + description: Identifier of the control inside the requirement. + example: 164.308-a-4-i + type: string + framework: + description: Handle of the compliance framework. + example: hipaa + type: string + is_default: + description: Whether the framework is a Datadog default framework. `true` indicates a Datadog framework and `false` indicates a custom framework. + example: true + type: boolean + message: + description: Optional message describing the framework mapping for the rule. + example: "" + type: string + requirement: + description: Name of the requirement that contains the control. + example: Information-Access-Management + type: string + version: + description: Version of the compliance framework. + example: "1" + type: string + type: object + RuleBasedViewComplianceFrameworks: + description: List of compliance framework mappings associated with the rule. + items: + $ref: "#/components/schemas/RuleBasedViewComplianceFramework" + type: array + RuleBasedViewData: + description: Data envelope for the rule-based view response. + properties: + attributes: + $ref: "#/components/schemas/RuleBasedViewAttributes" + id: + description: Unique identifier of the rule-based view document. + example: JSONAPI_USELESS_ID + type: string + type: + $ref: "#/components/schemas/RuleBasedViewType" + required: + - attributes + - id + - type + type: object + RuleBasedViewResourceAttributes: + description: List of resource attribute names exposed by the rule. + example: + - instance_id + items: + description: Name of a resource attribute exposed by the rule. + example: instance_id + type: string + type: array + RuleBasedViewResponse: + description: Response containing an aggregated view of compliance rules with their finding statistics. + properties: + data: + $ref: "#/components/schemas/RuleBasedViewData" + required: + - data + type: object + RuleBasedViewRule: + description: A compliance rule along with its evaluation statistics and framework mappings. + properties: + compliance_frameworks: + $ref: "#/components/schemas/RuleBasedViewComplianceFrameworks" + enabled: + description: Whether the rule is enabled. + example: true + type: boolean + id: + description: Unique identifier of the rule. + example: qjx-udx-xo8 + type: string + name: + description: Human-readable name of the rule. + example: IAM roles should not allow untrusted GitHub Actions to assume them + type: string + resourceAttributes: + $ref: "#/components/schemas/RuleBasedViewResourceAttributes" + resourceCategory: + description: Resource category targeted by the rule. + example: identity + type: string + resourceType: + description: Resource type targeted by the rule. + example: aws_iam_role + type: string + stats: + $ref: "#/components/schemas/RuleBasedViewRuleStats" + status: + description: Severity associated with the rule (for example, `info`, `low`, `medium`, `high`, or `critical`). + example: critical + type: string + tags: + $ref: "#/components/schemas/RuleBasedViewRuleTags" + type: + $ref: "#/components/schemas/RuleBasedViewRuleCategory" + required: + - compliance_frameworks + - enabled + - id + - name + - resourceAttributes + - resourceCategory + - resourceType + - stats + - status + - tags + - type + type: object + RuleBasedViewRuleCategory: + description: The category of the security rule. + enum: + - cloud_configuration + - infrastructure_configuration + - api_security + example: cloud_configuration + type: string + x-enum-varnames: + - CLOUD_CONFIGURATION + - INFRASTRUCTURE_CONFIGURATION + - API_SECURITY + RuleBasedViewRuleStats: + description: Counts of findings for the rule, grouped by their evaluation status. + properties: + fail: + description: Number of findings that failed evaluation. + example: 0 + format: int64 + type: integer + muted: + description: Number of findings that have been muted. + example: 0 + format: int64 + type: integer + pass: + description: Number of findings that passed evaluation. + example: 3 + format: int64 + type: integer + required: + - fail + - pass + - muted + type: object + RuleBasedViewRuleTags: + description: List of tags attached to the rule. + example: + - security:compliance + items: + description: A tag attached to the rule. + example: security:compliance + type: string + type: array + RuleBasedViewRules: + description: List of rules in the rule-based view. + items: + $ref: "#/components/schemas/RuleBasedViewRule" + type: array + RuleBasedViewType: + default: rule_based_view + description: The type of the resource. The value should always be `rule_based_view`. + enum: + - rule_based_view + example: rule_based_view + type: string + x-enum-varnames: + - RULE_BASED_VIEW RuleId: description: The unique ID for a scorecard rule. example: q8MQxk8TCqrHnWkx @@ -95228,6 +95477,89 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and may be subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/compliance_findings/rule_based_view: + get: + description: |- + Get an aggregated view of compliance rules with their pass, fail, and muted finding counts. + Supports filtering by compliance framework, framework version, and additional query filters. + operationId: GetRuleBasedView + parameters: + - $ref: "#/components/parameters/RuleBasedViewTo" + - $ref: "#/components/parameters/RuleBasedViewFramework" + - $ref: "#/components/parameters/RuleBasedViewVersion" + - $ref: "#/components/parameters/RuleBasedViewQueryFindingsWithoutFrameworkVersion" + - $ref: "#/components/parameters/RuleBasedViewIncludeRulesWithoutFindings" + - $ref: "#/components/parameters/RuleBasedViewIsCustom" + - $ref: "#/components/parameters/RuleBasedViewQuery" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + count: 1 + rules: + - compliance_frameworks: + - control: 164.308-a-4-i + framework: hipaa + is_default: true + message: "" + requirement: Information-Access-Management + version: "1" + enabled: true + id: qjx-udx-xo8 + name: IAM roles should not allow untrusted GitHub Actions to assume them + resourceAttributes: [] + resourceCategory: identity + resourceType: aws_iam_role + stats: + fail: 0 + muted: 0 + pass: 3 + status: critical + tags: + - security:compliance + - cloud_provider:aws + - framework:hipaa + type: cloud_configuration + id: JSONAPI_USELESS_ID + type: rule_based_view + schema: + $ref: "#/components/schemas/RuleBasedViewResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "503": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Service Unavailable + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_findings_read + summary: Get the rule-based view of compliance findings + tags: ["Compliance"] + "x-permission": + operator: OR + permissions: + - security_monitoring_findings_read + x-unstable: |- + **Note**: This endpoint is in Preview and subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/container_images: get: description: |- @@ -147630,6 +147962,12 @@ tags: - description: |- Retrieve and analyze code coverage data from Code Coverage. See the [Code Coverage page](https://docs.datadoghq.com/code_coverage/) for more information. name: Code Coverage + - description: |- + Datadog Cloud Security Misconfigurations provides aggregated views of + compliance rules and findings across your cloud resources, helping you assess + posture against industry frameworks (such as HIPAA, SOC 2, ISO 27001) and custom + frameworks. Learn more at https://docs.datadoghq.com/security/cloud_security_management/misconfigurations/#maintain-compliance-with-industry-frameworks-and-benchmarks. + name: "Compliance" - description: |- Manage your Datadog Confluent Cloud integration accounts and account resources directly through the Datadog API. See the [Confluent Cloud page](https://docs.datadoghq.com/integrations/confluent_cloud/) for more information. name: Confluent Cloud diff --git a/examples/v2/compliance/GetRuleBasedView.java b/examples/v2/compliance/GetRuleBasedView.java new file mode 100644 index 00000000000..c36c2688e3c --- /dev/null +++ b/examples/v2/compliance/GetRuleBasedView.java @@ -0,0 +1,25 @@ +// Get the rule-based view of compliance findings returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ComplianceApi; +import com.datadog.api.client.v2.model.RuleBasedViewResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getRuleBasedView", true); + ComplianceApi apiInstance = new ComplianceApi(defaultClient); + + try { + RuleBasedViewResponse result = apiInstance.getRuleBasedView(1739982278000L); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ComplianceApi#getRuleBasedView"); + 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/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index e5a49467ed4..91249da7223 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -859,6 +859,7 @@ public class ApiClient { put("v2.searchSecurityMonitoringHistsignals", false); put("v2.getCodeCoverageBranchSummary", false); put("v2.getCodeCoverageCommitSummary", false); + put("v2.getRuleBasedView", false); put("v2.getCostAnomaly", false); put("v2.listCostAnomalies", false); put("v2.createDashboardSecureEmbed", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/ComplianceApi.java b/src/main/java/com/datadog/api/client/v2/api/ComplianceApi.java new file mode 100644 index 00000000000..0356193666c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/ComplianceApi.java @@ -0,0 +1,354 @@ +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.RuleBasedViewResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +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 ComplianceApi { + private ApiClient apiClient; + + public ComplianceApi() { + this(ApiClient.getDefaultApiClient()); + } + + public ComplianceApi(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; + } + + /** Manage optional parameters to getRuleBasedView. */ + public static class GetRuleBasedViewOptionalParameters { + private String framework; + private String version; + private Boolean queryFindingsWithoutFrameworkVersion; + private Boolean includeRulesWithoutFindings; + private Boolean isCustom; + private String query; + + /** + * Set framework. + * + * @param framework Compliance framework handle to filter rules and findings by. (optional, + * default to "") + * @return GetRuleBasedViewOptionalParameters + */ + public GetRuleBasedViewOptionalParameters framework(String framework) { + this.framework = framework; + return this; + } + + /** + * Set version. + * + * @param version Version of the compliance framework to filter rules and findings by. + * (optional) + * @return GetRuleBasedViewOptionalParameters + */ + public GetRuleBasedViewOptionalParameters version(String version) { + this.version = version; + return this; + } + + /** + * Set queryFindingsWithoutFrameworkVersion. + * + * @param queryFindingsWithoutFrameworkVersion When true, returns findings without + * a framework_version tag. Used for findings from custom frameworks or those + * created before framework versioning was introduced. (optional, default to false) + * @return GetRuleBasedViewOptionalParameters + */ + public GetRuleBasedViewOptionalParameters queryFindingsWithoutFrameworkVersion( + Boolean queryFindingsWithoutFrameworkVersion) { + this.queryFindingsWithoutFrameworkVersion = queryFindingsWithoutFrameworkVersion; + return this; + } + + /** + * Set includeRulesWithoutFindings. + * + * @param includeRulesWithoutFindings When true, includes rules in the response + * that have no associated findings. (optional, default to false) + * @return GetRuleBasedViewOptionalParameters + */ + public GetRuleBasedViewOptionalParameters includeRulesWithoutFindings( + Boolean includeRulesWithoutFindings) { + this.includeRulesWithoutFindings = includeRulesWithoutFindings; + return this; + } + + /** + * Set isCustom. + * + * @param isCustom Set to true when the requested framework is a + * custom framework. (optional) + * @return GetRuleBasedViewOptionalParameters + */ + public GetRuleBasedViewOptionalParameters isCustom(Boolean isCustom) { + this.isCustom = isCustom; + return this; + } + + /** + * Set query. + * + * @param query Additional event-platform filters applied to the underlying findings query. For + * example, scored:true project_id:datadog-prod-us5. (optional, default to "") + * @return GetRuleBasedViewOptionalParameters + */ + public GetRuleBasedViewOptionalParameters query(String query) { + this.query = query; + return this; + } + } + + /** + * Get the rule-based view of compliance findings. + * + *

See {@link #getRuleBasedViewWithHttpInfo}. + * + * @param to Timestamp of the query end, in milliseconds since the Unix epoch. (required) + * @return RuleBasedViewResponse + * @throws ApiException if fails to make API call + */ + public RuleBasedViewResponse getRuleBasedView(Long to) throws ApiException { + return getRuleBasedViewWithHttpInfo(to, new GetRuleBasedViewOptionalParameters()).getData(); + } + + /** + * Get the rule-based view of compliance findings. + * + *

See {@link #getRuleBasedViewWithHttpInfoAsync}. + * + * @param to Timestamp of the query end, in milliseconds since the Unix epoch. (required) + * @return CompletableFuture<RuleBasedViewResponse> + */ + public CompletableFuture getRuleBasedViewAsync(Long to) { + return getRuleBasedViewWithHttpInfoAsync(to, new GetRuleBasedViewOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get the rule-based view of compliance findings. + * + *

See {@link #getRuleBasedViewWithHttpInfo}. + * + * @param to Timestamp of the query end, in milliseconds since the Unix epoch. (required) + * @param parameters Optional parameters for the request. + * @return RuleBasedViewResponse + * @throws ApiException if fails to make API call + */ + public RuleBasedViewResponse getRuleBasedView( + Long to, GetRuleBasedViewOptionalParameters parameters) throws ApiException { + return getRuleBasedViewWithHttpInfo(to, parameters).getData(); + } + + /** + * Get the rule-based view of compliance findings. + * + *

See {@link #getRuleBasedViewWithHttpInfoAsync}. + * + * @param to Timestamp of the query end, in milliseconds since the Unix epoch. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<RuleBasedViewResponse> + */ + public CompletableFuture getRuleBasedViewAsync( + Long to, GetRuleBasedViewOptionalParameters parameters) { + return getRuleBasedViewWithHttpInfoAsync(to, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get an aggregated view of compliance rules with their pass, fail, and muted finding counts. + * Supports filtering by compliance framework, framework version, and additional query filters. + * + * @param to Timestamp of the query end, in milliseconds since the Unix epoch. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<RuleBasedViewResponse> + * @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 -
429 Too many requests -
503 Service Unavailable -
+ */ + public ApiResponse getRuleBasedViewWithHttpInfo( + Long to, GetRuleBasedViewOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getRuleBasedView"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'to' is set + if (to == null) { + throw new ApiException( + 400, "Missing the required parameter 'to' when calling getRuleBasedView"); + } + String framework = parameters.framework; + String version = parameters.version; + Boolean queryFindingsWithoutFrameworkVersion = parameters.queryFindingsWithoutFrameworkVersion; + Boolean includeRulesWithoutFindings = parameters.includeRulesWithoutFindings; + Boolean isCustom = parameters.isCustom; + String query = parameters.query; + // create path and map variables + String localVarPath = "/api/v2/compliance_findings/rule_based_view"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "framework", framework)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "version", version)); + localVarQueryParams.addAll( + apiClient.parameterToPairs( + "", "query_findings_without_framework_version", queryFindingsWithoutFrameworkVersion)); + localVarQueryParams.addAll( + apiClient.parameterToPairs( + "", "include_rules_without_findings", includeRulesWithoutFindings)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "is_custom", isCustom)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ComplianceApi.getRuleBasedView", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get the rule-based view of compliance findings. + * + *

See {@link #getRuleBasedViewWithHttpInfo}. + * + * @param to Timestamp of the query end, in milliseconds since the Unix epoch. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<RuleBasedViewResponse>> + */ + public CompletableFuture> getRuleBasedViewWithHttpInfoAsync( + Long to, GetRuleBasedViewOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getRuleBasedView"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'to' is set + if (to == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'to' when calling getRuleBasedView")); + return result; + } + String framework = parameters.framework; + String version = parameters.version; + Boolean queryFindingsWithoutFrameworkVersion = parameters.queryFindingsWithoutFrameworkVersion; + Boolean includeRulesWithoutFindings = parameters.includeRulesWithoutFindings; + Boolean isCustom = parameters.isCustom; + String query = parameters.query; + // create path and map variables + String localVarPath = "/api/v2/compliance_findings/rule_based_view"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "to", to)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "framework", framework)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "version", version)); + localVarQueryParams.addAll( + apiClient.parameterToPairs( + "", "query_findings_without_framework_version", queryFindingsWithoutFrameworkVersion)); + localVarQueryParams.addAll( + apiClient.parameterToPairs( + "", "include_rules_without_findings", includeRulesWithoutFindings)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "is_custom", isCustom)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ComplianceApi.getRuleBasedView", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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/RuleBasedViewAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewAttributes.java new file mode 100644 index 00000000000..deb7b15d170 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewAttributes.java @@ -0,0 +1,184 @@ +/* + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes of the rule-based view. */ +@JsonPropertyOrder({ + RuleBasedViewAttributes.JSON_PROPERTY_COUNT, + RuleBasedViewAttributes.JSON_PROPERTY_RULES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RuleBasedViewAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COUNT = "count"; + private Long count; + + public static final String JSON_PROPERTY_RULES = "rules"; + private List rules = new ArrayList<>(); + + public RuleBasedViewAttributes() {} + + @JsonCreator + public RuleBasedViewAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_COUNT) Long count, + @JsonProperty(required = true, value = JSON_PROPERTY_RULES) List rules) { + this.count = count; + this.rules = rules; + } + + public RuleBasedViewAttributes count(Long count) { + this.count = count; + return this; + } + + /** + * Total number of rules in the view. + * + * @return count + */ + @JsonProperty(JSON_PROPERTY_COUNT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getCount() { + return count; + } + + public void setCount(Long count) { + this.count = count; + } + + public RuleBasedViewAttributes rules(List rules) { + this.rules = rules; + for (RuleBasedViewRule item : rules) { + this.unparsed |= item.unparsed; + } + return this; + } + + public RuleBasedViewAttributes addRulesItem(RuleBasedViewRule rulesItem) { + this.rules.add(rulesItem); + this.unparsed |= rulesItem.unparsed; + return this; + } + + /** + * List of rules in the rule-based view. + * + * @return rules + */ + @JsonProperty(JSON_PROPERTY_RULES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRules() { + return rules; + } + + public void setRules(List rules) { + this.rules = rules; + } + + /** + * 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 RuleBasedViewAttributes + */ + @JsonAnySetter + public RuleBasedViewAttributes 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 RuleBasedViewAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleBasedViewAttributes ruleBasedViewAttributes = (RuleBasedViewAttributes) o; + return Objects.equals(this.count, ruleBasedViewAttributes.count) + && Objects.equals(this.rules, ruleBasedViewAttributes.rules) + && Objects.equals(this.additionalProperties, ruleBasedViewAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(count, rules, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleBasedViewAttributes {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).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/RuleBasedViewComplianceFramework.java b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewComplianceFramework.java new file mode 100644 index 00000000000..d583719fc99 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewComplianceFramework.java @@ -0,0 +1,276 @@ +/* + * 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; + +/** Compliance framework mapping for a rule. */ +@JsonPropertyOrder({ + RuleBasedViewComplianceFramework.JSON_PROPERTY_CONTROL, + RuleBasedViewComplianceFramework.JSON_PROPERTY_FRAMEWORK, + RuleBasedViewComplianceFramework.JSON_PROPERTY_IS_DEFAULT, + RuleBasedViewComplianceFramework.JSON_PROPERTY_MESSAGE, + RuleBasedViewComplianceFramework.JSON_PROPERTY_REQUIREMENT, + RuleBasedViewComplianceFramework.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RuleBasedViewComplianceFramework { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONTROL = "control"; + private String control; + + public static final String JSON_PROPERTY_FRAMEWORK = "framework"; + private String framework; + + public static final String JSON_PROPERTY_IS_DEFAULT = "is_default"; + private Boolean isDefault; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_REQUIREMENT = "requirement"; + private String requirement; + + public static final String JSON_PROPERTY_VERSION = "version"; + private String version; + + public RuleBasedViewComplianceFramework control(String control) { + this.control = control; + return this; + } + + /** + * Identifier of the control inside the requirement. + * + * @return control + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTROL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getControl() { + return control; + } + + public void setControl(String control) { + this.control = control; + } + + public RuleBasedViewComplianceFramework framework(String framework) { + this.framework = framework; + return this; + } + + /** + * Handle of the compliance framework. + * + * @return framework + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FRAMEWORK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFramework() { + return framework; + } + + public void setFramework(String framework) { + this.framework = framework; + } + + public RuleBasedViewComplianceFramework isDefault(Boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + * Whether the framework is a Datadog default framework. true indicates a Datadog + * framework and false indicates a custom framework. + * + * @return isDefault + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_DEFAULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsDefault() { + return isDefault; + } + + public void setIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + } + + public RuleBasedViewComplianceFramework message(String message) { + this.message = message; + return this; + } + + /** + * Optional message describing the framework mapping for the rule. + * + * @return message + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public RuleBasedViewComplianceFramework requirement(String requirement) { + this.requirement = requirement; + return this; + } + + /** + * Name of the requirement that contains the control. + * + * @return requirement + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REQUIREMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRequirement() { + return requirement; + } + + public void setRequirement(String requirement) { + this.requirement = requirement; + } + + public RuleBasedViewComplianceFramework version(String version) { + this.version = version; + return this; + } + + /** + * Version of the compliance framework. + * + * @return version + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + /** + * 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 RuleBasedViewComplianceFramework + */ + @JsonAnySetter + public RuleBasedViewComplianceFramework 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 RuleBasedViewComplianceFramework object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleBasedViewComplianceFramework ruleBasedViewComplianceFramework = + (RuleBasedViewComplianceFramework) o; + return Objects.equals(this.control, ruleBasedViewComplianceFramework.control) + && Objects.equals(this.framework, ruleBasedViewComplianceFramework.framework) + && Objects.equals(this.isDefault, ruleBasedViewComplianceFramework.isDefault) + && Objects.equals(this.message, ruleBasedViewComplianceFramework.message) + && Objects.equals(this.requirement, ruleBasedViewComplianceFramework.requirement) + && Objects.equals(this.version, ruleBasedViewComplianceFramework.version) + && Objects.equals( + this.additionalProperties, ruleBasedViewComplianceFramework.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + control, framework, isDefault, message, requirement, version, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleBasedViewComplianceFramework {\n"); + sb.append(" control: ").append(toIndentedString(control)).append("\n"); + sb.append(" framework: ").append(toIndentedString(framework)).append("\n"); + sb.append(" isDefault: ").append(toIndentedString(isDefault)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" requirement: ").append(toIndentedString(requirement)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/RuleBasedViewData.java b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewData.java new file mode 100644 index 00000000000..be232c93847 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewData.java @@ -0,0 +1,209 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data envelope for the rule-based view response. */ +@JsonPropertyOrder({ + RuleBasedViewData.JSON_PROPERTY_ATTRIBUTES, + RuleBasedViewData.JSON_PROPERTY_ID, + RuleBasedViewData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RuleBasedViewData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RuleBasedViewAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private RuleBasedViewType type = RuleBasedViewType.RULE_BASED_VIEW; + + public RuleBasedViewData() {} + + @JsonCreator + public RuleBasedViewData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + RuleBasedViewAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) RuleBasedViewType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public RuleBasedViewData attributes(RuleBasedViewAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the rule-based view. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RuleBasedViewAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RuleBasedViewAttributes attributes) { + this.attributes = attributes; + } + + public RuleBasedViewData id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the rule-based view document. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public RuleBasedViewData type(RuleBasedViewType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the resource. The value should always be rule_based_view. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RuleBasedViewType getType() { + return type; + } + + public void setType(RuleBasedViewType 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 RuleBasedViewData + */ + @JsonAnySetter + public RuleBasedViewData 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 RuleBasedViewData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleBasedViewData ruleBasedViewData = (RuleBasedViewData) o; + return Objects.equals(this.attributes, ruleBasedViewData.attributes) + && Objects.equals(this.id, ruleBasedViewData.id) + && Objects.equals(this.type, ruleBasedViewData.type) + && Objects.equals(this.additionalProperties, ruleBasedViewData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleBasedViewData {\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/RuleBasedViewResponse.java b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewResponse.java new file mode 100644 index 00000000000..c9fef41d668 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewResponse.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; + +/** Response containing an aggregated view of compliance rules with their finding statistics. */ +@JsonPropertyOrder({RuleBasedViewResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RuleBasedViewResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RuleBasedViewData data; + + public RuleBasedViewResponse() {} + + @JsonCreator + public RuleBasedViewResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) RuleBasedViewData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public RuleBasedViewResponse data(RuleBasedViewData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for the rule-based view response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RuleBasedViewData getData() { + return data; + } + + public void setData(RuleBasedViewData 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 RuleBasedViewResponse + */ + @JsonAnySetter + public RuleBasedViewResponse 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 RuleBasedViewResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleBasedViewResponse ruleBasedViewResponse = (RuleBasedViewResponse) o; + return Objects.equals(this.data, ruleBasedViewResponse.data) + && Objects.equals(this.additionalProperties, ruleBasedViewResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleBasedViewResponse {\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/RuleBasedViewRule.java b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewRule.java new file mode 100644 index 00000000000..8b44d9a905a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewRule.java @@ -0,0 +1,473 @@ +/* + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A compliance rule along with its evaluation statistics and framework mappings. */ +@JsonPropertyOrder({ + RuleBasedViewRule.JSON_PROPERTY_COMPLIANCE_FRAMEWORKS, + RuleBasedViewRule.JSON_PROPERTY_ENABLED, + RuleBasedViewRule.JSON_PROPERTY_ID, + RuleBasedViewRule.JSON_PROPERTY_NAME, + RuleBasedViewRule.JSON_PROPERTY_RESOURCE_ATTRIBUTES, + RuleBasedViewRule.JSON_PROPERTY_RESOURCE_CATEGORY, + RuleBasedViewRule.JSON_PROPERTY_RESOURCE_TYPE, + RuleBasedViewRule.JSON_PROPERTY_STATS, + RuleBasedViewRule.JSON_PROPERTY_STATUS, + RuleBasedViewRule.JSON_PROPERTY_TAGS, + RuleBasedViewRule.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RuleBasedViewRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COMPLIANCE_FRAMEWORKS = "compliance_frameworks"; + private List complianceFrameworks = new ArrayList<>(); + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_RESOURCE_ATTRIBUTES = "resourceAttributes"; + private List resourceAttributes = new ArrayList<>(); + + public static final String JSON_PROPERTY_RESOURCE_CATEGORY = "resourceCategory"; + private String resourceCategory; + + public static final String JSON_PROPERTY_RESOURCE_TYPE = "resourceType"; + private String resourceType; + + public static final String JSON_PROPERTY_STATS = "stats"; + private RuleBasedViewRuleStats stats; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = new ArrayList<>(); + + public static final String JSON_PROPERTY_TYPE = "type"; + private RuleBasedViewRuleCategory type; + + public RuleBasedViewRule() {} + + @JsonCreator + public RuleBasedViewRule( + @JsonProperty(required = true, value = JSON_PROPERTY_COMPLIANCE_FRAMEWORKS) + List complianceFrameworks, + @JsonProperty(required = true, value = JSON_PROPERTY_ENABLED) Boolean enabled, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_ATTRIBUTES) + List resourceAttributes, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_CATEGORY) + String resourceCategory, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_TYPE) String resourceType, + @JsonProperty(required = true, value = JSON_PROPERTY_STATS) RuleBasedViewRuleStats stats, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) String status, + @JsonProperty(required = true, value = JSON_PROPERTY_TAGS) List tags, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) RuleBasedViewRuleCategory type) { + this.complianceFrameworks = complianceFrameworks; + this.enabled = enabled; + this.id = id; + this.name = name; + this.resourceAttributes = resourceAttributes; + this.resourceCategory = resourceCategory; + this.resourceType = resourceType; + this.stats = stats; + this.unparsed |= stats.unparsed; + this.status = status; + this.tags = tags; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public RuleBasedViewRule complianceFrameworks( + List complianceFrameworks) { + this.complianceFrameworks = complianceFrameworks; + for (RuleBasedViewComplianceFramework item : complianceFrameworks) { + this.unparsed |= item.unparsed; + } + return this; + } + + public RuleBasedViewRule addComplianceFrameworksItem( + RuleBasedViewComplianceFramework complianceFrameworksItem) { + this.complianceFrameworks.add(complianceFrameworksItem); + this.unparsed |= complianceFrameworksItem.unparsed; + return this; + } + + /** + * List of compliance framework mappings associated with the rule. + * + * @return complianceFrameworks + */ + @JsonProperty(JSON_PROPERTY_COMPLIANCE_FRAMEWORKS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getComplianceFrameworks() { + return complianceFrameworks; + } + + public void setComplianceFrameworks(List complianceFrameworks) { + this.complianceFrameworks = complianceFrameworks; + } + + public RuleBasedViewRule enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether the rule is enabled. + * + * @return enabled + */ + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public RuleBasedViewRule id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the rule. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public RuleBasedViewRule name(String name) { + this.name = name; + return this; + } + + /** + * Human-readable name of the rule. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public RuleBasedViewRule resourceAttributes(List resourceAttributes) { + this.resourceAttributes = resourceAttributes; + return this; + } + + public RuleBasedViewRule addResourceAttributesItem(String resourceAttributesItem) { + this.resourceAttributes.add(resourceAttributesItem); + return this; + } + + /** + * List of resource attribute names exposed by the rule. + * + * @return resourceAttributes + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getResourceAttributes() { + return resourceAttributes; + } + + public void setResourceAttributes(List resourceAttributes) { + this.resourceAttributes = resourceAttributes; + } + + public RuleBasedViewRule resourceCategory(String resourceCategory) { + this.resourceCategory = resourceCategory; + return this; + } + + /** + * Resource category targeted by the rule. + * + * @return resourceCategory + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_CATEGORY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResourceCategory() { + return resourceCategory; + } + + public void setResourceCategory(String resourceCategory) { + this.resourceCategory = resourceCategory; + } + + public RuleBasedViewRule resourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Resource type targeted by the rule. + * + * @return resourceType + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public RuleBasedViewRule stats(RuleBasedViewRuleStats stats) { + this.stats = stats; + this.unparsed |= stats.unparsed; + return this; + } + + /** + * Counts of findings for the rule, grouped by their evaluation status. + * + * @return stats + */ + @JsonProperty(JSON_PROPERTY_STATS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RuleBasedViewRuleStats getStats() { + return stats; + } + + public void setStats(RuleBasedViewRuleStats stats) { + this.stats = stats; + } + + public RuleBasedViewRule status(String status) { + this.status = status; + return this; + } + + /** + * Severity associated with the rule (for example, info, low, + * medium, high, or critical). + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public RuleBasedViewRule tags(List tags) { + this.tags = tags; + return this; + } + + public RuleBasedViewRule addTagsItem(String tagsItem) { + this.tags.add(tagsItem); + return this; + } + + /** + * List of tags attached to the rule. + * + * @return tags + */ + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public RuleBasedViewRule type(RuleBasedViewRuleCategory type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The category of the security rule. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RuleBasedViewRuleCategory getType() { + return type; + } + + public void setType(RuleBasedViewRuleCategory 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 RuleBasedViewRule + */ + @JsonAnySetter + public RuleBasedViewRule 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 RuleBasedViewRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleBasedViewRule ruleBasedViewRule = (RuleBasedViewRule) o; + return Objects.equals(this.complianceFrameworks, ruleBasedViewRule.complianceFrameworks) + && Objects.equals(this.enabled, ruleBasedViewRule.enabled) + && Objects.equals(this.id, ruleBasedViewRule.id) + && Objects.equals(this.name, ruleBasedViewRule.name) + && Objects.equals(this.resourceAttributes, ruleBasedViewRule.resourceAttributes) + && Objects.equals(this.resourceCategory, ruleBasedViewRule.resourceCategory) + && Objects.equals(this.resourceType, ruleBasedViewRule.resourceType) + && Objects.equals(this.stats, ruleBasedViewRule.stats) + && Objects.equals(this.status, ruleBasedViewRule.status) + && Objects.equals(this.tags, ruleBasedViewRule.tags) + && Objects.equals(this.type, ruleBasedViewRule.type) + && Objects.equals(this.additionalProperties, ruleBasedViewRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + complianceFrameworks, + enabled, + id, + name, + resourceAttributes, + resourceCategory, + resourceType, + stats, + status, + tags, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleBasedViewRule {\n"); + sb.append(" complianceFrameworks: ") + .append(toIndentedString(complianceFrameworks)) + .append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" resourceAttributes: ").append(toIndentedString(resourceAttributes)).append("\n"); + sb.append(" resourceCategory: ").append(toIndentedString(resourceCategory)).append("\n"); + sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); + sb.append(" stats: ").append(toIndentedString(stats)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).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/RuleBasedViewRuleCategory.java b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewRuleCategory.java new file mode 100644 index 00000000000..0a9ea6e3bac --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewRuleCategory.java @@ -0,0 +1,62 @@ +/* + * 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 category of the security rule. */ +@JsonSerialize(using = RuleBasedViewRuleCategory.RuleBasedViewRuleCategorySerializer.class) +public class RuleBasedViewRuleCategory extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("cloud_configuration", "infrastructure_configuration", "api_security")); + + public static final RuleBasedViewRuleCategory CLOUD_CONFIGURATION = + new RuleBasedViewRuleCategory("cloud_configuration"); + public static final RuleBasedViewRuleCategory INFRASTRUCTURE_CONFIGURATION = + new RuleBasedViewRuleCategory("infrastructure_configuration"); + public static final RuleBasedViewRuleCategory API_SECURITY = + new RuleBasedViewRuleCategory("api_security"); + + RuleBasedViewRuleCategory(String value) { + super(value, allowedValues); + } + + public static class RuleBasedViewRuleCategorySerializer + extends StdSerializer { + public RuleBasedViewRuleCategorySerializer(Class t) { + super(t); + } + + public RuleBasedViewRuleCategorySerializer() { + this(null); + } + + @Override + public void serialize( + RuleBasedViewRuleCategory value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RuleBasedViewRuleCategory fromValue(String value) { + return new RuleBasedViewRuleCategory(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewRuleStats.java b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewRuleStats.java new file mode 100644 index 00000000000..d53117be559 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewRuleStats.java @@ -0,0 +1,201 @@ +/* + * 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; + +/** Counts of findings for the rule, grouped by their evaluation status. */ +@JsonPropertyOrder({ + RuleBasedViewRuleStats.JSON_PROPERTY_FAIL, + RuleBasedViewRuleStats.JSON_PROPERTY_MUTED, + RuleBasedViewRuleStats.JSON_PROPERTY_PASS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RuleBasedViewRuleStats { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FAIL = "fail"; + private Long fail; + + public static final String JSON_PROPERTY_MUTED = "muted"; + private Long muted; + + public static final String JSON_PROPERTY_PASS = "pass"; + private Long pass; + + public RuleBasedViewRuleStats() {} + + @JsonCreator + public RuleBasedViewRuleStats( + @JsonProperty(required = true, value = JSON_PROPERTY_FAIL) Long fail, + @JsonProperty(required = true, value = JSON_PROPERTY_MUTED) Long muted, + @JsonProperty(required = true, value = JSON_PROPERTY_PASS) Long pass) { + this.fail = fail; + this.muted = muted; + this.pass = pass; + } + + public RuleBasedViewRuleStats fail(Long fail) { + this.fail = fail; + return this; + } + + /** + * Number of findings that failed evaluation. + * + * @return fail + */ + @JsonProperty(JSON_PROPERTY_FAIL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getFail() { + return fail; + } + + public void setFail(Long fail) { + this.fail = fail; + } + + public RuleBasedViewRuleStats muted(Long muted) { + this.muted = muted; + return this; + } + + /** + * Number of findings that have been muted. + * + * @return muted + */ + @JsonProperty(JSON_PROPERTY_MUTED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getMuted() { + return muted; + } + + public void setMuted(Long muted) { + this.muted = muted; + } + + public RuleBasedViewRuleStats pass(Long pass) { + this.pass = pass; + return this; + } + + /** + * Number of findings that passed evaluation. + * + * @return pass + */ + @JsonProperty(JSON_PROPERTY_PASS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getPass() { + return pass; + } + + public void setPass(Long pass) { + this.pass = pass; + } + + /** + * 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 RuleBasedViewRuleStats + */ + @JsonAnySetter + public RuleBasedViewRuleStats 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 RuleBasedViewRuleStats object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleBasedViewRuleStats ruleBasedViewRuleStats = (RuleBasedViewRuleStats) o; + return Objects.equals(this.fail, ruleBasedViewRuleStats.fail) + && Objects.equals(this.muted, ruleBasedViewRuleStats.muted) + && Objects.equals(this.pass, ruleBasedViewRuleStats.pass) + && Objects.equals(this.additionalProperties, ruleBasedViewRuleStats.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(fail, muted, pass, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleBasedViewRuleStats {\n"); + sb.append(" fail: ").append(toIndentedString(fail)).append("\n"); + sb.append(" muted: ").append(toIndentedString(muted)).append("\n"); + sb.append(" pass: ").append(toIndentedString(pass)).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/RuleBasedViewType.java b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewType.java new file mode 100644 index 00000000000..0672de55197 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RuleBasedViewType.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 resource. The value should always be rule_based_view. */ +@JsonSerialize(using = RuleBasedViewType.RuleBasedViewTypeSerializer.class) +public class RuleBasedViewType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("rule_based_view")); + + public static final RuleBasedViewType RULE_BASED_VIEW = new RuleBasedViewType("rule_based_view"); + + RuleBasedViewType(String value) { + super(value, allowedValues); + } + + public static class RuleBasedViewTypeSerializer extends StdSerializer { + public RuleBasedViewTypeSerializer(Class t) { + super(t); + } + + public RuleBasedViewTypeSerializer() { + this(null); + } + + @Override + public void serialize(RuleBasedViewType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RuleBasedViewType fromValue(String value) { + return new RuleBasedViewType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/compliance.feature b/src/test/resources/com/datadog/api/client/v2/api/compliance.feature new file mode 100644 index 00000000000..e59eba055be --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/compliance.feature @@ -0,0 +1,27 @@ +@endpoint(compliance) @endpoint(compliance-v2) +Feature: Compliance + Datadog Cloud Security Misconfigurations provides aggregated views of + compliance rules and findings across your cloud resources, helping you + assess posture against industry frameworks (such as HIPAA, SOC 2, ISO + 27001) and custom frameworks. Learn more at https://docs.datadoghq.com/sec + urity/cloud_security_management/misconfigurations/#maintain-compliance- + with-industry-frameworks-and-benchmarks. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Compliance" API + And operation "GetRuleBasedView" enabled + And new "GetRuleBasedView" request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get the rule-based view of compliance findings returns "Bad Request" response + Given request contains "to" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-misconfigs + Scenario: Get the rule-based view of compliance findings returns "OK" response + Given request contains "to" parameter from "REPLACE.ME" + 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 40d310f9a51..35b117222c3 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 @@ -1253,6 +1253,12 @@ "type": "safe" } }, + "GetRuleBasedView": { + "tag": "Compliance", + "undo": { + "type": "safe" + } + }, "ListContainerImages": { "tag": "Container Images", "undo": {