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]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CompleteSnapshotInput {
    /// <p>The ID of the snapshot.</p>
    pub snapshot_id: ::std::option::Option<::std::string::String>,
    /// <p>The number of blocks that were written to the snapshot.</p>
    pub changed_blocks_count: ::std::option::Option<i32>,
    /// <p>An aggregated Base-64 SHA256 checksum based on the checksums of each written block.</p>
    /// <p>To generate the aggregated checksum using the linear aggregation method, arrange the checksums for each written block in ascending order of their block index, concatenate them to form a single string, and then generate the checksum on the entire string using the SHA256 algorithm.</p>
    pub checksum: ::std::option::Option<::std::string::String>,
    /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
    pub checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
    /// <p>The aggregation method used to generate the checksum. Currently, the only supported aggregation method is <code>LINEAR</code>.</p>
    pub checksum_aggregation_method: ::std::option::Option<crate::types::ChecksumAggregationMethod>,
}
impl CompleteSnapshotInput {
    /// <p>The ID of the snapshot.</p>
    pub fn snapshot_id(&self) -> ::std::option::Option<&str> {
        self.snapshot_id.as_deref()
    }
    /// <p>The number of blocks that were written to the snapshot.</p>
    pub fn changed_blocks_count(&self) -> ::std::option::Option<i32> {
        self.changed_blocks_count
    }
    /// <p>An aggregated Base-64 SHA256 checksum based on the checksums of each written block.</p>
    /// <p>To generate the aggregated checksum using the linear aggregation method, arrange the checksums for each written block in ascending order of their block index, concatenate them to form a single string, and then generate the checksum on the entire string using the SHA256 algorithm.</p>
    pub fn checksum(&self) -> ::std::option::Option<&str> {
        self.checksum.as_deref()
    }
    /// <p>The algorithm used to generate the checksum. Currently, the only supported algorithm is <code>SHA256</code>.</p>
    pub fn checksum_algorithm(&self) -> ::std::option::Option<&crate::types::ChecksumAlgorithm> {
        self.checksum_algorithm.as_ref()
    }
    /// <p>The aggregation method used to generate the checksum. Currently, the only supported aggregation method is <code>LINEAR</code>.</p>
    pub fn checksum_aggregation_method(&self) -> ::std::option::Option<&crate::types::ChecksumAggregationMethod> {
        self.checksum_aggregation_method.as_ref()
    }
}
static COMPLETESNAPSHOTINPUT_MEMBER_SNAPSHOT_ID: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#CompleteSnapshotInput$SnapshotId",
        "com.amazonaws.ebs.synthetic",
        "CompleteSnapshotInput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "SnapshotId",
    0,
)
.with_http_label();
static COMPLETESNAPSHOTINPUT_MEMBER_CHANGED_BLOCKS_COUNT: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#CompleteSnapshotInput$ChangedBlocksCount",
        "com.amazonaws.ebs.synthetic",
        "CompleteSnapshotInput",
    ),
    ::aws_smithy_schema::ShapeType::Integer,
    "ChangedBlocksCount",
    1,
)
.with_http_header("x-amz-ChangedBlocksCount");
static COMPLETESNAPSHOTINPUT_MEMBER_CHECKSUM: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#CompleteSnapshotInput$Checksum",
        "com.amazonaws.ebs.synthetic",
        "CompleteSnapshotInput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "Checksum",
    2,
)
.with_http_header("x-amz-Checksum");
static COMPLETESNAPSHOTINPUT_MEMBER_CHECKSUM_ALGORITHM: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#CompleteSnapshotInput$ChecksumAlgorithm",
        "com.amazonaws.ebs.synthetic",
        "CompleteSnapshotInput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "ChecksumAlgorithm",
    3,
)
.with_http_header("x-amz-Checksum-Algorithm");
static COMPLETESNAPSHOTINPUT_MEMBER_CHECKSUM_AGGREGATION_METHOD: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#CompleteSnapshotInput$ChecksumAggregationMethod",
        "com.amazonaws.ebs.synthetic",
        "CompleteSnapshotInput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "ChecksumAggregationMethod",
    4,
)
.with_http_header("x-amz-Checksum-Aggregation-Method");
static COMPLETESNAPSHOTINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ebs.synthetic#CompleteSnapshotInput",
        "com.amazonaws.ebs.synthetic",
        "CompleteSnapshotInput",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    &[
        &COMPLETESNAPSHOTINPUT_MEMBER_SNAPSHOT_ID,
        &COMPLETESNAPSHOTINPUT_MEMBER_CHANGED_BLOCKS_COUNT,
        &COMPLETESNAPSHOTINPUT_MEMBER_CHECKSUM,
        &COMPLETESNAPSHOTINPUT_MEMBER_CHECKSUM_ALGORITHM,
        &COMPLETESNAPSHOTINPUT_MEMBER_CHECKSUM_AGGREGATION_METHOD,
    ],
)
.with_http(aws_smithy_schema::traits::HttpTrait::new(
    "POST",
    "/snapshots/completion/{SnapshotId}",
    Some(202),
))
.with_no_body_members()
.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
.with_original_name("CompleteSnapshotRequest");
impl CompleteSnapshotInput {
    /// The schema for this shape.
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &COMPLETESNAPSHOTINPUT_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for CompleteSnapshotInput {
    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.snapshot_id {
            ser.write_string(&COMPLETESNAPSHOTINPUT_MEMBER_SNAPSHOT_ID, val)?;
        }
        if let Some(ref val) = self.changed_blocks_count {
            ser.write_integer(&COMPLETESNAPSHOTINPUT_MEMBER_CHANGED_BLOCKS_COUNT, *val)?;
        }
        if let Some(ref val) = self.checksum {
            ser.write_string(&COMPLETESNAPSHOTINPUT_MEMBER_CHECKSUM, val)?;
        }
        if let Some(ref val) = self.checksum_algorithm {
            ser.write_string(&COMPLETESNAPSHOTINPUT_MEMBER_CHECKSUM_ALGORITHM, val.as_str())?;
        }
        if let Some(ref val) = self.checksum_aggregation_method {
            ser.write_string(&COMPLETESNAPSHOTINPUT_MEMBER_CHECKSUM_AGGREGATION_METHOD, val.as_str())?;
        }
        Ok(())
    }
}
impl crate::operation::complete_snapshot::builders::CompleteSnapshotInputBuilder {
    #[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(&COMPLETESNAPSHOTINPUT_SCHEMA, &mut |member, deser| {
            match member.member_index() {
                Some(0) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.snapshot_id = Some(deser.read_string(member)?);
                    }
                }
                Some(1) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.changed_blocks_count = Some(deser.read_integer(member)?);
                    }
                }
                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()));
                    }
                }
                Some(4) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.checksum_aggregation_method = Some(crate::types::ChecksumAggregationMethod::from(deser.read_string(member)?.as_str()));
                    }
                }
                _ => {}
            }
            Ok(())
        })
    }
}

