listSnapshotBlocks method

Future<ListSnapshotBlocksResponse> listSnapshotBlocks({
  1. required String snapshotId,
  2. int? maxResults,
  3. String? nextToken,
  4. int? startingBlockIndex,
})

Returns information about the blocks in an Amazon Elastic Block Store snapshot.

May throw AccessDeniedException. May throw InternalServerException. May throw RequestThrottledException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter snapshotId : The ID of the snapshot from which to get block indexes and block tokens.

Parameter maxResults : The maximum number of blocks to be returned by the request.

Even if additional blocks can be retrieved from the snapshot, the request can return less blocks than MaxResults or an empty array of blocks.

To retrieve the next set of blocks from the snapshot, make another request with the returned NextToken value. The value of NextToken is null when there are no more blocks to return.

Parameter nextToken : The token to request the next page of results.

If you specify NextToken, then StartingBlockIndex is ignored.

Parameter startingBlockIndex : The block index from which the list should start. The list in the response will start from this block index or the next valid block index in the snapshot.

If you specify NextToken, then StartingBlockIndex is ignored.

Implementation

Future<ListSnapshotBlocksResponse> listSnapshotBlocks({
  required String snapshotId,
  int? maxResults,
  String? nextToken,
  int? startingBlockIndex,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    100,
    10000,
  );
  _s.validateNumRange(
    'startingBlockIndex',
    startingBlockIndex,
    0,
    1152921504606846976,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'pageToken': [nextToken],
    if (startingBlockIndex != null)
      'startingBlockIndex': [startingBlockIndex.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/snapshots/${Uri.encodeComponent(snapshotId)}/blocks',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListSnapshotBlocksResponse.fromJson(response);
}