aws_sdk_elasticloadbalancingv2/operation/create_load_balancer/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_load_balancer::_create_load_balancer_output::CreateLoadBalancerOutputBuilder;
3
4pub use crate::operation::create_load_balancer::_create_load_balancer_input::CreateLoadBalancerInputBuilder;
5
6impl crate::operation::create_load_balancer::builders::CreateLoadBalancerInputBuilder {
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_load_balancer::CreateLoadBalancerOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_load_balancer::CreateLoadBalancerError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_load_balancer();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateLoadBalancer`.
24///
25/// <p>Creates an Application Load Balancer, Network Load Balancer, or Gateway Load Balancer.</p>
26/// <p>For more information, see the following:</p>
27/// <ul>
28/// <li>
29/// <p><a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html">Application Load Balancers</a></p></li>
30/// <li>
31/// <p><a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html">Network Load Balancers</a></p></li>
32/// <li>
33/// <p><a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/gateway-load-balancers.html">Gateway Load Balancers</a></p></li>
34/// </ul>
35/// <p>This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple load balancers with the same settings, each call succeeds.</p>
36#[derive(::std::clone::Clone, ::std::fmt::Debug)]
37pub struct CreateLoadBalancerFluentBuilder {
38    handle: ::std::sync::Arc<crate::client::Handle>,
39    inner: crate::operation::create_load_balancer::builders::CreateLoadBalancerInputBuilder,
40    config_override: ::std::option::Option<crate::config::Builder>,
41}
42impl
43    crate::client::customize::internal::CustomizableSend<
44        crate::operation::create_load_balancer::CreateLoadBalancerOutput,
45        crate::operation::create_load_balancer::CreateLoadBalancerError,
46    > for CreateLoadBalancerFluentBuilder
47{
48    fn send(
49        self,
50        config_override: crate::config::Builder,
51    ) -> crate::client::customize::internal::BoxFuture<
52        crate::client::customize::internal::SendResult<
53            crate::operation::create_load_balancer::CreateLoadBalancerOutput,
54            crate::operation::create_load_balancer::CreateLoadBalancerError,
55        >,
56    > {
57        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
58    }
59}
60impl CreateLoadBalancerFluentBuilder {
61    /// Creates a new `CreateLoadBalancerFluentBuilder`.
62    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
63        Self {
64            handle,
65            inner: ::std::default::Default::default(),
66            config_override: ::std::option::Option::None,
67        }
68    }
69    /// Access the CreateLoadBalancer as a reference.
70    pub fn as_input(&self) -> &crate::operation::create_load_balancer::builders::CreateLoadBalancerInputBuilder {
71        &self.inner
72    }
73    /// Sends the request and returns the response.
74    ///
75    /// If an error occurs, an `SdkError` will be returned with additional details that
76    /// can be matched against.
77    ///
78    /// By default, any retryable failures will be retried twice. Retry behavior
79    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
80    /// set when configuring the client.
81    pub async fn send(
82        self,
83    ) -> ::std::result::Result<
84        crate::operation::create_load_balancer::CreateLoadBalancerOutput,
85        ::aws_smithy_runtime_api::client::result::SdkError<
86            crate::operation::create_load_balancer::CreateLoadBalancerError,
87            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
88        >,
89    > {
90        let input = self
91            .inner
92            .build()
93            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
94        let runtime_plugins = crate::operation::create_load_balancer::CreateLoadBalancer::operation_runtime_plugins(
95            self.handle.runtime_plugins.clone(),
96            &self.handle.conf,
97            self.config_override,
98        );
99        crate::operation::create_load_balancer::CreateLoadBalancer::orchestrate(&runtime_plugins, input).await
100    }
101
102    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
103    pub fn customize(
104        self,
105    ) -> crate::client::customize::CustomizableOperation<
106        crate::operation::create_load_balancer::CreateLoadBalancerOutput,
107        crate::operation::create_load_balancer::CreateLoadBalancerError,
108        Self,
109    > {
110        crate::client::customize::CustomizableOperation::new(self)
111    }
112    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
113        self.set_config_override(::std::option::Option::Some(config_override.into()));
114        self
115    }
116
117    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
118        self.config_override = config_override;
119        self
120    }
121    /// <p>The name of the load balancer.</p>
122    /// <p>This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, must not begin or end with a hyphen, and must not begin with "internal-".</p>
123    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124        self.inner = self.inner.name(input.into());
125        self
126    }
127    /// <p>The name of the load balancer.</p>
128    /// <p>This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, must not begin or end with a hyphen, and must not begin with "internal-".</p>
129    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.inner = self.inner.set_name(input);
131        self
132    }
133    /// <p>The name of the load balancer.</p>
134    /// <p>This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, must not begin or end with a hyphen, and must not begin with "internal-".</p>
135    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
136        self.inner.get_name()
137    }
138    ///
139    /// Appends an item to `Subnets`.
140    ///
141    /// To override the contents of this collection use [`set_subnets`](Self::set_subnets).
142    ///
143    /// <p>The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both. To specify an Elastic IP address, specify subnet mappings instead of subnets.</p>
144    /// <p>\[Application Load Balancers\] You must specify subnets from at least two Availability Zones.</p>
145    /// <p>\[Application Load Balancers on Outposts\] You must specify one Outpost subnet.</p>
146    /// <p>\[Application Load Balancers on Local Zones\] You can specify subnets from one or more Local Zones.</p>
147    /// <p>\[Network Load Balancers and Gateway Load Balancers\] You can specify subnets from one or more Availability Zones.</p>
148    pub fn subnets(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149        self.inner = self.inner.subnets(input.into());
150        self
151    }
152    /// <p>The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both. To specify an Elastic IP address, specify subnet mappings instead of subnets.</p>
153    /// <p>\[Application Load Balancers\] You must specify subnets from at least two Availability Zones.</p>
154    /// <p>\[Application Load Balancers on Outposts\] You must specify one Outpost subnet.</p>
155    /// <p>\[Application Load Balancers on Local Zones\] You can specify subnets from one or more Local Zones.</p>
156    /// <p>\[Network Load Balancers and Gateway Load Balancers\] You can specify subnets from one or more Availability Zones.</p>
157    pub fn set_subnets(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
158        self.inner = self.inner.set_subnets(input);
159        self
160    }
161    /// <p>The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both. To specify an Elastic IP address, specify subnet mappings instead of subnets.</p>
162    /// <p>\[Application Load Balancers\] You must specify subnets from at least two Availability Zones.</p>
163    /// <p>\[Application Load Balancers on Outposts\] You must specify one Outpost subnet.</p>
164    /// <p>\[Application Load Balancers on Local Zones\] You can specify subnets from one or more Local Zones.</p>
165    /// <p>\[Network Load Balancers and Gateway Load Balancers\] You can specify subnets from one or more Availability Zones.</p>
166    pub fn get_subnets(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
167        self.inner.get_subnets()
168    }
169    ///
170    /// Appends an item to `SubnetMappings`.
171    ///
172    /// To override the contents of this collection use [`set_subnet_mappings`](Self::set_subnet_mappings).
173    ///
174    /// <p>The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both.</p>
175    /// <p>\[Application Load Balancers\] You must specify subnets from at least two Availability Zones. You can't specify Elastic IP addresses for your subnets.</p>
176    /// <p>\[Application Load Balancers on Outposts\] You must specify one Outpost subnet.</p>
177    /// <p>\[Application Load Balancers on Local Zones\] You can specify subnets from one or more Local Zones.</p>
178    /// <p>\[Network Load Balancers\] You can specify subnets from one or more Availability Zones. You can specify one Elastic IP address per subnet if you need static IP addresses for your internet-facing load balancer. For internal load balancers, you can specify one private IP address per subnet from the IPv4 range of the subnet. For internet-facing load balancer, you can specify one IPv6 address per subnet.</p>
179    /// <p>\[Gateway Load Balancers\] You can specify subnets from one or more Availability Zones. You can't specify Elastic IP addresses for your subnets.</p>
180    pub fn subnet_mappings(mut self, input: crate::types::SubnetMapping) -> Self {
181        self.inner = self.inner.subnet_mappings(input);
182        self
183    }
184    /// <p>The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both.</p>
185    /// <p>\[Application Load Balancers\] You must specify subnets from at least two Availability Zones. You can't specify Elastic IP addresses for your subnets.</p>
186    /// <p>\[Application Load Balancers on Outposts\] You must specify one Outpost subnet.</p>
187    /// <p>\[Application Load Balancers on Local Zones\] You can specify subnets from one or more Local Zones.</p>
188    /// <p>\[Network Load Balancers\] You can specify subnets from one or more Availability Zones. You can specify one Elastic IP address per subnet if you need static IP addresses for your internet-facing load balancer. For internal load balancers, you can specify one private IP address per subnet from the IPv4 range of the subnet. For internet-facing load balancer, you can specify one IPv6 address per subnet.</p>
189    /// <p>\[Gateway Load Balancers\] You can specify subnets from one or more Availability Zones. You can't specify Elastic IP addresses for your subnets.</p>
190    pub fn set_subnet_mappings(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SubnetMapping>>) -> Self {
191        self.inner = self.inner.set_subnet_mappings(input);
192        self
193    }
194    /// <p>The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both.</p>
195    /// <p>\[Application Load Balancers\] You must specify subnets from at least two Availability Zones. You can't specify Elastic IP addresses for your subnets.</p>
196    /// <p>\[Application Load Balancers on Outposts\] You must specify one Outpost subnet.</p>
197    /// <p>\[Application Load Balancers on Local Zones\] You can specify subnets from one or more Local Zones.</p>
198    /// <p>\[Network Load Balancers\] You can specify subnets from one or more Availability Zones. You can specify one Elastic IP address per subnet if you need static IP addresses for your internet-facing load balancer. For internal load balancers, you can specify one private IP address per subnet from the IPv4 range of the subnet. For internet-facing load balancer, you can specify one IPv6 address per subnet.</p>
199    /// <p>\[Gateway Load Balancers\] You can specify subnets from one or more Availability Zones. You can't specify Elastic IP addresses for your subnets.</p>
200    pub fn get_subnet_mappings(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SubnetMapping>> {
201        self.inner.get_subnet_mappings()
202    }
203    ///
204    /// Appends an item to `SecurityGroups`.
205    ///
206    /// To override the contents of this collection use [`set_security_groups`](Self::set_security_groups).
207    ///
208    /// <p>\[Application Load Balancers and Network Load Balancers\] The IDs of the security groups for the load balancer.</p>
209    pub fn security_groups(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
210        self.inner = self.inner.security_groups(input.into());
211        self
212    }
213    /// <p>\[Application Load Balancers and Network Load Balancers\] The IDs of the security groups for the load balancer.</p>
214    pub fn set_security_groups(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
215        self.inner = self.inner.set_security_groups(input);
216        self
217    }
218    /// <p>\[Application Load Balancers and Network Load Balancers\] The IDs of the security groups for the load balancer.</p>
219    pub fn get_security_groups(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
220        self.inner.get_security_groups()
221    }
222    /// <p>The nodes of an Internet-facing load balancer have public IP addresses. The DNS name of an Internet-facing load balancer is publicly resolvable to the public IP addresses of the nodes. Therefore, Internet-facing load balancers can route requests from clients over the internet.</p>
223    /// <p>The nodes of an internal load balancer have only private IP addresses. The DNS name of an internal load balancer is publicly resolvable to the private IP addresses of the nodes. Therefore, internal load balancers can route requests only from clients with access to the VPC for the load balancer.</p>
224    /// <p>The default is an Internet-facing load balancer.</p>
225    /// <p>You can't specify a scheme for a Gateway Load Balancer.</p>
226    pub fn scheme(mut self, input: crate::types::LoadBalancerSchemeEnum) -> Self {
227        self.inner = self.inner.scheme(input);
228        self
229    }
230    /// <p>The nodes of an Internet-facing load balancer have public IP addresses. The DNS name of an Internet-facing load balancer is publicly resolvable to the public IP addresses of the nodes. Therefore, Internet-facing load balancers can route requests from clients over the internet.</p>
231    /// <p>The nodes of an internal load balancer have only private IP addresses. The DNS name of an internal load balancer is publicly resolvable to the private IP addresses of the nodes. Therefore, internal load balancers can route requests only from clients with access to the VPC for the load balancer.</p>
232    /// <p>The default is an Internet-facing load balancer.</p>
233    /// <p>You can't specify a scheme for a Gateway Load Balancer.</p>
234    pub fn set_scheme(mut self, input: ::std::option::Option<crate::types::LoadBalancerSchemeEnum>) -> Self {
235        self.inner = self.inner.set_scheme(input);
236        self
237    }
238    /// <p>The nodes of an Internet-facing load balancer have public IP addresses. The DNS name of an Internet-facing load balancer is publicly resolvable to the public IP addresses of the nodes. Therefore, Internet-facing load balancers can route requests from clients over the internet.</p>
239    /// <p>The nodes of an internal load balancer have only private IP addresses. The DNS name of an internal load balancer is publicly resolvable to the private IP addresses of the nodes. Therefore, internal load balancers can route requests only from clients with access to the VPC for the load balancer.</p>
240    /// <p>The default is an Internet-facing load balancer.</p>
241    /// <p>You can't specify a scheme for a Gateway Load Balancer.</p>
242    pub fn get_scheme(&self) -> &::std::option::Option<crate::types::LoadBalancerSchemeEnum> {
243        self.inner.get_scheme()
244    }
245    ///
246    /// Appends an item to `Tags`.
247    ///
248    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
249    ///
250    /// <p>The tags to assign to the load balancer.</p>
251    pub fn tags(mut self, input: crate::types::Tag) -> Self {
252        self.inner = self.inner.tags(input);
253        self
254    }
255    /// <p>The tags to assign to the load balancer.</p>
256    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
257        self.inner = self.inner.set_tags(input);
258        self
259    }
260    /// <p>The tags to assign to the load balancer.</p>
261    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
262        self.inner.get_tags()
263    }
264    /// <p>The type of load balancer. The default is <code>application</code>.</p>
265    pub fn r#type(mut self, input: crate::types::LoadBalancerTypeEnum) -> Self {
266        self.inner = self.inner.r#type(input);
267        self
268    }
269    /// <p>The type of load balancer. The default is <code>application</code>.</p>
270    pub fn set_type(mut self, input: ::std::option::Option<crate::types::LoadBalancerTypeEnum>) -> Self {
271        self.inner = self.inner.set_type(input);
272        self
273    }
274    /// <p>The type of load balancer. The default is <code>application</code>.</p>
275    pub fn get_type(&self) -> &::std::option::Option<crate::types::LoadBalancerTypeEnum> {
276        self.inner.get_type()
277    }
278    /// <p>The IP address type. Internal load balancers must use <code>ipv4</code>.</p>
279    /// <p>\[Application Load Balancers\] The possible values are ipv4 (IPv4 addresses), dualstack (IPv4 and IPv6 addresses), and dualstack-without-public-ipv4 (public IPv6 addresses and private IPv4 and IPv6 addresses).</p>
280    /// <p>\[Network Load Balancers and Gateway Load Balancers\] The possible values are ipv4 (IPv4 addresses) and dualstack (IPv4 and IPv6 addresses).</p>
281    pub fn ip_address_type(mut self, input: crate::types::IpAddressType) -> Self {
282        self.inner = self.inner.ip_address_type(input);
283        self
284    }
285    /// <p>The IP address type. Internal load balancers must use <code>ipv4</code>.</p>
286    /// <p>\[Application Load Balancers\] The possible values are ipv4 (IPv4 addresses), dualstack (IPv4 and IPv6 addresses), and dualstack-without-public-ipv4 (public IPv6 addresses and private IPv4 and IPv6 addresses).</p>
287    /// <p>\[Network Load Balancers and Gateway Load Balancers\] The possible values are ipv4 (IPv4 addresses) and dualstack (IPv4 and IPv6 addresses).</p>
288    pub fn set_ip_address_type(mut self, input: ::std::option::Option<crate::types::IpAddressType>) -> Self {
289        self.inner = self.inner.set_ip_address_type(input);
290        self
291    }
292    /// <p>The IP address type. Internal load balancers must use <code>ipv4</code>.</p>
293    /// <p>\[Application Load Balancers\] The possible values are ipv4 (IPv4 addresses), dualstack (IPv4 and IPv6 addresses), and dualstack-without-public-ipv4 (public IPv6 addresses and private IPv4 and IPv6 addresses).</p>
294    /// <p>\[Network Load Balancers and Gateway Load Balancers\] The possible values are ipv4 (IPv4 addresses) and dualstack (IPv4 and IPv6 addresses).</p>
295    pub fn get_ip_address_type(&self) -> &::std::option::Option<crate::types::IpAddressType> {
296        self.inner.get_ip_address_type()
297    }
298    /// <p>\[Application Load Balancers on Outposts\] The ID of the customer-owned address pool (CoIP pool).</p>
299    pub fn customer_owned_ipv4_pool(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
300        self.inner = self.inner.customer_owned_ipv4_pool(input.into());
301        self
302    }
303    /// <p>\[Application Load Balancers on Outposts\] The ID of the customer-owned address pool (CoIP pool).</p>
304    pub fn set_customer_owned_ipv4_pool(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
305        self.inner = self.inner.set_customer_owned_ipv4_pool(input);
306        self
307    }
308    /// <p>\[Application Load Balancers on Outposts\] The ID of the customer-owned address pool (CoIP pool).</p>
309    pub fn get_customer_owned_ipv4_pool(&self) -> &::std::option::Option<::std::string::String> {
310        self.inner.get_customer_owned_ipv4_pool()
311    }
312    /// <p>\[Network Load Balancers with UDP listeners\] Indicates whether to use an IPv6 prefix from each subnet for source NAT. The IP address type must be dualstack. The default value is off.</p>
313    pub fn enable_prefix_for_ipv6_source_nat(mut self, input: crate::types::EnablePrefixForIpv6SourceNatEnum) -> Self {
314        self.inner = self.inner.enable_prefix_for_ipv6_source_nat(input);
315        self
316    }
317    /// <p>\[Network Load Balancers with UDP listeners\] Indicates whether to use an IPv6 prefix from each subnet for source NAT. The IP address type must be dualstack. The default value is off.</p>
318    pub fn set_enable_prefix_for_ipv6_source_nat(mut self, input: ::std::option::Option<crate::types::EnablePrefixForIpv6SourceNatEnum>) -> Self {
319        self.inner = self.inner.set_enable_prefix_for_ipv6_source_nat(input);
320        self
321    }
322    /// <p>\[Network Load Balancers with UDP listeners\] Indicates whether to use an IPv6 prefix from each subnet for source NAT. The IP address type must be dualstack. The default value is off.</p>
323    pub fn get_enable_prefix_for_ipv6_source_nat(&self) -> &::std::option::Option<crate::types::EnablePrefixForIpv6SourceNatEnum> {
324        self.inner.get_enable_prefix_for_ipv6_source_nat()
325    }
326    /// <p>\[Application Load Balancers\] The IPAM pools to use with the load balancer.</p>
327    pub fn ipam_pools(mut self, input: crate::types::IpamPools) -> Self {
328        self.inner = self.inner.ipam_pools(input);
329        self
330    }
331    /// <p>\[Application Load Balancers\] The IPAM pools to use with the load balancer.</p>
332    pub fn set_ipam_pools(mut self, input: ::std::option::Option<crate::types::IpamPools>) -> Self {
333        self.inner = self.inner.set_ipam_pools(input);
334        self
335    }
336    /// <p>\[Application Load Balancers\] The IPAM pools to use with the load balancer.</p>
337    pub fn get_ipam_pools(&self) -> &::std::option::Option<crate::types::IpamPools> {
338        self.inner.get_ipam_pools()
339    }
340}