aws-sdk-ebs 1.118.0

AWS SDK for Amazon Elastic Block Store
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
pub struct GetSnapshotBlockOutput {
    /// <p>The size of the data in the block.</p>
    pub data_length: ::std::option::Option<i32>,
    /// <p>The data content of the block.</p>
    pub block_data: ::aws_smithy_types::byte_stream::ByteStream,
    /// <p>The checksum generated for the block, which is Base64 encoded.</p>
    pub checksum: ::std::option::Option<::std::string::String>,
    /// <p>The algorithm used to generate the checksum for the block, such as SHA256.</p>
    pub checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
    _request_id: Option<String>,
}
impl GetSnapshotBlockOutput {
    /// <p>The size of the data in the block.</p>
    pub fn data_length(&self) -> ::std::option::Option<i32> {
        self.data_length
    }
    /// <p>The data content of the block.</p>
    pub fn block_data(&self) -> &::aws_smithy_types::byte_stream::ByteStream {
        &self.block_data
    }
    /// <p>The checksum generated for the block, which is Base64 encoded.</p>
    pub fn checksum(&self) -> ::std::option::Option<&str> {
        self.checksum.as_deref()
    }
    /// <p>The algorithm used to generate the checksum for the block, such as SHA256.</p>
    pub fn checksum_algorithm(&self) -> ::std::option::Option<&crate::types::ChecksumAlgorithm> {
        self.checksum_algorithm.as_ref()
    }
}
impl ::std::fmt::Debug for GetSnapshotBlockOutput {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("GetSnapshotBlockOutput");
        formatter.field("data_length", &self.data_length);
        formatter.field("block_data", &"*** Sensitive Data Redacted ***");
        formatter.field("checksum", &self.checksum);
        formatter.field("checksum_algorithm", &self.checksum_algorithm);
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}
static GETSNAPSHOTBLOCKOUTPUT_MEMBER_DATA_LENGTH: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#GetSnapshotBlockOutput$DataLength",
        "com.amazonaws.ebs.synthetic",
        "GetSnapshotBlockOutput",
    ),
    ::aws_smithy_schema::ShapeType::Integer,
    "DataLength",
    0,
)
.with_http_header("x-amz-Data-Length");
static GETSNAPSHOTBLOCKOUTPUT_MEMBER_BLOCK_DATA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#GetSnapshotBlockOutput$BlockData",
        "com.amazonaws.ebs.synthetic",
        "GetSnapshotBlockOutput",
    ),
    ::aws_smithy_schema::ShapeType::Blob,
    "BlockData",
    1,
)
.with_http_payload()
.with_streaming();
static GETSNAPSHOTBLOCKOUTPUT_MEMBER_CHECKSUM: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#GetSnapshotBlockOutput$Checksum",
        "com.amazonaws.ebs.synthetic",
        "GetSnapshotBlockOutput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "Checksum",
    2,
)
.with_http_header("x-amz-Checksum");
static GETSNAPSHOTBLOCKOUTPUT_MEMBER_CHECKSUM_ALGORITHM: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#GetSnapshotBlockOutput$ChecksumAlgorithm",
        "com.amazonaws.ebs.synthetic",
        "GetSnapshotBlockOutput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "ChecksumAlgorithm",
    3,
)
.with_http_header("x-amz-Checksum-Algorithm");
static GETSNAPSHOTBLOCKOUTPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#GetSnapshotBlockOutput",
        "com.amazonaws.ebs.synthetic",
        "GetSnapshotBlockOutput",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    &[
        &GETSNAPSHOTBLOCKOUTPUT_MEMBER_DATA_LENGTH,
        &GETSNAPSHOTBLOCKOUTPUT_MEMBER_BLOCK_DATA,
        &GETSNAPSHOTBLOCKOUTPUT_MEMBER_CHECKSUM,
        &GETSNAPSHOTBLOCKOUTPUT_MEMBER_CHECKSUM_ALGORITHM,
    ],
)
.with_original_name("GetSnapshotBlockResponse");
impl GetSnapshotBlockOutput {
    /// The schema for this shape.
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &GETSNAPSHOTBLOCKOUTPUT_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for GetSnapshotBlockOutput {
    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
        Self::SCHEMA
    }

