KinesisClient.list_shards
rboto-kinesis==0.4.0 · Service index · Types
Model summary (excerpt): Lists the shards in a stream and provides information about each shard. This operation has a limit of 1000 transactions per second per data stream. When invoking this API, you must use either the StreamARN or the StreamName parameter, or both. It is recommended that you use the StreamARN input parameter when you invoke this API. This action does not list expired shards. For information about...
Install and imports
Signature
async def list_shards(
*,
stream_name: str | None = None,
next_token: str | None = None,
exclusive_start_shard_id: str | None = None,
max_results: int | None = None,
stream_creation_timestamp: str | None = None,
shard_filter: ShardFilter | None = None,
stream_arn: str | None = None,
stream_id: str | None = None,
) -> ListShardsOutput: ...
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) |
|---|---|---|
stream_name |
No | The name of the data stream whose shards you want to list. You cannot specify this parameter if you specify the NextToken parameter. |
next_token |
No | When the number of shards in the data stream is greater than the default value for the MaxResults parameter, or if you explicitly specify a value for MaxResults that is less than the number of shards in the data stream, the response includes a pagination token named NextToken . You can specify this NextToken value in a subsequent call to ListShards to list the next set of shards. Don't specify... |
exclusive_start_shard_id |
No | Specify this parameter to indicate that you want to list the shards starting with the shard whose ID immediately follows ExclusiveStartShardId . If you don't specify this parameter, the default behavior is for ListShards to list the shards starting with the first one in the stream. You cannot specify this parameter if you specify NextToken . |
max_results |
No | The maximum number of shards to return in a single call to ListShards . The maximum number of shards to return in a single call. The default value is 1000. If you specify a value greater than 1000, at most 1000 results are returned. When the number of shards to be listed is greater than the value of MaxResults , the response contains a NextToken value that you can use in a subsequent call to... |
stream_creation_timestamp |
No | Specify this input parameter to distinguish data streams that have the same name. For example, if you create a data stream and then delete it, and you later create another data stream with the same name, you can use this input parameter to specify which of the two streams you want to list the shards for. You cannot specify this parameter if you specify the NextToken parameter. |
shard_filter |
No | Enables you to filter out the response of the ListShards API. You can only specify one filter at a time. If you use the ShardFilter parameter when invoking the ListShards API, the Type is the required property and must be specified. If you specify the AT_TRIM_HORIZON , FROM_TRIM_HORIZON , or AT_LATEST types, you do not need to specify either the ShardId or the Timestamp optional properties. If... |
stream_arn |
No | The ARN of the stream. |
stream_id |
No | Not Implemented. Reserved for future use. |
Output
ListShardsOutput.
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 |
|---|---|---|---|
shards |
list[ShardOutput] | None |
Always present | ShardOutput |
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.
Related types
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
client.paginators.list_shards(...) accepts the same arguments and returns AsyncIterator[ListShardsOutput]. Direct calls return one page. Pages preserve the Output representation above.
Input cursors: next_token. Page-size argument: max_results.
No output stream.
Errors
Import from rboto_kinesis.exceptions:
AccessDeniedError, ExpiredNextTokenError, InvalidArgumentError, LimitExceededError, ResourceInUseError, ResourceNotFoundError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.