aws_sdk_workmail/operation/put_access_control_rule/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_access_control_rule::_put_access_control_rule_output::PutAccessControlRuleOutputBuilder;
3
4pub use crate::operation::put_access_control_rule::_put_access_control_rule_input::PutAccessControlRuleInputBuilder;
5
6impl crate::operation::put_access_control_rule::builders::PutAccessControlRuleInputBuilder {
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::put_access_control_rule::PutAccessControlRuleOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_access_control_rule::PutAccessControlRuleError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_access_control_rule();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutAccessControlRule`.
24///
25/// <p>Adds a new access control rule for the specified organization. The rule allows or denies access to the organization for the specified IPv4 addresses, access protocol actions, user IDs and impersonation IDs. Adding a new rule with the same name as an existing rule replaces the older rule.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct PutAccessControlRuleFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::put_access_control_rule::builders::PutAccessControlRuleInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::put_access_control_rule::PutAccessControlRuleOutput,
35        crate::operation::put_access_control_rule::PutAccessControlRuleError,
36    > for PutAccessControlRuleFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::put_access_control_rule::PutAccessControlRuleOutput,
44            crate::operation::put_access_control_rule::PutAccessControlRuleError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl PutAccessControlRuleFluentBuilder {
51    /// Creates a new `PutAccessControlRuleFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the PutAccessControlRule as a reference.
60    pub fn as_input(&self) -> &crate::operation::put_access_control_rule::builders::PutAccessControlRuleInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::put_access_control_rule::PutAccessControlRuleOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::put_access_control_rule::PutAccessControlRuleError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::put_access_control_rule::PutAccessControlRule::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::put_access_control_rule::PutAccessControlRule::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::put_access_control_rule::PutAccessControlRuleOutput,
97        crate::operation::put_access_control_rule::PutAccessControlRuleError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The rule name.</p>
112    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.name(input.into());
114        self
115    }
116    /// <p>The rule name.</p>
117    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_name(input);
119        self
120    }
121    /// <p>The rule name.</p>
122    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_name()
124    }
125    /// <p>The rule effect.</p>
126    pub fn effect(mut self, input: crate::types::AccessControlRuleEffect) -> Self {
127        self.inner = self.inner.effect(input);
128        self
129    }
130    /// <p>The rule effect.</p>
131    pub fn set_effect(mut self, input: ::std::option::Option<crate::types::AccessControlRuleEffect>) -> Self {
132        self.inner = self.inner.set_effect(input);
133        self
134    }
135    /// <p>The rule effect.</p>
136    pub fn get_effect(&self) -> &::std::option::Option<crate::types::AccessControlRuleEffect> {
137        self.inner.get_effect()
138    }
139    /// <p>The rule description.</p>
140    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.description(input.into());
142        self
143    }
144    /// <p>The rule description.</p>
145    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.inner = self.inner.set_description(input);
147        self
148    }
149    /// <p>The rule description.</p>
150    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
151        self.inner.get_description()
152    }
153    ///
154    /// Appends an item to `IpRanges`.
155    ///
156    /// To override the contents of this collection use [`set_ip_ranges`](Self::set_ip_ranges).
157    ///
158    /// <p>IPv4 CIDR ranges to include in the rule.</p>
159    pub fn ip_ranges(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.ip_ranges(input.into());
161        self
162    }
163    /// <p>IPv4 CIDR ranges to include in the rule.</p>
164    pub fn set_ip_ranges(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
165        self.inner = self.inner.set_ip_ranges(input);
166        self
167    }
168    /// <p>IPv4 CIDR ranges to include in the rule.</p>
169    pub fn get_ip_ranges(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
170        self.inner.get_ip_ranges()
171    }
172    ///
173    /// Appends an item to `NotIpRanges`.
174    ///
175    /// To override the contents of this collection use [`set_not_ip_ranges`](Self::set_not_ip_ranges).
176    ///
177    /// <p>IPv4 CIDR ranges to exclude from the rule.</p>
178    pub fn not_ip_ranges(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
179        self.inner = self.inner.not_ip_ranges(input.into());
180        self
181    }
182    /// <p>IPv4 CIDR ranges to exclude from the rule.</p>
183    pub fn set_not_ip_ranges(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
184        self.inner = self.inner.set_not_ip_ranges(input);
185        self
186    }
187    /// <p>IPv4 CIDR ranges to exclude from the rule.</p>
188    pub fn get_not_ip_ranges(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
189        self.inner.get_not_ip_ranges()
190    }
191    ///
192    /// Appends an item to `Actions`.
193    ///
194    /// To override the contents of this collection use [`set_actions`](Self::set_actions).
195    ///
196    /// <p>Access protocol actions to include in the rule. Valid values include <code>ActiveSync</code>, <code>AutoDiscover</code>, <code>EWS</code>, <code>IMAP</code>, <code>SMTP</code>, <code>WindowsOutlook</code>, and <code>WebMail</code>.</p>
197    pub fn actions(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
198        self.inner = self.inner.actions(input.into());
199        self
200    }
201    /// <p>Access protocol actions to include in the rule. Valid values include <code>ActiveSync</code>, <code>AutoDiscover</code>, <code>EWS</code>, <code>IMAP</code>, <code>SMTP</code>, <code>WindowsOutlook</code>, and <code>WebMail</code>.</p>
202    pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
203        self.inner = self.inner.set_actions(input);
204        self
205    }
206    /// <p>Access protocol actions to include in the rule. Valid values include <code>ActiveSync</code>, <code>AutoDiscover</code>, <code>EWS</code>, <code>IMAP</code>, <code>SMTP</code>, <code>WindowsOutlook</code>, and <code>WebMail</code>.</p>
207    pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
208        self.inner.get_actions()
209    }
210    ///
211    /// Appends an item to `NotActions`.
212    ///
213    /// To override the contents of this collection use [`set_not_actions`](Self::set_not_actions).
214    ///
215    /// <p>Access protocol actions to exclude from the rule. Valid values include <code>ActiveSync</code>, <code>AutoDiscover</code>, <code>EWS</code>, <code>IMAP</code>, <code>SMTP</code>, <code>WindowsOutlook</code>, and <code>WebMail</code>.</p>
216    pub fn not_actions(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
217        self.inner = self.inner.not_actions(input.into());
218        self
219    }
220    /// <p>Access protocol actions to exclude from the rule. Valid values include <code>ActiveSync</code>, <code>AutoDiscover</code>, <code>EWS</code>, <code>IMAP</code>, <code>SMTP</code>, <code>WindowsOutlook</code>, and <code>WebMail</code>.</p>
221    pub fn set_not_actions(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
222        self.inner = self.inner.set_not_actions(input);
223        self
224    }
225    /// <p>Access protocol actions to exclude from the rule. Valid values include <code>ActiveSync</code>, <code>AutoDiscover</code>, <code>EWS</code>, <code>IMAP</code>, <code>SMTP</code>, <code>WindowsOutlook</code>, and <code>WebMail</code>.</p>
226    pub fn get_not_actions(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
227        self.inner.get_not_actions()
228    }
229    ///
230    /// Appends an item to `UserIds`.
231    ///
232    /// To override the contents of this collection use [`set_user_ids`](Self::set_user_ids).
233    ///
234    /// <p>User IDs to include in the rule.</p>
235    pub fn user_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
236        self.inner = self.inner.user_ids(input.into());
237        self
238    }
239    /// <p>User IDs to include in the rule.</p>
240    pub fn set_user_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
241        self.inner = self.inner.set_user_ids(input);
242        self
243    }
244    /// <p>User IDs to include in the rule.</p>
245    pub fn get_user_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
246        self.inner.get_user_ids()
247    }
248    ///
249    /// Appends an item to `NotUserIds`.
250    ///
251    /// To override the contents of this collection use [`set_not_user_ids`](Self::set_not_user_ids).
252    ///
253    /// <p>User IDs to exclude from the rule.</p>
254    pub fn not_user_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
255        self.inner = self.inner.not_user_ids(input.into());
256        self
257    }
258    /// <p>User IDs to exclude from the rule.</p>
259    pub fn set_not_user_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
260        self.inner = self.inner.set_not_user_ids(input);
261        self
262    }
263    /// <p>User IDs to exclude from the rule.</p>
264    pub fn get_not_user_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
265        self.inner.get_not_user_ids()
266    }
267    /// <p>The identifier of the organization.</p>
268    pub fn organization_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
269        self.inner = self.inner.organization_id(input.into());
270        self
271    }
272    /// <p>The identifier of the organization.</p>
273    pub fn set_organization_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
274        self.inner = self.inner.set_organization_id(input);
275        self
276    }
277    /// <p>The identifier of the organization.</p>
278    pub fn get_organization_id(&self) -> &::std::option::Option<::std::string::String> {
279        self.inner.get_organization_id()
280    }
281    ///
282    /// Appends an item to `ImpersonationRoleIds`.
283    ///
284    /// To override the contents of this collection use [`set_impersonation_role_ids`](Self::set_impersonation_role_ids).
285    ///
286    /// <p>Impersonation role IDs to include in the rule.</p>
287    pub fn impersonation_role_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
288        self.inner = self.inner.impersonation_role_ids(input.into());
289        self
290    }
291    /// <p>Impersonation role IDs to include in the rule.</p>
292    pub fn set_impersonation_role_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
293        self.inner = self.inner.set_impersonation_role_ids(input);
294        self
295    }
296    /// <p>Impersonation role IDs to include in the rule.</p>
297    pub fn get_impersonation_role_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
298        self.inner.get_impersonation_role_ids()
299    }
300    ///
301    /// Appends an item to `NotImpersonationRoleIds`.
302    ///
303    /// To override the contents of this collection use [`set_not_impersonation_role_ids`](Self::set_not_impersonation_role_ids).
304    ///
305    /// <p>Impersonation role IDs to exclude from the rule.</p>
306    pub fn not_impersonation_role_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
307        self.inner = self.inner.not_impersonation_role_ids(input.into());
308        self
309    }
310    /// <p>Impersonation role IDs to exclude from the rule.</p>
311    pub fn set_not_impersonation_role_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
312        self.inner = self.inner.set_not_impersonation_role_ids(input);
313        self
314    }
315    /// <p>Impersonation role IDs to exclude from the rule.</p>
316    pub fn get_not_impersonation_role_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
317        self.inner.get_not_impersonation_role_ids()
318    }
319}