aws_sdk_ec2/operation/create_network_acl_entry/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_network_acl_entry::_create_network_acl_entry_output::CreateNetworkAclEntryOutputBuilder;
3
4pub use crate::operation::create_network_acl_entry::_create_network_acl_entry_input::CreateNetworkAclEntryInputBuilder;
5
6impl crate::operation::create_network_acl_entry::builders::CreateNetworkAclEntryInputBuilder {
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_network_acl_entry::CreateNetworkAclEntryOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_network_acl_entry::CreateNetworkAclEntryError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_network_acl_entry();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateNetworkAclEntry`.
24///
25/// <p>Creates an entry (a rule) in a network ACL with the specified rule number. Each network ACL has a set of numbered ingress rules and a separate set of numbered egress rules. When determining whether a packet should be allowed in or out of a subnet associated with the ACL, we process the entries in the ACL according to the rule numbers, in ascending order. Each network ACL has a set of ingress rules and a separate set of egress rules.</p>
26/// <p>We recommend that you leave room between the rule numbers (for example, 100, 110, 120, ...), and not number them one right after the other (for example, 101, 102, 103, ...). This makes it easier to add a rule between existing ones without having to renumber the rules.</p>
27/// <p>After you add an entry, you can't modify it; you must either replace it, or create an entry and delete the old one.</p>
28/// <p>For more information about network ACLs, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html">Network ACLs</a> in the <i>Amazon VPC User Guide</i>.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct CreateNetworkAclEntryFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::create_network_acl_entry::builders::CreateNetworkAclEntryInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::create_network_acl_entry::CreateNetworkAclEntryOutput,
38        crate::operation::create_network_acl_entry::CreateNetworkAclEntryError,
39    > for CreateNetworkAclEntryFluentBuilder
40{
41    fn send(
42        self,
43        config_override: crate::config::Builder,
44    ) -> crate::client::customize::internal::BoxFuture<
45        crate::client::customize::internal::SendResult<
46            crate::operation::create_network_acl_entry::CreateNetworkAclEntryOutput,
47            crate::operation::create_network_acl_entry::CreateNetworkAclEntryError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl CreateNetworkAclEntryFluentBuilder {
54    /// Creates a new `CreateNetworkAclEntryFluentBuilder`.
55    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56        Self {
57            handle,
58            inner: ::std::default::Default::default(),
59            config_override: ::std::option::Option::None,
60        }
61    }
62    /// Access the CreateNetworkAclEntry as a reference.
63    pub fn as_input(&self) -> &crate::operation::create_network_acl_entry::builders::CreateNetworkAclEntryInputBuilder {
64        &self.inner
65    }
66    /// Sends the request and returns the response.
67    ///
68    /// If an error occurs, an `SdkError` will be returned with additional details that
69    /// can be matched against.
70    ///
71    /// By default, any retryable failures will be retried twice. Retry behavior
72    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73    /// set when configuring the client.
74    pub async fn send(
75        self,
76    ) -> ::std::result::Result<
77        crate::operation::create_network_acl_entry::CreateNetworkAclEntryOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::create_network_acl_entry::CreateNetworkAclEntryError,
80            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81        >,
82    > {
83        let input = self
84            .inner
85            .build()
86            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87        let runtime_plugins = crate::operation::create_network_acl_entry::CreateNetworkAclEntry::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::create_network_acl_entry::CreateNetworkAclEntry::orchestrate(&runtime_plugins, input).await
93    }
94
95    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96    pub fn customize(
97        self,
98    ) -> crate::client::customize::CustomizableOperation<
99        crate::operation::create_network_acl_entry::CreateNetworkAclEntryOutput,
100        crate::operation::create_network_acl_entry::CreateNetworkAclEntryError,
101        Self,
102    > {
103        crate::client::customize::CustomizableOperation::new(self)
104    }
105    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106        self.set_config_override(::std::option::Option::Some(config_override.into()));
107        self
108    }
109
110    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111        self.config_override = config_override;
112        self
113    }
114    /// <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>
115    pub fn dry_run(mut self, input: bool) -> Self {
116        self.inner = self.inner.dry_run(input);
117        self
118    }
119    /// <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>
120    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
121        self.inner = self.inner.set_dry_run(input);
122        self
123    }
124    /// <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>
125    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
126        self.inner.get_dry_run()
127    }
128    /// <p>The ID of the network ACL.</p>
129    pub fn network_acl_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.network_acl_id(input.into());
131        self
132    }
133    /// <p>The ID of the network ACL.</p>
134    pub fn set_network_acl_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.inner = self.inner.set_network_acl_id(input);
136        self
137    }
138    /// <p>The ID of the network ACL.</p>
139    pub fn get_network_acl_id(&self) -> &::std::option::Option<::std::string::String> {
140        self.inner.get_network_acl_id()
141    }
142    /// <p>The rule number for the entry (for example, 100). ACL entries are processed in ascending order by rule number.</p>
143    /// <p>Constraints: Positive integer from 1 to 32766. The range 32767 to 65535 is reserved for internal use.</p>
144    pub fn rule_number(mut self, input: i32) -> Self {
145        self.inner = self.inner.rule_number(input);
146        self
147    }
148    /// <p>The rule number for the entry (for example, 100). ACL entries are processed in ascending order by rule number.</p>
149    /// <p>Constraints: Positive integer from 1 to 32766. The range 32767 to 65535 is reserved for internal use.</p>
150    pub fn set_rule_number(mut self, input: ::std::option::Option<i32>) -> Self {
151        self.inner = self.inner.set_rule_number(input);
152        self
153    }
154    /// <p>The rule number for the entry (for example, 100). ACL entries are processed in ascending order by rule number.</p>
155    /// <p>Constraints: Positive integer from 1 to 32766. The range 32767 to 65535 is reserved for internal use.</p>
156    pub fn get_rule_number(&self) -> &::std::option::Option<i32> {
157        self.inner.get_rule_number()
158    }
159    /// <p>The protocol number. A value of "-1" means all protocols. If you specify "-1" or a protocol number other than "6" (TCP), "17" (UDP), or "1" (ICMP), traffic on all ports is allowed, regardless of any ports or ICMP types or codes that you specify. If you specify protocol "58" (ICMPv6) and specify an IPv4 CIDR block, traffic for all ICMP types and codes allowed, regardless of any that you specify. If you specify protocol "58" (ICMPv6) and specify an IPv6 CIDR block, you must specify an ICMP type and code.</p>
160    pub fn protocol(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.inner = self.inner.protocol(input.into());
162        self
163    }
164    /// <p>The protocol number. A value of "-1" means all protocols. If you specify "-1" or a protocol number other than "6" (TCP), "17" (UDP), or "1" (ICMP), traffic on all ports is allowed, regardless of any ports or ICMP types or codes that you specify. If you specify protocol "58" (ICMPv6) and specify an IPv4 CIDR block, traffic for all ICMP types and codes allowed, regardless of any that you specify. If you specify protocol "58" (ICMPv6) and specify an IPv6 CIDR block, you must specify an ICMP type and code.</p>
165    pub fn set_protocol(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.inner = self.inner.set_protocol(input);
167        self
168    }
169    /// <p>The protocol number. A value of "-1" means all protocols. If you specify "-1" or a protocol number other than "6" (TCP), "17" (UDP), or "1" (ICMP), traffic on all ports is allowed, regardless of any ports or ICMP types or codes that you specify. If you specify protocol "58" (ICMPv6) and specify an IPv4 CIDR block, traffic for all ICMP types and codes allowed, regardless of any that you specify. If you specify protocol "58" (ICMPv6) and specify an IPv6 CIDR block, you must specify an ICMP type and code.</p>
170    pub fn get_protocol(&self) -> &::std::option::Option<::std::string::String> {
171        self.inner.get_protocol()
172    }
173    /// <p>Indicates whether to allow or deny the traffic that matches the rule.</p>
174    pub fn rule_action(mut self, input: crate::types::RuleAction) -> Self {
175        self.inner = self.inner.rule_action(input);
176        self
177    }
178    /// <p>Indicates whether to allow or deny the traffic that matches the rule.</p>
179    pub fn set_rule_action(mut self, input: ::std::option::Option<crate::types::RuleAction>) -> Self {
180        self.inner = self.inner.set_rule_action(input);
181        self
182    }
183    /// <p>Indicates whether to allow or deny the traffic that matches the rule.</p>
184    pub fn get_rule_action(&self) -> &::std::option::Option<crate::types::RuleAction> {
185        self.inner.get_rule_action()
186    }
187    /// <p>Indicates whether this is an egress rule (rule is applied to traffic leaving the subnet).</p>
188    pub fn egress(mut self, input: bool) -> Self {
189        self.inner = self.inner.egress(input);
190        self
191    }
192    /// <p>Indicates whether this is an egress rule (rule is applied to traffic leaving the subnet).</p>
193    pub fn set_egress(mut self, input: ::std::option::Option<bool>) -> Self {
194        self.inner = self.inner.set_egress(input);
195        self
196    }
197    /// <p>Indicates whether this is an egress rule (rule is applied to traffic leaving the subnet).</p>
198    pub fn get_egress(&self) -> &::std::option::Option<bool> {
199        self.inner.get_egress()
200    }
201    /// <p>The IPv4 network range to allow or deny, in CIDR notation (for example <code>172.16.0.0/24</code>). We modify the specified CIDR block to its canonical form; for example, if you specify <code>100.68.0.18/18</code>, we modify it to <code>100.68.0.0/18</code>.</p>
202    pub fn cidr_block(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
203        self.inner = self.inner.cidr_block(input.into());
204        self
205    }
206    /// <p>The IPv4 network range to allow or deny, in CIDR notation (for example <code>172.16.0.0/24</code>). We modify the specified CIDR block to its canonical form; for example, if you specify <code>100.68.0.18/18</code>, we modify it to <code>100.68.0.0/18</code>.</p>
207    pub fn set_cidr_block(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
208        self.inner = self.inner.set_cidr_block(input);
209        self
210    }
211    /// <p>The IPv4 network range to allow or deny, in CIDR notation (for example <code>172.16.0.0/24</code>). We modify the specified CIDR block to its canonical form; for example, if you specify <code>100.68.0.18/18</code>, we modify it to <code>100.68.0.0/18</code>.</p>
212    pub fn get_cidr_block(&self) -> &::std::option::Option<::std::string::String> {
213        self.inner.get_cidr_block()
214    }
215    /// <p>The IPv6 network range to allow or deny, in CIDR notation (for example <code>2001:db8:1234:1a00::/64</code>).</p>
216    pub fn ipv6_cidr_block(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
217        self.inner = self.inner.ipv6_cidr_block(input.into());
218        self
219    }
220    /// <p>The IPv6 network range to allow or deny, in CIDR notation (for example <code>2001:db8:1234:1a00::/64</code>).</p>
221    pub fn set_ipv6_cidr_block(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
222        self.inner = self.inner.set_ipv6_cidr_block(input);
223        self
224    }
225    /// <p>The IPv6 network range to allow or deny, in CIDR notation (for example <code>2001:db8:1234:1a00::/64</code>).</p>
226    pub fn get_ipv6_cidr_block(&self) -> &::std::option::Option<::std::string::String> {
227        self.inner.get_ipv6_cidr_block()
228    }
229    /// <p>ICMP protocol: The ICMP or ICMPv6 type and code. Required if specifying protocol 1 (ICMP) or protocol 58 (ICMPv6) with an IPv6 CIDR block.</p>
230    pub fn icmp_type_code(mut self, input: crate::types::IcmpTypeCode) -> Self {
231        self.inner = self.inner.icmp_type_code(input);
232        self
233    }
234    /// <p>ICMP protocol: The ICMP or ICMPv6 type and code. Required if specifying protocol 1 (ICMP) or protocol 58 (ICMPv6) with an IPv6 CIDR block.</p>
235    pub fn set_icmp_type_code(mut self, input: ::std::option::Option<crate::types::IcmpTypeCode>) -> Self {
236        self.inner = self.inner.set_icmp_type_code(input);
237        self
238    }
239    /// <p>ICMP protocol: The ICMP or ICMPv6 type and code. Required if specifying protocol 1 (ICMP) or protocol 58 (ICMPv6) with an IPv6 CIDR block.</p>
240    pub fn get_icmp_type_code(&self) -> &::std::option::Option<crate::types::IcmpTypeCode> {
241        self.inner.get_icmp_type_code()
242    }
243    /// <p>TCP or UDP protocols: The range of ports the rule applies to. Required if specifying protocol 6 (TCP) or 17 (UDP).</p>
244    pub fn port_range(mut self, input: crate::types::PortRange) -> Self {
245        self.inner = self.inner.port_range(input);
246        self
247    }
248    /// <p>TCP or UDP protocols: The range of ports the rule applies to. Required if specifying protocol 6 (TCP) or 17 (UDP).</p>
249    pub fn set_port_range(mut self, input: ::std::option::Option<crate::types::PortRange>) -> Self {
250        self.inner = self.inner.set_port_range(input);
251        self
252    }
253    /// <p>TCP or UDP protocols: The range of ports the rule applies to. Required if specifying protocol 6 (TCP) or 17 (UDP).</p>
254    pub fn get_port_range(&self) -> &::std::option::Option<crate::types::PortRange> {
255        self.inner.get_port_range()
256    }
257}