aws_sdk_ec2/operation/create_vpn_connection/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_vpn_connection::_create_vpn_connection_output::CreateVpnConnectionOutputBuilder;
3
4pub use crate::operation::create_vpn_connection::_create_vpn_connection_input::CreateVpnConnectionInputBuilder;
5
6impl crate::operation::create_vpn_connection::builders::CreateVpnConnectionInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::create_vpn_connection::CreateVpnConnectionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_vpn_connection::CreateVpnConnectionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_vpn_connection();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateVpnConnection`.
24///
25/// <p>Creates a VPN connection between an existing virtual private gateway or transit gateway and a customer gateway. The supported connection type is <code>ipsec.1</code>.</p>
26/// <p>The response includes information that you need to give to your network administrator to configure your customer gateway.</p><important>
27/// <p>We strongly recommend that you use HTTPS when calling this operation because the response contains sensitive cryptographic information for configuring your customer gateway device.</p>
28/// </important>
29/// <p>If you decide to shut down your VPN connection for any reason and later create a new VPN connection, you must reconfigure your customer gateway with the new information returned from this call.</p>
30/// <p>This is an idempotent operation. If you perform the operation more than once, Amazon EC2 doesn't return an error.</p>
31/// <p>For more information, see <a href="https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html">Amazon Web Services Site-to-Site VPN</a> in the <i>Amazon Web Services Site-to-Site VPN User Guide</i>.</p>
32#[derive(::std::clone::Clone, ::std::fmt::Debug)]
33pub struct CreateVpnConnectionFluentBuilder {
34    handle: ::std::sync::Arc<crate::client::Handle>,
35    inner: crate::operation::create_vpn_connection::builders::CreateVpnConnectionInputBuilder,
36    config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39    crate::client::customize::internal::CustomizableSend<
40        crate::operation::create_vpn_connection::CreateVpnConnectionOutput,
41        crate::operation::create_vpn_connection::CreateVpnConnectionError,
42    > for CreateVpnConnectionFluentBuilder
43{
44    fn send(
45        self,
46        config_override: crate::config::Builder,
47    ) -> crate::client::customize::internal::BoxFuture<
48        crate::client::customize::internal::SendResult<
49            crate::operation::create_vpn_connection::CreateVpnConnectionOutput,
50            crate::operation::create_vpn_connection::CreateVpnConnectionError,
51        >,
52    > {
53        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54    }
55}
56impl CreateVpnConnectionFluentBuilder {
57    /// Creates a new `CreateVpnConnectionFluentBuilder`.
58    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59        Self {
60            handle,
61            inner: ::std::default::Default::default(),
62            config_override: ::std::option::Option::None,
63        }
64    }
65    /// Access the CreateVpnConnection as a reference.
66    pub fn as_input(&self) -> &crate::operation::create_vpn_connection::builders::CreateVpnConnectionInputBuilder {
67        &self.inner
68    }
69    /// Sends the request and returns the response.
70    ///
71    /// If an error occurs, an `SdkError` will be returned with additional details that
72    /// can be matched against.
73    ///
74    /// By default, any retryable failures will be retried twice. Retry behavior
75    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
76    /// set when configuring the client.
77    pub async fn send(
78        self,
79    ) -> ::std::result::Result<
80        crate::operation::create_vpn_connection::CreateVpnConnectionOutput,
81        ::aws_smithy_runtime_api::client::result::SdkError<
82            crate::operation::create_vpn_connection::CreateVpnConnectionError,
83            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
84        >,
85    > {
86        let input = self
87            .inner
88            .build()
89            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
90        let runtime_plugins = crate::operation::create_vpn_connection::CreateVpnConnection::operation_runtime_plugins(
91            self.handle.runtime_plugins.clone(),
92            &self.handle.conf,
93            self.config_override,
94        );
95        crate::operation::create_vpn_connection::CreateVpnConnection::orchestrate(&runtime_plugins, input).await
96    }
97
98    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
99    pub fn customize(
100        self,
101    ) -> crate::client::customize::CustomizableOperation<
102        crate::operation::create_vpn_connection::CreateVpnConnectionOutput,
103        crate::operation::create_vpn_connection::CreateVpnConnectionError,
104        Self,
105    > {
106        crate::client::customize::CustomizableOperation::new(self)
107    }
108    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
109        self.set_config_override(::std::option::Option::Some(config_override.into()));
110        self
111    }
112
113    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
114        self.config_override = config_override;
115        self
116    }
117    /// <p>The ID of the customer gateway.</p>
118    pub fn customer_gateway_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.inner = self.inner.customer_gateway_id(input.into());
120        self
121    }
122    /// <p>The ID of the customer gateway.</p>
123    pub fn set_customer_gateway_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124        self.inner = self.inner.set_customer_gateway_id(input);
125        self
126    }
127    /// <p>The ID of the customer gateway.</p>
128    pub fn get_customer_gateway_id(&self) -> &::std::option::Option<::std::string::String> {
129        self.inner.get_customer_gateway_id()
130    }
131    /// <p>The type of VPN connection (<code>ipsec.1</code>).</p>
132    pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133        self.inner = self.inner.r#type(input.into());
134        self
135    }
136    /// <p>The type of VPN connection (<code>ipsec.1</code>).</p>
137    pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.inner = self.inner.set_type(input);
139        self
140    }
141    /// <p>The type of VPN connection (<code>ipsec.1</code>).</p>
142    pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_type()
144    }
145    /// <p>The ID of the virtual private gateway. If you specify a virtual private gateway, you cannot specify a transit gateway.</p>
146    pub fn vpn_gateway_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.vpn_gateway_id(input.into());
148        self
149    }
150    /// <p>The ID of the virtual private gateway. If you specify a virtual private gateway, you cannot specify a transit gateway.</p>
151    pub fn set_vpn_gateway_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_vpn_gateway_id(input);
153        self
154    }
155    /// <p>The ID of the virtual private gateway. If you specify a virtual private gateway, you cannot specify a transit gateway.</p>
156    pub fn get_vpn_gateway_id(&self) -> &::std::option::Option<::std::string::String> {
157        self.inner.get_vpn_gateway_id()
158    }
159    /// <p>The ID of the transit gateway. If you specify a transit gateway, you cannot specify a virtual private gateway.</p>
160    pub fn transit_gateway_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.inner = self.inner.transit_gateway_id(input.into());
162        self
163    }
164    /// <p>The ID of the transit gateway. If you specify a transit gateway, you cannot specify a virtual private gateway.</p>
165    pub fn set_transit_gateway_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.inner = self.inner.set_transit_gateway_id(input);
167        self
168    }
169    /// <p>The ID of the transit gateway. If you specify a transit gateway, you cannot specify a virtual private gateway.</p>
170    pub fn get_transit_gateway_id(&self) -> &::std::option::Option<::std::string::String> {
171        self.inner.get_transit_gateway_id()
172    }
173    ///
174    /// Appends an item to `TagSpecifications`.
175    ///
176    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
177    ///
178    /// <p>The tags to apply to the VPN connection.</p>
179    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
180        self.inner = self.inner.tag_specifications(input);
181        self
182    }
183    /// <p>The tags to apply to the VPN connection.</p>
184    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
185        self.inner = self.inner.set_tag_specifications(input);
186        self
187    }
188    /// <p>The tags to apply to the VPN connection.</p>
189    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
190        self.inner.get_tag_specifications()
191    }
192    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
193    pub fn dry_run(mut self, input: bool) -> Self {
194        self.inner = self.inner.dry_run(input);
195        self
196    }
197    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
198    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
199        self.inner = self.inner.set_dry_run(input);
200        self
201    }
202    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
203    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
204        self.inner.get_dry_run()
205    }
206    /// <p>The options for the VPN connection.</p>
207    pub fn options(mut self, input: crate::types::VpnConnectionOptionsSpecification) -> Self {
208        self.inner = self.inner.options(input);
209        self
210    }
211    /// <p>The options for the VPN connection.</p>
212    pub fn set_options(mut self, input: ::std::option::Option<crate::types::VpnConnectionOptionsSpecification>) -> Self {
213        self.inner = self.inner.set_options(input);
214        self
215    }
216    /// <p>The options for the VPN connection.</p>
217    pub fn get_options(&self) -> &::std::option::Option<crate::types::VpnConnectionOptionsSpecification> {
218        self.inner.get_options()
219    }
220}