    #[allow(unused_variables, clippy::diverging_sub_expression)]
    fn serialize_members(
        &self,
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
        if let Some(ref val) = self.data_length {
            ser.write_integer(&GETSNAPSHOTBLOCKOUTPUT_MEMBER_DATA_LENGTH, *val)?;
        }
        if let Some(ref val) = self.checksum {
            ser.write_string(&GETSNAPSHOTBLOCKOUTPUT_MEMBER_CHECKSUM, val)?;
        }
        if let Some(ref val) = self.checksum_algorithm {
            ser.write_string(&GETSNAPSHOTBLOCKOUTPUT_MEMBER_CHECKSUM_ALGORITHM, val.as_str())?;
        }
        Ok(())
    }
}
impl crate::operation::get_snapshot_block::builders::GetSnapshotBlockOutputBuilder {
    #[allow(
        unused_variables,
        unreachable_code,
        clippy::single_match,
        clippy::match_single_binding,
        clippy::diverging_sub_expression
    )]
    pub(crate) fn deserialize_members(
        &mut self,
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
        deserializer.read_struct(&GETSNAPSHOTBLOCKOUTPUT_SCHEMA, &mut |member, deser| {
            match member.member_index() {
                Some(0) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.data_length = Some(deser.read_integer(member)?);
                    }
                }
                Some(1) => {
                    deser.skip_value()?;
                }
                Some(2) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.checksum = Some(deser.read_string(member)?);
                    }
                }
                Some(3) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.checksum_algorithm = Some(crate::types::ChecksumAlgorithm::from(deser.read_string(member)?.as_str()));
                    }
                }
                _ => {}
            }
            Ok(())
        })
    }
}

impl GetSnapshotBlockOutput {
    /// Deserializes this structure from a [`ShapeDeserializer`].
    pub fn deserialize(
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
        let mut builder = Self::builder();
        builder.deserialize_members(deserializer)?;
        Ok(builder.build())
    }
}
impl ::aws_types::request_id::RequestId for GetSnapshotBlockOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl GetSnapshotBlockOutput {
    /// Creates a new builder-style object to manufacture [`GetSnapshotBlockOutput`](crate::operation::get_snapshot_block::GetSnapshotBlockOutput).
    pub fn builder() -> crate::operation::get_snapshot_block::builders::GetSnapshotBlockOutputBuilder {
        crate::operation::get_snapshot_block::builders::GetSnapshotBlockOutputBuilder::default()
    }
}

/// A builder for [`GetSnapshotBlockOutput`](crate::operation::get_snapshot_block::GetSnapshotBlockOutput).
#[derive(::std::default::Default)]
#[non_exhaustive]
pub struct GetSnapshotBlockOutputBuilder {
    pub(crate) data_length: ::std::option::Option<i32>,
    pub(crate) block_data: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>,
    pub(crate) checksum: ::std::option::Option<::std::string::String>,
    pub(crate) checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
    _request_id: Option<String>,
}
impl GetSnapshotBlockOutputBuilder {
    /// <p>The size of the data in the block.</p>
    pub fn data_length(mut self, input: i32) -> Self {
        self.data_length = ::std::option::Option::Some(input);
        self
    }
    /// <p>The size of the data in the block.</p>
    pub fn set_data_length(mut self, input: ::std::option::Option<i32>) -> Self {
        self.data_length = input;
        self
    }
    /// <p>The size of the data in the block.</p>
    pub fn get_data_length(&self) -> &::std::option::Option<i32> {
        &self.data_length
    }
    /// <p>The data content of the block.</p>
    pub fn block_data(mut self, input: ::aws_smithy_types::byte_stream::ByteStream) -> Self {
        self.block_data = ::std::option::Option::Some(input);
        self
    }
    /// <p>The data content of the block.</p>
    pub fn set_block_data(mut self, input: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>) -> Self {
        self.block_data = input;
        self
    }
    /// <p>The data content of the block.</p>
    pub fn get_block_data(&self) -> &::std::option::Option<::aws_smithy_types::byte_stream::ByteStream> {
        &self.block_data
    }
    /// <p>The checksum generated for the block, which is Base64 encoded.</p>
    pub fn checksum(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.checksum = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The checksum generated for the block, which is Base64 encoded.</p>
    pub fn set_checksum(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.checksum = input;
        self
    }
    /// <p>The checksum generated for the block, which is Base64 encoded.</p>
    pub fn get_checksum(&self) -> &::std::option::Option<::std::string::String> {
        &self.checksum
    }
    /// <p>The algorithm used to generate the checksum for the block, such as SHA256.</p>
    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
        self.checksum_algorithm = ::std::option::Option::Some(input);
        self
    }
    /// <p>The algorithm used to generate the checksum for the block, such as SHA256.</p>
    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
        self.checksum_algorithm = input;
        self
    }
    /// <p>The algorithm used to generate the checksum for the block, such as SHA256.</p>
    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
        &self.checksum_algorithm
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`GetSnapshotBlockOutput`](crate::operation::get_snapshot_block::GetSnapshotBlockOutput).
    pub fn build(self) -> crate::operation::get_snapshot_block::GetSnapshotBlockOutput {
        crate::operation::get_snapshot_block::GetSnapshotBlockOutput {
            data_length: self.data_length,
            block_data: self.block_data.unwrap_or_default(),
            checksum: self.checksum,
            checksum_algorithm: self.checksum_algorithm,
            _request_id: self._request_id,
        }
    }
}
impl ::std::fmt::Debug for GetSnapshotBlockOutputBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("GetSnapshotBlockOutputBuilder");
        formatter.field("data_length", &self.data_length);
        formatter.field("block_data", &"*** Sensitive Data Redacted ***");
        formatter.field("checksum", &self.checksum);
        formatter.field("checksum_algorithm", &self.checksum_algorithm);
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}