aws_sdk_qbusiness/types/
_data_source_vpc_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Provides configuration information needed to connect to an Amazon VPC (Virtual Private Cloud).</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct DataSourceVpcConfiguration {
7    /// <p>A list of identifiers for subnets within your Amazon VPC. The subnets should be able to connect to each other in the VPC, and they should have outgoing access to the Internet through a NAT device.</p>
8    pub subnet_ids: ::std::vec::Vec<::std::string::String>,
9    /// <p>A list of identifiers of security groups within your Amazon VPC. The security groups should enable Amazon Q Business to connect to the data source.</p>
10    pub security_group_ids: ::std::vec::Vec<::std::string::String>,
11}
12impl DataSourceVpcConfiguration {
13    /// <p>A list of identifiers for subnets within your Amazon VPC. The subnets should be able to connect to each other in the VPC, and they should have outgoing access to the Internet through a NAT device.</p>
14    pub fn subnet_ids(&self) -> &[::std::string::String] {
15        use std::ops::Deref;
16        self.subnet_ids.deref()
17    }
18    /// <p>A list of identifiers of security groups within your Amazon VPC. The security groups should enable Amazon Q Business to connect to the data source.</p>
19    pub fn security_group_ids(&self) -> &[::std::string::String] {
20        use std::ops::Deref;
21        self.security_group_ids.deref()
22    }
23}
24impl DataSourceVpcConfiguration {
25    /// Creates a new builder-style object to manufacture [`DataSourceVpcConfiguration`](crate::types::DataSourceVpcConfiguration).
26    pub fn builder() -> crate::types::builders::DataSourceVpcConfigurationBuilder {
27        crate::types::builders::DataSourceVpcConfigurationBuilder::default()
28    }
29}
30
31/// A builder for [`DataSourceVpcConfiguration`](crate::types::DataSourceVpcConfiguration).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct DataSourceVpcConfigurationBuilder {
35    pub(crate) subnet_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
36    pub(crate) security_group_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
37}
38impl DataSourceVpcConfigurationBuilder {
39    /// Appends an item to `subnet_ids`.
40    ///
41    /// To override the contents of this collection use [`set_subnet_ids`](Self::set_subnet_ids).
42    ///
43    /// <p>A list of identifiers for subnets within your Amazon VPC. The subnets should be able to connect to each other in the VPC, and they should have outgoing access to the Internet through a NAT device.</p>
44    pub fn subnet_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
45        let mut v = self.subnet_ids.unwrap_or_default();
46        v.push(input.into());
47        self.subnet_ids = ::std::option::Option::Some(v);
48        self
49    }
50    /// <p>A list of identifiers for subnets within your Amazon VPC. The subnets should be able to connect to each other in the VPC, and they should have outgoing access to the Internet through a NAT device.</p>
51    pub fn set_subnet_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
52        self.subnet_ids = input;
53        self
54    }
55    /// <p>A list of identifiers for subnets within your Amazon VPC. The subnets should be able to connect to each other in the VPC, and they should have outgoing access to the Internet through a NAT device.</p>
56    pub fn get_subnet_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
57        &self.subnet_ids
58    }
59    /// Appends an item to `security_group_ids`.
60    ///
61    /// To override the contents of this collection use [`set_security_group_ids`](Self::set_security_group_ids).
62    ///
63    /// <p>A list of identifiers of security groups within your Amazon VPC. The security groups should enable Amazon Q Business to connect to the data source.</p>
64    pub fn security_group_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
65        let mut v = self.security_group_ids.unwrap_or_default();
66        v.push(input.into());
67        self.security_group_ids = ::std::option::Option::Some(v);
68        self
69    }
70    /// <p>A list of identifiers of security groups within your Amazon VPC. The security groups should enable Amazon Q Business to connect to the data source.</p>
71    pub fn set_security_group_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
72        self.security_group_ids = input;
73        self
74    }
75    /// <p>A list of identifiers of security groups within your Amazon VPC. The security groups should enable Amazon Q Business to connect to the data source.</p>
76    pub fn get_security_group_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
77        &self.security_group_ids
78    }
79    /// Consumes the builder and constructs a [`DataSourceVpcConfiguration`](crate::types::DataSourceVpcConfiguration).
80    /// This method will fail if any of the following fields are not set:
81    /// - [`subnet_ids`](crate::types::builders::DataSourceVpcConfigurationBuilder::subnet_ids)
82    /// - [`security_group_ids`](crate::types::builders::DataSourceVpcConfigurationBuilder::security_group_ids)
83    pub fn build(self) -> ::std::result::Result<crate::types::DataSourceVpcConfiguration, ::aws_smithy_types::error::operation::BuildError> {
84        ::std::result::Result::Ok(crate::types::DataSourceVpcConfiguration {
85            subnet_ids: self.subnet_ids.ok_or_else(|| {
86                ::aws_smithy_types::error::operation::BuildError::missing_field(
87                    "subnet_ids",
88                    "subnet_ids was not specified but it is required when building DataSourceVpcConfiguration",
89                )
90            })?,
91            security_group_ids: self.security_group_ids.ok_or_else(|| {
92                ::aws_smithy_types::error::operation::BuildError::missing_field(
93                    "security_group_ids",
94                    "security_group_ids was not specified but it is required when building DataSourceVpcConfiguration",
95                )
96            })?,
97        })
98    }
99}