Skip to content

create_publishing_destination async

create_publishing_destination(
    detector_id: DetectorId,
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    destination_type: Optional[DestinationType] = None,
    destination_properties: Optional[DestinationProperties] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagMap] = None,
) -> CreatePublishingDestinationResponse

Creates a publishing destination where you can export your GuardDuty findings. Before you start exporting the findings, the destination resource must exist.

Parameters:

  • detector_id (DetectorId) –

    The ID of the GuardDuty detector associated with the publishing destination.

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

  • destination_type (Optional[DestinationType], default: None ) –

    The type of resource for the publishing destination. Currently only Amazon S3 buckets are supported.

  • destination_properties (Optional[DestinationProperties], default: None ) –

    The properties of the publishing destination, including the ARNs for the destination and the KMS key used for encryption.

  • client_token (Optional[ClientToken], default: None ) –

    The idempotency token for the request.

  • tags (Optional[TagMap], default: None ) –

    The tags to be added to a new publishing destination resource.

Raises:

Source code in docs_src/capo_guardduty/_services/async_guard_duty.py
async def create_publishing_destination(
    self,
    detector_id: "capo_guardduty.types.detector_id.DetectorId",
    *,
    config_overrides: Optional[AsyncGuardDutyClientConfig] = None,
    destination_type: Optional[
        "capo_guardduty.types.destination_type.DestinationType"
    ] = None,
    destination_properties: Optional[
        "capo_guardduty.types.destination_properties.DestinationProperties"
    ] = None,
    client_token: Optional["capo_guardduty.types.client_token.ClientToken"] = None,
    tags: Optional["capo_guardduty.types.tag_map.TagMap"] = None,
) -> "capo_guardduty.types.create_publishing_destination_response.CreatePublishingDestinationResponse":
    """<p>Creates a publishing destination where you can export your GuardDuty findings. Before you start exporting the findings, the destination resource must exist.</p>

    Args:
        detector_id: <p>The ID of the GuardDuty detector associated with the publishing destination.</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>
        destination_type: <p>The type of resource for the publishing destination. Currently only Amazon S3 buckets are supported.</p>
        destination_properties: <p>The properties of the publishing destination, including the ARNs for the destination and the KMS key used for encryption.</p>
        client_token: <p>The idempotency token for the request.</p>
        tags: <p>The tags to be added to a new publishing destination resource.</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_publishing_destination_request.CreatePublishingDestinationRequest]",
    ) -> AsyncOperationResponse[
        "capo_guardduty.types.create_publishing_destination_response.CreatePublishingDestinationResponse"
    ]:
        import capo_guardduty._operations.guard_duty_api_service.create_publishing_destination

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreatePublishingDestination")
    )
    input_: capo_guardduty.types.create_publishing_destination_request.CreatePublishingDestinationRequest = {
        "detector_id": detector_id
    }
    if destination_type is not None:
        input_["destination_type"] = destination_type
    if destination_properties is not None:
        input_["destination_properties"] = destination_properties
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

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