Skip to content

list_trails async

list_trails(
    *,
    config_overrides: Optional[AsyncCloudTrailClientConfig] = None,
    next_token: Optional[String] = None,
) -> ListTrailsResponse

Lists trails that are in the current account.

Parameters:

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

    The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.

Raises:

Source code in docs_src/capo_cloudtrail/_services/async_cloud_trail.py
async def list_trails(
    self,
    *,
    config_overrides: Optional[AsyncCloudTrailClientConfig] = None,
    next_token: Optional["capo_cloudtrail.types.string.String"] = None,
) -> "capo_cloudtrail.types.list_trails_response.ListTrailsResponse":
    """<p>Lists trails that are in the current account.</p>

    Args:
        next_token: <p>The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.</p>

    Raises:
        capo_cloudtrail.errors.operation_not_permitted_exception.OperationNotPermittedException: <p>This exception is thrown when the requested operation is not permitted.</p>
        capo_cloudtrail.errors.unsupported_operation_exception.UnsupportedOperationException: <p>This exception is thrown when the requested operation is not supported.</p>
        capo_cloudtrail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudtrail.types.list_trails_request.ListTrailsRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudtrail.types.list_trails_response.ListTrailsResponse"
    ]:
        import capo_cloudtrail._operations.cloud_trail_20131101.list_trails

        (
            output,
            http_response,
        ) = await capo_cloudtrail._operations.cloud_trail_20131101.list_trails.async_list_trails(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListTrails")
    )
    input_: capo_cloudtrail.types.list_trails_request.ListTrailsRequest = {}
    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