From 1f6d1772501e187f8fc451dd14199459cb0e6cd3 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 28 Oct 2026 17:24:10 +0000 Subject: [PATCH] Regenerate client from commit 916a332 of spec repo --- .generator/schemas/v2/openapi.yaml | 358 ++++++++++++++++++ .../GetSecurityMonitoringRuleProposal.rb | 12 + .../StartSecurityMonitoringRuleProposal.rb | 19 + features/scenarios_model_mapping.rb | 6 + features/v2/given.json | 12 + features/v2/security_monitoring.feature | 45 +++ features/v2/undo.json | 12 + generated-test/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 +++++ lib/datadog_api_client/configuration.rb | 2 + lib/datadog_api_client/inflector.rb | 12 + .../v2/api/security_monitoring_api.rb | 163 ++++++++ ...security_monitoring_rule_proposal_error.rb | 147 +++++++ ...ity_monitoring_rule_proposal_input_type.rb | 31 ++ ...urity_monitoring_rule_proposal_response.rb | 123 ++++++ ...oring_rule_proposal_response_attributes.rb | 150 ++++++++ ..._monitoring_rule_proposal_response_data.rb | 165 ++++++++ ..._monitoring_rule_proposal_start_request.rb | 123 ++++++ ..._rule_proposal_start_request_attributes.rb | 152 ++++++++ ...toring_rule_proposal_start_request_data.rb | 144 +++++++ ...monitoring_rule_proposal_start_response.rb | 123 ++++++ ...rule_proposal_start_response_attributes.rb | 124 ++++++ ...oring_rule_proposal_start_response_data.rb | 165 ++++++++ .../security_monitoring_rule_proposal_type.rb | 26 ++ 26 files changed, 2298 insertions(+) create mode 100644 examples/v2/security-monitoring/GetSecurityMonitoringRuleProposal.rb create mode 100644 examples/v2/security-monitoring/StartSecurityMonitoringRuleProposal.rb create mode 100644 generated-test/test-runner-data/v2/security-monitoring/get-a-rule-proposal-returns-ok-response.json create mode 100644 generated-test/test-runner-data/v2/security-monitoring/start-a-rule-proposal-returns-accepted-response.json create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_error.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_input_type.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 993e6653a164..ce141ae18532 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.rb b/examples/v2/security-monitoring/GetSecurityMonitoringRuleProposal.rb new file mode 100644 index 000000000000..7f20fbdf46ec --- /dev/null +++ b/examples/v2/security-monitoring/GetSecurityMonitoringRuleProposal.rb @@ -0,0 +1,12 @@ +# Get a rule proposal returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.get_security_monitoring_rule_proposal".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +# there is a valid "rule_proposal" in the system +RULE_PROPOSAL_DATA_ID = ENV["RULE_PROPOSAL_DATA_ID"] +p api_instance.get_security_monitoring_rule_proposal(RULE_PROPOSAL_DATA_ID) diff --git a/examples/v2/security-monitoring/StartSecurityMonitoringRuleProposal.rb b/examples/v2/security-monitoring/StartSecurityMonitoringRuleProposal.rb new file mode 100644 index 000000000000..5d27a98f3adc --- /dev/null +++ b/examples/v2/security-monitoring/StartSecurityMonitoringRuleProposal.rb @@ -0,0 +1,19 @@ +# Start a rule proposal returns "Accepted" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.start_security_monitoring_rule_proposal".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::SecurityMonitoringRuleProposalStartRequest.new({ + data: DatadogAPIClient::V2::SecurityMonitoringRuleProposalStartRequestData.new({ + type: DatadogAPIClient::V2::SecurityMonitoringRuleProposalType::RULE_PROPOSALS, + attributes: DatadogAPIClient::V2::SecurityMonitoringRuleProposalStartRequestAttributes.new({ + input_type: DatadogAPIClient::V2::SecurityMonitoringRuleProposalInputType::NATURAL_LANGUAGE, + input: "Detect repeated failed Okta logins followed by a successful login from the same IP.", + }), + }), +}) +p api_instance.start_security_monitoring_rule_proposal(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 2a86c80e39fb..be9cd543e12a 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2693,6 +2693,12 @@ "v2.BulkConvertExistingSecurityMonitoringRules" => { "body" => "SecurityMonitoringRuleConvertBulkPayload", }, + "v2.StartSecurityMonitoringRuleProposal" => { + "body" => "SecurityMonitoringRuleProposalStartRequest", + }, + "v2.GetSecurityMonitoringRuleProposal" => { + "proposal_id" => "UUID", + }, "v2.TestSecurityMonitoringRule" => { "body" => "SecurityMonitoringRuleTestRequest", }, diff --git a/features/v2/given.json b/features/v2/given.json index 84ca5af22e2f..133777e08d81 100644 --- a/features/v2/given.json +++ b/features/v2/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/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index 76da45be8aa4..97a3aab55c42 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 2b20834efcfe..6942b8c8a993 100644 --- a/features/v2/undo.json +++ b/features/v2/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/generated-test/test-runner-data/manifest.json b/generated-test/test-runner-data/manifest.json index 076864d2a4fe..33788a111c19 100644 --- a/generated-test/test-runner-data/manifest.json +++ b/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": "../../features/v2/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": "../../features/v2/security_monitoring.feature", @@ -11368,6 +11375,13 @@ "scenario": "Search security findings returns \"OK\" response with pagination", "version": "v2" }, + { + "feature": "Security Monitoring", + "feature_file": "../../features/v2/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": "../../features/v2/security_monitoring.feature", diff --git a/generated-test/test-runner-data/v2/security-monitoring/get-a-rule-proposal-returns-ok-response.json b/generated-test/test-runner-data/v2/security-monitoring/get-a-rule-proposal-returns-ok-response.json new file mode 100644 index 000000000000..9970e3c223a1 --- /dev/null +++ b/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/generated-test/test-runner-data/v2/security-monitoring/start-a-rule-proposal-returns-accepted-response.json b/generated-test/test-runner-data/v2/security-monitoring/start-a-rule-proposal-returns-accepted-response.json new file mode 100644 index 000000000000..6dc5b334884d --- /dev/null +++ b/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/generated-test/test-server-data/v2/security-monitoring.json b/generated-test/test-server-data/v2/security-monitoring.json index a1d8f896f0ce..db5fdfa56f90 100644 --- a/generated-test/test-server-data/v2/security-monitoring.json +++ b/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", diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 8423be51c663..0872f9c05a6b 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -372,6 +372,7 @@ def initialize "v2.get_security_monitoring_histsignal": false, "v2.get_security_monitoring_histsignals_by_job_id": false, "v2.get_security_monitoring_integration_config": false, + "v2.get_security_monitoring_rule_proposal": false, "v2.get_signal_entities": false, "v2.get_single_entity_context": false, "v2.get_static_analysis_default_rulesets": false, @@ -409,6 +410,7 @@ def initialize "v2.run_historical_job": false, "v2.search_security_monitoring_histsignals": false, "v2.start_security_monitoring_batch_migration": false, + "v2.start_security_monitoring_rule_proposal": false, "v2.update_findings_assignee": false, "v2.update_findings_severity": false, "v2.update_security_findings_automation_due_date_rule": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 3cd8ab6ff4c3..7e3097d49e22 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -8094,6 +8094,18 @@ def overrides "v2.security_monitoring_rule_new_value_options_learning_method" => "SecurityMonitoringRuleNewValueOptionsLearningMethod", "v2.security_monitoring_rule_new_value_options_learning_threshold" => "SecurityMonitoringRuleNewValueOptionsLearningThreshold", "v2.security_monitoring_rule_options" => "SecurityMonitoringRuleOptions", + "v2.security_monitoring_rule_proposal_error" => "SecurityMonitoringRuleProposalError", + "v2.security_monitoring_rule_proposal_input_type" => "SecurityMonitoringRuleProposalInputType", + "v2.security_monitoring_rule_proposal_response" => "SecurityMonitoringRuleProposalResponse", + "v2.security_monitoring_rule_proposal_response_attributes" => "SecurityMonitoringRuleProposalResponseAttributes", + "v2.security_monitoring_rule_proposal_response_data" => "SecurityMonitoringRuleProposalResponseData", + "v2.security_monitoring_rule_proposal_start_request" => "SecurityMonitoringRuleProposalStartRequest", + "v2.security_monitoring_rule_proposal_start_request_attributes" => "SecurityMonitoringRuleProposalStartRequestAttributes", + "v2.security_monitoring_rule_proposal_start_request_data" => "SecurityMonitoringRuleProposalStartRequestData", + "v2.security_monitoring_rule_proposal_start_response" => "SecurityMonitoringRuleProposalStartResponse", + "v2.security_monitoring_rule_proposal_start_response_attributes" => "SecurityMonitoringRuleProposalStartResponseAttributes", + "v2.security_monitoring_rule_proposal_start_response_data" => "SecurityMonitoringRuleProposalStartResponseData", + "v2.security_monitoring_rule_proposal_type" => "SecurityMonitoringRuleProposalType", "v2.security_monitoring_rule_query" => "SecurityMonitoringRuleQuery", "v2.security_monitoring_rule_query_aggregation" => "SecurityMonitoringRuleQueryAggregation", "v2.security_monitoring_rule_query_payload" => "SecurityMonitoringRuleQueryPayload", diff --git a/lib/datadog_api_client/v2/api/security_monitoring_api.rb b/lib/datadog_api_client/v2/api/security_monitoring_api.rb index 45acd1b26034..42855a2f1740 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -2423,6 +2423,7 @@ def create_security_monitoring_batch_migration(body, opts = {}) # 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. # # @param body [SecurityMonitoringBatchMigrationCreateRequest] # @param opts [Hash] the optional parameters @@ -7448,6 +7449,84 @@ def get_security_monitoring_rule_with_http_info(rule_id, opts = {}) return data, status_code, headers end + # Get a rule proposal. + # + # @see #get_security_monitoring_rule_proposal_with_http_info + def get_security_monitoring_rule_proposal(proposal_id, opts = {}) + data, _status_code, _headers = get_security_monitoring_rule_proposal_with_http_info(proposal_id, opts) + data + end + + # Get a rule proposal. + # + # 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 proposal_id [UUID] The ID of the rule proposal, returned by the start a rule proposal endpoint. + # @param opts [Hash] the optional parameters + # @return [Array<(SecurityMonitoringRuleProposalResponse, Integer, Hash)>] SecurityMonitoringRuleProposalResponse data, response status code and response headers + def get_security_monitoring_rule_proposal_with_http_info(proposal_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_security_monitoring_rule_proposal".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_security_monitoring_rule_proposal") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_security_monitoring_rule_proposal")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.get_security_monitoring_rule_proposal ...' + end + # verify the required parameter 'proposal_id' is set + if @api_client.config.client_side_validation && proposal_id.nil? + fail ArgumentError, "Missing the required parameter 'proposal_id' when calling SecurityMonitoringAPI.get_security_monitoring_rule_proposal" + end + # resource path + local_var_path = '/api/v2/security_monitoring/rules/proposals/{proposal_id}'.sub('{proposal_id}', CGI.escape(proposal_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SecurityMonitoringRuleProposalResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_security_monitoring_rule_proposal, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#get_security_monitoring_rule_proposal\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a signal's details. # # @see #get_security_monitoring_signal_with_http_info @@ -12465,6 +12544,90 @@ def start_security_monitoring_batch_migration_with_http_info(batch_id, opts = {} return data, status_code, headers end + # Start a rule proposal. + # + # @see #start_security_monitoring_rule_proposal_with_http_info + def start_security_monitoring_rule_proposal(body, opts = {}) + data, _status_code, _headers = start_security_monitoring_rule_proposal_with_http_info(body, opts) + data + end + + # Start a rule proposal. + # + # 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 [SecurityMonitoringRuleProposalStartRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(SecurityMonitoringRuleProposalStartResponse, Integer, Hash)>] SecurityMonitoringRuleProposalStartResponse data, response status code and response headers + def start_security_monitoring_rule_proposal_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.start_security_monitoring_rule_proposal".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.start_security_monitoring_rule_proposal") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.start_security_monitoring_rule_proposal")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.start_security_monitoring_rule_proposal ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling SecurityMonitoringAPI.start_security_monitoring_rule_proposal" + end + # resource path + local_var_path = '/api/v2/security_monitoring/rules/proposals' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'SecurityMonitoringRuleProposalStartResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :start_security_monitoring_rule_proposal, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#start_security_monitoring_rule_proposal\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Test an existing rule. # # @see #test_existing_security_monitoring_rule_with_http_info diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_error.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_error.rb new file mode 100644 index 000000000000..a86591769b68 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_error.rb @@ -0,0 +1,147 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The reason no rule could be generated. Only present when the status is `failed`. + class SecurityMonitoringRuleProposalError + include BaseGenericModel + + # 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. + attr_reader :kind + + # A human-readable explanation of why no rule could be generated, when available. + attr_accessor :message + + # The type of failure within its kind, such as `NoRuleProduced`. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'kind' => :'kind', + :'message' => :'message', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'kind' => :'String', + :'message' => :'String', + :'type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringRuleProposalError` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @kind.nil? + true + end + + # Custom attribute writer method with validation + # @param kind [Object] Object to be assigned + # @!visibility private + def kind=(kind) + if kind.nil? + fail ArgumentError, 'invalid value for "kind", kind cannot be nil.' + end + @kind = kind + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + kind == o.kind && + message == o.message && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [kind, message, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_input_type.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_input_type.rb new file mode 100644 index 000000000000..56c04f283520 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_input_type.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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. + class SecurityMonitoringRuleProposalInputType + include BaseEnumModel + + NATURAL_LANGUAGE = "natural_language".freeze + SPL = "spl".freeze + KQL = "kql".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response.rb new file mode 100644 index 000000000000..087bfa317f3e --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a rule proposal. + class SecurityMonitoringRuleProposalResponse + include BaseGenericModel + + # Data of the rule proposal. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'SecurityMonitoringRuleProposalResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringRuleProposalResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response_attributes.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response_attributes.rb new file mode 100644 index 000000000000..71fbaba75ae5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response_attributes.rb @@ -0,0 +1,150 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the rule proposal. + class SecurityMonitoringRuleProposalResponseAttributes + include BaseGenericModel + + # The reason no rule could be generated. Only present when the status is `failed`. + attr_accessor :error + + # 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. + attr_accessor :rule + + # 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`. + attr_reader :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'error' => :'error', + :'rule' => :'rule', + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'error' => :'SecurityMonitoringRuleProposalError', + :'rule' => :'Hash', + :'status' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringRuleProposalResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'rule') + self.rule = attributes[:'rule'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @status.nil? + true + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + error == o.error && + rule == o.rule && + status == o.status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [error, rule, status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response_data.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response_data.rb new file mode 100644 index 000000000000..f5e4dd61f559 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_response_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data of the rule proposal. + class SecurityMonitoringRuleProposalResponseData + include BaseGenericModel + + # Attributes of the rule proposal. + attr_reader :attributes + + # The ID of the rule proposal. + attr_reader :id + + # The rule proposal resource type. The value is always `rule_proposals`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SecurityMonitoringRuleProposalResponseAttributes', + :'id' => :'UUID', + :'type' => :'SecurityMonitoringRuleProposalType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringRuleProposalResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request.rb new file mode 100644 index 000000000000..6ef88063d445 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to start a rule proposal. + class SecurityMonitoringRuleProposalStartRequest + include BaseGenericModel + + # Data of the rule proposal to start. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'SecurityMonitoringRuleProposalStartRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringRuleProposalStartRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request_attributes.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request_attributes.rb new file mode 100644 index 000000000000..c3faf902255e --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request_attributes.rb @@ -0,0 +1,152 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the rule proposal to start. + class SecurityMonitoringRuleProposalStartRequestAttributes + include BaseGenericModel + + # The natural-language description or rule to generate the proposed rule from, in the + # format given by `inputType`. + attr_reader :input + + # 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. + attr_reader :input_type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'input' => :'input', + :'input_type' => :'inputType' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'input' => :'String', + :'input_type' => :'SecurityMonitoringRuleProposalInputType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringRuleProposalStartRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'input') + self.input = attributes[:'input'] + end + + if attributes.key?(:'input_type') + self.input_type = attributes[:'input_type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @input.nil? + return false if @input.to_s.length > 65536 + return false if @input_type.nil? + true + end + + # Custom attribute writer method with validation + # @param input [Object] Object to be assigned + # @!visibility private + def input=(input) + if input.nil? + fail ArgumentError, 'invalid value for "input", input cannot be nil.' + end + if input.to_s.length > 65536 + fail ArgumentError, 'invalid value for "input", the character length must be smaller than or equal to 65536.' + end + @input = input + end + + # Custom attribute writer method with validation + # @param input_type [Object] Object to be assigned + # @!visibility private + def input_type=(input_type) + if input_type.nil? + fail ArgumentError, 'invalid value for "input_type", input_type cannot be nil.' + end + @input_type = input_type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + input == o.input && + input_type == o.input_type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [input, input_type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request_data.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request_data.rb new file mode 100644 index 000000000000..a2d00f05cbd2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data of the rule proposal to start. + class SecurityMonitoringRuleProposalStartRequestData + include BaseGenericModel + + # Attributes of the rule proposal to start. + attr_reader :attributes + + # The rule proposal resource type. The value is always `rule_proposals`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SecurityMonitoringRuleProposalStartRequestAttributes', + :'type' => :'SecurityMonitoringRuleProposalType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringRuleProposalStartRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response.rb new file mode 100644 index 000000000000..5f5c1b33796f --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response to a started rule proposal. + class SecurityMonitoringRuleProposalStartResponse + include BaseGenericModel + + # Data of the started rule proposal. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'SecurityMonitoringRuleProposalStartResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringRuleProposalStartResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response_attributes.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response_attributes.rb new file mode 100644 index 000000000000..38ffc3e8a20b --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response_attributes.rb @@ -0,0 +1,124 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the started rule proposal. + class SecurityMonitoringRuleProposalStartResponseAttributes + include BaseGenericModel + + # The status of the rule proposal, one of `pending`, `in_progress`, `completed`, or + # `failed`. For a newly started rule proposal, the status is `pending`. + attr_reader :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'status' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringRuleProposalStartResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @status.nil? + true + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response_data.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response_data.rb new file mode 100644 index 000000000000..c81da16267da --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_start_response_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data of the started rule proposal. + class SecurityMonitoringRuleProposalStartResponseData + include BaseGenericModel + + # Attributes of the started rule proposal. + attr_reader :attributes + + # The ID of the rule proposal. Use it as `proposal_id` to check the proposal status and get the proposed rule. + attr_reader :id + + # The rule proposal resource type. The value is always `rule_proposals`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SecurityMonitoringRuleProposalStartResponseAttributes', + :'id' => :'UUID', + :'type' => :'SecurityMonitoringRuleProposalType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SecurityMonitoringRuleProposalStartResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_type.rb b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_type.rb new file mode 100644 index 000000000000..5826fe9d0974 --- /dev/null +++ b/lib/datadog_api_client/v2/models/security_monitoring_rule_proposal_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The rule proposal resource type. The value is always `rule_proposals`. + class SecurityMonitoringRuleProposalType + include BaseEnumModel + + RULE_PROPOSALS = "rule_proposals".freeze + end +end