listFragments method

Future<ListFragmentsOutput> listFragments({
  1. FragmentSelector? fragmentSelector,
  2. int? maxResults,
  3. String? nextToken,
  4. String? streamARN,
  5. String? streamName,
})

Returns a list of Fragment objects from the specified stream and timestamp range within the archived data.

Listing fragments is eventually consistent. This means that even if the producer receives an acknowledgment that a fragment is persisted, the result might not be returned immediately from a request to ListFragments. However, results are typically available in less than one second.

  • x-amz-ErrorType HTTP header – contains a more specific error type in addition to what the HTTP status code provides.
  • x-amz-RequestId HTTP header – if you want to report an issue to Amazon Web Services, the support team can better diagnose the problem if given the Request Id.
Both the HTTP status code and the ErrorType header can be utilized to make programmatic decisions about whether errors are retry-able and under what conditions, as well as provide information on what actions the client programmer might need to take in order to successfully try again.

For more information, see the Errors section at the bottom of this topic, as well as Common Errors.

May throw ClientLimitExceededException. May throw InvalidArgumentException. May throw NotAuthorizedException. May throw ResourceNotFoundException.

Parameter fragmentSelector : Describes the timestamp range and timestamp origin for the range of fragments to return.

Parameter maxResults : The total number of fragments to return. If the total number of fragments available is more than the value specified in max-results, then a ListFragmentsOutput$NextToken is provided in the output that you can use to resume pagination.

Parameter nextToken : A token to specify where to start paginating. This is the ListFragmentsOutput$NextToken from a previously truncated response.

Parameter streamARN : The Amazon Resource Name (ARN) of the stream from which to retrieve a fragment list. Specify either this parameter or the StreamName parameter.

Parameter streamName : The name of the stream from which to retrieve a fragment list. Specify either this parameter or the StreamARN parameter.

Implementation

Future<ListFragmentsOutput> listFragments({
  FragmentSelector? fragmentSelector,
  int? maxResults,
  String? nextToken,
  String? streamARN,
  String? streamName,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final $payload = <String, dynamic>{
    if (fragmentSelector != null) 'FragmentSelector': fragmentSelector,
    if (maxResults != null) 'MaxResults': maxResults,
    if (nextToken != null) 'NextToken': nextToken,
    if (streamARN != null) 'StreamARN': streamARN,
    if (streamName != null) 'StreamName': streamName,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/listFragments',
    exceptionFnMap: _exceptionFns,
  );
  return ListFragmentsOutput.fromJson(response);
}