// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::put_snapshot_block::_put_snapshot_block_input::PutSnapshotBlockInputBuilder;
pub use crate::operation::put_snapshot_block::_put_snapshot_block_output::PutSnapshotBlockOutputBuilder;
impl crate::operation::put_snapshot_block::builders::PutSnapshotBlockInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::put_snapshot_block::PutSnapshotBlockOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::put_snapshot_block::PutSnapshotBlockError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.put_snapshot_block();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `PutSnapshotBlock`.
///
/// <p>Writes a block of data to a snapshot. If the specified block contains data, the existing data is overwritten. The target snapshot must be in the <code>pending</code> state.</p>
/// <p>Data written to a snapshot must be aligned with 512-KiB sectors.</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>
#[derive(::std::fmt::Debug)]
pub struct PutSnapshotBlockFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::put_snapshot_block::builders::PutSnapshotBlockInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::put_snapshot_block::PutSnapshotBlockOutput,
crate::operation::put_snapshot_block::PutSnapshotBlockError,
> for PutSnapshotBlockFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::put_snapshot_block::PutSnapshotBlockOutput,
crate::operation::put_snapshot_block::PutSnapshotBlockError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl PutSnapshotBlockFluentBuilder {
/// Creates a new `PutSnapshotBlockFluentBuilder`.
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
config_override: ::std::option::Option::None,
}
}
/// Access the PutSnapshotBlock as a reference.
pub fn as_input(&self) -> &crate::operation::put_snapshot_block::builders::PutSnapshotBlockInputBuilder {
&self.inner
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::put_snapshot_block::PutSnapshotBlockOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::put_snapshot_block::PutSnapshotBlockError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let input = self
.inner
.build()
.map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
let runtime_plugins = crate::operation::put_snapshot_block::PutSnapshotBlock::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::put_snapshot_block::PutSnapshotBlock::orchestrate(&runtime_plugins, input).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being sent.
pub fn customize(
self,
) -> crate::client::customize::CustomizableOperation<
crate::operation::put_snapshot_block::PutSnapshotBlockOutput,
crate::operation::put_snapshot_block::PutSnapshotBlockError,
Self,
> {
crate::client::customize::CustomizableOperation::new(self)
}
pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
self.set_config_override(::std::option::Option::Some(config_override.into()));
self
}
pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
self.config_override = config_override;
self
}
/// <p>The ID of the snapshot.</p><important>
/// <p>If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the snapshot. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>..</p>
/// </important>
pub fn snapshot_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.snapshot_id(input.into());
self
}
/// <p>The ID of the snapshot.</p><important>
/// <p>If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the snapshot. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>..</p>
/// </important>
pub fn set_snapshot_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_snapshot_id(input);
self
}
/// <p>The ID of the snapshot.</p><important>
/// <p>If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the snapshot. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebsapis-using-encryption.html"> Using encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>..</p>
/// </important>
pub fn get_snapshot_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_snapshot_id()
}
/// <p>The block index of the block in which to write the data. A block index is a logical index in units of <code>512</code> KiB blocks. To identify the block index, divide the logical offset of the data in the logical volume by the block size (logical offset of data/<code>524288</code>). The logical offset of the data must be <code>512</code> KiB aligned.</p>
pub fn block_index(mut self, input: i32) -> Self {
self.inner = self.inner.block_index(input);
self
}
/// <p>The block index of the block in which to write the data. A block index is a logical index in units of <code>512</code> KiB blocks. To identify the block index, divide the logical offset of the data in the logical volume by the block size (logical offset of data/<code>524288</code>). The logical offset of the data must be <code>512</code> KiB aligned.</p>
pub fn set_block_index(mut self, input: ::std::option::Option<i32>) -> Self {
self.inner = self.inner.set_block_index(input);
self
}
/// <p>The block index of the block in which to write the data. A block index is a logical index in units of <code>512</code> KiB blocks. To identify the block index, divide the logical offset of the data in the logical volume by the block size (logical offset of data/<code>524288</code>). The logical offset of the data must be <code>512</code> KiB aligned.</p>
pub fn get_block_index(&self) -> &::std::option::Option<i32> {
self.inner.get_block_index()
}
/// <p>The data to write to the block.</p>
/// <p>The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate and provide a Base64-encoded SHA256 checksum for the block data using the <b>x-amz-Checksum</b> header. Also, you must specify the checksum algorithm using the <b>x-amz-Checksum-Algorithm</b> header. The checksum that you provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request fails. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-checksums"> Using checksums with the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
pub fn block_data(mut self, input: ::aws_smithy_types::byte_stream::ByteStream) -> Self {
self.inner = self.inner.block_data(input);
self
}
/// <p>The data to write to the block.</p>
/// <p>The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate and provide a Base64-encoded SHA256 checksum for the block data using the <b>x-amz-Checksum</b> header. Also, you must specify the checksum algorithm using the <b>x-amz-Checksum-Algorithm</b> header. The checksum that you provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request fails. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-checksums"> Using checksums with the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
pub fn set_block_data(mut self, input: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>) -> Self {
self.inner = self.inner.set_block_data(input);
self
}
/// <p>The data to write to the block.</p>
/// <p>The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate and provide a Base64-encoded SHA256 checksum for the block data using the <b>x-amz-Checksum</b> header. Also, you must specify the checksum algorithm using the <b>x-amz-Checksum-Algorithm</b> header. The checksum that you provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request fails. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-checksums"> Using checksums with the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
pub fn get_block_data(&self) -> &::std::option::Option<::aws_smithy_types::byte_stream::ByteStream> {
self.inner.get_block_data()
}
/// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code> bytes.</p>
/// <p>Valid values: <code>524288</code></p>
pub fn data_length(mut self, input: i32) -> Self {
self.inner = self.inner.data_length(input);
self
}
/// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code> bytes.</p>
/// <p>Valid values: <code>524288</code></p>
pub fn set_data_length(mut self, input: ::std::option::Option<i32>) -> Self {
self.inner = self.inner.set_data_length(input);
self
}
/// <p>The size of the data to write to the block, in bytes. Currently, the only supported size is <code>524288</code> bytes.</p>
/// <p>Valid values: <code>524288</code></p>
pub fn get_data_length(&self) -> &::std::option::Option<i32> {
self.inner.get_data_length()
}
/// <p>The progress of the write process, as a percentage.</p>
pub fn progress(mut self, input: i32) -> Self {
self.inner = self.inner.progress(input);
self
}
/// <p>The progress of the write process, as a percentage.</p>
pub fn set_progress(mut self, input: ::std::option::Option<i32>) -> Self {
self.inner = self.inner.set_progress(input);
self
}
/// <p>The progress of the write process, as a percentage.</p>
pub fn get_progress(&self) -> &::std::option::Option<i32> {
self.inner.get_progress()
}
/// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
pub fn checksum(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.checksum(input.into());
self
}
/// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
pub fn set_checksum(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_checksum(input);
self
}
/// <p>A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported.</p>
pub fn get_checksum(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_checksum()
}
/// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
self.inner = self.inner.checksum_algorithm(input);
self
}
/// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
self.inner = self.inner.set_checksum_algorithm(input);
self
}
/// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
self.inner.get_checksum_algorithm()
}
}