aws_sdk_connect/operation/release_phone_number/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::release_phone_number::_release_phone_number_output::ReleasePhoneNumberOutputBuilder;
3
4pub use crate::operation::release_phone_number::_release_phone_number_input::ReleasePhoneNumberInputBuilder;
5
6impl crate::operation::release_phone_number::builders::ReleasePhoneNumberInputBuilder {
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::release_phone_number::ReleasePhoneNumberOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::release_phone_number::ReleasePhoneNumberError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.release_phone_number();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ReleasePhoneNumber`.
24///
25/// <p>Releases a phone number previously claimed to an Amazon Connect instance or traffic distribution group. You can call this API only in the Amazon Web Services Region where the number was claimed.</p><important>
26/// <p>To release phone numbers from a traffic distribution group, use the <code>ReleasePhoneNumber</code> API, not the Amazon Connect admin website.</p>
27/// <p>After releasing a phone number, the phone number enters into a cooldown period for up to 180 days. It cannot be searched for or claimed again until the period has ended. If you accidentally release a phone number, contact Amazon Web ServicesSupport.</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 ReleasePhoneNumberFluentBuilder {
34    handle: ::std::sync::Arc<crate::client::Handle>,
35    inner: crate::operation::release_phone_number::builders::ReleasePhoneNumberInputBuilder,
36    config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39    crate::client::customize::internal::CustomizableSend<
40        crate::operation::release_phone_number::ReleasePhoneNumberOutput,
41        crate::operation::release_phone_number::ReleasePhoneNumberError,
42    > for ReleasePhoneNumberFluentBuilder
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::release_phone_number::ReleasePhoneNumberOutput,
50            crate::operation::release_phone_number::ReleasePhoneNumberError,
51        >,
52    > {
53        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54    }
55}
56impl ReleasePhoneNumberFluentBuilder {
57    /// Creates a new `ReleasePhoneNumberFluentBuilder`.
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 ReleasePhoneNumber as a reference.
66    pub fn as_input(&self) -> &crate::operation::release_phone_number::builders::ReleasePhoneNumberInputBuilder {
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::release_phone_number::ReleasePhoneNumberOutput,
81        ::aws_smithy_runtime_api::client::result::SdkError<
82            crate::operation::release_phone_number::ReleasePhoneNumberError,
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::release_phone_number::ReleasePhoneNumber::operation_runtime_plugins(
91            self.handle.runtime_plugins.clone(),
92            &self.handle.conf,
93            self.config_override,
94        );
95        crate::operation::release_phone_number::ReleasePhoneNumber::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::release_phone_number::ReleasePhoneNumberOutput,
103        crate::operation::release_phone_number::ReleasePhoneNumberError,
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>A unique identifier for the phone number.</p>
118    pub fn phone_number_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.inner = self.inner.phone_number_id(input.into());
120        self
121    }
122    /// <p>A unique identifier for the phone number.</p>
123    pub fn set_phone_number_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124        self.inner = self.inner.set_phone_number_id(input);
125        self
126    }
127    /// <p>A unique identifier for the phone number.</p>
128    pub fn get_phone_number_id(&self) -> &::std::option::Option<::std::string::String> {
129        self.inner.get_phone_number_id()
130    }
131    /// <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>
132    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133        self.inner = self.inner.client_token(input.into());
134        self
135    }
136    /// <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>
137    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.inner = self.inner.set_client_token(input);
139        self
140    }
141    /// <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>
142    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_client_token()
144    }
145}