From 1d3dce20d274185a52ed16bb4ea119242ef748ae Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 30 Oct 2023 15:20:16 +0000 Subject: [PATCH] Regenerate client from commit 483916f9 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 336 ++++++++---------- docs/datadog_api_client.v2.model.rst | 112 +++--- .../v2/security-monitoring/MuteFindings.py | 43 +++ .../v2/security-monitoring/UpdateFinding.py | 37 -- src/datadog_api_client/configuration.py | 2 +- .../v2/api/security_monitoring_api.py | 93 +++-- ...quest.py => bulk_mute_findings_request.py} | 16 +- ... bulk_mute_findings_request_attributes.py} | 14 +- .../model/bulk_mute_findings_request_data.py | 69 ++++ .../model/bulk_mute_findings_request_meta.py | 44 +++ ...ulk_mute_findings_request_meta_findings.py | 36 ++ ... bulk_mute_findings_request_properties.py} | 8 +- ...onse.py => bulk_mute_findings_response.py} | 14 +- ...py => bulk_mute_findings_response_data.py} | 23 +- .../v2/model/mute_finding_request_data.py | 54 --- .../model/mute_finding_response_attributes.py | 125 ------- .../model/mute_finding_response_properties.py | 72 ---- src/datadog_api_client/v2/models/__init__.py | 32 +- ...alid_syntax_in_the_request_response.frozen | 1 + ...nvalid_syntax_in_the_request_response.yaml | 21 ++ ...findings_ids_are_malformed_response.frozen | 1 + ...e_findings_ids_are_malformed_response.yaml | 21 ++ ...ess_it_due_to_invalid_data_response.frozen | 1 + ...ocess_it_due_to_invalid_data_response.yaml | 21 ++ ...ed_finding_cannot_be_found_response.frozen | 1 + ...sted_finding_cannot_be_found_response.yaml | 20 ++ ...tch_of_findings_returns_ok_response.frozen | 1 + ...batch_of_findings_returns_ok_response.yaml | 20 ++ ...nmute_a_finding_returns_ok_response.frozen | 1 - ..._unmute_a_finding_returns_ok_response.yaml | 22 -- tests/v2/features/security_monitoring.feature | 48 +-- tests/v2/features/undo.json | 4 +- 33 files changed, 611 insertions(+), 710 deletions(-) create mode 100644 examples/v2/security-monitoring/MuteFindings.py delete mode 100644 examples/v2/security-monitoring/UpdateFinding.py rename src/datadog_api_client/v2/model/{mute_finding_request.py => bulk_mute_findings_request.py} (52%) rename src/datadog_api_client/v2/model/{mute_finding_request_attributes.py => bulk_mute_findings_request_attributes.py} (59%) create mode 100644 src/datadog_api_client/v2/model/bulk_mute_findings_request_data.py create mode 100644 src/datadog_api_client/v2/model/bulk_mute_findings_request_meta.py create mode 100644 src/datadog_api_client/v2/model/bulk_mute_findings_request_meta_findings.py rename src/datadog_api_client/v2/model/{mute_finding_request_properties.py => bulk_mute_findings_request_properties.py} (90%) rename src/datadog_api_client/v2/model/{mute_finding_response.py => bulk_mute_findings_response.py} (56%) rename src/datadog_api_client/v2/model/{mute_finding_response_data.py => bulk_mute_findings_response_data.py} (54%) delete mode 100644 src/datadog_api_client/v2/model/mute_finding_request_data.py delete mode 100644 src/datadog_api_client/v2/model/mute_finding_response_attributes.py delete mode 100644 src/datadog_api_client/v2/model/mute_finding_response_properties.py create mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_bad_request_the_server_cannot_process_the_request_due_to_invalid_syntax_in_the_request_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_bad_request_the_server_cannot_process_the_request_due_to_invalid_syntax_in_the_request_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_some_findings_ids_are_malformed_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_some_findings_ids_are_malformed_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_the_server_understands_the_request_syntax_but_cannot_process_it_due_to_invalid_data_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_the_server_understands_the_request_syntax_but_cannot_process_it_due_to_invalid_data_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_not_found_the_requested_finding_cannot_be_found_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_not_found_the_requested_finding_cannot_be_found_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_ok_response.yaml delete mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_finding_returns_ok_response.frozen delete mode 100644 tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_finding_returns_ok_response.yaml diff --git a/.apigentools-info b/.apigentools-info index f6ee3fcaf6..c4818ca03e 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2023-10-27 08:09:54.577931", - "spec_repo_commit": "86d56f2b" + "regenerated": "2023-10-30 15:19:04.164754", + "spec_repo_commit": "483916f9" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2023-10-27 08:09:54.592108", - "spec_repo_commit": "86d56f2b" + "regenerated": "2023-10-30 15:19:04.179200", + "spec_repo_commit": "483916f9" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index abfee46735..672d2d9acb 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1283,6 +1283,104 @@ components: type: string x-enum-varnames: - AUTHN_MAPPINGS + BulkMuteFindingsRequest: + description: The new bulk mute finding request. + properties: + data: + $ref: '#/components/schemas/BulkMuteFindingsRequestData' + required: + - data + type: object + BulkMuteFindingsRequestAttributes: + additionalProperties: false + description: The mute properties to be updated. + properties: + mute: + $ref: '#/components/schemas/BulkMuteFindingsRequestProperties' + required: + - mute + type: object + BulkMuteFindingsRequestData: + description: Data object containing the new bulk mute properties of the finding. + properties: + attributes: + $ref: '#/components/schemas/BulkMuteFindingsRequestAttributes' + id: + description: UUID to identify the request + example: dbe5f567-192b-4404-b908-29b70e1c9f76 + type: string + meta: + $ref: '#/components/schemas/BulkMuteFindingsRequestMeta' + type: + $ref: '#/components/schemas/FindingType' + required: + - id + - type + - attributes + - meta + type: object + BulkMuteFindingsRequestMeta: + description: Meta object containing the findings to be updated. + properties: + findings: + description: Array of findings. + items: + $ref: '#/components/schemas/BulkMuteFindingsRequestMetaFindings' + type: array + type: object + BulkMuteFindingsRequestMetaFindings: + description: Finding object containing the finding information. + properties: + finding_id: + $ref: '#/components/schemas/FindingID' + type: object + BulkMuteFindingsRequestProperties: + additionalProperties: false + description: Object containing the new mute properties of the findings. + properties: + description: + description: Additional information about the reason why those findings + are muted or unmuted. This field has a maximum limit of 280 characters. + type: string + expiration_date: + description: 'The expiration date of the mute or unmute action (Unix ms). + It must be set to a value greater than the current timestamp. + + If this field is not provided, the finding will be muted or unmuted indefinitely, + which is equivalent to setting the expiration date to 9999999999999. + + ' + example: 1778721573794 + format: int64 + type: integer + muted: + description: Whether those findings should be muted or unmuted. + example: true + type: boolean + reason: + $ref: '#/components/schemas/FindingMuteReason' + required: + - muted + - reason + type: object + BulkMuteFindingsResponse: + description: The expected response schema. + properties: + data: + $ref: '#/components/schemas/BulkMuteFindingsResponseData' + required: + - data + type: object + BulkMuteFindingsResponseData: + description: Data object containing the ID of the request that was updated. + properties: + id: + description: UUID used to identify the request + example: 93bfeb70-af47-424d-908a-948d3f08e37f + type: string + type: + $ref: '#/components/schemas/FindingType' + type: object CIAppAggregateBucketValue: description: A bucket value, can either be a timeseries or a single value. oneOf: @@ -5646,7 +5744,7 @@ components: type: integer FindingID: description: The unique ID for this finding. - example: AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE + example: ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw== type: string FindingMute: additionalProperties: false @@ -10540,139 +10638,6 @@ components: description: The monitor type. type: string type: object - MuteFindingRequest: - description: The new mute finding request. - properties: - data: - $ref: '#/components/schemas/MuteFindingRequestData' - required: - - data - type: object - MuteFindingRequestAttributes: - additionalProperties: false - description: The mute properties to be updated. - properties: - mute: - $ref: '#/components/schemas/MuteFindingRequestProperties' - required: - - mute - type: object - MuteFindingRequestData: - description: Data object containing the new mute properties of the finding. - properties: - attributes: - $ref: '#/components/schemas/MuteFindingRequestAttributes' - id: - $ref: '#/components/schemas/FindingID' - type: - $ref: '#/components/schemas/FindingType' - required: - - id - - type - - attributes - type: object - MuteFindingRequestProperties: - additionalProperties: false - description: Object containing the new mute properties of the finding. - properties: - description: - description: Additional information about the reason why this finding is - muted or unmuted. This field has a maximum limit of 280 characters. - example: To be resolved later - type: string - expiration_date: - description: 'The expiration date of the mute or unmute action (Unix ms). - It must be set to a value greater than the current timestamp. - - If this field is not provided, the finding will be muted or unmuted indefinitely, - which is equivalent to setting the expiration date to 9999999999999. - - ' - example: 1778721573794 - format: int64 - type: integer - muted: - description: Whether this finding is muted or unmuted. - example: true - type: boolean - reason: - $ref: '#/components/schemas/FindingMuteReason' - required: - - muted - - reason - type: object - MuteFindingResponse: - description: The expected response schema. - properties: - data: - $ref: '#/components/schemas/MuteFindingResponseData' - required: - - data - type: object - MuteFindingResponseAttributes: - description: The JSON:API attributes of the finding. - properties: - evaluation: - $ref: '#/components/schemas/FindingEvaluation' - evaluation_changed_at: - $ref: '#/components/schemas/FindingEvaluationChangedAt' - mute: - $ref: '#/components/schemas/MuteFindingResponseProperties' - resource: - $ref: '#/components/schemas/FindingResource' - resource_discovery_date: - $ref: '#/components/schemas/FindingResourceDiscoveryDate' - resource_type: - $ref: '#/components/schemas/FindingResourceType' - rule: - $ref: '#/components/schemas/FindingRule' - status: - $ref: '#/components/schemas/FindingStatus' - tags: - $ref: '#/components/schemas/FindingTags' - type: object - MuteFindingResponseData: - description: Data object containing the updated finding. - properties: - attributes: - $ref: '#/components/schemas/MuteFindingResponseAttributes' - id: - $ref: '#/components/schemas/FindingID' - type: - $ref: '#/components/schemas/FindingType' - type: object - MuteFindingResponseProperties: - additionalProperties: false - description: Information about the mute status of this finding. - properties: - description: - description: 'Additional information about the reason why this finding is - muted or unmuted. - - This attribute will not be included in the response if the description - is not provided in the request body. - - ' - example: To be resolved later - type: string - expiration_date: - description: 'The expiration date of the mute or unmute action. - - If the expiration date is not provided in the request body, this attribute - will not be included in the response and the finding will be muted or - unmuted indefinitely. - - ' - example: 1778721573794 - format: int64 - type: integer - muted: - description: Whether this finding is muted or unmuted. - example: true - type: boolean - reason: - $ref: '#/components/schemas/FindingMuteReason' - type: object NullableRelationshipToUser: description: Relationship to user. properties: @@ -24537,32 +24502,28 @@ paths: x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' - /api/v2/posture_management/findings/{finding_id}: - get: - description: Returns a single finding with message and resource configuration. - operationId: GetFinding - parameters: - - description: The ID of the finding. - in: path - name: finding_id + patch: + description: Mute or unmute findings. + operationId: MuteFindings + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BulkMuteFindingsRequest' + description: "### Attributes\n\nAll findings are updated with the same attributes. + The request body must include at least two attributes: `muted` and `reason`.\nThe + allowed reasons depend on whether the finding is being muted or unmuted:\n + \ - To mute a finding: `PENDING_FIX`, `FALSE_POSITIVE`, `ACCEPTED_RISK`, + `OTHER`.\n - To unmute a finding : `NO_PENDING_FIX`, `HUMAN_ERROR`, `NO_LONGER_ACCEPTED_RISK`, + `OTHER`.\n\n### Meta\n\nThe request body must include a list of the finding + IDs to be updated.\n" required: true - schema: - type: string - - description: Return the finding for a given snapshot of time (Unix ms). - example: 1678721573794 - in: query - name: snapshot_timestamp - required: false - schema: - format: int64 - minimum: 1 - type: integer responses: '200': content: application/json: schema: - $ref: '#/components/schemas/GetFindingResponse' + $ref: '#/components/schemas/BulkMuteFindingsResponse' description: OK '400': $ref: '#/components/responses/FindingsBadRequestResponse' @@ -24570,24 +24531,29 @@ paths: $ref: '#/components/responses/FindingsForbiddenResponse' '404': $ref: '#/components/responses/FindingsNotFoundResponse' + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: 'Invalid Request: The server understands the request syntax + but cannot process it due to invalid data.' '429': $ref: '#/components/responses/FindingsTooManyRequestsResponse' security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: - - security_monitoring_findings_read - summary: Get a finding + summary: Mute or unmute a batch of findings tags: - Security Monitoring + x-codegen-request-body-name: body x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' - patch: - description: 'Mute or unmute a specific finding. - - The API returns the updated finding object when the request is successful.' - operationId: UpdateFinding + /api/v2/posture_management/findings/{finding_id}: + get: + description: Returns a single finding with message and resource configuration. + operationId: GetFinding parameters: - description: The ID of the finding. in: path @@ -24595,28 +24561,21 @@ paths: required: true schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/MuteFindingRequest' - description: 'To mute or unmute a finding, the request body should include - at least two attributes: `muted` and `reason`. The allowed reasons depend - on whether the finding is being muted or unmuted: - - - To mute a finding: `PENDING_FIX`, `FALSE_POSITIVE`, `ACCEPTED_RISK`, `OTHER`. - - - To unmute a finding : `NO_PENDING_FIX`, `HUMAN_ERROR`, `NO_LONGER_ACCEPTED_RISK`, - `OTHER`. - - ' - required: true + - description: Return the finding for a given snapshot of time (Unix ms). + example: 1678721573794 + in: query + name: snapshot_timestamp + required: false + schema: + format: int64 + minimum: 1 + type: integer responses: '200': content: application/json: schema: - $ref: '#/components/schemas/MuteFindingResponse' + $ref: '#/components/schemas/GetFindingResponse' description: OK '400': $ref: '#/components/responses/FindingsBadRequestResponse' @@ -24624,29 +24583,16 @@ paths: $ref: '#/components/responses/FindingsForbiddenResponse' '404': $ref: '#/components/responses/FindingsNotFoundResponse' - '409': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: 'Resource Conflict: The finding has already been muted or unmuted - within the last 60 seconds.' - '422': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: 'Invalid Request: The server understands the request syntax - but cannot process it due to invalid data.' '429': $ref: '#/components/responses/FindingsTooManyRequestsResponse' security: - apiKeyAuth: [] appKeyAuth: [] - summary: Mute or unmute a finding + - AuthZ: + - security_monitoring_findings_read + summary: Get a finding tags: - Security Monitoring - x-codegen-request-body-name: body x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 091da10140..1ec286aed5 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -386,6 +386,62 @@ authn\_mappings\_type :members: :show-inheritance: +bulk\_mute\_findings\_request +----------------------------- + +.. automodule:: datadog_api_client.v2.model.bulk_mute_findings_request + :members: + :show-inheritance: + +bulk\_mute\_findings\_request\_attributes +----------------------------------------- + +.. automodule:: datadog_api_client.v2.model.bulk_mute_findings_request_attributes + :members: + :show-inheritance: + +bulk\_mute\_findings\_request\_data +----------------------------------- + +.. automodule:: datadog_api_client.v2.model.bulk_mute_findings_request_data + :members: + :show-inheritance: + +bulk\_mute\_findings\_request\_meta +----------------------------------- + +.. automodule:: datadog_api_client.v2.model.bulk_mute_findings_request_meta + :members: + :show-inheritance: + +bulk\_mute\_findings\_request\_meta\_findings +--------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.bulk_mute_findings_request_meta_findings + :members: + :show-inheritance: + +bulk\_mute\_findings\_request\_properties +----------------------------------------- + +.. automodule:: datadog_api_client.v2.model.bulk_mute_findings_request_properties + :members: + :show-inheritance: + +bulk\_mute\_findings\_response +------------------------------ + +.. automodule:: datadog_api_client.v2.model.bulk_mute_findings_response + :members: + :show-inheritance: + +bulk\_mute\_findings\_response\_data +------------------------------------ + +.. automodule:: datadog_api_client.v2.model.bulk_mute_findings_response_data + :members: + :show-inheritance: + chargeback\_breakdown --------------------- @@ -4565,62 +4621,6 @@ monitor\_type :members: :show-inheritance: -mute\_finding\_request ----------------------- - -.. automodule:: datadog_api_client.v2.model.mute_finding_request - :members: - :show-inheritance: - -mute\_finding\_request\_attributes ----------------------------------- - -.. automodule:: datadog_api_client.v2.model.mute_finding_request_attributes - :members: - :show-inheritance: - -mute\_finding\_request\_data ----------------------------- - -.. automodule:: datadog_api_client.v2.model.mute_finding_request_data - :members: - :show-inheritance: - -mute\_finding\_request\_properties ----------------------------------- - -.. automodule:: datadog_api_client.v2.model.mute_finding_request_properties - :members: - :show-inheritance: - -mute\_finding\_response ------------------------ - -.. automodule:: datadog_api_client.v2.model.mute_finding_response - :members: - :show-inheritance: - -mute\_finding\_response\_attributes ------------------------------------ - -.. automodule:: datadog_api_client.v2.model.mute_finding_response_attributes - :members: - :show-inheritance: - -mute\_finding\_response\_data ------------------------------ - -.. automodule:: datadog_api_client.v2.model.mute_finding_response_data - :members: - :show-inheritance: - -mute\_finding\_response\_properties ------------------------------------ - -.. automodule:: datadog_api_client.v2.model.mute_finding_response_properties - :members: - :show-inheritance: - nullable\_relationship\_to\_user -------------------------------- diff --git a/examples/v2/security-monitoring/MuteFindings.py b/examples/v2/security-monitoring/MuteFindings.py new file mode 100644 index 0000000000..fac337c545 --- /dev/null +++ b/examples/v2/security-monitoring/MuteFindings.py @@ -0,0 +1,43 @@ +""" +Mute or unmute a batch of findings returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi +from datadog_api_client.v2.model.bulk_mute_findings_request import BulkMuteFindingsRequest +from datadog_api_client.v2.model.bulk_mute_findings_request_attributes import BulkMuteFindingsRequestAttributes +from datadog_api_client.v2.model.bulk_mute_findings_request_data import BulkMuteFindingsRequestData +from datadog_api_client.v2.model.bulk_mute_findings_request_meta import BulkMuteFindingsRequestMeta +from datadog_api_client.v2.model.bulk_mute_findings_request_meta_findings import BulkMuteFindingsRequestMetaFindings +from datadog_api_client.v2.model.bulk_mute_findings_request_properties import BulkMuteFindingsRequestProperties +from datadog_api_client.v2.model.finding_mute_reason import FindingMuteReason +from datadog_api_client.v2.model.finding_type import FindingType + +body = BulkMuteFindingsRequest( + data=BulkMuteFindingsRequestData( + attributes=BulkMuteFindingsRequestAttributes( + mute=BulkMuteFindingsRequestProperties( + expiration_date=1778721573794, + muted=True, + reason=FindingMuteReason.ACCEPTED_RISK, + ), + ), + id="dbe5f567-192b-4404-b908-29b70e1c9f76", + meta=BulkMuteFindingsRequestMeta( + findings=[ + BulkMuteFindingsRequestMetaFindings( + finding_id="ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", + ), + ], + ), + type=FindingType.FINDING, + ), +) + +configuration = Configuration() +configuration.unstable_operations["mute_findings"] = True +with ApiClient(configuration) as api_client: + api_instance = SecurityMonitoringApi(api_client) + response = api_instance.mute_findings(body=body) + + print(response) diff --git a/examples/v2/security-monitoring/UpdateFinding.py b/examples/v2/security-monitoring/UpdateFinding.py deleted file mode 100644 index 37728066c2..0000000000 --- a/examples/v2/security-monitoring/UpdateFinding.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Mute or unmute a finding returns "OK" response -""" - -from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi -from datadog_api_client.v2.model.finding_mute_reason import FindingMuteReason -from datadog_api_client.v2.model.finding_type import FindingType -from datadog_api_client.v2.model.mute_finding_request import MuteFindingRequest -from datadog_api_client.v2.model.mute_finding_request_attributes import MuteFindingRequestAttributes -from datadog_api_client.v2.model.mute_finding_request_data import MuteFindingRequestData -from datadog_api_client.v2.model.mute_finding_request_properties import MuteFindingRequestProperties - -body = MuteFindingRequest( - data=MuteFindingRequestData( - attributes=MuteFindingRequestAttributes( - mute=MuteFindingRequestProperties( - description="To be resolved later", - expiration_date=1778721573794, - muted=True, - reason=FindingMuteReason.ACCEPTED_RISK, - ), - ), - id="AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", - type=FindingType.FINDING, - ), -) - -configuration = Configuration() -configuration.unstable_operations["update_finding"] = True -with ApiClient(configuration) as api_client: - api_instance = SecurityMonitoringApi(api_client) - response = api_instance.update_finding( - finding_id="AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", body=body - ) - - print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 620bb990e0..a4d2673553 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -263,7 +263,7 @@ def __init__( "v2.query_timeseries_data": False, "v2.get_finding": False, "v2.list_findings": False, - "v2.update_finding": False, + "v2.mute_findings": False, "v2.create_incident_service": False, "v2.delete_incident_service": False, "v2.get_incident_service": False, diff --git a/src/datadog_api_client/v2/api/security_monitoring_api.py b/src/datadog_api_client/v2/api/security_monitoring_api.py index 52855f0f7a..51a2ff4c65 100644 --- a/src/datadog_api_client/v2/api/security_monitoring_api.py +++ b/src/datadog_api_client/v2/api/security_monitoring_api.py @@ -19,9 +19,9 @@ from datadog_api_client.v2.model.finding_evaluation import FindingEvaluation from datadog_api_client.v2.model.finding_status import FindingStatus from datadog_api_client.v2.model.finding import Finding +from datadog_api_client.v2.model.bulk_mute_findings_response import BulkMuteFindingsResponse +from datadog_api_client.v2.model.bulk_mute_findings_request import BulkMuteFindingsRequest from datadog_api_client.v2.model.get_finding_response import GetFindingResponse -from datadog_api_client.v2.model.mute_finding_response import MuteFindingResponse -from datadog_api_client.v2.model.mute_finding_request import MuteFindingRequest from datadog_api_client.v2.model.security_filters_response import SecurityFiltersResponse from datadog_api_client.v2.model.security_filter_response import SecurityFilterResponse from datadog_api_client.v2.model.security_filter_create_request import SecurityFilterCreateRequest @@ -508,18 +508,19 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._search_security_monitoring_signals_endpoint = _Endpoint( + self._mute_findings_endpoint = _Endpoint( settings={ - "response_type": (SecurityMonitoringSignalsListResponse,), - "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], - "endpoint_path": "/api/v2/security_monitoring/signals/search", - "operation_id": "search_security_monitoring_signals", - "http_method": "POST", + "response_type": (BulkMuteFindingsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/posture_management/findings", + "operation_id": "mute_findings", + "http_method": "PATCH", "version": "v2", }, params_map={ "body": { - "openapi_types": (SecurityMonitoringSignalListRequest,), + "required": True, + "openapi_types": (BulkMuteFindingsRequest,), "location": "body", }, }, @@ -527,25 +528,18 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._update_finding_endpoint = _Endpoint( + self._search_security_monitoring_signals_endpoint = _Endpoint( settings={ - "response_type": (MuteFindingResponse,), - "auth": ["apiKeyAuth", "appKeyAuth"], - "endpoint_path": "/api/v2/posture_management/findings/{finding_id}", - "operation_id": "update_finding", - "http_method": "PATCH", + "response_type": (SecurityMonitoringSignalsListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/security_monitoring/signals/search", + "operation_id": "search_security_monitoring_signals", + "http_method": "POST", "version": "v2", }, params_map={ - "finding_id": { - "required": True, - "openapi_types": (str,), - "attribute": "finding_id", - "location": "path", - }, "body": { - "required": True, - "openapi_types": (MuteFindingRequest,), + "openapi_types": (SecurityMonitoringSignalListRequest,), "location": "body", }, }, @@ -1186,6 +1180,33 @@ def list_security_monitoring_signals_with_pagination( } return endpoint.call_with_http_info_paginated(pagination) + def mute_findings( + self, + body: BulkMuteFindingsRequest, + ) -> BulkMuteFindingsResponse: + """Mute or unmute a batch of findings. + + Mute or unmute findings. + + :param body: **Attributes** + + All findings are updated with the same attributes. The request body must include at least two attributes: ``muted`` and ``reason``. + The allowed reasons depend on whether the finding is being muted or unmuted: + + * To mute a finding: ``PENDING_FIX`` , ``FALSE_POSITIVE`` , ``ACCEPTED_RISK`` , ``OTHER``. + * To unmute a finding : ``NO_PENDING_FIX`` , ``HUMAN_ERROR`` , ``NO_LONGER_ACCEPTED_RISK`` , ``OTHER``. + + **Meta** + + The request body must include a list of the finding IDs to be updated. + :type body: BulkMuteFindingsRequest + :rtype: BulkMuteFindingsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._mute_findings_endpoint.call_with_http_info(**kwargs) + def search_security_monitoring_signals( self, *, @@ -1237,32 +1258,6 @@ def search_security_monitoring_signals_with_pagination( } return endpoint.call_with_http_info_paginated(pagination) - def update_finding( - self, - finding_id: str, - body: MuteFindingRequest, - ) -> MuteFindingResponse: - """Mute or unmute a finding. - - Mute or unmute a specific finding. - The API returns the updated finding object when the request is successful. - - :param finding_id: The ID of the finding. - :type finding_id: str - :param body: To mute or unmute a finding, the request body should include at least two attributes: ``muted`` and ``reason``. The allowed reasons depend on whether the finding is being muted or unmuted: - - * To mute a finding: ``PENDING_FIX`` , ``FALSE_POSITIVE`` , ``ACCEPTED_RISK`` , ``OTHER``. - * To unmute a finding : ``NO_PENDING_FIX`` , ``HUMAN_ERROR`` , ``NO_LONGER_ACCEPTED_RISK`` , ``OTHER``. - :type body: MuteFindingRequest - :rtype: MuteFindingResponse - """ - kwargs: Dict[str, Any] = {} - kwargs["finding_id"] = finding_id - - kwargs["body"] = body - - return self._update_finding_endpoint.call_with_http_info(**kwargs) - def update_security_filter( self, security_filter_id: str, diff --git a/src/datadog_api_client/v2/model/mute_finding_request.py b/src/datadog_api_client/v2/model/bulk_mute_findings_request.py similarity index 52% rename from src/datadog_api_client/v2/model/mute_finding_request.py rename to src/datadog_api_client/v2/model/bulk_mute_findings_request.py index b572c12587..6c908a7bd1 100644 --- a/src/datadog_api_client/v2/model/mute_finding_request.py +++ b/src/datadog_api_client/v2/model/bulk_mute_findings_request.py @@ -12,28 +12,28 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.mute_finding_request_data import MuteFindingRequestData + from datadog_api_client.v2.model.bulk_mute_findings_request_data import BulkMuteFindingsRequestData -class MuteFindingRequest(ModelNormal): +class BulkMuteFindingsRequest(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.mute_finding_request_data import MuteFindingRequestData + from datadog_api_client.v2.model.bulk_mute_findings_request_data import BulkMuteFindingsRequestData return { - "data": (MuteFindingRequestData,), + "data": (BulkMuteFindingsRequestData,), } attribute_map = { "data": "data", } - def __init__(self_, data: MuteFindingRequestData, **kwargs): + def __init__(self_, data: BulkMuteFindingsRequestData, **kwargs): """ - The new mute finding request. + The new bulk mute finding request. - :param data: Data object containing the new mute properties of the finding. - :type data: MuteFindingRequestData + :param data: Data object containing the new bulk mute properties of the finding. + :type data: BulkMuteFindingsRequestData """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/mute_finding_request_attributes.py b/src/datadog_api_client/v2/model/bulk_mute_findings_request_attributes.py similarity index 59% rename from src/datadog_api_client/v2/model/mute_finding_request_attributes.py rename to src/datadog_api_client/v2/model/bulk_mute_findings_request_attributes.py index f4d28846a7..11f81ca944 100644 --- a/src/datadog_api_client/v2/model/mute_finding_request_attributes.py +++ b/src/datadog_api_client/v2/model/bulk_mute_findings_request_attributes.py @@ -12,28 +12,28 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.mute_finding_request_properties import MuteFindingRequestProperties + from datadog_api_client.v2.model.bulk_mute_findings_request_properties import BulkMuteFindingsRequestProperties -class MuteFindingRequestAttributes(ModelNormal): +class BulkMuteFindingsRequestAttributes(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.mute_finding_request_properties import MuteFindingRequestProperties + from datadog_api_client.v2.model.bulk_mute_findings_request_properties import BulkMuteFindingsRequestProperties return { - "mute": (MuteFindingRequestProperties,), + "mute": (BulkMuteFindingsRequestProperties,), } attribute_map = { "mute": "mute", } - def __init__(self_, mute: MuteFindingRequestProperties, **kwargs): + def __init__(self_, mute: BulkMuteFindingsRequestProperties, **kwargs): """ The mute properties to be updated. - :param mute: Object containing the new mute properties of the finding. - :type mute: MuteFindingRequestProperties + :param mute: Object containing the new mute properties of the findings. + :type mute: BulkMuteFindingsRequestProperties """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/bulk_mute_findings_request_data.py b/src/datadog_api_client/v2/model/bulk_mute_findings_request_data.py new file mode 100644 index 0000000000..896b2f942d --- /dev/null +++ b/src/datadog_api_client/v2/model/bulk_mute_findings_request_data.py @@ -0,0 +1,69 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.bulk_mute_findings_request_attributes import BulkMuteFindingsRequestAttributes + from datadog_api_client.v2.model.bulk_mute_findings_request_meta import BulkMuteFindingsRequestMeta + from datadog_api_client.v2.model.finding_type import FindingType + + +class BulkMuteFindingsRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.bulk_mute_findings_request_attributes import BulkMuteFindingsRequestAttributes + from datadog_api_client.v2.model.bulk_mute_findings_request_meta import BulkMuteFindingsRequestMeta + from datadog_api_client.v2.model.finding_type import FindingType + + return { + "attributes": (BulkMuteFindingsRequestAttributes,), + "id": (str,), + "meta": (BulkMuteFindingsRequestMeta,), + "type": (FindingType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "meta": "meta", + "type": "type", + } + + def __init__( + self_, + attributes: BulkMuteFindingsRequestAttributes, + id: str, + meta: BulkMuteFindingsRequestMeta, + type: FindingType, + **kwargs, + ): + """ + Data object containing the new bulk mute properties of the finding. + + :param attributes: The mute properties to be updated. + :type attributes: BulkMuteFindingsRequestAttributes + + :param id: UUID to identify the request + :type id: str + + :param meta: Meta object containing the findings to be updated. + :type meta: BulkMuteFindingsRequestMeta + + :param type: The JSON:API type for findings. + :type type: FindingType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.meta = meta + self_.type = type diff --git a/src/datadog_api_client/v2/model/bulk_mute_findings_request_meta.py b/src/datadog_api_client/v2/model/bulk_mute_findings_request_meta.py new file mode 100644 index 0000000000..0147d9a251 --- /dev/null +++ b/src/datadog_api_client/v2/model/bulk_mute_findings_request_meta.py @@ -0,0 +1,44 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.bulk_mute_findings_request_meta_findings import BulkMuteFindingsRequestMetaFindings + + +class BulkMuteFindingsRequestMeta(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.bulk_mute_findings_request_meta_findings import ( + BulkMuteFindingsRequestMetaFindings, + ) + + return { + "findings": ([BulkMuteFindingsRequestMetaFindings],), + } + + attribute_map = { + "findings": "findings", + } + + def __init__(self_, findings: Union[List[BulkMuteFindingsRequestMetaFindings], UnsetType] = unset, **kwargs): + """ + Meta object containing the findings to be updated. + + :param findings: Array of findings. + :type findings: [BulkMuteFindingsRequestMetaFindings], optional + """ + if findings is not unset: + kwargs["findings"] = findings + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/bulk_mute_findings_request_meta_findings.py b/src/datadog_api_client/v2/model/bulk_mute_findings_request_meta_findings.py new file mode 100644 index 0000000000..5e15edbf6a --- /dev/null +++ b/src/datadog_api_client/v2/model/bulk_mute_findings_request_meta_findings.py @@ -0,0 +1,36 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class BulkMuteFindingsRequestMetaFindings(ModelNormal): + @cached_property + def openapi_types(_): + return { + "finding_id": (str,), + } + + attribute_map = { + "finding_id": "finding_id", + } + + def __init__(self_, finding_id: Union[str, UnsetType] = unset, **kwargs): + """ + Finding object containing the finding information. + + :param finding_id: The unique ID for this finding. + :type finding_id: str, optional + """ + if finding_id is not unset: + kwargs["finding_id"] = finding_id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/mute_finding_request_properties.py b/src/datadog_api_client/v2/model/bulk_mute_findings_request_properties.py similarity index 90% rename from src/datadog_api_client/v2/model/mute_finding_request_properties.py rename to src/datadog_api_client/v2/model/bulk_mute_findings_request_properties.py index 5f9a70d20d..b6a201da22 100644 --- a/src/datadog_api_client/v2/model/mute_finding_request_properties.py +++ b/src/datadog_api_client/v2/model/bulk_mute_findings_request_properties.py @@ -17,7 +17,7 @@ from datadog_api_client.v2.model.finding_mute_reason import FindingMuteReason -class MuteFindingRequestProperties(ModelNormal): +class BulkMuteFindingsRequestProperties(ModelNormal): @cached_property def openapi_types(_): from datadog_api_client.v2.model.finding_mute_reason import FindingMuteReason @@ -45,16 +45,16 @@ def __init__( **kwargs, ): """ - Object containing the new mute properties of the finding. + Object containing the new mute properties of the findings. - :param description: Additional information about the reason why this finding is muted or unmuted. This field has a maximum limit of 280 characters. + :param description: Additional information about the reason why those findings are muted or unmuted. This field has a maximum limit of 280 characters. :type description: str, optional :param expiration_date: The expiration date of the mute or unmute action (Unix ms). It must be set to a value greater than the current timestamp. If this field is not provided, the finding will be muted or unmuted indefinitely, which is equivalent to setting the expiration date to 9999999999999. :type expiration_date: int, optional - :param muted: Whether this finding is muted or unmuted. + :param muted: Whether those findings should be muted or unmuted. :type muted: bool :param reason: The reason why this finding is muted or unmuted. diff --git a/src/datadog_api_client/v2/model/mute_finding_response.py b/src/datadog_api_client/v2/model/bulk_mute_findings_response.py similarity index 56% rename from src/datadog_api_client/v2/model/mute_finding_response.py rename to src/datadog_api_client/v2/model/bulk_mute_findings_response.py index e310592fd2..cf83ec5e92 100644 --- a/src/datadog_api_client/v2/model/mute_finding_response.py +++ b/src/datadog_api_client/v2/model/bulk_mute_findings_response.py @@ -12,28 +12,28 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.mute_finding_response_data import MuteFindingResponseData + from datadog_api_client.v2.model.bulk_mute_findings_response_data import BulkMuteFindingsResponseData -class MuteFindingResponse(ModelNormal): +class BulkMuteFindingsResponse(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.mute_finding_response_data import MuteFindingResponseData + from datadog_api_client.v2.model.bulk_mute_findings_response_data import BulkMuteFindingsResponseData return { - "data": (MuteFindingResponseData,), + "data": (BulkMuteFindingsResponseData,), } attribute_map = { "data": "data", } - def __init__(self_, data: MuteFindingResponseData, **kwargs): + def __init__(self_, data: BulkMuteFindingsResponseData, **kwargs): """ The expected response schema. - :param data: Data object containing the updated finding. - :type data: MuteFindingResponseData + :param data: Data object containing the ID of the request that was updated. + :type data: BulkMuteFindingsResponseData """ super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/mute_finding_response_data.py b/src/datadog_api_client/v2/model/bulk_mute_findings_response_data.py similarity index 54% rename from src/datadog_api_client/v2/model/mute_finding_response_data.py rename to src/datadog_api_client/v2/model/bulk_mute_findings_response_data.py index b41948b0be..a1bcbd09f9 100644 --- a/src/datadog_api_client/v2/model/mute_finding_response_data.py +++ b/src/datadog_api_client/v2/model/bulk_mute_findings_response_data.py @@ -14,49 +14,34 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.mute_finding_response_attributes import MuteFindingResponseAttributes from datadog_api_client.v2.model.finding_type import FindingType -class MuteFindingResponseData(ModelNormal): +class BulkMuteFindingsResponseData(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.mute_finding_response_attributes import MuteFindingResponseAttributes from datadog_api_client.v2.model.finding_type import FindingType return { - "attributes": (MuteFindingResponseAttributes,), "id": (str,), "type": (FindingType,), } attribute_map = { - "attributes": "attributes", "id": "id", "type": "type", } - def __init__( - self_, - attributes: Union[MuteFindingResponseAttributes, UnsetType] = unset, - id: Union[str, UnsetType] = unset, - type: Union[FindingType, UnsetType] = unset, - **kwargs, - ): + def __init__(self_, id: Union[str, UnsetType] = unset, type: Union[FindingType, UnsetType] = unset, **kwargs): """ - Data object containing the updated finding. + Data object containing the ID of the request that was updated. - :param attributes: The JSON:API attributes of the finding. - :type attributes: MuteFindingResponseAttributes, optional - - :param id: The unique ID for this finding. + :param id: UUID used to identify the request :type id: str, optional :param type: The JSON:API type for findings. :type type: FindingType, optional """ - if attributes is not unset: - kwargs["attributes"] = attributes if id is not unset: kwargs["id"] = id if type is not unset: diff --git a/src/datadog_api_client/v2/model/mute_finding_request_data.py b/src/datadog_api_client/v2/model/mute_finding_request_data.py deleted file mode 100644 index 72cafe872e..0000000000 --- a/src/datadog_api_client/v2/model/mute_finding_request_data.py +++ /dev/null @@ -1,54 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.mute_finding_request_attributes import MuteFindingRequestAttributes - from datadog_api_client.v2.model.finding_type import FindingType - - -class MuteFindingRequestData(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.mute_finding_request_attributes import MuteFindingRequestAttributes - from datadog_api_client.v2.model.finding_type import FindingType - - return { - "attributes": (MuteFindingRequestAttributes,), - "id": (str,), - "type": (FindingType,), - } - - attribute_map = { - "attributes": "attributes", - "id": "id", - "type": "type", - } - - def __init__(self_, attributes: MuteFindingRequestAttributes, id: str, type: FindingType, **kwargs): - """ - Data object containing the new mute properties of the finding. - - :param attributes: The mute properties to be updated. - :type attributes: MuteFindingRequestAttributes - - :param id: The unique ID for this finding. - :type id: str - - :param type: The JSON:API type for findings. - :type type: FindingType - """ - super().__init__(kwargs) - - self_.attributes = attributes - self_.id = id - self_.type = type diff --git a/src/datadog_api_client/v2/model/mute_finding_response_attributes.py b/src/datadog_api_client/v2/model/mute_finding_response_attributes.py deleted file mode 100644 index 84c3a2d4a1..0000000000 --- a/src/datadog_api_client/v2/model/mute_finding_response_attributes.py +++ /dev/null @@ -1,125 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import List, Union, TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, - unset, - UnsetType, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.finding_evaluation import FindingEvaluation - from datadog_api_client.v2.model.mute_finding_response_properties import MuteFindingResponseProperties - from datadog_api_client.v2.model.finding_rule import FindingRule - from datadog_api_client.v2.model.finding_status import FindingStatus - - -class MuteFindingResponseAttributes(ModelNormal): - validations = { - "evaluation_changed_at": { - "inclusive_minimum": 1, - }, - "resource_discovery_date": { - "inclusive_minimum": 1, - }, - } - - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.finding_evaluation import FindingEvaluation - from datadog_api_client.v2.model.mute_finding_response_properties import MuteFindingResponseProperties - from datadog_api_client.v2.model.finding_rule import FindingRule - from datadog_api_client.v2.model.finding_status import FindingStatus - - return { - "evaluation": (FindingEvaluation,), - "evaluation_changed_at": (int,), - "mute": (MuteFindingResponseProperties,), - "resource": (str,), - "resource_discovery_date": (int,), - "resource_type": (str,), - "rule": (FindingRule,), - "status": (FindingStatus,), - "tags": ([str],), - } - - attribute_map = { - "evaluation": "evaluation", - "evaluation_changed_at": "evaluation_changed_at", - "mute": "mute", - "resource": "resource", - "resource_discovery_date": "resource_discovery_date", - "resource_type": "resource_type", - "rule": "rule", - "status": "status", - "tags": "tags", - } - - def __init__( - self_, - evaluation: Union[FindingEvaluation, UnsetType] = unset, - evaluation_changed_at: Union[int, UnsetType] = unset, - mute: Union[MuteFindingResponseProperties, UnsetType] = unset, - resource: Union[str, UnsetType] = unset, - resource_discovery_date: Union[int, UnsetType] = unset, - resource_type: Union[str, UnsetType] = unset, - rule: Union[FindingRule, UnsetType] = unset, - status: Union[FindingStatus, UnsetType] = unset, - tags: Union[List[str], UnsetType] = unset, - **kwargs, - ): - """ - The JSON:API attributes of the finding. - - :param evaluation: The evaluation of the finding. - :type evaluation: FindingEvaluation, optional - - :param evaluation_changed_at: The date on which the evaluation for this finding changed (Unix ms). - :type evaluation_changed_at: int, optional - - :param mute: Information about the mute status of this finding. - :type mute: MuteFindingResponseProperties, optional - - :param resource: The resource name of this finding. - :type resource: str, optional - - :param resource_discovery_date: The date on which the resource was discovered (Unix ms). - :type resource_discovery_date: int, optional - - :param resource_type: The resource type of this finding. - :type resource_type: str, optional - - :param rule: The rule that triggered this finding. - :type rule: FindingRule, optional - - :param status: The status of the finding. - :type status: FindingStatus, optional - - :param tags: The tags associated with this finding. - :type tags: [str], optional - """ - if evaluation is not unset: - kwargs["evaluation"] = evaluation - if evaluation_changed_at is not unset: - kwargs["evaluation_changed_at"] = evaluation_changed_at - if mute is not unset: - kwargs["mute"] = mute - if resource is not unset: - kwargs["resource"] = resource - if resource_discovery_date is not unset: - kwargs["resource_discovery_date"] = resource_discovery_date - if resource_type is not unset: - kwargs["resource_type"] = resource_type - if rule is not unset: - kwargs["rule"] = rule - if status is not unset: - kwargs["status"] = status - if tags is not unset: - kwargs["tags"] = tags - super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/mute_finding_response_properties.py b/src/datadog_api_client/v2/model/mute_finding_response_properties.py deleted file mode 100644 index 0253690328..0000000000 --- a/src/datadog_api_client/v2/model/mute_finding_response_properties.py +++ /dev/null @@ -1,72 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import Union, TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, - unset, - UnsetType, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.finding_mute_reason import FindingMuteReason - - -class MuteFindingResponseProperties(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.finding_mute_reason import FindingMuteReason - - return { - "description": (str,), - "expiration_date": (int,), - "muted": (bool,), - "reason": (FindingMuteReason,), - } - - attribute_map = { - "description": "description", - "expiration_date": "expiration_date", - "muted": "muted", - "reason": "reason", - } - - def __init__( - self_, - description: Union[str, UnsetType] = unset, - expiration_date: Union[int, UnsetType] = unset, - muted: Union[bool, UnsetType] = unset, - reason: Union[FindingMuteReason, UnsetType] = unset, - **kwargs, - ): - """ - Information about the mute status of this finding. - - :param description: Additional information about the reason why this finding is muted or unmuted. - This attribute will not be included in the response if the description is not provided in the request body. - :type description: str, optional - - :param expiration_date: The expiration date of the mute or unmute action. - If the expiration date is not provided in the request body, this attribute will not be included in the response and the finding will be muted or unmuted indefinitely. - :type expiration_date: int, optional - - :param muted: Whether this finding is muted or unmuted. - :type muted: bool, optional - - :param reason: The reason why this finding is muted or unmuted. - :type reason: FindingMuteReason, optional - """ - if description is not unset: - kwargs["description"] = description - if expiration_date is not unset: - kwargs["expiration_date"] = expiration_date - if muted is not unset: - kwargs["muted"] = muted - if reason is not unset: - kwargs["reason"] = reason - super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 52ad856e26..b9ebe525ea 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -53,6 +53,14 @@ from datadog_api_client.v2.model.authn_mappings_response import AuthNMappingsResponse from datadog_api_client.v2.model.authn_mappings_sort import AuthNMappingsSort from datadog_api_client.v2.model.authn_mappings_type import AuthNMappingsType +from datadog_api_client.v2.model.bulk_mute_findings_request import BulkMuteFindingsRequest +from datadog_api_client.v2.model.bulk_mute_findings_request_attributes import BulkMuteFindingsRequestAttributes +from datadog_api_client.v2.model.bulk_mute_findings_request_data import BulkMuteFindingsRequestData +from datadog_api_client.v2.model.bulk_mute_findings_request_meta import BulkMuteFindingsRequestMeta +from datadog_api_client.v2.model.bulk_mute_findings_request_meta_findings import BulkMuteFindingsRequestMetaFindings +from datadog_api_client.v2.model.bulk_mute_findings_request_properties import BulkMuteFindingsRequestProperties +from datadog_api_client.v2.model.bulk_mute_findings_response import BulkMuteFindingsResponse +from datadog_api_client.v2.model.bulk_mute_findings_response_data import BulkMuteFindingsResponseData from datadog_api_client.v2.model.ci_app_aggregate_bucket_value import CIAppAggregateBucketValue from datadog_api_client.v2.model.ci_app_aggregate_bucket_value_timeseries import CIAppAggregateBucketValueTimeseries from datadog_api_client.v2.model.ci_app_aggregate_bucket_value_timeseries_point import ( @@ -762,14 +770,6 @@ ) from datadog_api_client.v2.model.monitor_downtime_match_response_data import MonitorDowntimeMatchResponseData from datadog_api_client.v2.model.monitor_type import MonitorType -from datadog_api_client.v2.model.mute_finding_request import MuteFindingRequest -from datadog_api_client.v2.model.mute_finding_request_attributes import MuteFindingRequestAttributes -from datadog_api_client.v2.model.mute_finding_request_data import MuteFindingRequestData -from datadog_api_client.v2.model.mute_finding_request_properties import MuteFindingRequestProperties -from datadog_api_client.v2.model.mute_finding_response import MuteFindingResponse -from datadog_api_client.v2.model.mute_finding_response_attributes import MuteFindingResponseAttributes -from datadog_api_client.v2.model.mute_finding_response_data import MuteFindingResponseData -from datadog_api_client.v2.model.mute_finding_response_properties import MuteFindingResponseProperties from datadog_api_client.v2.model.nullable_relationship_to_user import NullableRelationshipToUser from datadog_api_client.v2.model.nullable_relationship_to_user_data import NullableRelationshipToUserData from datadog_api_client.v2.model.on_demand_concurrency_cap import OnDemandConcurrencyCap @@ -1484,6 +1484,14 @@ "AuthNMappingsResponse", "AuthNMappingsSort", "AuthNMappingsType", + "BulkMuteFindingsRequest", + "BulkMuteFindingsRequestAttributes", + "BulkMuteFindingsRequestData", + "BulkMuteFindingsRequestMeta", + "BulkMuteFindingsRequestMetaFindings", + "BulkMuteFindingsRequestProperties", + "BulkMuteFindingsResponse", + "BulkMuteFindingsResponseData", "CIAppAggregateBucketValue", "CIAppAggregateBucketValueTimeseries", "CIAppAggregateBucketValueTimeseriesPoint", @@ -2081,14 +2089,6 @@ "MonitorDowntimeMatchResponseAttributes", "MonitorDowntimeMatchResponseData", "MonitorType", - "MuteFindingRequest", - "MuteFindingRequestAttributes", - "MuteFindingRequestData", - "MuteFindingRequestProperties", - "MuteFindingResponse", - "MuteFindingResponseAttributes", - "MuteFindingResponseData", - "MuteFindingResponseProperties", "NullableRelationshipToUser", "NullableRelationshipToUserData", "OnDemandConcurrencyCap", diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_bad_request_the_server_cannot_process_the_request_due_to_invalid_syntax_in_the_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_bad_request_the_server_cannot_process_the_request_due_to_invalid_syntax_in_the_request_response.frozen new file mode 100644 index 0000000000..047be77541 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_bad_request_the_server_cannot_process_the_request_due_to_invalid_syntax_in_the_request_response.frozen @@ -0,0 +1 @@ +2023-10-27T10:39:51.051Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_bad_request_the_server_cannot_process_the_request_due_to_invalid_syntax_in_the_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_bad_request_the_server_cannot_process_the_request_due_to_invalid_syntax_in_the_request_response.yaml new file mode 100644 index 0000000000..d7abd6d6e2 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_bad_request_the_server_cannot_process_the_request_due_to_invalid_syntax_in_the_request_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '{"data":{"attributes":{"mute":{"expirationDate":1778721573794,"muted":"true","reason":"ACCEPTED_RISK"}},"id":"dbe5f567-192b-4404-b908-29b70e1c9f76","meta":{"findings":[{"finding_id":"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw=="}]},"type":"finding"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/posture_management/findings + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"json: cannot + unmarshal number into Go struct field Mute.mute.expirationDate of type string"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_some_findings_ids_are_malformed_response.frozen b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_some_findings_ids_are_malformed_response.frozen new file mode 100644 index 0000000000..5b62b79e30 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_some_findings_ids_are_malformed_response.frozen @@ -0,0 +1 @@ +2023-10-27T10:39:51.414Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_some_findings_ids_are_malformed_response.yaml b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_some_findings_ids_are_malformed_response.yaml new file mode 100644 index 0000000000..94e15f3f28 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_some_findings_ids_are_malformed_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '{"data":{"attributes":{"mute":{"expiration_date":1778721573794,"muted":true,"reason":"ACCEPTED_RISK"}},"id":"dbe5f567-192b-4404-b908-29b70e1c9f76","meta":{"findings":[{"finding_id":"AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE"}]},"type":"finding"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/posture_management/findings + response: + body: + string: '{"errors":[{"status":"422","title":"Invalid Request","detail":"Some + findings IDs are malformed"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 422 + message: Unprocessable Entity +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_the_server_understands_the_request_syntax_but_cannot_process_it_due_to_invalid_data_response.frozen b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_the_server_understands_the_request_syntax_but_cannot_process_it_due_to_invalid_data_response.frozen new file mode 100644 index 0000000000..4ee3074598 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_the_server_understands_the_request_syntax_but_cannot_process_it_due_to_invalid_data_response.frozen @@ -0,0 +1 @@ +2023-10-27T10:09:05.292Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_the_server_understands_the_request_syntax_but_cannot_process_it_due_to_invalid_data_response.yaml b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_the_server_understands_the_request_syntax_but_cannot_process_it_due_to_invalid_data_response.yaml new file mode 100644 index 0000000000..94e15f3f28 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_invalid_request_the_server_understands_the_request_syntax_but_cannot_process_it_due_to_invalid_data_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '{"data":{"attributes":{"mute":{"expiration_date":1778721573794,"muted":true,"reason":"ACCEPTED_RISK"}},"id":"dbe5f567-192b-4404-b908-29b70e1c9f76","meta":{"findings":[{"finding_id":"AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE"}]},"type":"finding"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/posture_management/findings + response: + body: + string: '{"errors":[{"status":"422","title":"Invalid Request","detail":"Some + findings IDs are malformed"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 422 + message: Unprocessable Entity +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_not_found_the_requested_finding_cannot_be_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_not_found_the_requested_finding_cannot_be_found_response.frozen new file mode 100644 index 0000000000..6d7f12b009 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_not_found_the_requested_finding_cannot_be_found_response.frozen @@ -0,0 +1 @@ +2023-10-27T10:39:51.776Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_not_found_the_requested_finding_cannot_be_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_not_found_the_requested_finding_cannot_be_found_response.yaml new file mode 100644 index 0000000000..123f93dde2 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_not_found_the_requested_finding_cannot_be_found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '{"data":{"attributes":{"mute":{"expiration_date":1778721573794,"muted":true,"reason":"ACCEPTED_RISK"}},"id":"dbe5f567-192b-4404-b908-29b70e1c9f76","meta":{"findings":[{"finding_id":"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw=="}]},"type":"finding"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/posture_management/findings + response: + body: + string: '{"errors":[{"status":"404"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_ok_response.frozen new file mode 100644 index 0000000000..107d765466 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-10-27T12:59:49.496Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_ok_response.yaml new file mode 100644 index 0000000000..7967a26ced --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_batch_of_findings_returns_ok_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '{"data":{"attributes":{"mute":{"expiration_date":1778721573794,"muted":true,"reason":"ACCEPTED_RISK"}},"id":"dbe5f567-192b-4404-b908-29b70e1c9f76","meta":{"findings":[{"finding_id":"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw=="}]},"type":"finding"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/posture_management/findings + response: + body: + string: '{"data":{"id":"dbe5f567-192b-4404-b908-29b70e1c9f76","type":"finding"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_finding_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_finding_returns_ok_response.frozen deleted file mode 100644 index 0bbac63155..0000000000 --- a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_finding_returns_ok_response.frozen +++ /dev/null @@ -1 +0,0 @@ -2023-05-30T22:58:28.319Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_finding_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_finding_returns_ok_response.yaml deleted file mode 100644 index 60a0cd6fc9..0000000000 --- a/tests/v2/cassettes/test_scenarios/test_mute_or_unmute_a_finding_returns_ok_response.yaml +++ /dev/null @@ -1,22 +0,0 @@ -interactions: -- request: - body: '{"data":{"attributes":{"mute":{"description":"To be resolved later","expiration_date":1778721573794,"muted":true,"reason":"ACCEPTED_RISK"}},"id":"AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE","type":"finding"}}' - headers: - accept: - - application/json - content-type: - - application/json - method: PATCH - uri: https://api.datadoghq.com/api/v2/posture_management/findings/AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE - response: - body: - string: '{"data":{"id":"AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE","type":"finding","attributes":{"evaluation":"pass","evaluation_changed_at":1681220975000,"mute":{"description":"To - be resolved later","expiration_date":1778721573794,"muted":true,"reason":"ACCEPTED_RISK"},"resource":"dd-chaos-cloud-xuxu-eu-north-1","resource_discovery_date":1681220975000,"resource_type":"aws_s3_bucket","rule":{"name":"S3 - bucket ACL does not grant full bucket control to everyone","id":"gkb-eoz-lut"},"status":"critical","tags":["requirement:AWS","scored:true","aws_account:013910733512","framework:gdpr","control:164.308-a-3-i","requirement:Compliance","framework:iso-27001","framework:hipaa","requirement:Access-Control","source:s3","requirement:Information-Access-Management","region:eu-north-1","control:164.308-a-4-ii-B","framework:pci","control:164.308-a-4-ii-C","control:25.2","requirement:Workforce-Security","control:1.1","security:compliance","requirement:Least-Privileged-Access","cloud_provider:aws","requirement:Data-Protection","control:7.2.1","control:7.2.2","requirement:Security-of-Processing","control:A.18.1.3","framework:soc-2","scope:s3","control:A.9.2.3","control:32.1a","requirement:Logical-and-Physical-Access-Control","control:CC6.3","framework:security-labs","control:CC6.1"]}}}' - headers: - content-type: - - application/vnd.api+json - status: - code: 200 - message: OK -version: 1 diff --git a/tests/v2/features/security_monitoring.feature b/tests/v2/features/security_monitoring.feature index 66fd9ae2a0..fdde409bca 100644 --- a/tests/v2/features/security_monitoring.feature +++ b/tests/v2/features/security_monitoring.feature @@ -390,50 +390,36 @@ Feature: Security Monitoring Then the response status is 200 OK @generated @skip @team:DataDog/cloud-security-posture-management - Scenario: Mute or unmute a finding returns "Bad Request: The server cannot process the request due to invalid syntax in the request." response - Given operation "UpdateFinding" enabled - And new "UpdateFinding" request - And request contains "finding_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later", "expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", "type": "finding"}} + Scenario: Mute or unmute a batch of findings returns "Bad Request: The server cannot process the request due to invalid syntax in the request." response + Given operation "MuteFindings" enabled + And new "MuteFindings" request + And body with value {"data": {"attributes": {"mute": {"expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "dbe5f567-192b-4404-b908-29b70e1c9f76", "meta": {"findings": [{"finding_id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw=="}]}, "type": "finding"}} When the request is sent Then the response status is 400 Bad Request: The server cannot process the request due to invalid syntax in the request. @generated @skip @team:DataDog/cloud-security-posture-management - Scenario: Mute or unmute a finding returns "Invalid Request: The server understands the request syntax but cannot process it due to invalid data." response - Given operation "UpdateFinding" enabled - And new "UpdateFinding" request - And request contains "finding_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later", "expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", "type": "finding"}} + Scenario: Mute or unmute a batch of findings returns "Invalid Request: The server understands the request syntax but cannot process it due to invalid data." response + Given operation "MuteFindings" enabled + And new "MuteFindings" request + And body with value {"data": {"attributes": {"mute": {"expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "dbe5f567-192b-4404-b908-29b70e1c9f76", "meta": {"findings": [{"finding_id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw=="}]}, "type": "finding"}} When the request is sent Then the response status is 422 Invalid Request: The server understands the request syntax but cannot process it due to invalid data. @generated @skip @team:DataDog/cloud-security-posture-management - Scenario: Mute or unmute a finding returns "Not Found: The requested finding cannot be found." response - Given operation "UpdateFinding" enabled - And new "UpdateFinding" request - And request contains "finding_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later", "expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", "type": "finding"}} + Scenario: Mute or unmute a batch of findings returns "Not Found: The requested finding cannot be found." response + Given operation "MuteFindings" enabled + And new "MuteFindings" request + And body with value {"data": {"attributes": {"mute": {"expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "dbe5f567-192b-4404-b908-29b70e1c9f76", "meta": {"findings": [{"finding_id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw=="}]}, "type": "finding"}} When the request is sent Then the response status is 404 Not Found: The requested finding cannot be found. - @replay-only @team:DataDog/cloud-security-posture-management - Scenario: Mute or unmute a finding returns "OK" response - Given operation "UpdateFinding" enabled - And new "UpdateFinding" request - And request contains "finding_id" parameter with value "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE" - And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later", "expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", "type": "finding"}} + @team:DataDog/cloud-security-posture-management + Scenario: Mute or unmute a batch of findings returns "OK" response + Given operation "MuteFindings" enabled + And new "MuteFindings" request + And body with value {"data": {"attributes": {"mute": {"expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "dbe5f567-192b-4404-b908-29b70e1c9f76", "meta": {"findings":[{"finding_id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw=="}]}, "type": "finding"}} When the request is sent Then the response status is 200 OK - And the response "data.attributes.mute.muted" is equal to true - - @generated @skip @team:DataDog/cloud-security-posture-management - Scenario: Mute or unmute a finding returns "Resource Conflict: The finding has already been muted or unmuted within the last 60 seconds." response - Given operation "UpdateFinding" enabled - And new "UpdateFinding" request - And request contains "finding_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"mute": {"description": "To be resolved later", "expiration_date": 1778721573794, "muted": true, "reason": "ACCEPTED_RISK"}}, "id": "AQAAAYbb1i0gijTHEQAAAABBWWJiMWkwZ0FBQ2FuNzBJVGZXZ3B3QUE", "type": "finding"}} - When the request is sent - Then the response status is 409 Resource Conflict: The finding has already been muted or unmuted within the last 60 seconds. @skip-validation @team:DataDog/k9-cloud-security-platform Scenario: Update a cloud configuration rule's details returns "OK" response diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 58eb5421de..8f2d7f67b5 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1023,13 +1023,13 @@ "type": "safe" } }, - "GetFinding": { + "MuteFindings": { "tag": "Security Monitoring", "undo": { "type": "safe" } }, - "UpdateFinding": { + "GetFinding": { "tag": "Security Monitoring", "undo": { "type": "safe"