From e0f96d443babb4ad61fa05ca464af02304f00167 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 28 Oct 2026 17:30:16 +0000 Subject: [PATCH] Regenerate client from commit 916a332 of spec repo --- .generator/schemas/v2/openapi.yaml | 358 ++++++++++++++++++ .../GetSecurityMonitoringRuleProposal.java | 37 ++ .../StartSecurityMonitoringRuleProposal.java | 45 +++ .../com/datadog/api/client/ApiClient.java | 2 + .../client/v2/api/SecurityMonitoringApi.java | 354 ++++++++++++++++- .../SecurityMonitoringRuleProposalError.java | 204 ++++++++++ ...curityMonitoringRuleProposalInputType.java | 72 ++++ ...ecurityMonitoringRuleProposalResponse.java | 152 ++++++++ ...itoringRuleProposalResponseAttributes.java | 225 +++++++++++ ...ityMonitoringRuleProposalResponseData.java | 220 +++++++++++ ...ityMonitoringRuleProposalStartRequest.java | 154 ++++++++ ...ingRuleProposalStartRequestAttributes.java | 192 ++++++++++ ...onitoringRuleProposalStartRequestData.java | 193 ++++++++++ ...tyMonitoringRuleProposalStartResponse.java | 154 ++++++++ ...ngRuleProposalStartResponseAttributes.java | 152 ++++++++ ...nitoringRuleProposalStartResponseData.java | 224 +++++++++++ .../SecurityMonitoringRuleProposalType.java | 59 +++ .../com/datadog/api/client/v2/api/given.json | 12 + .../client/v2/api/security_monitoring.feature | 45 +++ .../com/datadog/api/client/v2/api/undo.json | 12 + .../test-runner-data/manifest.json | 14 + ...t-a-rule-proposal-returns-ok-response.json | 35 ++ ...le-proposal-returns-accepted-response.json | 34 ++ .../v2/security-monitoring.json | 101 +++++ 24 files changed, 3049 insertions(+), 1 deletion(-) create mode 100644 examples/v2/security-monitoring/GetSecurityMonitoringRuleProposal.java create mode 100644 examples/v2/security-monitoring/StartSecurityMonitoringRuleProposal.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalError.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalInputType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalResponseAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartResponseAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalType.java create mode 100644 src/test/resources/generated-test/test-runner-data/v2/security-monitoring/get-a-rule-proposal-returns-ok-response.json create mode 100644 src/test/resources/generated-test/test-runner-data/v2/security-monitoring/start-a-rule-proposal-returns-accepted-response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 993e6653a16..ce141ae1853 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2060,6 +2060,15 @@ components: required: true schema: type: string + SecurityMonitoringRuleProposalID: + description: The ID of the rule proposal, returned by the start a rule proposal endpoint. + in: path + name: proposal_id + required: true + schema: + example: c968cf83-56c2-4d54-a993-6c86dfb83527 + format: uuid + type: string SecurityMonitoringRuleVersion: description: The historical version number of the rule. in: path @@ -2512,6 +2521,30 @@ components: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Unauthorized + SecurityMonitoringRuleProposalBadRequestResponse: + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + SecurityMonitoringRuleProposalForbiddenResponse: + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + SecurityMonitoringRuleProposalNotFoundResponse: + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + SecurityMonitoringRuleProposalUnauthorizedResponse: + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized SpansBadRequestResponse: content: application/json: @@ -117483,6 +117516,177 @@ components: thirdPartyRuleOptions: $ref: "#/components/schemas/SecurityMonitoringRuleThirdPartyOptions" type: object + SecurityMonitoringRuleProposalError: + description: The reason no rule could be generated. Only present when the status is `failed`. + properties: + kind: + description: |- + The kind of failure. + - `translation_error`: no rule could be generated from the input. Reword the input + or add details, then start a new rule proposal. + - `internal_error`: the proposal failed because of an internal error. Start a new + rule proposal to try again. + example: translation_error + type: string + message: + description: A human-readable explanation of why no rule could be generated, when available. + example: No log source matches the described activity. + type: string + type: + description: The type of failure within its kind, such as `NoRuleProduced`. + example: NoRuleProduced + type: string + required: + - kind + type: object + SecurityMonitoringRuleProposalInputType: + description: |- + The type of input to generate the proposed rule from: `natural_language` for a + plain-English description of the behavior to detect, `spl` for a Splunk SPL search or + saved search definition, or `kql` for a Microsoft KQL query. SPL inputs must be + self-contained, with search macros expanded. + enum: + - natural_language + - spl + - kql + example: natural_language + type: string + x-enum-varnames: + - NATURAL_LANGUAGE + - SPL + - KQL + SecurityMonitoringRuleProposalResponse: + description: Response containing a rule proposal. + properties: + data: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalResponseData" + required: + - data + type: object + SecurityMonitoringRuleProposalResponseAttributes: + description: Attributes of the rule proposal. + properties: + error: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalError" + rule: + additionalProperties: {} + description: |- + The proposed Cloud SIEM detection rule in the same format as the create a detection + rule endpoint. It is not saved in Cloud SIEM. Only present when the status is + `completed`. Review the rule, then create it with the [create a + detection rule](https://docs.datadoghq.com/api/latest/security-monitoring/#create-a-detection-rule) + endpoint. + type: object + status: + description: |- + The status of the rule proposal. `pending` and `in_progress` mean the proposed rule is + still being generated. Poll the endpoint again later. `completed` and `failed` are final: + `completed` proposals contain the proposed rule in `rule`, and `failed` proposals + contain the reason in `error`. + example: completed + type: string + required: + - status + type: object + SecurityMonitoringRuleProposalResponseData: + description: Data of the rule proposal. + properties: + attributes: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalResponseAttributes" + id: + description: The ID of the rule proposal. + example: c968cf83-56c2-4d54-a993-6c86dfb83527 + format: uuid + type: string + type: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalType" + required: + - id + - type + - attributes + type: object + SecurityMonitoringRuleProposalStartRequest: + description: Request to start a rule proposal. + properties: + data: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalStartRequestData" + required: + - data + type: object + SecurityMonitoringRuleProposalStartRequestAttributes: + description: Attributes of the rule proposal to start. + properties: + input: + description: |- + The natural-language description or rule to generate the proposed rule from, in the + format given by `inputType`. + example: Detect repeated failed Okta logins followed by a successful login from the same IP. + maxLength: 65536 + type: string + inputType: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalInputType" + required: + - inputType + - input + type: object + SecurityMonitoringRuleProposalStartRequestData: + description: Data of the rule proposal to start. + properties: + attributes: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalStartRequestAttributes" + type: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalType" + required: + - type + - attributes + type: object + SecurityMonitoringRuleProposalStartResponse: + description: Response to a started rule proposal. + properties: + data: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalStartResponseData" + required: + - data + type: object + SecurityMonitoringRuleProposalStartResponseAttributes: + description: Attributes of the started rule proposal. + properties: + status: + description: |- + The status of the rule proposal, one of `pending`, `in_progress`, `completed`, or + `failed`. For a newly started rule proposal, the status is `pending`. + example: pending + type: string + required: + - status + type: object + SecurityMonitoringRuleProposalStartResponseData: + description: Data of the started rule proposal. + properties: + attributes: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalStartResponseAttributes" + id: + description: |- + The ID of the rule proposal. Use it as `proposal_id` to check the proposal status and get the proposed rule. + example: c968cf83-56c2-4d54-a993-6c86dfb83527 + format: uuid + type: string + type: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalType" + required: + - id + - type + - attributes + type: object + SecurityMonitoringRuleProposalType: + default: rule_proposals + description: The rule proposal resource type. The value is always `rule_proposals`. + enum: + - rule_proposals + example: rule_proposals + type: string + x-enum-varnames: + - RULE_PROPOSALS SecurityMonitoringRuleQuery: description: Query for matching rule. oneOf: @@ -231586,6 +231790,7 @@ paths: rule. To load more rules, add them with the add resources endpoint before starting the batch migration. A batch migration can hold up to 1000 resources. The response does not include the created resources: list the resources of the batch migration to retrieve them. + Alternatively, use the start-a-rule-proposal endpoint to get a single proposed rule. operationId: CreateSecurityMonitoringBatchMigration requestBody: content: @@ -235707,6 +235912,159 @@ paths: operator: OR permissions: - security_monitoring_rules_read + /api/v2/security_monitoring/rules/proposals: + post: + description: |- + Start generating a proposed Cloud SIEM detection rule from a natural-language + description, or from an SPL or KQL rule. The proposal is based on your organization's + log sources, log fields, and existing detection rules. When logs from the matching + source are available, the proposed query is tested against your recent logs. + + The proposed rule is generated asynchronously. This endpoint returns a proposal `id` + with the status `pending`. To get the proposed rule, pass this `id` to the get-a-rule-proposal + endpoint and poll the endpoint until the status is `completed` or `failed`. A proposal + usually takes a few minutes, and up to 10 minutes. + + This endpoint does not create or modify any detection rules in Cloud SIEM. To translate + many rules at once, use batch migrations instead. + operationId: StartSecurityMonitoringRuleProposal + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalStartRequest" + required: true + responses: + "202": + content: + application/json: + examples: + default: + value: + data: + attributes: + status: pending + id: c968cf83-56c2-4d54-a993-6c86dfb83527 + type: rule_proposals + schema: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalStartResponse" + description: Accepted + "400": + $ref: "#/components/responses/SecurityMonitoringRuleProposalBadRequestResponse" + "401": + $ref: "#/components/responses/SecurityMonitoringRuleProposalUnauthorizedResponse" + "403": + $ref: "#/components/responses/SecurityMonitoringRuleProposalForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_rules_write + summary: Start a rule proposal + tags: + - Security Monitoring + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_rules_write + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + To request access, contact [Datadog support](https://docs.datadoghq.com/help/) or your Customer Success Manager. + /api/v2/security_monitoring/rules/proposals/{proposal_id}: + get: + description: |- + Get the status of a rule proposal started with the start-a-rule-proposal endpoint. + While the status is `pending` or `in_progress`, the proposed rule is still being + generated. Poll this endpoint again later. If the status is `completed`, the response's `rule` field contains + the proposed Cloud SIEM detection rule. If the status is `failed`, the response's `error` field contains + the reason a rule could not be generated. + + This endpoint does not create or modify any detection rules in Cloud SIEM. To create the + proposed rule, use the create-a-detection-rule endpoint. + operationId: GetSecurityMonitoringRuleProposal + parameters: + - $ref: "#/components/parameters/SecurityMonitoringRuleProposalID" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + rule: + cases: + - condition: failed_login > 5 && successful_login > 0 + name: Successful login after repeated failures + status: medium + isEnabled: false + message: Repeated failed Okta logins were followed by a successful login from the same IP. + name: Successful Okta login after repeated failures + options: + detectionMethod: threshold + evaluationWindow: 900 + keepAlive: 3600 + maxSignalDuration: 86400 + queries: + - aggregation: count + groupByFields: + - "@network.client.ip" + name: failed_login + query: source:okta @evt.name:user.session.start @evt.outcome:FAILURE + - aggregation: count + groupByFields: + - "@network.client.ip" + name: successful_login + query: source:okta @evt.name:user.session.start @evt.outcome:SUCCESS + tags: + - source:okta + type: log_detection + status: completed + id: c968cf83-56c2-4d54-a993-6c86dfb83527 + type: rule_proposals + failed: + value: + data: + attributes: + error: + kind: translation_error + message: No log source matches the described activity. + type: NoRuleProduced + status: failed + id: c968cf83-56c2-4d54-a993-6c86dfb83527 + type: rule_proposals + schema: + $ref: "#/components/schemas/SecurityMonitoringRuleProposalResponse" + description: OK + "400": + $ref: "#/components/responses/SecurityMonitoringRuleProposalBadRequestResponse" + "401": + $ref: "#/components/responses/SecurityMonitoringRuleProposalUnauthorizedResponse" + "403": + $ref: "#/components/responses/SecurityMonitoringRuleProposalForbiddenResponse" + "404": + $ref: "#/components/responses/SecurityMonitoringRuleProposalNotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_rules_read + summary: Get a rule proposal + tags: + - Security Monitoring + "x-permission": + operator: OR + permissions: + - security_monitoring_rules_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + To request access, contact [Datadog support](https://docs.datadoghq.com/help/) or your Customer Success Manager. /api/v2/security_monitoring/rules/test: post: description: |- diff --git a/examples/v2/security-monitoring/GetSecurityMonitoringRuleProposal.java b/examples/v2/security-monitoring/GetSecurityMonitoringRuleProposal.java new file mode 100644 index 00000000000..24c9de3733c --- /dev/null +++ b/examples/v2/security-monitoring/GetSecurityMonitoringRuleProposal.java @@ -0,0 +1,37 @@ +// Get a rule proposal returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleProposalResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getSecurityMonitoringRuleProposal", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + // there is a valid "rule_proposal" in the system + UUID RULE_PROPOSAL_DATA_ID = null; + try { + RULE_PROPOSAL_DATA_ID = UUID.fromString(System.getenv("RULE_PROPOSAL_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + try { + SecurityMonitoringRuleProposalResponse result = + apiInstance.getSecurityMonitoringRuleProposal(RULE_PROPOSAL_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#getSecurityMonitoringRuleProposal"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/security-monitoring/StartSecurityMonitoringRuleProposal.java b/examples/v2/security-monitoring/StartSecurityMonitoringRuleProposal.java new file mode 100644 index 00000000000..21b5d78b6e3 --- /dev/null +++ b/examples/v2/security-monitoring/StartSecurityMonitoringRuleProposal.java @@ -0,0 +1,45 @@ +// Start a rule proposal returns "Accepted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SecurityMonitoringApi; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleProposalInputType; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleProposalStartRequest; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleProposalStartRequestAttributes; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleProposalStartRequestData; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleProposalStartResponse; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleProposalType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.startSecurityMonitoringRuleProposal", true); + SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient); + + SecurityMonitoringRuleProposalStartRequest body = + new SecurityMonitoringRuleProposalStartRequest() + .data( + new SecurityMonitoringRuleProposalStartRequestData() + .type(SecurityMonitoringRuleProposalType.RULE_PROPOSALS) + .attributes( + new SecurityMonitoringRuleProposalStartRequestAttributes() + .inputType(SecurityMonitoringRuleProposalInputType.NATURAL_LANGUAGE) + .input( + "Detect repeated failed Okta logins followed by a successful login" + + " from the same IP."))); + + try { + SecurityMonitoringRuleProposalStartResponse result = + apiInstance.startSecurityMonitoringRuleProposal(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling SecurityMonitoringApi#startSecurityMonitoringRuleProposal"); + 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 1511d27dff6..36a1153d0f7 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1154,6 +1154,7 @@ public class ApiClient { put("v2.getSecurityMonitoringHistsignal", false); put("v2.getSecurityMonitoringHistsignalsByJobId", false); put("v2.getSecurityMonitoringIntegrationConfig", false); + put("v2.getSecurityMonitoringRuleProposal", false); put("v2.getSignalEntities", false); put("v2.getSingleEntityContext", false); put("v2.getStaticAnalysisDefaultRulesets", false); @@ -1191,6 +1192,7 @@ public class ApiClient { put("v2.runHistoricalJob", false); put("v2.searchSecurityMonitoringHistsignals", false); put("v2.startSecurityMonitoringBatchMigration", false); + put("v2.startSecurityMonitoringRuleProposal", false); put("v2.updateFindingsAssignee", false); put("v2.updateFindingsSeverity", false); put("v2.updateSecurityFindingsAutomationDueDateRule", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java index b5c88bf4681..6169ece49f8 100644 --- a/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/SecurityMonitoringApi.java @@ -154,6 +154,9 @@ import com.datadog.api.client.v2.model.SecurityMonitoringRuleConvertPayload; import com.datadog.api.client.v2.model.SecurityMonitoringRuleConvertResponse; import com.datadog.api.client.v2.model.SecurityMonitoringRuleCreatePayload; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleProposalResponse; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleProposalStartRequest; +import com.datadog.api.client.v2.model.SecurityMonitoringRuleProposalStartResponse; import com.datadog.api.client.v2.model.SecurityMonitoringRuleResponse; import com.datadog.api.client.v2.model.SecurityMonitoringRuleSort; import com.datadog.api.client.v2.model.SecurityMonitoringRuleTestRequest; @@ -5380,7 +5383,8 @@ public SecurityMonitoringBatchMigrationResponse createSecurityMonitoringBatchMig * resources. Each resource holds one source rule to translate into a Cloud SIEM detection rule. * To load more rules, add them with the add resources endpoint before starting the batch * migration. A batch migration can hold up to 1000 resources. The response does not include the - * created resources: list the resources of the batch migration to retrieve them. + * created resources: list the resources of the batch migration to retrieve them. Alternatively, + * use the start-a-rule-proposal endpoint to get a single proposed rule. * * @param body (required) * @return ApiResponse<SecurityMonitoringBatchMigrationResponse> @@ -17238,6 +17242,183 @@ public ApiResponse getSecurityMonitoringRuleWith new GenericType() {}); } + /** + * Get a rule proposal. + * + *

See {@link #getSecurityMonitoringRuleProposalWithHttpInfo}. + * + * @param proposalId The ID of the rule proposal, returned by the start a rule proposal endpoint. + * (required) + * @return SecurityMonitoringRuleProposalResponse + * @throws ApiException if fails to make API call + */ + public SecurityMonitoringRuleProposalResponse getSecurityMonitoringRuleProposal(UUID proposalId) + throws ApiException { + return getSecurityMonitoringRuleProposalWithHttpInfo(proposalId).getData(); + } + + /** + * Get a rule proposal. + * + *

See {@link #getSecurityMonitoringRuleProposalWithHttpInfoAsync}. + * + * @param proposalId The ID of the rule proposal, returned by the start a rule proposal endpoint. + * (required) + * @return CompletableFuture<SecurityMonitoringRuleProposalResponse> + */ + public CompletableFuture + getSecurityMonitoringRuleProposalAsync(UUID proposalId) { + return getSecurityMonitoringRuleProposalWithHttpInfoAsync(proposalId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get the status of a rule proposal started with the start-a-rule-proposal endpoint. While the + * status is pending or in_progress, the proposed rule is still being + * generated. Poll this endpoint again later. If the status is completed, the + * response's rule field contains the proposed Cloud SIEM detection rule. If the + * status is failed, the response's error field contains the reason a + * rule could not be generated. + * + *

This endpoint does not create or modify any detection rules in Cloud SIEM. To create the + * proposed rule, use the create-a-detection-rule endpoint. + * + * @param proposalId The ID of the rule proposal, returned by the start a rule proposal endpoint. + * (required) + * @return ApiResponse<SecurityMonitoringRuleProposalResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse + getSecurityMonitoringRuleProposalWithHttpInfo(UUID proposalId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getSecurityMonitoringRuleProposal"; + 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 'proposalId' is set + if (proposalId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'proposalId' when calling" + + " getSecurityMonitoringRuleProposal"); + } + // create path and map variables + String localVarPath = + "/api/v2/security_monitoring/rules/proposals/{proposal_id}" + .replaceAll( + "\\{" + "proposal_id" + "\\}", apiClient.escapeString(proposalId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getSecurityMonitoringRuleProposal", + localVarPath, + new ArrayList(), + 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 a rule proposal. + * + *

See {@link #getSecurityMonitoringRuleProposalWithHttpInfo}. + * + * @param proposalId The ID of the rule proposal, returned by the start a rule proposal endpoint. + * (required) + * @return CompletableFuture<ApiResponse<SecurityMonitoringRuleProposalResponse>> + */ + public CompletableFuture> + getSecurityMonitoringRuleProposalWithHttpInfoAsync(UUID proposalId) { + // Check if unstable operation is enabled + String operationId = "getSecurityMonitoringRuleProposal"; + 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 'proposalId' is set + if (proposalId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'proposalId' when calling" + + " getSecurityMonitoringRuleProposal")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/security_monitoring/rules/proposals/{proposal_id}" + .replaceAll( + "\\{" + "proposal_id" + "\\}", apiClient.escapeString(proposalId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.getSecurityMonitoringRuleProposal", + localVarPath, + new ArrayList(), + 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() {}); + } + /** * Get a signal's details. * @@ -30535,6 +30716,177 @@ public ApiResponse startSecurityMonitoringBatchMigrationWithHttpInfo(UUID null); } + /** + * Start a rule proposal. + * + *

See {@link #startSecurityMonitoringRuleProposalWithHttpInfo}. + * + * @param body (required) + * @return SecurityMonitoringRuleProposalStartResponse + * @throws ApiException if fails to make API call + */ + public SecurityMonitoringRuleProposalStartResponse startSecurityMonitoringRuleProposal( + SecurityMonitoringRuleProposalStartRequest body) throws ApiException { + return startSecurityMonitoringRuleProposalWithHttpInfo(body).getData(); + } + + /** + * Start a rule proposal. + * + *

See {@link #startSecurityMonitoringRuleProposalWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<SecurityMonitoringRuleProposalStartResponse> + */ + public CompletableFuture + startSecurityMonitoringRuleProposalAsync(SecurityMonitoringRuleProposalStartRequest body) { + return startSecurityMonitoringRuleProposalWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Start generating a proposed Cloud SIEM detection rule from a natural-language description, or + * from an SPL or KQL rule. The proposal is based on your organization's log sources, log fields, + * and existing detection rules. When logs from the matching source are available, the proposed + * query is tested against your recent logs. + * + *

The proposed rule is generated asynchronously. This endpoint returns a proposal id + * with the status pending. To get the proposed rule, pass this id + * to the get-a-rule-proposal endpoint and poll the endpoint until the status is + * completed or failed. A proposal usually takes a few minutes, and up to 10 + * minutes. + * + *

This endpoint does not create or modify any detection rules in Cloud SIEM. To translate many + * rules at once, use batch migrations instead. + * + * @param body (required) + * @return ApiResponse<SecurityMonitoringRuleProposalStartResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse + startSecurityMonitoringRuleProposalWithHttpInfo( + SecurityMonitoringRuleProposalStartRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "startSecurityMonitoringRuleProposal"; + 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 = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling startSecurityMonitoringRuleProposal"); + } + // create path and map variables + String localVarPath = "/api/v2/security_monitoring/rules/proposals"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.startSecurityMonitoringRuleProposal", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Start a rule proposal. + * + *

See {@link #startSecurityMonitoringRuleProposalWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<SecurityMonitoringRuleProposalStartResponse>> + */ + public CompletableFuture> + startSecurityMonitoringRuleProposalWithHttpInfoAsync( + SecurityMonitoringRuleProposalStartRequest body) { + // Check if unstable operation is enabled + String operationId = "startSecurityMonitoringRuleProposal"; + 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 = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " startSecurityMonitoringRuleProposal")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/security_monitoring/rules/proposals"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SecurityMonitoringApi.startSecurityMonitoringRuleProposal", + localVarPath, + new ArrayList(), + 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( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Test an existing rule. * diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalError.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalError.java new file mode 100644 index 00000000000..a95a8be1107 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalError.java @@ -0,0 +1,204 @@ +/* + * 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; + +/** The reason no rule could be generated. Only present when the status is failed. */ +@JsonPropertyOrder({ + SecurityMonitoringRuleProposalError.JSON_PROPERTY_KIND, + SecurityMonitoringRuleProposalError.JSON_PROPERTY_MESSAGE, + SecurityMonitoringRuleProposalError.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringRuleProposalError { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_KIND = "kind"; + private String kind; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public SecurityMonitoringRuleProposalError() {} + + @JsonCreator + public SecurityMonitoringRuleProposalError( + @JsonProperty(required = true, value = JSON_PROPERTY_KIND) String kind) { + this.kind = kind; + } + + public SecurityMonitoringRuleProposalError kind(String kind) { + this.kind = kind; + return this; + } + + /** + * The kind of failure. - translation_error: no rule could be generated from the + * input. Reword the input or add details, then start a new rule proposal. - internal_error + * : the proposal failed because of an internal error. Start a new rule proposal to try + * again. + * + * @return kind + */ + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getKind() { + return kind; + } + + public void setKind(String kind) { + this.kind = kind; + } + + public SecurityMonitoringRuleProposalError message(String message) { + this.message = message; + return this; + } + + /** + * A human-readable explanation of why no rule could be generated, when available. + * + * @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 SecurityMonitoringRuleProposalError type(String type) { + this.type = type; + return this; + } + + /** + * The type of failure within its kind, such as NoRuleProduced. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + 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 SecurityMonitoringRuleProposalError + */ + @JsonAnySetter + public SecurityMonitoringRuleProposalError 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 SecurityMonitoringRuleProposalError object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringRuleProposalError securityMonitoringRuleProposalError = + (SecurityMonitoringRuleProposalError) o; + return Objects.equals(this.kind, securityMonitoringRuleProposalError.kind) + && Objects.equals(this.message, securityMonitoringRuleProposalError.message) + && Objects.equals(this.type, securityMonitoringRuleProposalError.type) + && Objects.equals( + this.additionalProperties, securityMonitoringRuleProposalError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(kind, message, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringRuleProposalError {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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/SecurityMonitoringRuleProposalInputType.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalInputType.java new file mode 100644 index 00000000000..7f07bed6cde --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalInputType.java @@ -0,0 +1,72 @@ +/* + * 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 input to generate the proposed rule from: natural_language for a + * plain-English description of the behavior to detect, spl for a Splunk SPL search or + * saved search definition, or kql for a Microsoft KQL query. SPL inputs must be + * self-contained, with search macros expanded. + */ +@JsonSerialize( + using = + SecurityMonitoringRuleProposalInputType.SecurityMonitoringRuleProposalInputTypeSerializer + .class) +public class SecurityMonitoringRuleProposalInputType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("natural_language", "spl", "kql")); + + public static final SecurityMonitoringRuleProposalInputType NATURAL_LANGUAGE = + new SecurityMonitoringRuleProposalInputType("natural_language"); + public static final SecurityMonitoringRuleProposalInputType SPL = + new SecurityMonitoringRuleProposalInputType("spl"); + public static final SecurityMonitoringRuleProposalInputType KQL = + new SecurityMonitoringRuleProposalInputType("kql"); + + SecurityMonitoringRuleProposalInputType(String value) { + super(value, allowedValues); + } + + public static class SecurityMonitoringRuleProposalInputTypeSerializer + extends StdSerializer { + public SecurityMonitoringRuleProposalInputTypeSerializer( + Class t) { + super(t); + } + + public SecurityMonitoringRuleProposalInputTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SecurityMonitoringRuleProposalInputType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityMonitoringRuleProposalInputType fromValue(String value) { + return new SecurityMonitoringRuleProposalInputType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalResponse.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalResponse.java new file mode 100644 index 00000000000..2d8ee3e33d8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalResponse.java @@ -0,0 +1,152 @@ +/* + * 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 a rule proposal. */ +@JsonPropertyOrder({SecurityMonitoringRuleProposalResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringRuleProposalResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private SecurityMonitoringRuleProposalResponseData data; + + public SecurityMonitoringRuleProposalResponse() {} + + @JsonCreator + public SecurityMonitoringRuleProposalResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + SecurityMonitoringRuleProposalResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public SecurityMonitoringRuleProposalResponse data( + SecurityMonitoringRuleProposalResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data of the rule proposal. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringRuleProposalResponseData getData() { + return data; + } + + public void setData(SecurityMonitoringRuleProposalResponseData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 SecurityMonitoringRuleProposalResponse + */ + @JsonAnySetter + public SecurityMonitoringRuleProposalResponse 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 SecurityMonitoringRuleProposalResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringRuleProposalResponse securityMonitoringRuleProposalResponse = + (SecurityMonitoringRuleProposalResponse) o; + return Objects.equals(this.data, securityMonitoringRuleProposalResponse.data) + && Objects.equals( + this.additionalProperties, securityMonitoringRuleProposalResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringRuleProposalResponse {\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/SecurityMonitoringRuleProposalResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalResponseAttributes.java new file mode 100644 index 00000000000..b92d5b69ed9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalResponseAttributes.java @@ -0,0 +1,225 @@ +/* + * 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; + +/** Attributes of the rule proposal. */ +@JsonPropertyOrder({ + SecurityMonitoringRuleProposalResponseAttributes.JSON_PROPERTY_ERROR, + SecurityMonitoringRuleProposalResponseAttributes.JSON_PROPERTY_RULE, + SecurityMonitoringRuleProposalResponseAttributes.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringRuleProposalResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ERROR = "error"; + private SecurityMonitoringRuleProposalError error; + + public static final String JSON_PROPERTY_RULE = "rule"; + private Map rule = null; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public SecurityMonitoringRuleProposalResponseAttributes() {} + + @JsonCreator + public SecurityMonitoringRuleProposalResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) String status) { + this.status = status; + } + + public SecurityMonitoringRuleProposalResponseAttributes error( + SecurityMonitoringRuleProposalError error) { + this.error = error; + this.unparsed |= error.unparsed; + return this; + } + + /** + * The reason no rule could be generated. Only present when the status is failed. + * + * @return error + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ERROR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SecurityMonitoringRuleProposalError getError() { + return error; + } + + public void setError(SecurityMonitoringRuleProposalError error) { + this.error = error; + if (error != null) { + this.unparsed |= error.unparsed; + } + } + + public SecurityMonitoringRuleProposalResponseAttributes rule(Map rule) { + this.rule = rule; + return this; + } + + public SecurityMonitoringRuleProposalResponseAttributes putRuleItem(String key, Object ruleItem) { + if (this.rule == null) { + this.rule = new HashMap<>(); + } + this.rule.put(key, ruleItem); + return this; + } + + /** + * The proposed Cloud SIEM detection rule in the same format as the create a detection rule + * endpoint. It is not saved in Cloud SIEM. Only present when the status is completed + * . Review the rule, then create it with the create + * a detection rule endpoint. + * + * @return rule + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RULE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getRule() { + return rule; + } + + public void setRule(Map rule) { + this.rule = rule; + } + + public SecurityMonitoringRuleProposalResponseAttributes status(String status) { + this.status = status; + return this; + } + + /** + * The status of the rule proposal. pending and in_progress mean the + * proposed rule is still being generated. Poll the endpoint again later. completed + * and failed are final: completed proposals contain the proposed rule + * in rule, and failed proposals contain the reason in error + * . + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SecurityMonitoringRuleProposalResponseAttributes + */ + @JsonAnySetter + public SecurityMonitoringRuleProposalResponseAttributes 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 SecurityMonitoringRuleProposalResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringRuleProposalResponseAttributes + securityMonitoringRuleProposalResponseAttributes = + (SecurityMonitoringRuleProposalResponseAttributes) o; + return Objects.equals(this.error, securityMonitoringRuleProposalResponseAttributes.error) + && Objects.equals(this.rule, securityMonitoringRuleProposalResponseAttributes.rule) + && Objects.equals(this.status, securityMonitoringRuleProposalResponseAttributes.status) + && Objects.equals( + this.additionalProperties, + securityMonitoringRuleProposalResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(error, rule, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringRuleProposalResponseAttributes {\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" rule: ").append(toIndentedString(rule)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalResponseData.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalResponseData.java new file mode 100644 index 00000000000..a1bd463bc74 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalResponseData.java @@ -0,0 +1,220 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.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; +import java.util.UUID; + +/** Data of the rule proposal. */ +@JsonPropertyOrder({ + SecurityMonitoringRuleProposalResponseData.JSON_PROPERTY_ATTRIBUTES, + SecurityMonitoringRuleProposalResponseData.JSON_PROPERTY_ID, + SecurityMonitoringRuleProposalResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringRuleProposalResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private SecurityMonitoringRuleProposalResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SecurityMonitoringRuleProposalType type = + SecurityMonitoringRuleProposalType.RULE_PROPOSALS; + + public SecurityMonitoringRuleProposalResponseData() {} + + @JsonCreator + public SecurityMonitoringRuleProposalResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + SecurityMonitoringRuleProposalResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + SecurityMonitoringRuleProposalType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SecurityMonitoringRuleProposalResponseData attributes( + SecurityMonitoringRuleProposalResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the rule proposal. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringRuleProposalResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(SecurityMonitoringRuleProposalResponseAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public SecurityMonitoringRuleProposalResponseData id(UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the rule proposal. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public SecurityMonitoringRuleProposalResponseData type(SecurityMonitoringRuleProposalType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The rule proposal resource type. The value is always rule_proposals. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringRuleProposalType getType() { + return type; + } + + public void setType(SecurityMonitoringRuleProposalType 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 SecurityMonitoringRuleProposalResponseData + */ + @JsonAnySetter + public SecurityMonitoringRuleProposalResponseData 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 SecurityMonitoringRuleProposalResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringRuleProposalResponseData securityMonitoringRuleProposalResponseData = + (SecurityMonitoringRuleProposalResponseData) o; + return Objects.equals(this.attributes, securityMonitoringRuleProposalResponseData.attributes) + && Objects.equals(this.id, securityMonitoringRuleProposalResponseData.id) + && Objects.equals(this.type, securityMonitoringRuleProposalResponseData.type) + && Objects.equals( + this.additionalProperties, + securityMonitoringRuleProposalResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringRuleProposalResponseData {\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/SecurityMonitoringRuleProposalStartRequest.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartRequest.java new file mode 100644 index 00000000000..e39c3086943 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartRequest.java @@ -0,0 +1,154 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request to start a rule proposal. */ +@JsonPropertyOrder({SecurityMonitoringRuleProposalStartRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringRuleProposalStartRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private SecurityMonitoringRuleProposalStartRequestData data; + + public SecurityMonitoringRuleProposalStartRequest() {} + + @JsonCreator + public SecurityMonitoringRuleProposalStartRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + SecurityMonitoringRuleProposalStartRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public SecurityMonitoringRuleProposalStartRequest data( + SecurityMonitoringRuleProposalStartRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data of the rule proposal to start. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringRuleProposalStartRequestData getData() { + return data; + } + + public void setData(SecurityMonitoringRuleProposalStartRequestData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 SecurityMonitoringRuleProposalStartRequest + */ + @JsonAnySetter + public SecurityMonitoringRuleProposalStartRequest 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 SecurityMonitoringRuleProposalStartRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringRuleProposalStartRequest securityMonitoringRuleProposalStartRequest = + (SecurityMonitoringRuleProposalStartRequest) o; + return Objects.equals(this.data, securityMonitoringRuleProposalStartRequest.data) + && Objects.equals( + this.additionalProperties, + securityMonitoringRuleProposalStartRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringRuleProposalStartRequest {\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/SecurityMonitoringRuleProposalStartRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartRequestAttributes.java new file mode 100644 index 00000000000..50ab2b63bf9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartRequestAttributes.java @@ -0,0 +1,192 @@ +/* + * 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; + +/** Attributes of the rule proposal to start. */ +@JsonPropertyOrder({ + SecurityMonitoringRuleProposalStartRequestAttributes.JSON_PROPERTY_INPUT, + SecurityMonitoringRuleProposalStartRequestAttributes.JSON_PROPERTY_INPUT_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringRuleProposalStartRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_INPUT = "input"; + private String input; + + public static final String JSON_PROPERTY_INPUT_TYPE = "inputType"; + private SecurityMonitoringRuleProposalInputType inputType; + + public SecurityMonitoringRuleProposalStartRequestAttributes() {} + + @JsonCreator + public SecurityMonitoringRuleProposalStartRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_INPUT) String input, + @JsonProperty(required = true, value = JSON_PROPERTY_INPUT_TYPE) + SecurityMonitoringRuleProposalInputType inputType) { + this.input = input; + this.inputType = inputType; + this.unparsed |= !inputType.isValid(); + } + + public SecurityMonitoringRuleProposalStartRequestAttributes input(String input) { + this.input = input; + return this; + } + + /** + * The natural-language description or rule to generate the proposed rule from, in the format + * given by inputType. + * + * @return input + */ + @JsonProperty(JSON_PROPERTY_INPUT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getInput() { + return input; + } + + public void setInput(String input) { + this.input = input; + } + + public SecurityMonitoringRuleProposalStartRequestAttributes inputType( + SecurityMonitoringRuleProposalInputType inputType) { + this.inputType = inputType; + this.unparsed |= !inputType.isValid(); + return this; + } + + /** + * The type of input to generate the proposed rule from: natural_language for a + * plain-English description of the behavior to detect, spl for a Splunk SPL search + * or saved search definition, or kql for a Microsoft KQL query. SPL inputs must be + * self-contained, with search macros expanded. + * + * @return inputType + */ + @JsonProperty(JSON_PROPERTY_INPUT_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringRuleProposalInputType getInputType() { + return inputType; + } + + public void setInputType(SecurityMonitoringRuleProposalInputType inputType) { + if (!inputType.isValid()) { + this.unparsed = true; + } + this.inputType = inputType; + } + + /** + * 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 SecurityMonitoringRuleProposalStartRequestAttributes + */ + @JsonAnySetter + public SecurityMonitoringRuleProposalStartRequestAttributes 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 SecurityMonitoringRuleProposalStartRequestAttributes object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringRuleProposalStartRequestAttributes + securityMonitoringRuleProposalStartRequestAttributes = + (SecurityMonitoringRuleProposalStartRequestAttributes) o; + return Objects.equals(this.input, securityMonitoringRuleProposalStartRequestAttributes.input) + && Objects.equals( + this.inputType, securityMonitoringRuleProposalStartRequestAttributes.inputType) + && Objects.equals( + this.additionalProperties, + securityMonitoringRuleProposalStartRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(input, inputType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringRuleProposalStartRequestAttributes {\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" inputType: ").append(toIndentedString(inputType)).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/SecurityMonitoringRuleProposalStartRequestData.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartRequestData.java new file mode 100644 index 00000000000..70bf983dc80 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartRequestData.java @@ -0,0 +1,193 @@ +/* + * 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 of the rule proposal to start. */ +@JsonPropertyOrder({ + SecurityMonitoringRuleProposalStartRequestData.JSON_PROPERTY_ATTRIBUTES, + SecurityMonitoringRuleProposalStartRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringRuleProposalStartRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private SecurityMonitoringRuleProposalStartRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SecurityMonitoringRuleProposalType type = + SecurityMonitoringRuleProposalType.RULE_PROPOSALS; + + public SecurityMonitoringRuleProposalStartRequestData() {} + + @JsonCreator + public SecurityMonitoringRuleProposalStartRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + SecurityMonitoringRuleProposalStartRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + SecurityMonitoringRuleProposalType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SecurityMonitoringRuleProposalStartRequestData attributes( + SecurityMonitoringRuleProposalStartRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the rule proposal to start. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringRuleProposalStartRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(SecurityMonitoringRuleProposalStartRequestAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public SecurityMonitoringRuleProposalStartRequestData type( + SecurityMonitoringRuleProposalType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The rule proposal resource type. The value is always rule_proposals. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringRuleProposalType getType() { + return type; + } + + public void setType(SecurityMonitoringRuleProposalType 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 SecurityMonitoringRuleProposalStartRequestData + */ + @JsonAnySetter + public SecurityMonitoringRuleProposalStartRequestData 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 SecurityMonitoringRuleProposalStartRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringRuleProposalStartRequestData securityMonitoringRuleProposalStartRequestData = + (SecurityMonitoringRuleProposalStartRequestData) o; + return Objects.equals( + this.attributes, securityMonitoringRuleProposalStartRequestData.attributes) + && Objects.equals(this.type, securityMonitoringRuleProposalStartRequestData.type) + && Objects.equals( + this.additionalProperties, + securityMonitoringRuleProposalStartRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringRuleProposalStartRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartResponse.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartResponse.java new file mode 100644 index 00000000000..b11bed96bb9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartResponse.java @@ -0,0 +1,154 @@ +/* + * 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 to a started rule proposal. */ +@JsonPropertyOrder({SecurityMonitoringRuleProposalStartResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringRuleProposalStartResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private SecurityMonitoringRuleProposalStartResponseData data; + + public SecurityMonitoringRuleProposalStartResponse() {} + + @JsonCreator + public SecurityMonitoringRuleProposalStartResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + SecurityMonitoringRuleProposalStartResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public SecurityMonitoringRuleProposalStartResponse data( + SecurityMonitoringRuleProposalStartResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data of the started rule proposal. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringRuleProposalStartResponseData getData() { + return data; + } + + public void setData(SecurityMonitoringRuleProposalStartResponseData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 SecurityMonitoringRuleProposalStartResponse + */ + @JsonAnySetter + public SecurityMonitoringRuleProposalStartResponse 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 SecurityMonitoringRuleProposalStartResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringRuleProposalStartResponse securityMonitoringRuleProposalStartResponse = + (SecurityMonitoringRuleProposalStartResponse) o; + return Objects.equals(this.data, securityMonitoringRuleProposalStartResponse.data) + && Objects.equals( + this.additionalProperties, + securityMonitoringRuleProposalStartResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringRuleProposalStartResponse {\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/SecurityMonitoringRuleProposalStartResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartResponseAttributes.java new file mode 100644 index 00000000000..154bf3a5e86 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartResponseAttributes.java @@ -0,0 +1,152 @@ +/* + * 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; + +/** Attributes of the started rule proposal. */ +@JsonPropertyOrder({SecurityMonitoringRuleProposalStartResponseAttributes.JSON_PROPERTY_STATUS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringRuleProposalStartResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public SecurityMonitoringRuleProposalStartResponseAttributes() {} + + @JsonCreator + public SecurityMonitoringRuleProposalStartResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) String status) { + this.status = status; + } + + public SecurityMonitoringRuleProposalStartResponseAttributes status(String status) { + this.status = status; + return this; + } + + /** + * The status of the rule proposal, one of pending, in_progress, + * completed, or failed. For a newly started rule proposal, the status is + * pending. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SecurityMonitoringRuleProposalStartResponseAttributes + */ + @JsonAnySetter + public SecurityMonitoringRuleProposalStartResponseAttributes 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 SecurityMonitoringRuleProposalStartResponseAttributes object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringRuleProposalStartResponseAttributes + securityMonitoringRuleProposalStartResponseAttributes = + (SecurityMonitoringRuleProposalStartResponseAttributes) o; + return Objects.equals(this.status, securityMonitoringRuleProposalStartResponseAttributes.status) + && Objects.equals( + this.additionalProperties, + securityMonitoringRuleProposalStartResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringRuleProposalStartResponseAttributes {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartResponseData.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartResponseData.java new file mode 100644 index 00000000000..0cb2070f4ff --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalStartResponseData.java @@ -0,0 +1,224 @@ +/* + * 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; +import java.util.UUID; + +/** Data of the started rule proposal. */ +@JsonPropertyOrder({ + SecurityMonitoringRuleProposalStartResponseData.JSON_PROPERTY_ATTRIBUTES, + SecurityMonitoringRuleProposalStartResponseData.JSON_PROPERTY_ID, + SecurityMonitoringRuleProposalStartResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SecurityMonitoringRuleProposalStartResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private SecurityMonitoringRuleProposalStartResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SecurityMonitoringRuleProposalType type = + SecurityMonitoringRuleProposalType.RULE_PROPOSALS; + + public SecurityMonitoringRuleProposalStartResponseData() {} + + @JsonCreator + public SecurityMonitoringRuleProposalStartResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + SecurityMonitoringRuleProposalStartResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + SecurityMonitoringRuleProposalType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SecurityMonitoringRuleProposalStartResponseData attributes( + SecurityMonitoringRuleProposalStartResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the started rule proposal. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringRuleProposalStartResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(SecurityMonitoringRuleProposalStartResponseAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public SecurityMonitoringRuleProposalStartResponseData id(UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the rule proposal. Use it as proposal_id to check the proposal status + * and get the proposed rule. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public SecurityMonitoringRuleProposalStartResponseData type( + SecurityMonitoringRuleProposalType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The rule proposal resource type. The value is always rule_proposals. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SecurityMonitoringRuleProposalType getType() { + return type; + } + + public void setType(SecurityMonitoringRuleProposalType 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 SecurityMonitoringRuleProposalStartResponseData + */ + @JsonAnySetter + public SecurityMonitoringRuleProposalStartResponseData 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 SecurityMonitoringRuleProposalStartResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityMonitoringRuleProposalStartResponseData + securityMonitoringRuleProposalStartResponseData = + (SecurityMonitoringRuleProposalStartResponseData) o; + return Objects.equals( + this.attributes, securityMonitoringRuleProposalStartResponseData.attributes) + && Objects.equals(this.id, securityMonitoringRuleProposalStartResponseData.id) + && Objects.equals(this.type, securityMonitoringRuleProposalStartResponseData.type) + && Objects.equals( + this.additionalProperties, + securityMonitoringRuleProposalStartResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityMonitoringRuleProposalStartResponseData {\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/SecurityMonitoringRuleProposalType.java b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalType.java new file mode 100644 index 00000000000..37ef8ee6e9a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SecurityMonitoringRuleProposalType.java @@ -0,0 +1,59 @@ +/* + * 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 rule proposal resource type. The value is always rule_proposals. */ +@JsonSerialize( + using = SecurityMonitoringRuleProposalType.SecurityMonitoringRuleProposalTypeSerializer.class) +public class SecurityMonitoringRuleProposalType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("rule_proposals")); + + public static final SecurityMonitoringRuleProposalType RULE_PROPOSALS = + new SecurityMonitoringRuleProposalType("rule_proposals"); + + SecurityMonitoringRuleProposalType(String value) { + super(value, allowedValues); + } + + public static class SecurityMonitoringRuleProposalTypeSerializer + extends StdSerializer { + public SecurityMonitoringRuleProposalTypeSerializer( + Class t) { + super(t); + } + + public SecurityMonitoringRuleProposalTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SecurityMonitoringRuleProposalType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SecurityMonitoringRuleProposalType fromValue(String value) { + return new SecurityMonitoringRuleProposalType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 84ca5af22e2..133777e08d8 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -1815,6 +1815,18 @@ "tag": "Security Monitoring", "operationId": "CreateSecurityMonitoringRule" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"rule_proposals\",\n \"attributes\": {\n \"inputType\": \"natural_language\",\n \"input\": \"Detect repeated failed Okta logins followed by a successful login from the same IP.\"\n }\n }\n}" + } + ], + "step": "there is a valid \"rule_proposal\" in the system", + "key": "rule_proposal", + "tag": "Security Monitoring", + "operationId": "StartSecurityMonitoringRuleProposal" + }, { "parameters": [ { diff --git a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature index 76da45be8aa..97a3aab55c4 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/security_monitoring.feature @@ -2173,6 +2173,33 @@ Feature: Security Monitoring Then the response status is 200 OK And the response has 3 items + @generated @skip @team:ddoghq/cloud-siem + Scenario: Get a rule proposal returns "Bad Request" response + Given operation "GetSecurityMonitoringRuleProposal" enabled + And new "GetSecurityMonitoringRuleProposal" request + And request contains "proposal_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/cloud-siem + Scenario: Get a rule proposal returns "Not Found" response + Given operation "GetSecurityMonitoringRuleProposal" enabled + And new "GetSecurityMonitoringRuleProposal" request + And request contains "proposal_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:ddoghq/cloud-siem + Scenario: Get a rule proposal returns "OK" response + Given operation "GetSecurityMonitoringRuleProposal" enabled + And there is a valid "rule_proposal" in the system + And new "GetSecurityMonitoringRuleProposal" request + And request contains "proposal_id" parameter from "rule_proposal.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "rule_proposal.data.id" + And the response "data.type" is equal to "rule_proposals" + @team:ddoghq/cloud-siem Scenario: Get a rule's details returns "Not Found" response Given new "GetSecurityMonitoringRule" request @@ -3744,6 +3771,24 @@ Feature: Security Monitoring When the request is sent Then the response status is 404 Not Found + @team:ddoghq/cloud-siem + Scenario: Start a rule proposal returns "Accepted" response + Given operation "StartSecurityMonitoringRuleProposal" enabled + And new "StartSecurityMonitoringRuleProposal" request + And body with value {"data": {"type": "rule_proposals", "attributes": {"inputType": "natural_language", "input": "Detect repeated failed Okta logins followed by a successful login from the same IP."}}} + When the request is sent + Then the response status is 202 Accepted + And the response "data.type" is equal to "rule_proposals" + And the response "data.attributes.status" is equal to "pending" + + @generated @skip @team:ddoghq/cloud-siem + Scenario: Start a rule proposal returns "Bad Request" response + Given operation "StartSecurityMonitoringRuleProposal" enabled + And new "StartSecurityMonitoringRuleProposal" request + And body with value {"data": {"attributes": {"input": "Detect repeated failed Okta logins followed by a successful login from the same IP.", "inputType": "natural_language"}, "type": "rule_proposals"}} + When the request is sent + Then the response status is 400 Bad Request + @generated @skip @team:ddoghq/cloud-siem Scenario: Subscribe to sample log generation returns "Bad Request" response Given operation "CreateSampleLogGenerationSubscription" enabled 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 2b20834efcf..6942b8c8a99 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 @@ -9603,6 +9603,18 @@ "type": "safe" } }, + "StartSecurityMonitoringRuleProposal": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, + "GetSecurityMonitoringRuleProposal": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "TestSecurityMonitoringRule": { "tag": "Security Monitoring", "undo": { diff --git a/src/test/resources/generated-test/test-runner-data/manifest.json b/src/test/resources/generated-test/test-runner-data/manifest.json index 1f460bf5a18..0d5e8925b99 100644 --- a/src/test/resources/generated-test/test-runner-data/manifest.json +++ b/src/test/resources/generated-test/test-runner-data/manifest.json @@ -10794,6 +10794,13 @@ "scenario": "Get a quick list of security signals returns \"OK\" response with pagination", "version": "v2" }, + { + "feature": "Security Monitoring", + "feature_file": "../../com/datadog/api/client/v2/api/security_monitoring.feature", + "file": "v2/security-monitoring/get-a-rule-proposal-returns-ok-response.json", + "scenario": "Get a rule proposal returns \"OK\" response", + "version": "v2" + }, { "feature": "Security Monitoring", "feature_file": "../../com/datadog/api/client/v2/api/security_monitoring.feature", @@ -11368,6 +11375,13 @@ "scenario": "Search security findings returns \"OK\" response with pagination", "version": "v2" }, + { + "feature": "Security Monitoring", + "feature_file": "../../com/datadog/api/client/v2/api/security_monitoring.feature", + "file": "v2/security-monitoring/start-a-rule-proposal-returns-accepted-response.json", + "scenario": "Start a rule proposal returns \"Accepted\" response", + "version": "v2" + }, { "feature": "Security Monitoring", "feature_file": "../../com/datadog/api/client/v2/api/security_monitoring.feature", diff --git a/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/get-a-rule-proposal-returns-ok-response.json b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/get-a-rule-proposal-returns-ok-response.json new file mode 100644 index 00000000000..9970e3c223a --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/get-a-rule-proposal-returns-ok-response.json @@ -0,0 +1,35 @@ +{ + "api": "SecurityMonitoring", + "expected_status": 200, + "feature": "Security Monitoring", + "id": "v2/Security Monitoring/Get a rule proposal returns \"OK\" response", + "operation_id": "GetSecurityMonitoringRuleProposal", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "proposal_id", + "required": true, + "schema": { + "format": "uuid", + "ref": null, + "type": "string" + }, + "source": { + "path": "rule_proposal.data.id", + "type": "fixture" + }, + "style": null + } + ], + "path": "/api/v2/security_monitoring/rules/proposals/{proposal_id}" + }, + "scenario": "Get a rule proposal returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/start-a-rule-proposal-returns-accepted-response.json b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/start-a-rule-proposal-returns-accepted-response.json new file mode 100644 index 00000000000..6dc5b334884 --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/security-monitoring/start-a-rule-proposal-returns-accepted-response.json @@ -0,0 +1,34 @@ +{ + "api": "SecurityMonitoring", + "expected_status": 202, + "feature": "Security Monitoring", + "id": "v2/Security Monitoring/Start a rule proposal returns \"Accepted\" response", + "operation_id": "StartSecurityMonitoringRuleProposal", + "request": { + "body": { + "schema": { + "format": null, + "ref": "SecurityMonitoringRuleProposalStartRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "input": "Detect repeated failed Okta logins followed by a successful login from the same IP.", + "inputType": "natural_language" + }, + "type": "rule_proposals" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/security_monitoring/rules/proposals" + }, + "scenario": "Start a rule proposal returns \"Accepted\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-server-data/v2/security-monitoring.json b/src/test/resources/generated-test/test-server-data/v2/security-monitoring.json index a1d8f896f0c..db5fdfa56f9 100644 --- a/src/test/resources/generated-test/test-server-data/v2/security-monitoring.json +++ b/src/test/resources/generated-test/test-server-data/v2/security-monitoring.json @@ -7530,6 +7530,68 @@ "scenario": "Get a quick list of security signals returns \"OK\" response with pagination", "version": "v2" }, + { + "feature": "Security Monitoring", + "frozen_at": "2026-10-28T09:56:29.502Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "input": "Detect repeated failed Okta logins followed by a successful login from the same IP.", + "inputType": "natural_language" + }, + "type": "rule_proposals" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/security_monitoring/rules/proposals", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"f4e95a96-51e3-4914-b68b-ef9a82044cb2\",\"type\":\"rule_proposals\",\"attributes\":{\"status\":\"pending\"}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Accepted", + "status": 202 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/security_monitoring/rules/proposals/f4e95a96-51e3-4914-b68b-ef9a82044cb2", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"f4e95a96-51e3-4914-b68b-ef9a82044cb2\",\"type\":\"rule_proposals\",\"attributes\":{\"status\":\"pending\"}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Get a rule proposal returns \"OK\" response", + "version": "v2" + }, { "feature": "Security Monitoring", "frozen_at": "2024-05-10T16:34:43.147Z", @@ -13372,6 +13434,45 @@ "scenario": "Search security findings returns \"OK\" response with pagination", "version": "v2" }, + { + "feature": "Security Monitoring", + "frozen_at": "2026-10-28T09:56:32.110Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "input": "Detect repeated failed Okta logins followed by a successful login from the same IP.", + "inputType": "natural_language" + }, + "type": "rule_proposals" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/security_monitoring/rules/proposals", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"05761b35-c9c1-4503-9071-dccb12cdf3fd\",\"type\":\"rule_proposals\",\"attributes\":{\"status\":\"pending\"}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Accepted", + "status": 202 + } + } + ], + "scenario": "Start a rule proposal returns \"Accepted\" response", + "version": "v2" + }, { "feature": "Security Monitoring", "frozen_at": "2026-06-10T09:27:59.116Z",