Skip to content

CloudTrailClient.list_trails

rboto-cloudtrail==0.4.0 · Service index · Types

Model summary (excerpt): Lists trails that are in the current account.

Install and imports

python -m pip install "rboto[cloudtrail]==0.4.0"
from rboto import CloudTrailClient
from rboto_cloudtrail.types import (
    ListTrailsOutput,
)

Signature

async def list_trails(
    *,
    next_token: str | None = None,
) -> ListTrailsOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
next_token No 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.

Output

ListTrailsOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
trails list[TrailInfoOutput] | None Always present TrailInfoOutput
next_token str | None Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

ListTrailsOutput

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

client.paginators.list_trails(...) accepts the same arguments and returns AsyncIterator[ListTrailsOutput]. Direct calls return one page. Pages preserve the Output representation above.

Input cursors: next_token. Page-size argument: not exposed.

No output stream.

Errors

Import from rboto_cloudtrail.exceptions:

OperationNotPermittedError, UnsupportedOperationError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Example

Complete, type-checked service example. Replace its placeholders and configure credentials before running it.

import asyncio

from rboto import CloudTrailClient


async def main() -> None:
    client = CloudTrailClient(region="us-east-1")
    response = await client.list_trails()
    for trail in response.trails or []:
        print(trail.name, trail.trail_arn)


if __name__ == "__main__":
    asyncio.run(main())

Service guide · Pinned model