Skip to content

create_sample_findings async

create_sample_findings(
    detector_id: DetectorId,
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    finding_types: Optional[FindingTypes] = None,
) -> CreateSampleFindingsResponse

Generates sample findings of types specified by the list of finding types. If 'NULL' is specified for findingTypes, the API generates sample findings of all supported finding types.

Parameters:

  • detector_id (DetectorId) –

    The ID of the detector for which you need to create sample findings.

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

  • finding_types (Optional[FindingTypes], default: None ) –

    The types of sample findings to generate.

Raises:

Source code in docs_src/capo_guardduty/_services/async_guard_duty.py
async def create_sample_findings(
    self,
    detector_id: "capo_guardduty.types.detector_id.DetectorId",
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    finding_types: Optional[
        "capo_guardduty.types.finding_types.FindingTypes"
    ] = None,
) -> "capo_guardduty.types.create_sample_findings_response.CreateSampleFindingsResponse":
    """<p>Generates sample findings of types specified by the list of finding types. If 'NULL' is specified for <code>findingTypes</code>, the API generates sample findings of all supported finding types.</p>

    Args:
        detector_id: <p>The ID of the detector for which you need to create sample findings.</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>
        finding_types: <p>The types of sample findings to generate.</p>

    Raises:
        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.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_guardduty.types.create_sample_findings_request.CreateSampleFindingsRequest]",
    ) -> AsyncOperationResponse[
        "capo_guardduty.types.create_sample_findings_response.CreateSampleFindingsResponse"
    ]:
        import capo_guardduty._operations.guard_duty_api_service.create_sample_findings

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSampleFindings")
    )
    input_: capo_guardduty.types.create_sample_findings_request.CreateSampleFindingsRequest = {
        "detector_id": detector_id
    }
    if finding_types is not None:
        input_["finding_types"] = finding_types

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