aws_sdk_dynamodb/operation/create_backup/
_create_backup_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 CreateBackupInput  {
6    /// <p>The name of the table. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
7    pub table_name: ::std::option::Option<::std::string::String>,
8    /// <p>Specified name for the backup.</p>
9    pub backup_name: ::std::option::Option<::std::string::String>,
10}
11impl  CreateBackupInput  {
12    /// <p>The name of the table. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
13    pub fn table_name(&self) -> ::std::option::Option<&str> {
14        self.table_name.as_deref()
15    }
16    /// <p>Specified name for the backup.</p>
17    pub fn backup_name(&self) -> ::std::option::Option<&str> {
18        self.backup_name.as_deref()
19    }
20}
21static CREATEBACKUPINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.dynamodb.synthetic#CreateBackupInput", "com.amazonaws.dynamodb.synthetic", "CreateBackupInput");
22static CREATEBACKUPINPUT_MEMBER_TABLE_NAME: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
23                            ::aws_smithy_schema::ShapeId::from_static(
24                                "com.amazonaws.dynamodb.synthetic#CreateBackupInput$TableName",
25                                "com.amazonaws.dynamodb.synthetic",
26                                "CreateBackupInput",
27                            ),
28                            ::aws_smithy_schema::ShapeType::String,
29                            "TableName",
30                            0,
31                        );
32static CREATEBACKUPINPUT_MEMBER_BACKUP_NAME: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
33                            ::aws_smithy_schema::ShapeId::from_static(
34                                "com.amazonaws.dynamodb.synthetic#CreateBackupInput$BackupName",
35                                "com.amazonaws.dynamodb.synthetic",
36                                "CreateBackupInput",
37                            ),
38                            ::aws_smithy_schema::ShapeType::String,
39                            "BackupName",
40                            1,
41                        );
42static CREATEBACKUPINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
43                            CREATEBACKUPINPUT_SCHEMA_ID,
44                            ::aws_smithy_schema::ShapeType::Structure,
45                            &[&CREATEBACKUPINPUT_MEMBER_TABLE_NAME, &CREATEBACKUPINPUT_MEMBER_BACKUP_NAME],
46                        );
47impl CreateBackupInput {
48                /// The schema for this shape.
49                pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &CREATEBACKUPINPUT_SCHEMA;
50            }
51impl ::aws_smithy_schema::serde::SerializableStruct for CreateBackupInput {
52                #[allow(unused_variables, clippy::diverging_sub_expression)]
53                fn serialize_members(&self, ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
54                    if let Some(ref val) = self.table_name {
55                                ser.write_string(&CREATEBACKUPINPUT_MEMBER_TABLE_NAME, val)?;
56                            }
57if let Some(ref val) = self.backup_name {
58                                ser.write_string(&CREATEBACKUPINPUT_MEMBER_BACKUP_NAME, val)?;
59                            }
60                    Ok(())
61                }
62            }
63impl CreateBackupInput {
64                /// Deserializes this structure from a [`ShapeDeserializer`].
65                pub fn deserialize(deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
66                    #[allow(unused_variables, unused_mut)]
67                    let mut builder = Self::builder();
68                    #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
69                    deserializer.read_struct(&CREATEBACKUPINPUT_SCHEMA, &mut |member, deser| {
70                        match member.member_index() {
71                            Some(0) => {
72                                    builder.table_name = Some(deser.read_string(member)?);
73                                }
74Some(1) => {
75                                    builder.backup_name = Some(deser.read_string(member)?);
76                                }
77                            _ => {}
78                        }
79                        Ok(())
80                    })?;
81                    builder.table_name = builder.table_name.or(Some(String::new()));
82builder.backup_name = builder.backup_name.or(Some(String::new()));
83builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
84                }
85            }
86impl CreateBackupInput {
87                        /// Deserializes this structure from a body deserializer and HTTP response.
88                        pub fn deserialize_with_response(
89                            deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
90                            _headers: &::aws_smithy_runtime_api::http::Headers,
91                            _status: u16,
92                            _body: &[u8],
93                        ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
94                            Self::deserialize(deserializer)
95                        }
96                    }
97impl CreateBackupInput {
98    /// Creates a new builder-style object to manufacture [`CreateBackupInput`](crate::operation::create_backup::CreateBackupInput).
99    pub fn builder() -> crate::operation::create_backup::builders::CreateBackupInputBuilder {
100        crate::operation::create_backup::builders::CreateBackupInputBuilder::default()
101    }
102}
103
104/// A builder for [`CreateBackupInput`](crate::operation::create_backup::CreateBackupInput).
105#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
106#[non_exhaustive]
107pub struct CreateBackupInputBuilder {
108    pub(crate) table_name: ::std::option::Option<::std::string::String>,
109    pub(crate) backup_name: ::std::option::Option<::std::string::String>,
110}
111impl CreateBackupInputBuilder {
112    /// <p>The name of the table. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
113    /// This field is required.
114    pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.table_name = ::std::option::Option::Some(input.into());
116        self
117    }
118    /// <p>The name of the table. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
119    pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.table_name = input; self
121    }
122    /// <p>The name of the table. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
123    pub fn get_table_name(&self) -> &::std::option::Option<::std::string::String> {
124        &self.table_name
125    }
126    /// <p>Specified name for the backup.</p>
127    /// This field is required.
128    pub fn backup_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.backup_name = ::std::option::Option::Some(input.into());
130        self
131    }
132    /// <p>Specified name for the backup.</p>
133    pub fn set_backup_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.backup_name = input; self
135    }
136    /// <p>Specified name for the backup.</p>
137    pub fn get_backup_name(&self) -> &::std::option::Option<::std::string::String> {
138        &self.backup_name
139    }
140    /// Consumes the builder and constructs a [`CreateBackupInput`](crate::operation::create_backup::CreateBackupInput).
141    pub fn build(self) -> ::std::result::Result<crate::operation::create_backup::CreateBackupInput, ::aws_smithy_types::error::operation::BuildError> {
142        ::std::result::Result::Ok(
143            crate::operation::create_backup::CreateBackupInput {
144                table_name: self.table_name
145                ,
146                backup_name: self.backup_name
147                ,
148            }
149        )
150    }
151}
152