aws_sdk_connect/operation/claim_phone_number/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::claim_phone_number::_claim_phone_number_output::ClaimPhoneNumberOutputBuilder;
3
4pub use crate::operation::claim_phone_number::_claim_phone_number_input::ClaimPhoneNumberInputBuilder;
5
6impl crate::operation::claim_phone_number::builders::ClaimPhoneNumberInputBuilder {
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::claim_phone_number::ClaimPhoneNumberOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::claim_phone_number::ClaimPhoneNumberError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.claim_phone_number();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ClaimPhoneNumber`.
24///
25/// <p>Claims an available phone number to your Amazon Connect instance or traffic distribution group. You can call this API only in the same Amazon Web Services Region where the Amazon Connect instance or traffic distribution group was created.</p>
26/// <p>For more information about how to use this operation, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/claim-phone-number.html">Claim a phone number in your country</a> and <a href="https://docs.aws.amazon.com/connect/latest/adminguide/claim-phone-numbers-traffic-distribution-groups.html">Claim phone numbers to traffic distribution groups</a> in the <i>Amazon Connect Administrator Guide</i>.</p><important>
27/// <p>You can call the <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_SearchAvailablePhoneNumbers.html">SearchAvailablePhoneNumbers</a> API for available phone numbers that you can claim. 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 <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_ClaimPhoneNumber.html">ClaimPhoneNumber</a> operation.</p>
28/// </important>
29/// <p>If you plan to claim and 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>
30/// <p>By default you can claim and release up to 200% of your maximum number of active phone numbers. If you claim and 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 any more numbers until 180 days past the oldest number released has expired.</p>
31/// <p>For example, if you already have 99 claimed 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>
32#[derive(::std::clone::Clone, ::std::fmt::Debug)]
33pub struct ClaimPhoneNumberFluentBuilder {
34    handle: ::std::sync::Arc<crate::client::Handle>,
35    inner: crate::operation::claim_phone_number::builders::ClaimPhoneNumberInputBuilder,
36    config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39    crate::client::customize::internal::CustomizableSend<
40        crate::operation::claim_phone_number::ClaimPhoneNumberOutput,
41        crate::operation::claim_phone_number::ClaimPhoneNumberError,
42    > for ClaimPhoneNumberFluentBuilder
43{
44    fn send(
45        self,
46        config_override: crate::config::Builder,
47    ) -> crate::client::customize::internal::BoxFuture<
48        crate::client::customize::internal::SendResult<
49            crate::operation::claim_phone_number::ClaimPhoneNumberOutput,
50            crate::operation::claim_phone_number::ClaimPhoneNumberError,
51        >,
52    > {
53        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54    }
55}
56impl ClaimPhoneNumberFluentBuilder {
57    /// Creates a new `ClaimPhoneNumberFluentBuilder`.
58    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59        Self {
60            handle,
61            inner: ::std::default::Default::default(),
62            config_override: ::std::option::Option::None,
63        }
64    }
65    /// Access the ClaimPhoneNumber as a reference.
66    pub fn as_input(&self) -> &crate::operation::claim_phone_number::builders::ClaimPhoneNumberInputBuilder {
67        &self.inner
68    }
69    /// Sends the request and returns the response.
70    ///
71    /// If an error occurs, an `SdkError` will be returned with additional details that
72    /// can be matched against.
73    ///
74    /// By default, any retryable failures will be retried twice. Retry behavior
75    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
76    /// set when configuring the client.
77    pub async fn send(
78        self,
79    ) -> ::std::result::Result<
80        crate::operation::claim_phone_number::ClaimPhoneNumberOutput,
81        ::aws_smithy_runtime_api::client::result::SdkError<
82            crate::operation::claim_phone_number::ClaimPhoneNumberError,
83            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
84        >,
85    > {
86        let input = self
87            .inner
88            .build()
89            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
90        let runtime_plugins = crate::operation::claim_phone_number::ClaimPhoneNumber::operation_runtime_plugins(
91            self.handle.runtime_plugins.clone(),
92            &self.handle.conf,
93            self.config_override,
94        );
95        crate::operation::claim_phone_number::ClaimPhoneNumber::orchestrate(&runtime_plugins, input).await
96    }
97
98    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
99    pub fn customize(
100        self,
101    ) -> crate::client::customize::CustomizableOperation<
102        crate::operation::claim_phone_number::ClaimPhoneNumberOutput,
103        crate::operation::claim_phone_number::ClaimPhoneNumberError,
104        Self,
105    > {
106        crate::client::customize::CustomizableOperation::new(self)
107    }
108    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
109        self.set_config_override(::std::option::Option::Some(config_override.into()));
110        self
111    }
112
113    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
114        self.config_override = config_override;
115        self
116    }
117    /// <p>The Amazon Resource Name (ARN) for Amazon Connect instances or traffic distribution groups that phone number inbound traffic is routed through. You must enter <code>InstanceId</code> or <code>TargetArn</code>.</p>
118    pub fn target_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.inner = self.inner.target_arn(input.into());
120        self
121    }
122    /// <p>The Amazon Resource Name (ARN) for Amazon Connect instances or traffic distribution groups that phone number inbound traffic is routed through. You must enter <code>InstanceId</code> or <code>TargetArn</code>.</p>
123    pub fn set_target_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124        self.inner = self.inner.set_target_arn(input);
125        self
126    }
127    /// <p>The Amazon Resource Name (ARN) for Amazon Connect instances or traffic distribution groups that phone number inbound traffic is routed through. You must enter <code>InstanceId</code> or <code>TargetArn</code>.</p>
128    pub fn get_target_arn(&self) -> &::std::option::Option<::std::string::String> {
129        self.inner.get_target_arn()
130    }
131    /// <p>The identifier of the Amazon Connect instance that phone numbers are claimed to. 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. You must enter <code>InstanceId</code> or <code>TargetArn</code>.</p>
132    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133        self.inner = self.inner.instance_id(input.into());
134        self
135    }
136    /// <p>The identifier of the Amazon Connect instance that phone numbers are claimed to. 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. You must enter <code>InstanceId</code> or <code>TargetArn</code>.</p>
137    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.inner = self.inner.set_instance_id(input);
139        self
140    }
141    /// <p>The identifier of the Amazon Connect instance that phone numbers are claimed to. 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. You must enter <code>InstanceId</code> or <code>TargetArn</code>.</p>
142    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_instance_id()
144    }
145    /// <p>The phone number you want to claim. Phone numbers are formatted <code>\[+\] \[country code\] \[subscriber number including area code\]</code>.</p>
146    pub fn phone_number(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.phone_number(input.into());
148        self
149    }
150    /// <p>The phone number you want to claim. Phone numbers are formatted <code>\[+\] \[country code\] \[subscriber number including area code\]</code>.</p>
151    pub fn set_phone_number(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_phone_number(input);
153        self
154    }
155    /// <p>The phone number you want to claim. Phone numbers are formatted <code>\[+\] \[country code\] \[subscriber number including area code\]</code>.</p>
156    pub fn get_phone_number(&self) -> &::std::option::Option<::std::string::String> {
157        self.inner.get_phone_number()
158    }
159    /// <p>The description of the phone number.</p>
160    pub fn phone_number_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.inner = self.inner.phone_number_description(input.into());
162        self
163    }
164    /// <p>The description of the phone number.</p>
165    pub fn set_phone_number_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.inner = self.inner.set_phone_number_description(input);
167        self
168    }
169    /// <p>The description of the phone number.</p>
170    pub fn get_phone_number_description(&self) -> &::std::option::Option<::std::string::String> {
171        self.inner.get_phone_number_description()
172    }
173    ///
174    /// Adds a key-value pair to `Tags`.
175    ///
176    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
177    ///
178    /// <p>The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.</p>
179    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
180        self.inner = self.inner.tags(k.into(), v.into());
181        self
182    }
183    /// <p>The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.</p>
184    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
185        self.inner = self.inner.set_tags(input);
186        self
187    }
188    /// <p>The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.</p>
189    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
190        self.inner.get_tags()
191    }
192    /// <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>
193    /// <p>Pattern: <code>^\[a-f0-9\]{8}-\[a-f0-9\]{4}-\[a-f0-9\]{4}-\[a-f0-9\]{4}-\[a-f0-9\]{12}$</code></p>
194    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
195        self.inner = self.inner.client_token(input.into());
196        self
197    }
198    /// <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>
199    /// <p>Pattern: <code>^\[a-f0-9\]{8}-\[a-f0-9\]{4}-\[a-f0-9\]{4}-\[a-f0-9\]{4}-\[a-f0-9\]{12}$</code></p>
200    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
201        self.inner = self.inner.set_client_token(input);
202        self
203    }
204    /// <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>
205    /// <p>Pattern: <code>^\[a-f0-9\]{8}-\[a-f0-9\]{4}-\[a-f0-9\]{4}-\[a-f0-9\]{4}-\[a-f0-9\]{12}$</code></p>
206    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
207        self.inner.get_client_token()
208    }
209}