aws_sdk_athena/types/
_database.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Database {
7 pub name: ::std::string::String,
9 pub description: ::std::option::Option<::std::string::String>,
11 pub parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
13}
14impl Database {
15 pub fn name(&self) -> &str {
17 use std::ops::Deref;
18 self.name.deref()
19 }
20 pub fn description(&self) -> ::std::option::Option<&str> {
22 self.description.as_deref()
23 }
24 pub fn parameters(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
26 self.parameters.as_ref()
27 }
28}
29impl Database {
30 pub fn builder() -> crate::types::builders::DatabaseBuilder {
32 crate::types::builders::DatabaseBuilder::default()
33 }
34}
35
36#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct DatabaseBuilder {
40 pub(crate) name: ::std::option::Option<::std::string::String>,
41 pub(crate) description: ::std::option::Option<::std::string::String>,
42 pub(crate) parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
43}
44impl DatabaseBuilder {
45 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
48 self.name = ::std::option::Option::Some(input.into());
49 self
50 }
51 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
53 self.name = input;
54 self
55 }
56 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
58 &self.name
59 }
60 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62 self.description = ::std::option::Option::Some(input.into());
63 self
64 }
65 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67 self.description = input;
68 self
69 }
70 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
72 &self.description
73 }
74 pub fn parameters(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
80 let mut hash_map = self.parameters.unwrap_or_default();
81 hash_map.insert(k.into(), v.into());
82 self.parameters = ::std::option::Option::Some(hash_map);
83 self
84 }
85 pub fn set_parameters(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
87 self.parameters = input;
88 self
89 }
90 pub fn get_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
92 &self.parameters
93 }
94 pub fn build(self) -> ::std::result::Result<crate::types::Database, ::aws_smithy_types::error::operation::BuildError> {
98 ::std::result::Result::Ok(crate::types::Database {
99 name: self.name.ok_or_else(|| {
100 ::aws_smithy_types::error::operation::BuildError::missing_field(
101 "name",
102 "name was not specified but it is required when building Database",
103 )
104 })?,
105 description: self.description,
106 parameters: self.parameters,
107 })
108 }
109}