aws_sdk_ec2/operation/authorize_security_group_ingress/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::authorize_security_group_ingress::_authorize_security_group_ingress_output::AuthorizeSecurityGroupIngressOutputBuilder;
3
4pub use crate::operation::authorize_security_group_ingress::_authorize_security_group_ingress_input::AuthorizeSecurityGroupIngressInputBuilder;
5
6impl crate::operation::authorize_security_group_ingress::builders::AuthorizeSecurityGroupIngressInputBuilder {
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::authorize_security_group_ingress::AuthorizeSecurityGroupIngressOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::authorize_security_group_ingress::AuthorizeSecurityGroupIngressError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.authorize_security_group_ingress();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `AuthorizeSecurityGroupIngress`.
24///
25/// <p>Adds the specified inbound (ingress) rules to a security group.</p>
26/// <p>An inbound rule permits instances to receive traffic from the specified IPv4 or IPv6 address range, the IP address ranges that are specified by a prefix list, or the instances that are associated with a destination security group. For more information, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/security-group-rules.html">Security group rules</a>.</p>
27/// <p>You must specify exactly one of the following sources: an IPv4 or IPv6 address range, a prefix list, or a security group. You must specify a protocol for each rule (for example, TCP). If the protocol is TCP or UDP, you must also specify a port or port range. If the protocol is ICMP or ICMPv6, you must also specify the ICMP/ICMPv6 type and code.</p>
28/// <p>Rule changes are propagated to instances associated with the security group as quickly as possible. However, a small delay might occur.</p>
29/// <p>For examples of rules that you can add to security groups for specific access scenarios, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-rules-reference.html">Security group rules for different use cases</a> in the <i>Amazon EC2 User Guide</i>.</p>
30/// <p>For more information about security group quotas, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html">Amazon VPC quotas</a> in the <i>Amazon VPC User Guide</i>.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct AuthorizeSecurityGroupIngressFluentBuilder {
33 handle: ::std::sync::Arc<crate::client::Handle>,
34 inner: crate::operation::authorize_security_group_ingress::builders::AuthorizeSecurityGroupIngressInputBuilder,
35 config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38 crate::client::customize::internal::CustomizableSend<
39 crate::operation::authorize_security_group_ingress::AuthorizeSecurityGroupIngressOutput,
40 crate::operation::authorize_security_group_ingress::AuthorizeSecurityGroupIngressError,
41 > for AuthorizeSecurityGroupIngressFluentBuilder
42{
43 fn send(
44 self,
45 config_override: crate::config::Builder,
46 ) -> crate::client::customize::internal::BoxFuture<
47 crate::client::customize::internal::SendResult<
48 crate::operation::authorize_security_group_ingress::AuthorizeSecurityGroupIngressOutput,
49 crate::operation::authorize_security_group_ingress::AuthorizeSecurityGroupIngressError,
50 >,
51 > {
52 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53 }
54}
55impl AuthorizeSecurityGroupIngressFluentBuilder {
56 /// Creates a new `AuthorizeSecurityGroupIngressFluentBuilder`.
57 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58 Self {
59 handle,
60 inner: ::std::default::Default::default(),
61 config_override: ::std::option::Option::None,
62 }
63 }
64 /// Access the AuthorizeSecurityGroupIngress as a reference.
65 pub fn as_input(&self) -> &crate::operation::authorize_security_group_ingress::builders::AuthorizeSecurityGroupIngressInputBuilder {
66 &self.inner
67 }
68 /// Sends the request and returns the response.
69 ///
70 /// If an error occurs, an `SdkError` will be returned with additional details that
71 /// can be matched against.
72 ///
73 /// By default, any retryable failures will be retried twice. Retry behavior
74 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75 /// set when configuring the client.
76 pub async fn send(
77 self,
78 ) -> ::std::result::Result<
79 crate::operation::authorize_security_group_ingress::AuthorizeSecurityGroupIngressOutput,
80 ::aws_smithy_runtime_api::client::result::SdkError<
81 crate::operation::authorize_security_group_ingress::AuthorizeSecurityGroupIngressError,
82 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83 >,
84 > {
85 let input = self
86 .inner
87 .build()
88 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89 let runtime_plugins = crate::operation::authorize_security_group_ingress::AuthorizeSecurityGroupIngress::operation_runtime_plugins(
90 self.handle.runtime_plugins.clone(),
91 &self.handle.conf,
92 self.config_override,
93 );
94 crate::operation::authorize_security_group_ingress::AuthorizeSecurityGroupIngress::orchestrate(&runtime_plugins, input).await
95 }
96
97 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98 pub fn customize(
99 self,
100 ) -> crate::client::customize::CustomizableOperation<
101 crate::operation::authorize_security_group_ingress::AuthorizeSecurityGroupIngressOutput,
102 crate::operation::authorize_security_group_ingress::AuthorizeSecurityGroupIngressError,
103 Self,
104 > {
105 crate::client::customize::CustomizableOperation::new(self)
106 }
107 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108 self.set_config_override(::std::option::Option::Some(config_override.into()));
109 self
110 }
111
112 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113 self.config_override = config_override;
114 self
115 }
116 /// <p>The IPv4 address range, in CIDR format.</p><note>
117 /// <p>Amazon Web Services <a href="https://en.wikipedia.org/wiki/Canonicalization">canonicalizes</a> IPv4 and IPv6 CIDRs. For example, if you specify 100.68.0.18/18 for the CIDR block, Amazon Web Services canonicalizes the CIDR block to 100.68.0.0/18. Any subsequent DescribeSecurityGroups and DescribeSecurityGroupRules calls will return the canonicalized form of the CIDR block. Additionally, if you attempt to add another rule with the non-canonical form of the CIDR (such as 100.68.0.18/18) and there is already a rule for the canonicalized form of the CIDR block (such as 100.68.0.0/18), the API throws an duplicate rule error.</p>
118 /// </note>
119 /// <p>To specify an IPv6 address range, use IP permissions instead.</p>
120 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
121 pub fn cidr_ip(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122 self.inner = self.inner.cidr_ip(input.into());
123 self
124 }
125 /// <p>The IPv4 address range, in CIDR format.</p><note>
126 /// <p>Amazon Web Services <a href="https://en.wikipedia.org/wiki/Canonicalization">canonicalizes</a> IPv4 and IPv6 CIDRs. For example, if you specify 100.68.0.18/18 for the CIDR block, Amazon Web Services canonicalizes the CIDR block to 100.68.0.0/18. Any subsequent DescribeSecurityGroups and DescribeSecurityGroupRules calls will return the canonicalized form of the CIDR block. Additionally, if you attempt to add another rule with the non-canonical form of the CIDR (such as 100.68.0.18/18) and there is already a rule for the canonicalized form of the CIDR block (such as 100.68.0.0/18), the API throws an duplicate rule error.</p>
127 /// </note>
128 /// <p>To specify an IPv6 address range, use IP permissions instead.</p>
129 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
130 pub fn set_cidr_ip(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
131 self.inner = self.inner.set_cidr_ip(input);
132 self
133 }
134 /// <p>The IPv4 address range, in CIDR format.</p><note>
135 /// <p>Amazon Web Services <a href="https://en.wikipedia.org/wiki/Canonicalization">canonicalizes</a> IPv4 and IPv6 CIDRs. For example, if you specify 100.68.0.18/18 for the CIDR block, Amazon Web Services canonicalizes the CIDR block to 100.68.0.0/18. Any subsequent DescribeSecurityGroups and DescribeSecurityGroupRules calls will return the canonicalized form of the CIDR block. Additionally, if you attempt to add another rule with the non-canonical form of the CIDR (such as 100.68.0.18/18) and there is already a rule for the canonicalized form of the CIDR block (such as 100.68.0.0/18), the API throws an duplicate rule error.</p>
136 /// </note>
137 /// <p>To specify an IPv6 address range, use IP permissions instead.</p>
138 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
139 pub fn get_cidr_ip(&self) -> &::std::option::Option<::std::string::String> {
140 self.inner.get_cidr_ip()
141 }
142 /// <p>If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the ICMP type or -1 (all ICMP types).</p>
143 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
144 pub fn from_port(mut self, input: i32) -> Self {
145 self.inner = self.inner.from_port(input);
146 self
147 }
148 /// <p>If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the ICMP type or -1 (all ICMP types).</p>
149 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
150 pub fn set_from_port(mut self, input: ::std::option::Option<i32>) -> Self {
151 self.inner = self.inner.set_from_port(input);
152 self
153 }
154 /// <p>If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the ICMP type or -1 (all ICMP types).</p>
155 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
156 pub fn get_from_port(&self) -> &::std::option::Option<i32> {
157 self.inner.get_from_port()
158 }
159 /// <p>The ID of the security group.</p>
160 pub fn group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161 self.inner = self.inner.group_id(input.into());
162 self
163 }
164 /// <p>The ID of the security group.</p>
165 pub fn set_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166 self.inner = self.inner.set_group_id(input);
167 self
168 }
169 /// <p>The ID of the security group.</p>
170 pub fn get_group_id(&self) -> &::std::option::Option<::std::string::String> {
171 self.inner.get_group_id()
172 }
173 /// <p>\[Default VPC\] The name of the security group. For security groups for a default VPC you can specify either the ID or the name of the security group. For security groups for a nondefault VPC, you must specify the ID of the security group.</p>
174 pub fn group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175 self.inner = self.inner.group_name(input.into());
176 self
177 }
178 /// <p>\[Default VPC\] The name of the security group. For security groups for a default VPC you can specify either the ID or the name of the security group. For security groups for a nondefault VPC, you must specify the ID of the security group.</p>
179 pub fn set_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
180 self.inner = self.inner.set_group_name(input);
181 self
182 }
183 /// <p>\[Default VPC\] The name of the security group. For security groups for a default VPC you can specify either the ID or the name of the security group. For security groups for a nondefault VPC, you must specify the ID of the security group.</p>
184 pub fn get_group_name(&self) -> &::std::option::Option<::std::string::String> {
185 self.inner.get_group_name()
186 }
187 ///
188 /// Appends an item to `IpPermissions`.
189 ///
190 /// To override the contents of this collection use [`set_ip_permissions`](Self::set_ip_permissions).
191 ///
192 /// <p>The permissions for the security group rules.</p>
193 pub fn ip_permissions(mut self, input: crate::types::IpPermission) -> Self {
194 self.inner = self.inner.ip_permissions(input);
195 self
196 }
197 /// <p>The permissions for the security group rules.</p>
198 pub fn set_ip_permissions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::IpPermission>>) -> Self {
199 self.inner = self.inner.set_ip_permissions(input);
200 self
201 }
202 /// <p>The permissions for the security group rules.</p>
203 pub fn get_ip_permissions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::IpPermission>> {
204 self.inner.get_ip_permissions()
205 }
206 /// <p>The IP protocol name (<code>tcp</code>, <code>udp</code>, <code>icmp</code>) or number (see <a href="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml">Protocol Numbers</a>). To specify all protocols, use <code>-1</code>.</p>
207 /// <p>To specify <code>icmpv6</code>, use IP permissions instead.</p>
208 /// <p>If you specify a protocol other than one of the supported values, traffic is allowed on all ports, regardless of any ports that you specify.</p>
209 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
210 pub fn ip_protocol(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
211 self.inner = self.inner.ip_protocol(input.into());
212 self
213 }
214 /// <p>The IP protocol name (<code>tcp</code>, <code>udp</code>, <code>icmp</code>) or number (see <a href="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml">Protocol Numbers</a>). To specify all protocols, use <code>-1</code>.</p>
215 /// <p>To specify <code>icmpv6</code>, use IP permissions instead.</p>
216 /// <p>If you specify a protocol other than one of the supported values, traffic is allowed on all ports, regardless of any ports that you specify.</p>
217 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
218 pub fn set_ip_protocol(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
219 self.inner = self.inner.set_ip_protocol(input);
220 self
221 }
222 /// <p>The IP protocol name (<code>tcp</code>, <code>udp</code>, <code>icmp</code>) or number (see <a href="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml">Protocol Numbers</a>). To specify all protocols, use <code>-1</code>.</p>
223 /// <p>To specify <code>icmpv6</code>, use IP permissions instead.</p>
224 /// <p>If you specify a protocol other than one of the supported values, traffic is allowed on all ports, regardless of any ports that you specify.</p>
225 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
226 pub fn get_ip_protocol(&self) -> &::std::option::Option<::std::string::String> {
227 self.inner.get_ip_protocol()
228 }
229 /// <p>\[Default VPC\] The name of the source security group.</p>
230 /// <p>The rule grants full ICMP, UDP, and TCP access. To create a rule with a specific protocol and port range, specify a set of IP permissions instead.</p>
231 pub fn source_security_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
232 self.inner = self.inner.source_security_group_name(input.into());
233 self
234 }
235 /// <p>\[Default VPC\] The name of the source security group.</p>
236 /// <p>The rule grants full ICMP, UDP, and TCP access. To create a rule with a specific protocol and port range, specify a set of IP permissions instead.</p>
237 pub fn set_source_security_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
238 self.inner = self.inner.set_source_security_group_name(input);
239 self
240 }
241 /// <p>\[Default VPC\] The name of the source security group.</p>
242 /// <p>The rule grants full ICMP, UDP, and TCP access. To create a rule with a specific protocol and port range, specify a set of IP permissions instead.</p>
243 pub fn get_source_security_group_name(&self) -> &::std::option::Option<::std::string::String> {
244 self.inner.get_source_security_group_name()
245 }
246 /// <p>The Amazon Web Services account ID for the source security group, if the source security group is in a different account.</p>
247 /// <p>The rule grants full ICMP, UDP, and TCP access. To create a rule with a specific protocol and port range, use IP permissions instead.</p>
248 pub fn source_security_group_owner_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
249 self.inner = self.inner.source_security_group_owner_id(input.into());
250 self
251 }
252 /// <p>The Amazon Web Services account ID for the source security group, if the source security group is in a different account.</p>
253 /// <p>The rule grants full ICMP, UDP, and TCP access. To create a rule with a specific protocol and port range, use IP permissions instead.</p>
254 pub fn set_source_security_group_owner_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
255 self.inner = self.inner.set_source_security_group_owner_id(input);
256 self
257 }
258 /// <p>The Amazon Web Services account ID for the source security group, if the source security group is in a different account.</p>
259 /// <p>The rule grants full ICMP, UDP, and TCP access. To create a rule with a specific protocol and port range, use IP permissions instead.</p>
260 pub fn get_source_security_group_owner_id(&self) -> &::std::option::Option<::std::string::String> {
261 self.inner.get_source_security_group_owner_id()
262 }
263 /// <p>If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the ICMP code or -1 (all ICMP codes). If the start port is -1 (all ICMP types), then the end port must be -1 (all ICMP codes).</p>
264 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
265 pub fn to_port(mut self, input: i32) -> Self {
266 self.inner = self.inner.to_port(input);
267 self
268 }
269 /// <p>If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the ICMP code or -1 (all ICMP codes). If the start port is -1 (all ICMP types), then the end port must be -1 (all ICMP codes).</p>
270 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
271 pub fn set_to_port(mut self, input: ::std::option::Option<i32>) -> Self {
272 self.inner = self.inner.set_to_port(input);
273 self
274 }
275 /// <p>If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the ICMP code or -1 (all ICMP codes). If the start port is -1 (all ICMP types), then the end port must be -1 (all ICMP codes).</p>
276 /// <p>To specify multiple rules and descriptions for the rules, use IP permissions instead.</p>
277 pub fn get_to_port(&self) -> &::std::option::Option<i32> {
278 self.inner.get_to_port()
279 }
280 ///
281 /// Appends an item to `TagSpecifications`.
282 ///
283 /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
284 ///
285 /// <p>The tags applied to the security group rule.</p>
286 pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
287 self.inner = self.inner.tag_specifications(input);
288 self
289 }
290 /// <p>The tags applied to the security group rule.</p>
291 pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
292 self.inner = self.inner.set_tag_specifications(input);
293 self
294 }
295 /// <p>The tags applied to the security group rule.</p>
296 pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
297 self.inner.get_tag_specifications()
298 }
299 /// <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>
300 pub fn dry_run(mut self, input: bool) -> Self {
301 self.inner = self.inner.dry_run(input);
302 self
303 }
304 /// <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>
305 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
306 self.inner = self.inner.set_dry_run(input);
307 self
308 }
309 /// <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>
310 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
311 self.inner.get_dry_run()
312 }
313}