aws_sdk_dynamodb/operation/create_global_table/
_create_global_table_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateGlobalTableInput {
6    /// <p>The global table name.</p>
7    pub global_table_name: ::std::option::Option<::std::string::String>,
8    /// <p>The Regions where the global table needs to be created.</p>
9    pub replication_group: ::std::option::Option<::std::vec::Vec<crate::types::Replica>>,
10}
11impl CreateGlobalTableInput {
12    /// <p>The global table name.</p>
13    pub fn global_table_name(&self) -> ::std::option::Option<&str> {
14        self.global_table_name.as_deref()
15    }
16    /// <p>The Regions where the global table needs to be created.</p>
17    ///
18    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.replication_group.is_none()`.
19    pub fn replication_group(&self) -> &[crate::types::Replica] {
20        self.replication_group.as_deref().unwrap_or_default()
21    }
22}
23impl CreateGlobalTableInput {
24    /// Creates a new builder-style object to manufacture [`CreateGlobalTableInput`](crate::operation::create_global_table::CreateGlobalTableInput).
25    pub fn builder() -> crate::operation::create_global_table::builders::CreateGlobalTableInputBuilder {
26        crate::operation::create_global_table::builders::CreateGlobalTableInputBuilder::default()
27    }
28}
29
30/// A builder for [`CreateGlobalTableInput`](crate::operation::create_global_table::CreateGlobalTableInput).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct CreateGlobalTableInputBuilder {
34    pub(crate) global_table_name: ::std::option::Option<::std::string::String>,
35    pub(crate) replication_group: ::std::option::Option<::std::vec::Vec<crate::types::Replica>>,
36}
37impl CreateGlobalTableInputBuilder {
38    /// <p>The global table name.</p>
39    /// This field is required.
40    pub fn global_table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.global_table_name = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>The global table name.</p>
45    pub fn set_global_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.global_table_name = input;
47        self
48    }
49    /// <p>The global table name.</p>
50    pub fn get_global_table_name(&self) -> &::std::option::Option<::std::string::String> {
51        &self.global_table_name
52    }
53    /// Appends an item to `replication_group`.
54    ///
55    /// To override the contents of this collection use [`set_replication_group`](Self::set_replication_group).
56    ///
57    /// <p>The Regions where the global table needs to be created.</p>
58    pub fn replication_group(mut self, input: crate::types::Replica) -> Self {
59        let mut v = self.replication_group.unwrap_or_default();
60        v.push(input);
61        self.replication_group = ::std::option::Option::Some(v);
62        self
63    }
64    /// <p>The Regions where the global table needs to be created.</p>
65    pub fn set_replication_group(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Replica>>) -> Self {
66        self.replication_group = input;
67        self
68    }
69    /// <p>The Regions where the global table needs to be created.</p>
70    pub fn get_replication_group(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Replica>> {
71        &self.replication_group
72    }
73    /// Consumes the builder and constructs a [`CreateGlobalTableInput`](crate::operation::create_global_table::CreateGlobalTableInput).
74    pub fn build(
75        self,
76    ) -> ::std::result::Result<crate::operation::create_global_table::CreateGlobalTableInput, ::aws_smithy_types::error::operation::BuildError> {
77        ::std::result::Result::Ok(crate::operation::create_global_table::CreateGlobalTableInput {
78            global_table_name: self.global_table_name,
79            replication_group: self.replication_group,
80        })
81    }
82}