describeStream method

Future<DescribeStreamOutput> describeStream({
  1. required String streamName,
  2. String? exclusiveStartShardId,
  3. int? limit,
})

Describes the specified Kinesis data stream.

The information returned includes the stream name, Amazon Resource Name (ARN), creation time, enhanced metric configuration, and shard map. The shard map is an array of shard objects. For each shard object, there is the hash key and sequence number ranges that the shard spans, and the IDs of any earlier shards that played in a role in creating the shard. Every record ingested in the stream is identified by a sequence number, which is assigned when the record is put into the stream.

You can limit the number of shards returned by each call. For more information, see Retrieving Shards from a Stream in the Amazon Kinesis Data Streams Developer Guide.

There are no guarantees about the chronological order shards returned. To process shards in chronological order, use the ID of the parent shard to track the lineage to the oldest shard.

This operation has a limit of 10 transactions per second per account.

May throw ResourceNotFoundException. May throw LimitExceededException.

Parameter streamName : The name of the stream to describe.

Parameter exclusiveStartShardId : The shard ID of the shard to start with.

Parameter limit : The maximum number of shards to return in a single call. The default value is 100. If you specify a value greater than 100, at most 100 shards are returned.

Implementation

Future<DescribeStreamOutput> describeStream({
  required String streamName,
  String? exclusiveStartShardId,
  int? limit,
}) async {
  ArgumentError.checkNotNull(streamName, 'streamName');
  _s.validateStringLength(
    'streamName',
    streamName,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'exclusiveStartShardId',
    exclusiveStartShardId,
    1,
    128,
  );
  _s.validateNumRange(
    'limit',
    limit,
    1,
    10000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Kinesis_20131202.DescribeStream'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'StreamName': streamName,
      if (exclusiveStartShardId != null)
        'ExclusiveStartShardId': exclusiveStartShardId,
      if (limit != null) 'Limit': limit,
    },
  );

  return DescribeStreamOutput.fromJson(jsonResponse.body);
}