aws_sdk_ec2/operation/revoke_security_group_ingress/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::revoke_security_group_ingress::_revoke_security_group_ingress_output::RevokeSecurityGroupIngressOutputBuilder;
3
4pub use crate::operation::revoke_security_group_ingress::_revoke_security_group_ingress_input::RevokeSecurityGroupIngressInputBuilder;
5
6impl crate::operation::revoke_security_group_ingress::builders::RevokeSecurityGroupIngressInputBuilder {
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::revoke_security_group_ingress::RevokeSecurityGroupIngressOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::revoke_security_group_ingress::RevokeSecurityGroupIngressError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.revoke_security_group_ingress();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `RevokeSecurityGroupIngress`.
24///
25/// <p>Removes the specified inbound (ingress) rules from a security group.</p>
26/// <p>You can specify rules using either rule IDs or security group rule properties. If you use rule properties, the values that you specify (for example, ports) must match the existing rule's values exactly. Each rule has a protocol, from and to ports, and source (CIDR range, security group, or prefix list). For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must also specify the ICMP type and code. If the security group rule has a description, you do not need to specify the description to revoke the rule.</p>
27/// <p>For a default VPC, if the values you specify do not match the existing rule's values, no error is returned, and the output describes the security group rules that were not revoked.</p>
28/// <p>For a non-default VPC, if the values you specify do not match the existing rule's values, an <code>InvalidPermission.NotFound</code> client error is returned, and no rules are revoked.</p>
29/// <p>Amazon Web Services recommends that you describe the security group to verify that the rules were removed.</p>
30/// <p>Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct RevokeSecurityGroupIngressFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::revoke_security_group_ingress::builders::RevokeSecurityGroupIngressInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::revoke_security_group_ingress::RevokeSecurityGroupIngressOutput,
40        crate::operation::revoke_security_group_ingress::RevokeSecurityGroupIngressError,
41    > for RevokeSecurityGroupIngressFluentBuilder
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::revoke_security_group_ingress::RevokeSecurityGroupIngressOutput,
49            crate::operation::revoke_security_group_ingress::RevokeSecurityGroupIngressError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl RevokeSecurityGroupIngressFluentBuilder {
56    /// Creates a new `RevokeSecurityGroupIngressFluentBuilder`.
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 RevokeSecurityGroupIngress as a reference.
65    pub fn as_input(&self) -> &crate::operation::revoke_security_group_ingress::builders::RevokeSecurityGroupIngressInputBuilder {
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::revoke_security_group_ingress::RevokeSecurityGroupIngressOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::revoke_security_group_ingress::RevokeSecurityGroupIngressError,
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::revoke_security_group_ingress::RevokeSecurityGroupIngress::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::revoke_security_group_ingress::RevokeSecurityGroupIngress::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::revoke_security_group_ingress::RevokeSecurityGroupIngressOutput,
102        crate::operation::revoke_security_group_ingress::RevokeSecurityGroupIngressError,
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 CIDR IP address range. You can't specify this parameter when specifying a source security group.</p>
117    pub fn cidr_ip(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.cidr_ip(input.into());
119        self
120    }
121    /// <p>The CIDR IP address range. You can't specify this parameter when specifying a source security group.</p>
122    pub fn set_cidr_ip(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.inner = self.inner.set_cidr_ip(input);
124        self
125    }
126    /// <p>The CIDR IP address range. You can't specify this parameter when specifying a source security group.</p>
127    pub fn get_cidr_ip(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_cidr_ip()
129    }
130    /// <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>
131    pub fn from_port(mut self, input: i32) -> Self {
132        self.inner = self.inner.from_port(input);
133        self
134    }
135    /// <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>
136    pub fn set_from_port(mut self, input: ::std::option::Option<i32>) -> Self {
137        self.inner = self.inner.set_from_port(input);
138        self
139    }
140    /// <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>
141    pub fn get_from_port(&self) -> &::std::option::Option<i32> {
142        self.inner.get_from_port()
143    }
144    /// <p>The ID of the security group.</p>
145    pub fn group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.group_id(input.into());
147        self
148    }
149    /// <p>The ID of the security group.</p>
150    pub fn set_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.inner = self.inner.set_group_id(input);
152        self
153    }
154    /// <p>The ID of the security group.</p>
155    pub fn get_group_id(&self) -> &::std::option::Option<::std::string::String> {
156        self.inner.get_group_id()
157    }
158    /// <p>\[Default VPC\] The name of the security group. You must specify either the security group ID or the security group name in the request. For security groups in a nondefault VPC, you must specify the security group ID.</p>
159    pub fn group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.group_name(input.into());
161        self
162    }
163    /// <p>\[Default VPC\] The name of the security group. You must specify either the security group ID or the security group name in the request. For security groups in a nondefault VPC, you must specify the security group ID.</p>
164    pub fn set_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.inner = self.inner.set_group_name(input);
166        self
167    }
168    /// <p>\[Default VPC\] The name of the security group. You must specify either the security group ID or the security group name in the request. For security groups in a nondefault VPC, you must specify the security group ID.</p>
169    pub fn get_group_name(&self) -> &::std::option::Option<::std::string::String> {
170        self.inner.get_group_name()
171    }
172    ///
173    /// Appends an item to `IpPermissions`.
174    ///
175    /// To override the contents of this collection use [`set_ip_permissions`](Self::set_ip_permissions).
176    ///
177    /// <p>The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the same set of permissions.</p>
178    pub fn ip_permissions(mut self, input: crate::types::IpPermission) -> Self {
179        self.inner = self.inner.ip_permissions(input);
180        self
181    }
182    /// <p>The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the same set of permissions.</p>
183    pub fn set_ip_permissions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::IpPermission>>) -> Self {
184        self.inner = self.inner.set_ip_permissions(input);
185        self
186    }
187    /// <p>The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in the same set of permissions.</p>
188    pub fn get_ip_permissions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::IpPermission>> {
189        self.inner.get_ip_permissions()
190    }
191    /// <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>). Use <code>-1</code> to specify all.</p>
192    pub fn ip_protocol(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
193        self.inner = self.inner.ip_protocol(input.into());
194        self
195    }
196    /// <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>). Use <code>-1</code> to specify all.</p>
197    pub fn set_ip_protocol(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
198        self.inner = self.inner.set_ip_protocol(input);
199        self
200    }
201    /// <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>). Use <code>-1</code> to specify all.</p>
202    pub fn get_ip_protocol(&self) -> &::std::option::Option<::std::string::String> {
203        self.inner.get_ip_protocol()
204    }
205    /// <p>\[Default VPC\] The name of the source security group. You can't specify this parameter in combination with the following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the end of the port range. The source security group must be in the same VPC. To revoke a specific rule for an IP protocol and port range, use a set of IP permissions instead.</p>
206    pub fn source_security_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
207        self.inner = self.inner.source_security_group_name(input.into());
208        self
209    }
210    /// <p>\[Default VPC\] The name of the source security group. You can't specify this parameter in combination with the following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the end of the port range. The source security group must be in the same VPC. To revoke a specific rule for an IP protocol and port range, use a set of IP permissions instead.</p>
211    pub fn set_source_security_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
212        self.inner = self.inner.set_source_security_group_name(input);
213        self
214    }
215    /// <p>\[Default VPC\] The name of the source security group. You can't specify this parameter in combination with the following parameters: the CIDR IP address range, the start of the port range, the IP protocol, and the end of the port range. The source security group must be in the same VPC. To revoke a specific rule for an IP protocol and port range, use a set of IP permissions instead.</p>
216    pub fn get_source_security_group_name(&self) -> &::std::option::Option<::std::string::String> {
217        self.inner.get_source_security_group_name()
218    }
219    /// <p>Not supported.</p>
220    pub fn source_security_group_owner_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
221        self.inner = self.inner.source_security_group_owner_id(input.into());
222        self
223    }
224    /// <p>Not supported.</p>
225    pub fn set_source_security_group_owner_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
226        self.inner = self.inner.set_source_security_group_owner_id(input);
227        self
228    }
229    /// <p>Not supported.</p>
230    pub fn get_source_security_group_owner_id(&self) -> &::std::option::Option<::std::string::String> {
231        self.inner.get_source_security_group_owner_id()
232    }
233    /// <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).</p>
234    pub fn to_port(mut self, input: i32) -> Self {
235        self.inner = self.inner.to_port(input);
236        self
237    }
238    /// <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).</p>
239    pub fn set_to_port(mut self, input: ::std::option::Option<i32>) -> Self {
240        self.inner = self.inner.set_to_port(input);
241        self
242    }
243    /// <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).</p>
244    pub fn get_to_port(&self) -> &::std::option::Option<i32> {
245        self.inner.get_to_port()
246    }
247    ///
248    /// Appends an item to `SecurityGroupRuleIds`.
249    ///
250    /// To override the contents of this collection use [`set_security_group_rule_ids`](Self::set_security_group_rule_ids).
251    ///
252    /// <p>The IDs of the security group rules.</p>
253    pub fn security_group_rule_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
254        self.inner = self.inner.security_group_rule_ids(input.into());
255        self
256    }
257    /// <p>The IDs of the security group rules.</p>
258    pub fn set_security_group_rule_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
259        self.inner = self.inner.set_security_group_rule_ids(input);
260        self
261    }
262    /// <p>The IDs of the security group rules.</p>
263    pub fn get_security_group_rule_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
264        self.inner.get_security_group_rule_ids()
265    }
266    /// <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>
267    pub fn dry_run(mut self, input: bool) -> Self {
268        self.inner = self.inner.dry_run(input);
269        self
270    }
271    /// <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>
272    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
273        self.inner = self.inner.set_dry_run(input);
274        self
275    }
276    /// <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>
277    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
278        self.inner.get_dry_run()
279    }
280}