Skip to content

list_investigation_records async

list_investigation_records(
    detector_id: DetectorId,
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    investigation_id: Optional[InvestigationId] = None,
    record_types: Optional[RecordTypes] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListInvestigationRecordsResponse

This API is currently available as a preview. This feature is available in the following Amazon Web Services Regions: US East (N. Virginia), US East (Ohio), US West (Oregon), Canada (Central), Europe (Frankfurt), Europe (Ireland), Europe (London), Europe (Paris), Europe (Stockholm), and Asia Pacific (Tokyo).

Returns the records for a specific GuardDuty investigation. Each record is one step in the reasoning that GuardDuty followed to reach the results of the investigation.

An administrator account can list the records of any investigation within the organization. Member accounts can only list the records of investigations that belong to them.

Parameters:

  • detector_id (DetectorId) –

    The unique ID of the GuardDuty detector associated with the investigation.

    To find the detectorId in the current Region, see the Settings page in the GuardDuty console, or run the ListDetectors API.

  • investigation_id (Optional[InvestigationId], default: None ) –

    The unique identifier of the investigation whose records you want to list.

  • record_types (Optional[RecordTypes], default: None ) –

    The types of records to return. Possible values are UPDATE, FETCH, OBSERVATION, ANALYSIS, and METADATA. If you don't specify this parameter, GuardDuty returns records of all types.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of records to return in a single response. Valid values are 1 to 50. The default value is 20. A response can contain fewer records than this value, or no records, and still include a NextToken.

  • next_token (Optional[NextToken], default: None ) –

    You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the list action. For subsequent calls to the action, fill nextToken in the request with the value of NextToken from the previous response to continue listing data. Use the same InvestigationId and RecordTypes values that you used in the previous request.

    If you specify this parameter for an investigation whose status isn't COMPLETED, the operation returns a BadRequestException. A NextToken expires 24 hours after it's returned.

Raises:

Source code in docs_src/capo_guardduty/_services/async_guard_duty.py
async def list_investigation_records(
    self,
    detector_id: "capo_guardduty.types.detector_id.DetectorId",
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    investigation_id: Optional[
        "capo_guardduty.types.investigation_id.InvestigationId"
    ] = None,
    record_types: Optional["capo_guardduty.types.record_types.RecordTypes"] = None,
    max_results: Optional["capo_guardduty.types.max_results.MaxResults"] = None,
    next_token: Optional["capo_guardduty.types.next_token.NextToken"] = None,
) -> "capo_guardduty.types.list_investigation_records_response.ListInvestigationRecordsResponse":
    """<p>This API is currently available as a preview. This feature is available in the following Amazon Web Services Regions: US East (N. Virginia), US East (Ohio), US West (Oregon), Canada (Central), Europe (Frankfurt), Europe (Ireland), Europe (London), Europe (Paris), Europe (Stockholm), and Asia Pacific (Tokyo).</p> <p>Returns the records for a specific GuardDuty investigation. Each record is one step in the reasoning that GuardDuty followed to reach the results of the investigation.</p> <p>An administrator account can list the records of any investigation within the organization. Member accounts can only list the records of investigations that belong to them.</p>

    Args:
        detector_id: <p>The unique ID of the GuardDuty detector associated with the investigation.</p> <p>To find the <code>detectorId</code> in the current Region, see the Settings page in the GuardDuty console, or run the <a href="https://docs.aws.amazon.com/guardduty/latest/APIReference/API_ListDetectors.html">ListDetectors</a> API.</p>
        investigation_id: <p>The unique identifier of the investigation whose records you want to list.</p>
        record_types: <p>The types of records to return. Possible values are <code>UPDATE</code>, <code>FETCH</code>, <code>OBSERVATION</code>, <code>ANALYSIS</code>, and <code>METADATA</code>. If you don't specify this parameter, GuardDuty returns records of all types.</p>
        max_results: <p>The maximum number of records to return in a single response. Valid values are 1 to 50. The default value is 20. A response can contain fewer records than this value, or no records, and still include a <code>NextToken</code>.</p>
        next_token: <p>You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the list action. For subsequent calls to the action, fill nextToken in the request with the value of NextToken from the previous response to continue listing data. Use the same <code>InvestigationId</code> and <code>RecordTypes</code> values that you used in the previous request.</p> <p>If you specify this parameter for an investigation whose status isn't <code>COMPLETED</code>, the operation returns a <code>BadRequestException</code>. A <code>NextToken</code> expires 24 hours after it's returned.</p>

    Raises:
        capo_guardduty.errors.access_denied_exception.AccessDeniedException: <p>An access denied exception object.</p>
        capo_guardduty.errors.bad_request_exception.BadRequestException: <p>A bad request exception object.</p>
        capo_guardduty.errors.internal_server_error_exception.InternalServerErrorException: <p>An internal server error exception object.</p>
        capo_guardduty.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource can't be found.</p>
        capo_guardduty.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_guardduty.types.list_investigation_records_request.ListInvestigationRecordsRequest]",
    ) -> AsyncOperationResponse[
        "capo_guardduty.types.list_investigation_records_response.ListInvestigationRecordsResponse"
    ]:
        import capo_guardduty._operations.guard_duty_api_service.list_investigation_records

        (
            output,
            http_response,
        ) = await capo_guardduty._operations.guard_duty_api_service.list_investigation_records.async_list_investigation_records(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_guardduty.types.list_investigation_records_response.ListInvestigationRecordsResponse",
    ) -> dict[str, Any]:
        import capo_guardduty.types.list_investigation_records_response

        return capo_guardduty.types.list_investigation_records_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListInvestigationRecords", redact_output=_redact_output),
    )
    input_: capo_guardduty.types.list_investigation_records_request.ListInvestigationRecordsRequest = {
        "detector_id": detector_id
    }
    if investigation_id is not None:
        input_["investigation_id"] = investigation_id
    if record_types is not None:
        input_["record_types"] = record_types
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output