aws_sdk_ec2/operation/create_vpc_peering_connection/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_vpc_peering_connection::_create_vpc_peering_connection_output::CreateVpcPeeringConnectionOutputBuilder;
3
4pub use crate::operation::create_vpc_peering_connection::_create_vpc_peering_connection_input::CreateVpcPeeringConnectionInputBuilder;
5
6impl crate::operation::create_vpc_peering_connection::builders::CreateVpcPeeringConnectionInputBuilder {
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_vpc_peering_connection::CreateVpcPeeringConnectionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_vpc_peering_connection::CreateVpcPeeringConnectionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_vpc_peering_connection();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateVpcPeeringConnection`.
24///
25/// <p>Requests a VPC peering connection between two VPCs: a requester VPC that you own and an accepter VPC with which to create the connection. The accepter VPC can belong to another Amazon Web Services account and can be in a different Region to the requester VPC. The requester VPC and accepter VPC cannot have overlapping CIDR blocks.</p><note>
26/// <p>Limitations and rules apply to a VPC peering connection. For more information, see the <a href="https://docs.aws.amazon.com/vpc/latest/peering/vpc-peering-basics.html#vpc-peering-limitations">VPC peering limitations</a> in the <i>VPC Peering Guide</i>.</p>
27/// </note>
28/// <p>The owner of the accepter VPC must accept the peering request to activate the peering connection. The VPC peering connection request expires after 7 days, after which it cannot be accepted or rejected.</p>
29/// <p>If you create a VPC peering connection request between VPCs with overlapping CIDR blocks, the VPC peering connection has a status of <code>failed</code>.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct CreateVpcPeeringConnectionFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::create_vpc_peering_connection::builders::CreateVpcPeeringConnectionInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::create_vpc_peering_connection::CreateVpcPeeringConnectionOutput,
39        crate::operation::create_vpc_peering_connection::CreateVpcPeeringConnectionError,
40    > for CreateVpcPeeringConnectionFluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<
47            crate::operation::create_vpc_peering_connection::CreateVpcPeeringConnectionOutput,
48            crate::operation::create_vpc_peering_connection::CreateVpcPeeringConnectionError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl CreateVpcPeeringConnectionFluentBuilder {
55    /// Creates a new `CreateVpcPeeringConnectionFluentBuilder`.
56    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57        Self {
58            handle,
59            inner: ::std::default::Default::default(),
60            config_override: ::std::option::Option::None,
61        }
62    }
63    /// Access the CreateVpcPeeringConnection as a reference.
64    pub fn as_input(&self) -> &crate::operation::create_vpc_peering_connection::builders::CreateVpcPeeringConnectionInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::create_vpc_peering_connection::CreateVpcPeeringConnectionOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::create_vpc_peering_connection::CreateVpcPeeringConnectionError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins = crate::operation::create_vpc_peering_connection::CreateVpcPeeringConnection::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::create_vpc_peering_connection::CreateVpcPeeringConnection::orchestrate(&runtime_plugins, input).await
94    }
95
96    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97    pub fn customize(
98        self,
99    ) -> crate::client::customize::CustomizableOperation<
100        crate::operation::create_vpc_peering_connection::CreateVpcPeeringConnectionOutput,
101        crate::operation::create_vpc_peering_connection::CreateVpcPeeringConnectionError,
102        Self,
103    > {
104        crate::client::customize::CustomizableOperation::new(self)
105    }
106    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107        self.set_config_override(::std::option::Option::Some(config_override.into()));
108        self
109    }
110
111    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112        self.config_override = config_override;
113        self
114    }
115    /// <p>The Region code for the accepter VPC, if the accepter VPC is located in a Region other than the Region in which you make the request.</p>
116    /// <p>Default: The Region in which you make the request.</p>
117    pub fn peer_region(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.peer_region(input.into());
119        self
120    }
121    /// <p>The Region code for the accepter VPC, if the accepter VPC is located in a Region other than the Region in which you make the request.</p>
122    /// <p>Default: The Region in which you make the request.</p>
123    pub fn set_peer_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124        self.inner = self.inner.set_peer_region(input);
125        self
126    }
127    /// <p>The Region code for the accepter VPC, if the accepter VPC is located in a Region other than the Region in which you make the request.</p>
128    /// <p>Default: The Region in which you make the request.</p>
129    pub fn get_peer_region(&self) -> &::std::option::Option<::std::string::String> {
130        self.inner.get_peer_region()
131    }
132    ///
133    /// Appends an item to `TagSpecifications`.
134    ///
135    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
136    ///
137    /// <p>The tags to assign to the peering connection.</p>
138    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
139        self.inner = self.inner.tag_specifications(input);
140        self
141    }
142    /// <p>The tags to assign to the peering connection.</p>
143    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
144        self.inner = self.inner.set_tag_specifications(input);
145        self
146    }
147    /// <p>The tags to assign to the peering connection.</p>
148    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
149        self.inner.get_tag_specifications()
150    }
151    /// <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>
152    pub fn dry_run(mut self, input: bool) -> Self {
153        self.inner = self.inner.dry_run(input);
154        self
155    }
156    /// <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>
157    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
158        self.inner = self.inner.set_dry_run(input);
159        self
160    }
161    /// <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>
162    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
163        self.inner.get_dry_run()
164    }
165    /// <p>The ID of the requester VPC. You must specify this parameter in the request.</p>
166    pub fn vpc_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167        self.inner = self.inner.vpc_id(input.into());
168        self
169    }
170    /// <p>The ID of the requester VPC. You must specify this parameter in the request.</p>
171    pub fn set_vpc_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
172        self.inner = self.inner.set_vpc_id(input);
173        self
174    }
175    /// <p>The ID of the requester VPC. You must specify this parameter in the request.</p>
176    pub fn get_vpc_id(&self) -> &::std::option::Option<::std::string::String> {
177        self.inner.get_vpc_id()
178    }
179    /// <p>The ID of the VPC with which you are creating the VPC peering connection. You must specify this parameter in the request.</p>
180    pub fn peer_vpc_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181        self.inner = self.inner.peer_vpc_id(input.into());
182        self
183    }
184    /// <p>The ID of the VPC with which you are creating the VPC peering connection. You must specify this parameter in the request.</p>
185    pub fn set_peer_vpc_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
186        self.inner = self.inner.set_peer_vpc_id(input);
187        self
188    }
189    /// <p>The ID of the VPC with which you are creating the VPC peering connection. You must specify this parameter in the request.</p>
190    pub fn get_peer_vpc_id(&self) -> &::std::option::Option<::std::string::String> {
191        self.inner.get_peer_vpc_id()
192    }
193    /// <p>The Amazon Web Services account ID of the owner of the accepter VPC.</p>
194    /// <p>Default: Your Amazon Web Services account ID</p>
195    pub fn peer_owner_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
196        self.inner = self.inner.peer_owner_id(input.into());
197        self
198    }
199    /// <p>The Amazon Web Services account ID of the owner of the accepter VPC.</p>
200    /// <p>Default: Your Amazon Web Services account ID</p>
201    pub fn set_peer_owner_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
202        self.inner = self.inner.set_peer_owner_id(input);
203        self
204    }
205    /// <p>The Amazon Web Services account ID of the owner of the accepter VPC.</p>
206    /// <p>Default: Your Amazon Web Services account ID</p>
207    pub fn get_peer_owner_id(&self) -> &::std::option::Option<::std::string::String> {
208        self.inner.get_peer_owner_id()
209    }
210}