aws_sdk_connect/operation/import_phone_number/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::import_phone_number::_import_phone_number_output::ImportPhoneNumberOutputBuilder;
3
4pub use crate::operation::import_phone_number::_import_phone_number_input::ImportPhoneNumberInputBuilder;
5
6impl crate::operation::import_phone_number::builders::ImportPhoneNumberInputBuilder {
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::import_phone_number::ImportPhoneNumberOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::import_phone_number::ImportPhoneNumberError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.import_phone_number();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ImportPhoneNumber`.
24///
25/// <p>Imports a claimed phone number from an external service, such as Amazon Web Services End User Messaging, into an Amazon Connect instance. You can call this API only in the same Amazon Web Services Region where the Amazon Connect instance was created.</p><important>
26/// <p>Call the <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_DescribePhoneNumber.html">DescribePhoneNumber</a> API to verify the status of a previous <code>ImportPhoneNumber</code> operation.</p>
27/// </important>
28/// <p>If you plan to claim or import numbers and then release numbers frequently, contact us for a service quota exception. Otherwise, it is possible you will be blocked from claiming and releasing any more numbers until up to 180 days past the oldest number released has expired.</p>
29/// <p>By default you can claim or import and then release up to 200% of your maximum number of active phone numbers. If you claim or import and then release phone numbers using the UI or API during a rolling 180 day cycle that exceeds 200% of your phone number service level quota, you will be blocked from claiming or importing any more numbers until 180 days past the oldest number released has expired.</p>
30/// <p>For example, if you already have 99 claimed or imported numbers and a service level quota of 99 phone numbers, and in any 180 day period you release 99, claim 99, and then release 99, you will have exceeded the 200% limit. At that point you are blocked from claiming any more numbers until you open an Amazon Web Services Support ticket.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct ImportPhoneNumberFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::import_phone_number::builders::ImportPhoneNumberInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::import_phone_number::ImportPhoneNumberOutput,
40        crate::operation::import_phone_number::ImportPhoneNumberError,
41    > for ImportPhoneNumberFluentBuilder
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::import_phone_number::ImportPhoneNumberOutput,
49            crate::operation::import_phone_number::ImportPhoneNumberError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl ImportPhoneNumberFluentBuilder {
56    /// Creates a new `ImportPhoneNumberFluentBuilder`.
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 ImportPhoneNumber as a reference.
65    pub fn as_input(&self) -> &crate::operation::import_phone_number::builders::ImportPhoneNumberInputBuilder {
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::import_phone_number::ImportPhoneNumberOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::import_phone_number::ImportPhoneNumberError,
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::import_phone_number::ImportPhoneNumber::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::import_phone_number::ImportPhoneNumber::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::import_phone_number::ImportPhoneNumberOutput,
102        crate::operation::import_phone_number::ImportPhoneNumberError,
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 identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
117    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.instance_id(input.into());
119        self
120    }
121    /// <p>The identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
122    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.inner = self.inner.set_instance_id(input);
124        self
125    }
126    /// <p>The identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
127    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_instance_id()
129    }
130    /// <p>The claimed phone number ARN being imported from the external service, such as Amazon Web Services End User Messaging. If it is from Amazon Web Services End User Messaging, it looks like the ARN of the phone number to import from Amazon Web Services End User Messaging.</p>
131    pub fn source_phone_number_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.inner = self.inner.source_phone_number_arn(input.into());
133        self
134    }
135    /// <p>The claimed phone number ARN being imported from the external service, such as Amazon Web Services End User Messaging. If it is from Amazon Web Services End User Messaging, it looks like the ARN of the phone number to import from Amazon Web Services End User Messaging.</p>
136    pub fn set_source_phone_number_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_source_phone_number_arn(input);
138        self
139    }
140    /// <p>The claimed phone number ARN being imported from the external service, such as Amazon Web Services End User Messaging. If it is from Amazon Web Services End User Messaging, it looks like the ARN of the phone number to import from Amazon Web Services End User Messaging.</p>
141    pub fn get_source_phone_number_arn(&self) -> &::std::option::Option<::std::string::String> {
142        self.inner.get_source_phone_number_arn()
143    }
144    /// <p>The description of the phone number.</p>
145    pub fn phone_number_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.phone_number_description(input.into());
147        self
148    }
149    /// <p>The description of the phone number.</p>
150    pub fn set_phone_number_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.inner = self.inner.set_phone_number_description(input);
152        self
153    }
154    /// <p>The description of the phone number.</p>
155    pub fn get_phone_number_description(&self) -> &::std::option::Option<::std::string::String> {
156        self.inner.get_phone_number_description()
157    }
158    ///
159    /// Adds a key-value pair to `Tags`.
160    ///
161    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
162    ///
163    /// <p>The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.</p>
164    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
165        self.inner = self.inner.tags(k.into(), v.into());
166        self
167    }
168    /// <p>The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.</p>
169    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
170        self.inner = self.inner.set_tags(input);
171        self
172    }
173    /// <p>The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.</p>
174    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
175        self.inner.get_tags()
176    }
177    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
178    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
179        self.inner = self.inner.client_token(input.into());
180        self
181    }
182    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
183    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
184        self.inner = self.inner.set_client_token(input);
185        self
186    }
187    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
188    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
189        self.inner.get_client_token()
190    }
191}