Skip to content

list_snapshot_blocks

list_snapshot_blocks(
    snapshot_id: SnapshotId,
    *,
    config_overrides: Optional[EBSClientConfig] = None,
    next_token: Optional[PageToken] = None,
    max_results: Optional[MaxResults] = None,
    starting_block_index: Optional[BlockIndex] = None,
) -> ListSnapshotBlocksResponse

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

You should always retry requests that receive server (5xx) error responses, and ThrottlingException and RequestThrottledException client error responses. For more information see Error retries in the Amazon Elastic Compute Cloud User Guide.

Parameters:

  • snapshot_id (SnapshotId) –

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

  • next_token (Optional[PageToken], default: None ) –

    The token to request the next page of results.

    If you specify NextToken, then StartingBlockIndex is ignored.

  • max_results (Optional[MaxResults], default: None ) –

    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.

  • starting_block_index (Optional[BlockIndex], default: None ) –

    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.

Raises:

Source code in docs_src/capo_ebs/_services/ebs.py
def list_snapshot_blocks(
    self,
    snapshot_id: "capo_ebs.types.snapshot_id.SnapshotId",
    *,
    config_overrides: Optional[EBSClientConfig] = None,
    next_token: Optional["capo_ebs.types.page_token.PageToken"] = None,
    max_results: Optional["capo_ebs.types.max_results.MaxResults"] = None,
    starting_block_index: Optional["capo_ebs.types.block_index.BlockIndex"] = None,
) -> "capo_ebs.types.list_snapshot_blocks_response.ListSnapshotBlocksResponse":
    """<p>Returns information about the blocks in an Amazon Elastic Block Store snapshot.</p> <note> <p>You should always retry requests that receive server (<code>5xx</code>) error responses, and <code>ThrottlingException</code> and <code>RequestThrottledException</code> client error responses. For more information see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/error-retries.html">Error retries</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p> </note>

    Args:
        snapshot_id: <p>The ID of the snapshot from which to get block indexes and block tokens.</p>
        next_token: <p>The token to request the next page of results.</p> <p>If you specify <b>NextToken</b>, then <b>StartingBlockIndex</b> is ignored.</p>
        max_results: <p>The maximum number of blocks to be returned by the request.</p> <p>Even if additional blocks can be retrieved from the snapshot, the request can return less blocks than <b>MaxResults</b> or an empty array of blocks.</p> <p>To retrieve the next set of blocks from the snapshot, make another request with the returned <b>NextToken</b> value. The value of <b>NextToken</b> is <code>null</code> when there are no more blocks to return.</p>
        starting_block_index: <p>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.</p> <p>If you specify <b>NextToken</b>, then <b>StartingBlockIndex</b> is ignored.</p>

    Raises:
        capo_ebs.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_ebs.errors.internal_server_exception.InternalServerException: <p>An internal error has occurred. For more information see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/error-retries.html">Error retries</a>.</p>
        capo_ebs.errors.request_throttled_exception.RequestThrottledException: <p>The number of API requests has exceeded the maximum allowed API request throttling limit for the snapshot. For more information see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/error-retries.html">Error retries</a>.</p>
        capo_ebs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_ebs.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Your current service quotas do not allow you to perform this action.</p>
        capo_ebs.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints of the EBS direct APIs.</p>
        capo_ebs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ebs.types.list_snapshot_blocks_request.ListSnapshotBlocksRequest]",
    ) -> OperationResponse[
        "capo_ebs.types.list_snapshot_blocks_response.ListSnapshotBlocksResponse"
    ]:
        import capo_ebs._operations.ebs.list_snapshot_blocks

        output, http_response = (
            capo_ebs._operations.ebs.list_snapshot_blocks.list_snapshot_blocks(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_ebs.types.list_snapshot_blocks_response.ListSnapshotBlocksResponse",
    ) -> dict[str, Any]:
        import capo_ebs.types.list_snapshot_blocks_response

        return capo_ebs.types.list_snapshot_blocks_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ListSnapshotBlocks", redact_output=_redact_output),
    )
    input_: capo_ebs.types.list_snapshot_blocks_request.ListSnapshotBlocksRequest = {
        "snapshot_id": snapshot_id
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if starting_block_index is not None:
        input_["starting_block_index"] = starting_block_index

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output