Skip to content

put_audit_events async

put_audit_events(
    audit_events: AuditEvents,
    channel_arn: ChannelArn,
    *,
    config_overrides: Optional[AsyncCloudTrailDataClientConfig] = None,
    external_id: Optional[ExternalId] = None,
) -> PutAuditEventsResponse

Ingests your application events into CloudTrail Lake. A required parameter, auditEvents, accepts the JSON records (also called payload) of events that you want CloudTrail to ingest. You can add up to 100 of these events (or up to 1 MB) per PutAuditEvents request.

Parameters:

  • audit_events (AuditEvents) –

    The JSON payload of events that you want to ingest. You can also point to the JSON event payload in a file.

  • channel_arn (ChannelArn) –

    The ARN or ID (the ARN suffix) of a channel.

  • external_id (Optional[ExternalId], default: None ) –

    A unique identifier that is conditionally required when the channel's resource policy includes an external ID. This value can be any string, such as a passphrase or account number.

Raises:

Source code in docs_src/capo_cloudtrail_data/_services/async_cloud_trail_data.py
async def put_audit_events(
    self,
    audit_events: "capo_cloudtrail_data.types.audit_events.AuditEvents",
    channel_arn: "capo_cloudtrail_data.types.channel_arn.ChannelArn",
    *,
    config_overrides: Optional[AsyncCloudTrailDataClientConfig] = None,
    external_id: Optional[
        "capo_cloudtrail_data.types.external_id.ExternalId"
    ] = None,
) -> "capo_cloudtrail_data.types.put_audit_events_response.PutAuditEventsResponse":
    """<p>Ingests your application events into CloudTrail Lake. A required parameter, <code>auditEvents</code>, accepts the JSON records (also called <i>payload</i>) of events that you want CloudTrail to ingest. You can add up to 100 of these events (or up to 1 MB) per <code>PutAuditEvents</code> request.</p>

    Args:
        audit_events: <p>The JSON payload of events that you want to ingest. You can also point to the JSON event payload in a file.</p>
        channel_arn: <p>The ARN or ID (the ARN suffix) of a channel.</p>
        external_id: <p>A unique identifier that is conditionally required when the channel's resource policy includes an external ID. This value can be any string, such as a passphrase or account number.</p>

    Raises:
        capo_cloudtrail_data.errors.channel_insufficient_permission.ChannelInsufficientPermission: <p>The caller's account ID must be the same as the channel owner's account ID.</p>
        capo_cloudtrail_data.errors.channel_not_found.ChannelNotFound: <p>The channel could not be found.</p>
        capo_cloudtrail_data.errors.channel_unsupported_schema.ChannelUnsupportedSchema: <p>The schema type of the event is not supported.</p>
        capo_cloudtrail_data.errors.duplicated_audit_event_id.DuplicatedAuditEventId: <p>Two or more entries in the request have the same event ID.</p>
        capo_cloudtrail_data.errors.invalid_channel_arn.InvalidChannelARN: <p>The specified channel ARN is not a valid channel ARN.</p>
        capo_cloudtrail_data.errors.unsupported_operation_exception.UnsupportedOperationException: <p>The operation requested is not supported in this region or account.</p>
        capo_cloudtrail_data.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudtrail_data.types.put_audit_events_request.PutAuditEventsRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudtrail_data.types.put_audit_events_response.PutAuditEventsResponse"
    ]:
        import capo_cloudtrail_data._operations.cloud_trail_data_service.put_audit_events

        (
            output,
            http_response,
        ) = await capo_cloudtrail_data._operations.cloud_trail_data_service.put_audit_events.async_put_audit_events(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutAuditEvents")
    )
    input_: capo_cloudtrail_data.types.put_audit_events_request.PutAuditEventsRequest = {
        "audit_events": audit_events,
        "channel_arn": channel_arn,
    }
    if external_id is not None:
        input_["external_id"] = external_id

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