From 7f0439b8c676143c3bace1a510459514795e82f9 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 18:44:39 +0000 Subject: [PATCH] Add MuteSecurityFindings endpoint spec (#3253) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 187 ++++++++++++++++++ ...-findings-returns-Accepted-response.frozen | 1 + ...ity-findings-returns-Accepted-response.yml | 24 +++ ...findings-returns-Not-Found-response.frozen | 1 + ...ty-findings-returns-Not-Found-response.yml | 25 +++ ...turns-Unprocessable-Entity-response.frozen | 1 + ...-returns-Unprocessable-Entity-response.yml | 25 +++ ...-findings-returns-Accepted-response.frozen | 1 + ...ity-findings-returns-Accepted-response.yml | 24 +++ ...findings-returns-Not-Found-response.frozen | 1 + ...ty-findings-returns-Not-Found-response.yml | 25 +++ ...turns-Unprocessable-Entity-response.frozen | 1 + ...-returns-Unprocessable-Entity-response.yml | 26 +++ .../MuteSecurityFindings.rb | 33 ++++ .../MuteSecurityFindings_298521544.rb | 31 +++ .../MuteSecurityFindings_3830190821.rb | 32 +++ features/scenarios_model_mapping.rb | 3 + features/v2/security_monitoring.feature | 80 ++++++++ features/v2/undo.json | 6 + lib/datadog_api_client/configuration.rb | 1 + lib/datadog_api_client/inflector.rb | 9 + .../v2/api/security_monitoring_api.rb | 76 +++++++ .../v2/models/mute_data_type.rb | 26 +++ .../models/mute_findings_mute_attributes.rb | 164 +++++++++++++++ .../v2/models/mute_findings_reason.rb | 34 ++++ .../v2/models/mute_findings_request.rb | 123 ++++++++++++ .../v2/models/mute_findings_request_data.rb | 175 ++++++++++++++++ .../mute_findings_request_data_attributes.rb | 123 ++++++++++++ ...ute_findings_request_data_relationships.rb | 123 ++++++++++++ .../v2/models/mute_findings_response.rb | 105 ++++++++++ .../v2/models/mute_findings_response_data.rb | 144 ++++++++++++++ 31 files changed, 1630 insertions(+) create mode 100644 cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Accepted-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Accepted-response.yml create mode 100644 cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Unprocessable-Entity-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Unprocessable-Entity-response.yml create mode 100644 cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Accepted-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Accepted-response.yml create mode 100644 cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Unprocessable-Entity-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Unprocessable-Entity-response.yml create mode 100644 examples/v2/security-monitoring/MuteSecurityFindings.rb create mode 100644 examples/v2/security-monitoring/MuteSecurityFindings_298521544.rb create mode 100644 examples/v2/security-monitoring/MuteSecurityFindings_3830190821.rb create mode 100644 lib/datadog_api_client/v2/models/mute_data_type.rb create mode 100644 lib/datadog_api_client/v2/models/mute_findings_mute_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/mute_findings_reason.rb create mode 100644 lib/datadog_api_client/v2/models/mute_findings_request.rb create mode 100644 lib/datadog_api_client/v2/models/mute_findings_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/mute_findings_request_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/mute_findings_request_data_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/mute_findings_response.rb create mode 100644 lib/datadog_api_client/v2/models/mute_findings_response_data.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4c46f3c596f9..9041f8a00394 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -45082,6 +45082,125 @@ components: meta: $ref: "#/components/schemas/MonthlyCostAttributionMeta" type: object + MuteDataType: + default: mute + description: Mute resource type. + enum: + - mute + example: mute + type: string + x-enum-varnames: + - MUTE + MuteFindingsMuteAttributes: + description: Mute properties to apply to the findings. + properties: + description: + description: Additional information about the reason why the findings are muted or unmuted. This field has a limit of 280 characters. + example: "To be resolved later." + type: string + expire_at: + description: >- + The expiration date of the mute action (Unix ms). It must be set to a value greater than the current timestamp. If this field is not provided, the findings remain muted indefinitely. + example: 1778721573794 + format: int64 + type: integer + is_muted: + description: Whether the findings should be muted or unmuted. + example: true + type: boolean + reason: + $ref: "#/components/schemas/MuteFindingsReason" + description: The reason why the findings are muted or unmuted. + required: + - is_muted + - reason + type: object + MuteFindingsReason: + description: The reason why the findings are muted or unmuted. + enum: + - PENDING_FIX + - FALSE_POSITIVE + - OTHER + - NO_FIX + - DUPLICATE + - RISK_ACCEPTED + - NO_PENDING_FIX + - HUMAN_ERROR + - NO_LONGER_ACCEPTED_RISK + example: PENDING_FIX + type: string + x-enum-varnames: + - PENDING_FIX + - FALSE_POSITIVE + - OTHER + - NO_FIX + - DUPLICATE + - RISK_ACCEPTED + - NO_PENDING_FIX + - HUMAN_ERROR + - NO_LONGER_ACCEPTED_RISK + MuteFindingsRequest: + description: Request to mute or unmute security findings. + properties: + data: + $ref: "#/components/schemas/MuteFindingsRequestData" + required: + - data + type: object + MuteFindingsRequestData: + description: Data of the mute request. + properties: + attributes: + $ref: "#/components/schemas/MuteFindingsRequestDataAttributes" + id: + description: Unique identifier of the mute request. + example: "93bfeb70-af47-424d-908a-948d3f08e37f" + type: string + relationships: + $ref: "#/components/schemas/MuteFindingsRequestDataRelationships" + type: + $ref: "#/components/schemas/MuteDataType" + required: + - attributes + - relationships + - type + type: object + MuteFindingsRequestDataAttributes: + description: Attributes of the mute request. + properties: + mute: + $ref: "#/components/schemas/MuteFindingsMuteAttributes" + required: + - mute + type: object + MuteFindingsRequestDataRelationships: + description: Relationships of the mute request. + properties: + findings: + $ref: "#/components/schemas/Findings" + description: Security findings to mute or unmute. + required: + - findings + type: object + MuteFindingsResponse: + description: Response for the mute or unmute request. + properties: + data: + $ref: "#/components/schemas/MuteFindingsResponseData" + type: object + MuteFindingsResponseData: + description: Data of the mute response. + properties: + id: + description: Unique identifier of the mute request. + example: "93bfeb70-af47-424d-908a-948d3f08e37f" + type: string + type: + $ref: "#/components/schemas/MuteDataType" + required: + - type + - id + type: object NotebookCreateData: description: Notebook creation data properties: @@ -119237,6 +119356,74 @@ paths: permissions: - security_monitoring_findings_write - appsec_vm_write + /api/v2/security/findings/mute: + patch: + description: >- + Mute or unmute security findings. + + You can mute or unmute up to 100 security findings per request. The request body must include `is_muted` and `reason` attributes. The allowed reasons depend on whether the finding is being muted or unmuted: + - To mute a finding: `PENDING_FIX`, `FALSE_POSITIVE`, `OTHER`, `NO_FIX`, `DUPLICATE`, `RISK_ACCEPTED`. + - To unmute a finding: `NO_PENDING_FIX`, `HUMAN_ERROR`, `NO_LONGER_ACCEPTED_RISK`, `OTHER`. + operationId: MuteSecurityFindings + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + mute: + description: "To be resolved later." + expire_at: 1778721573794 + is_muted: true + reason: "RISK_ACCEPTED" + relationships: + findings: + data: + - id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==" + type: "findings" + type: "mute" + schema: + $ref: "#/components/schemas/MuteFindingsRequest" + required: true + responses: + "202": + content: + application/json: + schema: + $ref: "#/components/schemas/MuteFindingsResponse" + description: Accepted + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: "Unprocessable Entity" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Mute or unmute security findings + tags: + - "Security Monitoring" + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/security/findings/search: post: description: |- diff --git a/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Accepted-response.frozen b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Accepted-response.frozen new file mode 100644 index 000000000000..c70fc98419e9 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Accepted-response.frozen @@ -0,0 +1 @@ +2026-04-27T16:46:59.369Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Accepted-response.yml b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Accepted-response.yml new file mode 100644 index 000000000000..270cc0cf7f1c --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Accepted-response.yml @@ -0,0 +1,24 @@ +http_interactions: +- recorded_at: Mon, 27 Apr 2026 16:46:59 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"mute":{"description":"To be resolved later.","expire_at":1778721573794,"is_muted":true,"reason":"RISK_ACCEPTED"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=","type":"findings"}]}},"type":"mute"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"7a0bd082-5c8a-4ea3-a8a5-c5036e083ddb","type":"mute"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 202 + message: Accepted +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Not-Found-response.frozen b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..2343aeed263a --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-04-27T16:13:25.084Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Not-Found-response.yml b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Not-Found-response.yml new file mode 100644 index 000000000000..c19874d05d6b --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Not-Found-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Mon, 27 Apr 2026 16:13:25 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"mute":{"description":"To be resolved later.","expire_at":1778721573794,"is_muted":true,"reason":"RISK_ACCEPTED"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==","type":"findings"}]}},"type":"mute"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Not Found","detail":"finding not + found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Unprocessable-Entity-response.frozen b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Unprocessable-Entity-response.frozen new file mode 100644 index 000000000000..4217cf20b9cd --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Unprocessable-Entity-response.frozen @@ -0,0 +1 @@ +2026-04-27T16:19:46.205Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Unprocessable-Entity-response.yml b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Unprocessable-Entity-response.yml new file mode 100644 index 000000000000..1f6061410cd6 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Mute-security-findings-returns-Unprocessable-Entity-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Mon, 27 Apr 2026 16:19:46 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"mute":{"description":"To be resolved later.","expire_at":1,"is_muted":true,"reason":"RISK_ACCEPTED"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==","type":"findings"}]}},"type":"mute"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"422","title":"Invalid Request","detail":"Invalid + expiration date. Please provide an expiration date in the future"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 422 + message: Unprocessable Entity +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Accepted-response.frozen b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Accepted-response.frozen new file mode 100644 index 000000000000..aeddfe329e92 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Accepted-response.frozen @@ -0,0 +1 @@ +2026-04-27T16:48:26.948Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Accepted-response.yml b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Accepted-response.yml new file mode 100644 index 000000000000..75ac674891d0 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Accepted-response.yml @@ -0,0 +1,24 @@ +http_interactions: +- recorded_at: Mon, 27 Apr 2026 16:48:26 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"mute":{"description":"Resolved.","is_muted":false,"reason":"NO_PENDING_FIX"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=","type":"findings"}]}},"type":"mute"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"4ae87c1e-099b-4f63-af21-3568cf226263","type":"mute"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 202 + message: Accepted +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Not-Found-response.frozen b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..2e3bb3a33a6c --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-04-27T16:23:28.911Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Not-Found-response.yml b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Not-Found-response.yml new file mode 100644 index 000000000000..2eb9f387c23a --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Not-Found-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Mon, 27 Apr 2026 16:23:28 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"mute":{"description":"Resolved.","is_muted":false,"reason":"NO_PENDING_FIX"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==","type":"findings"}]}},"type":"mute"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Not Found","detail":"finding not + found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Unprocessable-Entity-response.frozen b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Unprocessable-Entity-response.frozen new file mode 100644 index 000000000000..1c328239af83 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Unprocessable-Entity-response.frozen @@ -0,0 +1 @@ +2026-04-27T16:23:50.077Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Unprocessable-Entity-response.yml b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Unprocessable-Entity-response.yml new file mode 100644 index 000000000000..18051f3c2dfd --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Unmute-security-findings-returns-Unprocessable-Entity-response.yml @@ -0,0 +1,26 @@ +http_interactions: +- recorded_at: Mon, 27 Apr 2026 16:23:50 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"mute":{"description":"Resolved.","is_muted":false,"reason":"RISK_ACCEPTED"}},"relationships":{"findings":{"data":[{"id":"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==","type":"findings"}]}},"type":"mute"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/security/findings/mute + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"422","title":"Invalid Request","detail":"The + provided reason is not valid for the specified mute action. Possible values: + [NO_PENDING_FIX HUMAN_ERROR NO_LONGER_ACCEPTED_RISK OTHER]"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 422 + message: Unprocessable Entity +recorded_with: VCR 6.0.0 diff --git a/examples/v2/security-monitoring/MuteSecurityFindings.rb b/examples/v2/security-monitoring/MuteSecurityFindings.rb new file mode 100644 index 000000000000..7ba12a51075c --- /dev/null +++ b/examples/v2/security-monitoring/MuteSecurityFindings.rb @@ -0,0 +1,33 @@ +# Mute or unmute security findings returns "Accepted" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.mute_security_findings".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::MuteFindingsRequest.new({ + data: DatadogAPIClient::V2::MuteFindingsRequestData.new({ + attributes: DatadogAPIClient::V2::MuteFindingsRequestDataAttributes.new({ + mute: DatadogAPIClient::V2::MuteFindingsMuteAttributes.new({ + description: "To be resolved later.", + expire_at: 1778721573794, + is_muted: true, + reason: DatadogAPIClient::V2::MuteFindingsReason::PENDING_FIX, + }), + }), + id: "93bfeb70-af47-424d-908a-948d3f08e37f", + relationships: DatadogAPIClient::V2::MuteFindingsRequestDataRelationships.new({ + findings: DatadogAPIClient::V2::Findings.new({ + data: [ + DatadogAPIClient::V2::FindingData.new({ + id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", + type: DatadogAPIClient::V2::FindingDataType::FINDINGS, + }), + ], + }), + }), + type: DatadogAPIClient::V2::MuteDataType::MUTE, + }), +}) +p api_instance.mute_security_findings(body) diff --git a/examples/v2/security-monitoring/MuteSecurityFindings_298521544.rb b/examples/v2/security-monitoring/MuteSecurityFindings_298521544.rb new file mode 100644 index 000000000000..55c886021270 --- /dev/null +++ b/examples/v2/security-monitoring/MuteSecurityFindings_298521544.rb @@ -0,0 +1,31 @@ +# Unmute security findings returns "Accepted" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.mute_security_findings".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::MuteFindingsRequest.new({ + data: DatadogAPIClient::V2::MuteFindingsRequestData.new({ + attributes: DatadogAPIClient::V2::MuteFindingsRequestDataAttributes.new({ + mute: DatadogAPIClient::V2::MuteFindingsMuteAttributes.new({ + description: "Resolved.", + is_muted: false, + reason: DatadogAPIClient::V2::MuteFindingsReason::NO_PENDING_FIX, + }), + }), + relationships: DatadogAPIClient::V2::MuteFindingsRequestDataRelationships.new({ + findings: DatadogAPIClient::V2::Findings.new({ + data: [ + DatadogAPIClient::V2::FindingData.new({ + id: "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", + type: DatadogAPIClient::V2::FindingDataType::FINDINGS, + }), + ], + }), + }), + type: DatadogAPIClient::V2::MuteDataType::MUTE, + }), +}) +p api_instance.mute_security_findings(body) diff --git a/examples/v2/security-monitoring/MuteSecurityFindings_3830190821.rb b/examples/v2/security-monitoring/MuteSecurityFindings_3830190821.rb new file mode 100644 index 000000000000..0a69348ccb68 --- /dev/null +++ b/examples/v2/security-monitoring/MuteSecurityFindings_3830190821.rb @@ -0,0 +1,32 @@ +# Mute security findings returns "Accepted" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.mute_security_findings".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::MuteFindingsRequest.new({ + data: DatadogAPIClient::V2::MuteFindingsRequestData.new({ + attributes: DatadogAPIClient::V2::MuteFindingsRequestDataAttributes.new({ + mute: DatadogAPIClient::V2::MuteFindingsMuteAttributes.new({ + description: "To be resolved later.", + expire_at: 1778721573794, + is_muted: true, + reason: DatadogAPIClient::V2::MuteFindingsReason::RISK_ACCEPTED, + }), + }), + relationships: DatadogAPIClient::V2::MuteFindingsRequestDataRelationships.new({ + findings: DatadogAPIClient::V2::Findings.new({ + data: [ + DatadogAPIClient::V2::FindingData.new({ + id: "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", + type: DatadogAPIClient::V2::FindingDataType::FINDINGS, + }), + ], + }), + }), + type: DatadogAPIClient::V2::MuteDataType::MUTE, + }), +}) +p api_instance.mute_security_findings(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index a063dcd7cff5..790e6bc46768 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1720,6 +1720,9 @@ "v2.CreateJiraIssues" => { "body" => "CreateJiraIssueRequestArray", }, + "v2.MuteSecurityFindings" => { + "body" => "MuteFindingsRequest", + }, "v2.SearchSecurityFindings" => { "body" => "SecurityFindingsSearchRequest", }, diff --git a/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index 9c65c8a95bd0..820747b79b7b 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/security_monitoring.feature @@ -1864,6 +1864,62 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-investigation + Scenario: Mute or unmute security findings returns "Accepted" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "PENDING_FIX"}}, "id": "93bfeb70-af47-424d-908a-948d3f08e37f", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/k9-investigation + Scenario: Mute or unmute security findings returns "Bad Request" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "PENDING_FIX"}}, "id": "93bfeb70-af47-424d-908a-948d3f08e37f", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-investigation + Scenario: Mute or unmute security findings returns "Not Found" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "PENDING_FIX"}}, "id": "93bfeb70-af47-424d-908a-948d3f08e37f", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-investigation + Scenario: Mute or unmute security findings returns "Unprocessable Entity" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "PENDING_FIX"}}, "id": "93bfeb70-af47-424d-908a-948d3f08e37f", "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + + @team:DataDog/k9-investigation + Scenario: Mute security findings returns "Accepted" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "RISK_ACCEPTED"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 202 Accepted + + @team:DataDog/k9-investigation + Scenario: Mute security findings returns "Not Found" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1778721573794, "is_muted": true, "reason": "RISK_ACCEPTED"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-investigation + Scenario: Mute security findings returns "Unprocessable Entity" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later.", "expire_at": 1, "is_muted": true, "reason": "RISK_ACCEPTED"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @team:DataDog/cloud-security-posture-management Scenario: Patch a signal-based notification rule returns "Bad Request" response Given new "PatchSignalNotificationRule" request @@ -2065,6 +2121,30 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @team:DataDog/k9-investigation + Scenario: Unmute security findings returns "Accepted" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "Resolved.", "is_muted": false, "reason": "NO_PENDING_FIX"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwMC0wYmd-MDE4NjcyMDJkMzE4MDE5ODY5MGE4ZmQ2MmFlMjg0Y2M=", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 202 Accepted + + @team:DataDog/k9-investigation + Scenario: Unmute security findings returns "Not Found" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "Resolved.", "is_muted": false, "reason": "NO_PENDING_FIX"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-investigation + Scenario: Unmute security findings returns "Unprocessable Entity" response + Given operation "MuteSecurityFindings" enabled + And new "MuteSecurityFindings" request + And body with value {"data": {"attributes": {"mute": {"description": "Resolved.", "is_muted": false, "reason": "RISK_ACCEPTED"}}, "relationships": {"findings": {"data": [{"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings"}]}}, "type": "mute"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @skip-validation @team:DataDog/k9-cloud-siem Scenario: Update a cloud configuration rule's details returns "OK" response Given new "UpdateSecurityMonitoringRule" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 36d1cdbe4c04..8c591eca8c28 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5308,6 +5308,12 @@ "type": "unsafe" } }, + "MuteSecurityFindings": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "SearchSecurityFindings": { "tag": "Security Monitoring", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 166eaa897e84..ef86a243dbca 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -292,6 +292,7 @@ def initialize "v2.list_vulnerabilities": false, "v2.list_vulnerable_assets": false, "v2.mute_findings": false, + "v2.mute_security_findings": false, "v2.run_historical_job": false, "v2.search_security_monitoring_histsignals": false, "v2.get_code_coverage_branch_summary": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 4b359f379cce..63d4ad681a22 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3891,6 +3891,15 @@ def overrides "v2.monthly_cost_attribution_response" => "MonthlyCostAttributionResponse", "v2.ms_teams_integration_metadata" => "MSTeamsIntegrationMetadata", "v2.ms_teams_integration_metadata_teams_item" => "MSTeamsIntegrationMetadataTeamsItem", + "v2.mute_data_type" => "MuteDataType", + "v2.mute_findings_mute_attributes" => "MuteFindingsMuteAttributes", + "v2.mute_findings_reason" => "MuteFindingsReason", + "v2.mute_findings_request" => "MuteFindingsRequest", + "v2.mute_findings_request_data" => "MuteFindingsRequestData", + "v2.mute_findings_request_data_attributes" => "MuteFindingsRequestDataAttributes", + "v2.mute_findings_request_data_relationships" => "MuteFindingsRequestDataRelationships", + "v2.mute_findings_response" => "MuteFindingsResponse", + "v2.mute_findings_response_data" => "MuteFindingsResponseData", "v2.notebook_create_data" => "NotebookCreateData", "v2.notebook_create_request" => "NotebookCreateRequest", "v2.notebook_resource_type" => "NotebookResourceType", 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 34236b2d5474..2778e33ab649 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -6079,6 +6079,82 @@ def mute_findings_with_http_info(body, opts = {}) return data, status_code, headers end + # Mute or unmute security findings. + # + # @see #mute_security_findings_with_http_info + def mute_security_findings(body, opts = {}) + data, _status_code, _headers = mute_security_findings_with_http_info(body, opts) + data + end + + # Mute or unmute security findings. + # + # Mute or unmute security findings. + # You can mute or unmute up to 100 security findings per request. The request body must include `is_muted` and `reason` attributes. The allowed reasons depend on whether the finding is being muted or unmuted: + # - To mute a finding: `PENDING_FIX`, `FALSE_POSITIVE`, `OTHER`, `NO_FIX`, `DUPLICATE`, `RISK_ACCEPTED`. + # - To unmute a finding: `NO_PENDING_FIX`, `HUMAN_ERROR`, `NO_LONGER_ACCEPTED_RISK`, `OTHER`. + # + # @param body [MuteFindingsRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(MuteFindingsResponse, Integer, Hash)>] MuteFindingsResponse data, response status code and response headers + def mute_security_findings_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.mute_security_findings".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.mute_security_findings") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.mute_security_findings")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.mute_security_findings ...' + 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.mute_security_findings" + end + # resource path + local_var_path = '/api/v2/security/findings/mute' + + # 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] || 'MuteFindingsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :mute_security_findings, + :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::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#mute_security_findings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Patch a signal-based notification rule. # # @see #patch_signal_notification_rule_with_http_info diff --git a/lib/datadog_api_client/v2/models/mute_data_type.rb b/lib/datadog_api_client/v2/models/mute_data_type.rb new file mode 100644 index 000000000000..14876ef81cd8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/mute_data_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 + # Mute resource type. + class MuteDataType + include BaseEnumModel + + MUTE = "mute".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/mute_findings_mute_attributes.rb b/lib/datadog_api_client/v2/models/mute_findings_mute_attributes.rb new file mode 100644 index 000000000000..754a9cb2a0ca --- /dev/null +++ b/lib/datadog_api_client/v2/models/mute_findings_mute_attributes.rb @@ -0,0 +1,164 @@ +=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 + # Mute properties to apply to the findings. + class MuteFindingsMuteAttributes + include BaseGenericModel + + # Additional information about the reason why the findings are muted or unmuted. This field has a limit of 280 characters. + attr_accessor :description + + # The expiration date of the mute action (Unix ms). It must be set to a value greater than the current timestamp. If this field is not provided, the findings remain muted indefinitely. + attr_accessor :expire_at + + # Whether the findings should be muted or unmuted. + attr_reader :is_muted + + # The reason why the findings are muted or unmuted. + attr_reader :reason + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'expire_at' => :'expire_at', + :'is_muted' => :'is_muted', + :'reason' => :'reason' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'expire_at' => :'Integer', + :'is_muted' => :'Boolean', + :'reason' => :'MuteFindingsReason' + } + 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::MuteFindingsMuteAttributes` 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?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'expire_at') + self.expire_at = attributes[:'expire_at'] + end + + if attributes.key?(:'is_muted') + self.is_muted = attributes[:'is_muted'] + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + 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 @is_muted.nil? + return false if @reason.nil? + true + end + + # Custom attribute writer method with validation + # @param is_muted [Object] Object to be assigned + # @!visibility private + def is_muted=(is_muted) + if is_muted.nil? + fail ArgumentError, 'invalid value for "is_muted", is_muted cannot be nil.' + end + @is_muted = is_muted + end + + # Custom attribute writer method with validation + # @param reason [Object] Object to be assigned + # @!visibility private + def reason=(reason) + if reason.nil? + fail ArgumentError, 'invalid value for "reason", reason cannot be nil.' + end + @reason = reason + 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 && + description == o.description && + expire_at == o.expire_at && + is_muted == o.is_muted && + reason == o.reason && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, expire_at, is_muted, reason, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/mute_findings_reason.rb b/lib/datadog_api_client/v2/models/mute_findings_reason.rb new file mode 100644 index 000000000000..9ef81f1ecadf --- /dev/null +++ b/lib/datadog_api_client/v2/models/mute_findings_reason.rb @@ -0,0 +1,34 @@ +=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 why the findings are muted or unmuted. + class MuteFindingsReason + include BaseEnumModel + + PENDING_FIX = "PENDING_FIX".freeze + FALSE_POSITIVE = "FALSE_POSITIVE".freeze + OTHER = "OTHER".freeze + NO_FIX = "NO_FIX".freeze + DUPLICATE = "DUPLICATE".freeze + RISK_ACCEPTED = "RISK_ACCEPTED".freeze + NO_PENDING_FIX = "NO_PENDING_FIX".freeze + HUMAN_ERROR = "HUMAN_ERROR".freeze + NO_LONGER_ACCEPTED_RISK = "NO_LONGER_ACCEPTED_RISK".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/mute_findings_request.rb b/lib/datadog_api_client/v2/models/mute_findings_request.rb new file mode 100644 index 000000000000..8f422394f6a7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/mute_findings_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 mute or unmute security findings. + class MuteFindingsRequest + include BaseGenericModel + + # Data of the mute request. + 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' => :'MuteFindingsRequestData' + } + 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::MuteFindingsRequest` 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/mute_findings_request_data.rb b/lib/datadog_api_client/v2/models/mute_findings_request_data.rb new file mode 100644 index 000000000000..17b2a3e730cd --- /dev/null +++ b/lib/datadog_api_client/v2/models/mute_findings_request_data.rb @@ -0,0 +1,175 @@ +=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 mute request. + class MuteFindingsRequestData + include BaseGenericModel + + # Attributes of the mute request. + attr_reader :attributes + + # Unique identifier of the mute request. + attr_accessor :id + + # Relationships of the mute request. + attr_reader :relationships + + # Mute resource type. + 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', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'MuteFindingsRequestDataAttributes', + :'id' => :'String', + :'relationships' => :'MuteFindingsRequestDataRelationships', + :'type' => :'MuteDataType' + } + 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::MuteFindingsRequestData` 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?(:'relationships') + self.relationships = attributes[:'relationships'] + 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 @relationships.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 relationships [Object] Object to be assigned + # @!visibility private + def relationships=(relationships) + if relationships.nil? + fail ArgumentError, 'invalid value for "relationships", relationships cannot be nil.' + end + @relationships = relationships + 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 && + relationships == o.relationships && + 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, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/mute_findings_request_data_attributes.rb b/lib/datadog_api_client/v2/models/mute_findings_request_data_attributes.rb new file mode 100644 index 000000000000..ede01aaf7104 --- /dev/null +++ b/lib/datadog_api_client/v2/models/mute_findings_request_data_attributes.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 + # Attributes of the mute request. + class MuteFindingsRequestDataAttributes + include BaseGenericModel + + # Mute properties to apply to the findings. + attr_reader :mute + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'mute' => :'mute' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'mute' => :'MuteFindingsMuteAttributes' + } + 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::MuteFindingsRequestDataAttributes` 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?(:'mute') + self.mute = attributes[:'mute'] + 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 @mute.nil? + true + end + + # Custom attribute writer method with validation + # @param mute [Object] Object to be assigned + # @!visibility private + def mute=(mute) + if mute.nil? + fail ArgumentError, 'invalid value for "mute", mute cannot be nil.' + end + @mute = mute + 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 && + mute == o.mute && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [mute, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/mute_findings_request_data_relationships.rb b/lib/datadog_api_client/v2/models/mute_findings_request_data_relationships.rb new file mode 100644 index 000000000000..c961272d653b --- /dev/null +++ b/lib/datadog_api_client/v2/models/mute_findings_request_data_relationships.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 + # Relationships of the mute request. + class MuteFindingsRequestDataRelationships + include BaseGenericModel + + # A list of security findings. + attr_reader :findings + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'findings' => :'findings' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'findings' => :'Findings' + } + 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::MuteFindingsRequestDataRelationships` 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?(:'findings') + self.findings = attributes[:'findings'] + 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 @findings.nil? + true + end + + # Custom attribute writer method with validation + # @param findings [Object] Object to be assigned + # @!visibility private + def findings=(findings) + if findings.nil? + fail ArgumentError, 'invalid value for "findings", findings cannot be nil.' + end + @findings = findings + 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 && + findings == o.findings && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [findings, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/mute_findings_response.rb b/lib/datadog_api_client/v2/models/mute_findings_response.rb new file mode 100644 index 000000000000..3af4dec332a7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/mute_findings_response.rb @@ -0,0 +1,105 @@ +=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 for the mute or unmute request. + class MuteFindingsResponse + include BaseGenericModel + + # Data of the mute response. + attr_accessor :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' => :'MuteFindingsResponseData' + } + 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::MuteFindingsResponse` 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 + + # 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/mute_findings_response_data.rb b/lib/datadog_api_client/v2/models/mute_findings_response_data.rb new file mode 100644 index 000000000000..00ff91da7a3d --- /dev/null +++ b/lib/datadog_api_client/v2/models/mute_findings_response_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 mute response. + class MuteFindingsResponseData + include BaseGenericModel + + # Unique identifier of the mute request. + attr_reader :id + + # Mute resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'MuteDataType' + } + 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::MuteFindingsResponseData` 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?(:'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 @id.nil? + return false if @type.nil? + true + 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 && + 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 + [id, type, additional_properties].hash + end + end +end