aws-sdk-docdbelastic 1.78.0

AWS SDK for Amazon DocumentDB Elastic Clusters
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The name of the shard.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Shard {
    /// <p>The ID of the shard.</p>
    pub shard_id: ::std::string::String,
    /// <p>The time when the shard was created in Universal Coordinated Time (UTC).</p>
    pub create_time: ::std::string::String,
    /// <p>The current status of the shard.</p>
    pub status: crate::types::Status,
}
impl Shard {
    /// <p>The ID of the shard.</p>
    pub fn shard_id(&self) -> &str {
        use std::ops::Deref;
        self.shard_id.deref()
    }
    /// <p>The time when the shard was created in Universal Coordinated Time (UTC).</p>
    pub fn create_time(&self) -> &str {
        use std::ops::Deref;
        self.create_time.deref()
    }
    /// <p>The current status of the shard.</p>
    pub fn status(&self) -> &crate::types::Status {
        &self.status
    }
}
impl Shard {
    /// Creates a new builder-style object to manufacture [`Shard`](crate::types::Shard).
    pub fn builder() -> crate::types::builders::ShardBuilder {
        crate::types::builders::ShardBuilder::default()
    }
}

/// A builder for [`Shard`](crate::types::Shard).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ShardBuilder {
    pub(crate) shard_id: ::std::option::Option<::std::string::String>,
    pub(crate) create_time: ::std::option::Option<::std::string::String>,
    pub(crate) status: ::std::option::Option<crate::types::Status>,
}
impl ShardBuilder {
    /// <p>The ID of the shard.</p>
    /// This field is required.
    pub fn shard_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.shard_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ID of the shard.</p>
    pub fn set_shard_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.shard_id = input;
        self
    }
    /// <p>The ID of the shard.</p>
    pub fn get_shard_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.shard_id
    }
    /// <p>The time when the shard was created in Universal Coordinated Time (UTC).</p>
    /// This field is required.
    pub fn create_time(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.create_time = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The time when the shard was created in Universal Coordinated Time (UTC).</p>
    pub fn set_create_time(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.create_time = input;
        self
    }
    /// <p>The time when the shard was created in Universal Coordinated Time (UTC).</p>
    pub fn get_create_time(&self) -> &::std::option::Option<::std::string::String> {
        &self.create_time
    }
    /// <p>The current status of the shard.</p>
    /// This field is required.
    pub fn status(mut self, input: crate::types::Status) -> Self {
        self.status = ::std::option::Option::Some(input);
        self
    }
    /// <p>The current status of the shard.</p>
    pub fn set_status(mut self, input: ::std::option::Option<crate::types::Status>) -> Self {
        self.status = input;
        self
    }
    /// <p>The current status of the shard.</p>
    pub fn get_status(&self) -> &::std::option::Option<crate::types::Status> {
        &self.status
    }
    /// Consumes the builder and constructs a [`Shard`](crate::types::Shard).
    /// This method will fail if any of the following fields are not set:
    /// - [`shard_id`](crate::types::builders::ShardBuilder::shard_id)
    /// - [`create_time`](crate::types::builders::ShardBuilder::create_time)
    /// - [`status`](crate::types::builders::ShardBuilder::status)
    pub fn build(self) -> ::std::result::Result<crate::types::Shard, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Shard {
            shard_id: self.shard_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "shard_id",
                    "shard_id was not specified but it is required when building Shard",
                )
            })?,
            create_time: self.create_time.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "create_time",
                    "create_time was not specified but it is required when building Shard",
                )
            })?,
            status: self.status.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "status",
                    "status was not specified but it is required when building Shard",
                )
            })?,
        })
    }
}