Skip to main content

aws_sdk_machinelearning/types/
_redshift_database.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes the database details required to connect to an Amazon Redshift database.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct RedshiftDatabase {
7    /// <p>The name of a database hosted on an Amazon Redshift cluster.</p>
8    pub database_name: ::std::string::String,
9    /// <p>The ID of an Amazon Redshift cluster.</p>
10    pub cluster_identifier: ::std::string::String,
11}
12impl RedshiftDatabase {
13    /// <p>The name of a database hosted on an Amazon Redshift cluster.</p>
14    pub fn database_name(&self) -> &str {
15        use std::ops::Deref;
16        self.database_name.deref()
17    }
18    /// <p>The ID of an Amazon Redshift cluster.</p>
19    pub fn cluster_identifier(&self) -> &str {
20        use std::ops::Deref;
21        self.cluster_identifier.deref()
22    }
23}
24impl RedshiftDatabase {
25    /// Creates a new builder-style object to manufacture [`RedshiftDatabase`](crate::types::RedshiftDatabase).
26    pub fn builder() -> crate::types::builders::RedshiftDatabaseBuilder {
27        crate::types::builders::RedshiftDatabaseBuilder::default()
28    }
29}
30
31/// A builder for [`RedshiftDatabase`](crate::types::RedshiftDatabase).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct RedshiftDatabaseBuilder {
35    pub(crate) database_name: ::std::option::Option<::std::string::String>,
36    pub(crate) cluster_identifier: ::std::option::Option<::std::string::String>,
37}
38impl RedshiftDatabaseBuilder {
39    /// <p>The name of a database hosted on an Amazon Redshift cluster.</p>
40    /// This field is required.
41    pub fn database_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
42        self.database_name = ::std::option::Option::Some(input.into());
43        self
44    }
45    /// <p>The name of a database hosted on an Amazon Redshift cluster.</p>
46    pub fn set_database_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
47        self.database_name = input;
48        self
49    }
50    /// <p>The name of a database hosted on an Amazon Redshift cluster.</p>
51    pub fn get_database_name(&self) -> &::std::option::Option<::std::string::String> {
52        &self.database_name
53    }
54    /// <p>The ID of an Amazon Redshift cluster.</p>
55    /// This field is required.
56    pub fn cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
57        self.cluster_identifier = ::std::option::Option::Some(input.into());
58        self
59    }
60    /// <p>The ID of an Amazon Redshift cluster.</p>
61    pub fn set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
62        self.cluster_identifier = input;
63        self
64    }
65    /// <p>The ID of an Amazon Redshift cluster.</p>
66    pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
67        &self.cluster_identifier
68    }
69    /// Consumes the builder and constructs a [`RedshiftDatabase`](crate::types::RedshiftDatabase).
70    /// This method will fail if any of the following fields are not set:
71    /// - [`database_name`](crate::types::builders::RedshiftDatabaseBuilder::database_name)
72    /// - [`cluster_identifier`](crate::types::builders::RedshiftDatabaseBuilder::cluster_identifier)
73    pub fn build(self) -> ::std::result::Result<crate::types::RedshiftDatabase, ::aws_smithy_types::error::operation::BuildError> {
74        ::std::result::Result::Ok(crate::types::RedshiftDatabase {
75            database_name: self.database_name.ok_or_else(|| {
76                ::aws_smithy_types::error::operation::BuildError::missing_field(
77                    "database_name",
78                    "database_name was not specified but it is required when building RedshiftDatabase",
79                )
80            })?,
81            cluster_identifier: self.cluster_identifier.ok_or_else(|| {
82                ::aws_smithy_types::error::operation::BuildError::missing_field(
83                    "cluster_identifier",
84                    "cluster_identifier was not specified but it is required when building RedshiftDatabase",
85                )
86            })?,
87        })
88    }
89}