impl CompleteSnapshotInput {
    /// 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)?;
        builder.snapshot_id = builder.snapshot_id.or(Some(String::new()));
        builder.changed_blocks_count = builder.changed_blocks_count.or(Some(0i32));
        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
    }
}
impl CompleteSnapshotInput {
    /// Creates a new builder-style object to manufacture [`CompleteSnapshotInput`](crate::operation::complete_snapshot::CompleteSnapshotInput).
    pub fn builder() -> crate::operation::complete_snapshot::builders::CompleteSnapshotInputBuilder {
        crate::operation::complete_snapshot::builders::CompleteSnapshotInputBuilder::default()
    }
}

/// A builder for [`CompleteSnapshotInput`](crate::operation::complete_snapshot::CompleteSnapshotInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CompleteSnapshotInputBuilder {
    pub(crate) snapshot_id: ::std::option::Option<::std::string::String>,
    pub(crate) changed_blocks_count: ::std::option::Option<i32>,
    pub(crate) checksum: ::std::option::Option<::std::string::String>,
    pub(crate) checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
    pub(crate) checksum_aggregation_method: ::std::option::Option<crate::types::ChecksumAggregationMethod>,
}
impl CompleteSnapshotInputBuilder {
    /// <p>The ID of the snapshot.</p>
    /// This field is required.
    pub fn snapshot_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.snapshot_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ID of the snapshot.</p>
    pub fn set_snapshot_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.snapshot_id = input;
        self
    }
    /// <p>The ID of the snapshot.</p>
    pub fn get_snapshot_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.snapshot_id
    }
    /// <p>The number of blocks that were written to the snapshot.</p>
    /// This field is required.
    pub fn changed_blocks_count(mut self, input: i32) -> Self {
        self.changed_blocks_count = ::std::option::Option::Some(input);
        self
    }
    /// <p>The number of blocks that were written to the snapshot.</p>
    pub fn set_changed_blocks_count(mut self, input: ::std::option::Option<i32>) -> Self {
        self.changed_blocks_count = input;
        self
    }
    /// <p>The number of blocks that were written to the snapshot.</p>
    pub fn get_changed_blocks_count(&self) -> &::std::option::Option<i32> {
        &self.changed_blocks_count
    }
    /// <p>An aggregated Base-64 SHA256 checksum based on the checksums of each written block.</p>
    /// <p>To generate the aggregated checksum using the linear aggregation method, arrange the checksums for each written block in ascending order of their block index, concatenate them to form a single string, and then generate the checksum on the entire string using the SHA256 algorithm.</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>An aggregated Base-64 SHA256 checksum based on the checksums of each written block.</p>
    /// <p>To generate the aggregated checksum using the linear aggregation method, arrange the checksums for each written block in ascending order of their block index, concatenate them to form a single string, and then generate the checksum on the entire string using the SHA256 algorithm.</p>
    pub fn set_checksum(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.checksum = input;
        self
    }
    /// <p>An aggregated Base-64 SHA256 checksum based on the checksums of each written block.</p>
    /// <p>To generate the aggregated checksum using the linear aggregation method, arrange the checksums for each written block in ascending order of their block index, concatenate them to form a single string, and then generate the checksum on the entire string using the SHA256 algorithm.</p>
    pub fn get_checksum(&self) -> &::std::option::Option<::std::string::String> {
        &self.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.checksum_algorithm = ::std::option::Option::Some(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.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.checksum_algorithm
    }
    /// <p>The aggregation method used to generate the checksum. Currently, the only supported aggregation method is <code>LINEAR</code>.</p>
    pub fn checksum_aggregation_method(mut self, input: crate::types::ChecksumAggregationMethod) -> Self {
        self.checksum_aggregation_method = ::std::option::Option::Some(input);
        self
    }
    /// <p>The aggregation method used to generate the checksum. Currently, the only supported aggregation method is <code>LINEAR</code>.</p>
    pub fn set_checksum_aggregation_method(mut self, input: ::std::option::Option<crate::types::ChecksumAggregationMethod>) -> Self {
        self.checksum_aggregation_method = input;
        self
    }
    /// <p>The aggregation method used to generate the checksum. Currently, the only supported aggregation method is <code>LINEAR</code>.</p>
    pub fn get_checksum_aggregation_method(&self) -> &::std::option::Option<crate::types::ChecksumAggregationMethod> {
        &self.checksum_aggregation_method
    }
    /// Consumes the builder and constructs a [`CompleteSnapshotInput`](crate::operation::complete_snapshot::CompleteSnapshotInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::complete_snapshot::CompleteSnapshotInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::complete_snapshot::CompleteSnapshotInput {
            snapshot_id: self.snapshot_id,
            changed_blocks_count: self.changed_blocks_count,
            checksum: self.checksum,
            checksum_algorithm: self.checksum_algorithm,
            checksum_aggregation_method: self.checksum_aggregation_method,
        })
    }
}