aws_sdk_ec2/operation/create_dhcp_options/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_dhcp_options::_create_dhcp_options_output::CreateDhcpOptionsOutputBuilder;
3
4pub use crate::operation::create_dhcp_options::_create_dhcp_options_input::CreateDhcpOptionsInputBuilder;
5
6impl crate::operation::create_dhcp_options::builders::CreateDhcpOptionsInputBuilder {
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_dhcp_options::CreateDhcpOptionsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_dhcp_options::CreateDhcpOptionsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_dhcp_options();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateDhcpOptions`.
24///
25/// <p>Creates a custom set of DHCP options. After you create a DHCP option set, you associate it with a VPC. After you associate a DHCP option set with a VPC, all existing and newly launched instances in the VPC use this set of DHCP options.</p>
26/// <p>The following are the individual DHCP options you can specify. For more information, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_DHCP_Options.html">DHCP option sets</a> in the <i>Amazon VPC User Guide</i>.</p>
27/// <ul>
28/// <li>
29/// <p><code>domain-name</code> - If you're using AmazonProvidedDNS in <code>us-east-1</code>, specify <code>ec2.internal</code>. If you're using AmazonProvidedDNS in any other Region, specify <code>region.compute.internal</code>. Otherwise, specify a custom domain name. This value is used to complete unqualified DNS hostnames.</p>
30/// <p>Some Linux operating systems accept multiple domain names separated by spaces. However, Windows and other Linux operating systems treat the value as a single domain, which results in unexpected behavior. If your DHCP option set is associated with a VPC that has instances running operating systems that treat the value as a single domain, specify only one domain name.</p></li>
31/// <li>
32/// <p><code>domain-name-servers</code> - The IP addresses of up to four DNS servers, or AmazonProvidedDNS. To specify multiple domain name servers in a single parameter, separate the IP addresses using commas. To have your instances receive custom DNS hostnames as specified in <code>domain-name</code>, you must specify a custom DNS server.</p></li>
33/// <li>
34/// <p><code>ntp-servers</code> - The IP addresses of up to eight Network Time Protocol (NTP) servers (four IPv4 addresses and four IPv6 addresses).</p></li>
35/// <li>
36/// <p><code>netbios-name-servers</code> - The IP addresses of up to four NetBIOS name servers.</p></li>
37/// <li>
38/// <p><code>netbios-node-type</code> - The NetBIOS node type (1, 2, 4, or 8). We recommend that you specify 2. Broadcast and multicast are not supported. For more information about NetBIOS node types, see <a href="https://www.ietf.org/rfc/rfc2132.txt">RFC 2132</a>.</p></li>
39/// <li>
40/// <p><code>ipv6-address-preferred-lease-time</code> - A value (in seconds, minutes, hours, or years) for how frequently a running instance with an IPv6 assigned to it goes through DHCPv6 lease renewal. Acceptable values are between 140 and 2147483647 seconds (approximately 68 years). If no value is entered, the default lease time is 140 seconds. If you use long-term addressing for EC2 instances, you can increase the lease time and avoid frequent lease renewal requests. Lease renewal typically occurs when half of the lease time has elapsed.</p></li>
41/// </ul>
42#[derive(::std::clone::Clone, ::std::fmt::Debug)]
43pub struct CreateDhcpOptionsFluentBuilder {
44    handle: ::std::sync::Arc<crate::client::Handle>,
45    inner: crate::operation::create_dhcp_options::builders::CreateDhcpOptionsInputBuilder,
46    config_override: ::std::option::Option<crate::config::Builder>,
47}
48impl
49    crate::client::customize::internal::CustomizableSend<
50        crate::operation::create_dhcp_options::CreateDhcpOptionsOutput,
51        crate::operation::create_dhcp_options::CreateDhcpOptionsError,
52    > for CreateDhcpOptionsFluentBuilder
53{
54    fn send(
55        self,
56        config_override: crate::config::Builder,
57    ) -> crate::client::customize::internal::BoxFuture<
58        crate::client::customize::internal::SendResult<
59            crate::operation::create_dhcp_options::CreateDhcpOptionsOutput,
60            crate::operation::create_dhcp_options::CreateDhcpOptionsError,
61        >,
62    > {
63        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
64    }
65}
66impl CreateDhcpOptionsFluentBuilder {
67    /// Creates a new `CreateDhcpOptionsFluentBuilder`.
68    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
69        Self {
70            handle,
71            inner: ::std::default::Default::default(),
72            config_override: ::std::option::Option::None,
73        }
74    }
75    /// Access the CreateDhcpOptions as a reference.
76    pub fn as_input(&self) -> &crate::operation::create_dhcp_options::builders::CreateDhcpOptionsInputBuilder {
77        &self.inner
78    }
79    /// Sends the request and returns the response.
80    ///
81    /// If an error occurs, an `SdkError` will be returned with additional details that
82    /// can be matched against.
83    ///
84    /// By default, any retryable failures will be retried twice. Retry behavior
85    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
86    /// set when configuring the client.
87    pub async fn send(
88        self,
89    ) -> ::std::result::Result<
90        crate::operation::create_dhcp_options::CreateDhcpOptionsOutput,
91        ::aws_smithy_runtime_api::client::result::SdkError<
92            crate::operation::create_dhcp_options::CreateDhcpOptionsError,
93            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
94        >,
95    > {
96        let input = self
97            .inner
98            .build()
99            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
100        let runtime_plugins = crate::operation::create_dhcp_options::CreateDhcpOptions::operation_runtime_plugins(
101            self.handle.runtime_plugins.clone(),
102            &self.handle.conf,
103            self.config_override,
104        );
105        crate::operation::create_dhcp_options::CreateDhcpOptions::orchestrate(&runtime_plugins, input).await
106    }
107
108    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
109    pub fn customize(
110        self,
111    ) -> crate::client::customize::CustomizableOperation<
112        crate::operation::create_dhcp_options::CreateDhcpOptionsOutput,
113        crate::operation::create_dhcp_options::CreateDhcpOptionsError,
114        Self,
115    > {
116        crate::client::customize::CustomizableOperation::new(self)
117    }
118    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
119        self.set_config_override(::std::option::Option::Some(config_override.into()));
120        self
121    }
122
123    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
124        self.config_override = config_override;
125        self
126    }
127    ///
128    /// Appends an item to `DhcpConfigurations`.
129    ///
130    /// To override the contents of this collection use [`set_dhcp_configurations`](Self::set_dhcp_configurations).
131    ///
132    /// <p>A DHCP configuration option.</p>
133    pub fn dhcp_configurations(mut self, input: crate::types::NewDhcpConfiguration) -> Self {
134        self.inner = self.inner.dhcp_configurations(input);
135        self
136    }
137    /// <p>A DHCP configuration option.</p>
138    pub fn set_dhcp_configurations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::NewDhcpConfiguration>>) -> Self {
139        self.inner = self.inner.set_dhcp_configurations(input);
140        self
141    }
142    /// <p>A DHCP configuration option.</p>
143    pub fn get_dhcp_configurations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::NewDhcpConfiguration>> {
144        self.inner.get_dhcp_configurations()
145    }
146    ///
147    /// Appends an item to `TagSpecifications`.
148    ///
149    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
150    ///
151    /// <p>The tags to assign to the DHCP option.</p>
152    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
153        self.inner = self.inner.tag_specifications(input);
154        self
155    }
156    /// <p>The tags to assign to the DHCP option.</p>
157    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
158        self.inner = self.inner.set_tag_specifications(input);
159        self
160    }
161    /// <p>The tags to assign to the DHCP option.</p>
162    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
163        self.inner.get_tag_specifications()
164    }
165    /// <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>
166    pub fn dry_run(mut self, input: bool) -> Self {
167        self.inner = self.inner.dry_run(input);
168        self
169    }
170    /// <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>
171    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
172        self.inner = self.inner.set_dry_run(input);
173        self
174    }
175    /// <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>
176    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
177        self.inner.get_dry_run()
178    }
179}