aws_sdk_glue/types/
_my_sql_catalog_target.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Specifies a target that uses MySQL.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct MySqlCatalogTarget {
7    /// <p>The name of the data target.</p>
8    pub name: ::std::string::String,
9    /// <p>The nodes that are inputs to the data target.</p>
10    pub inputs: ::std::vec::Vec<::std::string::String>,
11    /// <p>The name of the database to write to.</p>
12    pub database: ::std::string::String,
13    /// <p>The name of the table in the database to write to.</p>
14    pub table: ::std::string::String,
15}
16impl MySqlCatalogTarget {
17    /// <p>The name of the data target.</p>
18    pub fn name(&self) -> &str {
19        use std::ops::Deref;
20        self.name.deref()
21    }
22    /// <p>The nodes that are inputs to the data target.</p>
23    pub fn inputs(&self) -> &[::std::string::String] {
24        use std::ops::Deref;
25        self.inputs.deref()
26    }
27    /// <p>The name of the database to write to.</p>
28    pub fn database(&self) -> &str {
29        use std::ops::Deref;
30        self.database.deref()
31    }
32    /// <p>The name of the table in the database to write to.</p>
33    pub fn table(&self) -> &str {
34        use std::ops::Deref;
35        self.table.deref()
36    }
37}
38impl MySqlCatalogTarget {
39    /// Creates a new builder-style object to manufacture [`MySqlCatalogTarget`](crate::types::MySqlCatalogTarget).
40    pub fn builder() -> crate::types::builders::MySqlCatalogTargetBuilder {
41        crate::types::builders::MySqlCatalogTargetBuilder::default()
42    }
43}
44
45/// A builder for [`MySqlCatalogTarget`](crate::types::MySqlCatalogTarget).
46#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
47#[non_exhaustive]
48pub struct MySqlCatalogTargetBuilder {
49    pub(crate) name: ::std::option::Option<::std::string::String>,
50    pub(crate) inputs: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
51    pub(crate) database: ::std::option::Option<::std::string::String>,
52    pub(crate) table: ::std::option::Option<::std::string::String>,
53}
54impl MySqlCatalogTargetBuilder {
55    /// <p>The name of the data target.</p>
56    /// This field is required.
57    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
58        self.name = ::std::option::Option::Some(input.into());
59        self
60    }
61    /// <p>The name of the data target.</p>
62    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
63        self.name = input;
64        self
65    }
66    /// <p>The name of the data target.</p>
67    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
68        &self.name
69    }
70    /// Appends an item to `inputs`.
71    ///
72    /// To override the contents of this collection use [`set_inputs`](Self::set_inputs).
73    ///
74    /// <p>The nodes that are inputs to the data target.</p>
75    pub fn inputs(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        let mut v = self.inputs.unwrap_or_default();
77        v.push(input.into());
78        self.inputs = ::std::option::Option::Some(v);
79        self
80    }
81    /// <p>The nodes that are inputs to the data target.</p>
82    pub fn set_inputs(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
83        self.inputs = input;
84        self
85    }
86    /// <p>The nodes that are inputs to the data target.</p>
87    pub fn get_inputs(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
88        &self.inputs
89    }
90    /// <p>The name of the database to write to.</p>
91    /// This field is required.
92    pub fn database(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
93        self.database = ::std::option::Option::Some(input.into());
94        self
95    }
96    /// <p>The name of the database to write to.</p>
97    pub fn set_database(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
98        self.database = input;
99        self
100    }
101    /// <p>The name of the database to write to.</p>
102    pub fn get_database(&self) -> &::std::option::Option<::std::string::String> {
103        &self.database
104    }
105    /// <p>The name of the table in the database to write to.</p>
106    /// This field is required.
107    pub fn table(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
108        self.table = ::std::option::Option::Some(input.into());
109        self
110    }
111    /// <p>The name of the table in the database to write to.</p>
112    pub fn set_table(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
113        self.table = input;
114        self
115    }
116    /// <p>The name of the table in the database to write to.</p>
117    pub fn get_table(&self) -> &::std::option::Option<::std::string::String> {
118        &self.table
119    }
120    /// Consumes the builder and constructs a [`MySqlCatalogTarget`](crate::types::MySqlCatalogTarget).
121    /// This method will fail if any of the following fields are not set:
122    /// - [`name`](crate::types::builders::MySqlCatalogTargetBuilder::name)
123    /// - [`inputs`](crate::types::builders::MySqlCatalogTargetBuilder::inputs)
124    /// - [`database`](crate::types::builders::MySqlCatalogTargetBuilder::database)
125    /// - [`table`](crate::types::builders::MySqlCatalogTargetBuilder::table)
126    pub fn build(self) -> ::std::result::Result<crate::types::MySqlCatalogTarget, ::aws_smithy_types::error::operation::BuildError> {
127        ::std::result::Result::Ok(crate::types::MySqlCatalogTarget {
128            name: self.name.ok_or_else(|| {
129                ::aws_smithy_types::error::operation::BuildError::missing_field(
130                    "name",
131                    "name was not specified but it is required when building MySqlCatalogTarget",
132                )
133            })?,
134            inputs: self.inputs.ok_or_else(|| {
135                ::aws_smithy_types::error::operation::BuildError::missing_field(
136                    "inputs",
137                    "inputs was not specified but it is required when building MySqlCatalogTarget",
138                )
139            })?,
140            database: self.database.ok_or_else(|| {
141                ::aws_smithy_types::error::operation::BuildError::missing_field(
142                    "database",
143                    "database was not specified but it is required when building MySqlCatalogTarget",
144                )
145            })?,
146            table: self.table.ok_or_else(|| {
147                ::aws_smithy_types::error::operation::BuildError::missing_field(
148                    "table",
149                    "table was not specified but it is required when building MySqlCatalogTarget",
150                )
151            })?,
152        })
153    }
154}