Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use PutSnapshotBlock
with an Amazon SDK or CLI
The following code example shows how to use PutSnapshotBlock
.
- Rust
-
- SDK for Rust
-
async fn add_block(
client: &Client,
id: &str,
idx: usize,
block: Vec<u8>,
checksum: &str,
) -> Result<(), Error> {
client
.put_snapshot_block()
.snapshot_id(id)
.block_index(idx as i32)
.block_data(ByteStream::from(block))
.checksum(checksum)
.checksum_algorithm(ChecksumAlgorithm::ChecksumAlgorithmSha256)
.data_length(EBS_BLOCK_SIZE as i32)
.send()
.await?;
Ok(())
}