aws-sdk-backupstorage 1.30.0

AWS SDK for AWS Backup Storage
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::fmt::Debug)]
pub struct GetChunkOutput {
    /// Chunk data
    pub data: ::aws_smithy_types::byte_stream::ByteStream,
    /// Data length
    pub length: i64,
    /// Data checksum
    pub checksum: ::std::string::String,
    /// Checksum algorithm
    pub checksum_algorithm: crate::types::DataChecksumAlgorithm,
    _request_id: Option<String>,
}
impl GetChunkOutput {
    /// Chunk data
    pub fn data(&self) -> &::aws_smithy_types::byte_stream::ByteStream {
        &self.data
    }
    /// Data length
    pub fn length(&self) -> i64 {
        self.length
    }
    /// Data checksum
    pub fn checksum(&self) -> &str {
        use std::ops::Deref;
        self.checksum.deref()
    }
    /// Checksum algorithm
    pub fn checksum_algorithm(&self) -> &crate::types::DataChecksumAlgorithm {
        &self.checksum_algorithm
    }
}
impl ::aws_types::request_id::RequestId for GetChunkOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl GetChunkOutput {
    /// Creates a new builder-style object to manufacture [`GetChunkOutput`](crate::operation::get_chunk::GetChunkOutput).
    pub fn builder() -> crate::operation::get_chunk::builders::GetChunkOutputBuilder {
        crate::operation::get_chunk::builders::GetChunkOutputBuilder::default()
    }
}

/// A builder for [`GetChunkOutput`](crate::operation::get_chunk::GetChunkOutput).
#[non_exhaustive]
#[derive(::std::default::Default, ::std::fmt::Debug)]
pub struct GetChunkOutputBuilder {
    pub(crate) data: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>,
    pub(crate) length: ::std::option::Option<i64>,
    pub(crate) checksum: ::std::option::Option<::std::string::String>,
    pub(crate) checksum_algorithm: ::std::option::Option<crate::types::DataChecksumAlgorithm>,
    _request_id: Option<String>,
}
impl GetChunkOutputBuilder {
    /// Chunk data
    /// This field is required.
    pub fn data(mut self, input: ::aws_smithy_types::byte_stream::ByteStream) -> Self {
        self.data = ::std::option::Option::Some(input);
        self
    }
    /// Chunk data
    pub fn set_data(mut self, input: ::std::option::Option<::aws_smithy_types::byte_stream::ByteStream>) -> Self {
        self.data = input;
        self
    }
    /// Chunk data
    pub fn get_data(&self) -> &::std::option::Option<::aws_smithy_types::byte_stream::ByteStream> {
        &self.data
    }
    /// Data length
    /// This field is required.
    pub fn length(mut self, input: i64) -> Self {
        self.length = ::std::option::Option::Some(input);
        self
    }
    /// Data length
    pub fn set_length(mut self, input: ::std::option::Option<i64>) -> Self {
        self.length = input;
        self
    }
    /// Data length
    pub fn get_length(&self) -> &::std::option::Option<i64> {
        &self.length
    }
    /// Data checksum
    /// This field is required.
    pub fn checksum(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.checksum = ::std::option::Option::Some(input.into());
        self
    }
    /// Data checksum
    pub fn set_checksum(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.checksum = input;
        self
    }
    /// Data checksum
    pub fn get_checksum(&self) -> &::std::option::Option<::std::string::String> {
        &self.checksum
    }
    /// Checksum algorithm
    /// This field is required.
    pub fn checksum_algorithm(mut self, input: crate::types::DataChecksumAlgorithm) -> Self {
        self.checksum_algorithm = ::std::option::Option::Some(input);
        self
    }
    /// Checksum algorithm
    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::DataChecksumAlgorithm>) -> Self {
        self.checksum_algorithm = input;
        self
    }
    /// Checksum algorithm
    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::DataChecksumAlgorithm> {
        &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 [`GetChunkOutput`](crate::operation::get_chunk::GetChunkOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`checksum`](crate::operation::get_chunk::builders::GetChunkOutputBuilder::checksum)
    /// - [`checksum_algorithm`](crate::operation::get_chunk::builders::GetChunkOutputBuilder::checksum_algorithm)
    pub fn build(self) -> ::std::result::Result<crate::operation::get_chunk::GetChunkOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::get_chunk::GetChunkOutput {
            data: self.data.unwrap_or_default(),
            length: self.length.unwrap_or_default(),
            checksum: self.checksum.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "checksum",
                    "checksum was not specified but it is required when building GetChunkOutput",
                )
            })?,
            checksum_algorithm: self.checksum_algorithm.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "checksum_algorithm",
                    "checksum_algorithm was not specified but it is required when building GetChunkOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}