aws_sdk_iot/operation/transfer_certificate/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::transfer_certificate::_transfer_certificate_output::TransferCertificateOutputBuilder;
3
4pub use crate::operation::transfer_certificate::_transfer_certificate_input::TransferCertificateInputBuilder;
5
6impl crate::operation::transfer_certificate::builders::TransferCertificateInputBuilder {
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::transfer_certificate::TransferCertificateOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::transfer_certificate::TransferCertificateError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.transfer_certificate();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `TransferCertificate`.
24///
25/// <p>Transfers the specified certificate to the specified Amazon Web Services account.</p>
26/// <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">TransferCertificate</a> action.</p>
27/// <p>You can cancel the transfer until it is acknowledged by the recipient.</p>
28/// <p>No notification is sent to the transfer destination's account. It's up to the caller to notify the transfer target.</p>
29/// <p>The certificate being transferred must not be in the <code>ACTIVE</code> state. You can use the <code>UpdateCertificate</code> action to deactivate it.</p>
30/// <p>The certificate must not have any policies attached to it. You can use the <code>DetachPolicy</code> action to detach them.</p>
31/// <p><b>Customer managed key behavior:</b> When you use a customer managed key to secure your data and then transfer the key to a customer in a different account using the <code>TransferCertificate</code> operation, the certificates will no longer be protected by their customer managed key configuration. During the transfer process, certificates are encrypted using IoT owned keys.</p>
32/// <p>While a certificate is in the <b>PENDING_TRANSFER</b> state, it's always protected by IoT owned keys, regardless of the customer managed key configuration of either the source or destination account.</p>
33/// <p>Once the transfer is completed through <code>AcceptCertificateTransfer</code>, <code>RejectCertificateTransfer</code>, or <code>CancelCertificateTransfer</code>, the certificate will be protected by the customer managed key configuration of the account that owns the certificate after the transfer operation:</p>
34/// <ul>
35/// <li>
36/// <p>If the transfer is accepted: The certificate is protected by the destination account's customer managed key configuration.</p></li>
37/// <li>
38/// <p>If the transfer is rejected or cancelled: The certificate is protected by the source account's customer managed key configuration.</p></li>
39/// </ul>
40#[derive(::std::clone::Clone, ::std::fmt::Debug)]
41pub struct TransferCertificateFluentBuilder {
42    handle: ::std::sync::Arc<crate::client::Handle>,
43    inner: crate::operation::transfer_certificate::builders::TransferCertificateInputBuilder,
44    config_override: ::std::option::Option<crate::config::Builder>,
45}
46impl
47    crate::client::customize::internal::CustomizableSend<
48        crate::operation::transfer_certificate::TransferCertificateOutput,
49        crate::operation::transfer_certificate::TransferCertificateError,
50    > for TransferCertificateFluentBuilder
51{
52    fn send(
53        self,
54        config_override: crate::config::Builder,
55    ) -> crate::client::customize::internal::BoxFuture<
56        crate::client::customize::internal::SendResult<
57            crate::operation::transfer_certificate::TransferCertificateOutput,
58            crate::operation::transfer_certificate::TransferCertificateError,
59        >,
60    > {
61        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
62    }
63}
64impl TransferCertificateFluentBuilder {
65    /// Creates a new `TransferCertificateFluentBuilder`.
66    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
67        Self {
68            handle,
69            inner: ::std::default::Default::default(),
70            config_override: ::std::option::Option::None,
71        }
72    }
73    /// Access the TransferCertificate as a reference.
74    pub fn as_input(&self) -> &crate::operation::transfer_certificate::builders::TransferCertificateInputBuilder {
75        &self.inner
76    }
77    /// Sends the request and returns the response.
78    ///
79    /// If an error occurs, an `SdkError` will be returned with additional details that
80    /// can be matched against.
81    ///
82    /// By default, any retryable failures will be retried twice. Retry behavior
83    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
84    /// set when configuring the client.
85    pub async fn send(
86        self,
87    ) -> ::std::result::Result<
88        crate::operation::transfer_certificate::TransferCertificateOutput,
89        ::aws_smithy_runtime_api::client::result::SdkError<
90            crate::operation::transfer_certificate::TransferCertificateError,
91            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
92        >,
93    > {
94        let input = self
95            .inner
96            .build()
97            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
98        let runtime_plugins = crate::operation::transfer_certificate::TransferCertificate::operation_runtime_plugins(
99            self.handle.runtime_plugins.clone(),
100            &self.handle.conf,
101            self.config_override,
102        );
103        crate::operation::transfer_certificate::TransferCertificate::orchestrate(&runtime_plugins, input).await
104    }
105
106    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
107    pub fn customize(
108        self,
109    ) -> crate::client::customize::CustomizableOperation<
110        crate::operation::transfer_certificate::TransferCertificateOutput,
111        crate::operation::transfer_certificate::TransferCertificateError,
112        Self,
113    > {
114        crate::client::customize::CustomizableOperation::new(self)
115    }
116    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
117        self.set_config_override(::std::option::Option::Some(config_override.into()));
118        self
119    }
120
121    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
122        self.config_override = config_override;
123        self
124    }
125    /// <p>The ID of the certificate. (The last part of the certificate ARN contains the certificate ID.)</p>
126    pub fn certificate_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.certificate_id(input.into());
128        self
129    }
130    /// <p>The ID of the certificate. (The last part of the certificate ARN contains the certificate ID.)</p>
131    pub fn set_certificate_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_certificate_id(input);
133        self
134    }
135    /// <p>The ID of the certificate. (The last part of the certificate ARN contains the certificate ID.)</p>
136    pub fn get_certificate_id(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_certificate_id()
138    }
139    /// <p>The Amazon Web Services account.</p>
140    pub fn target_aws_account(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.target_aws_account(input.into());
142        self
143    }
144    /// <p>The Amazon Web Services account.</p>
145    pub fn set_target_aws_account(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.inner = self.inner.set_target_aws_account(input);
147        self
148    }
149    /// <p>The Amazon Web Services account.</p>
150    pub fn get_target_aws_account(&self) -> &::std::option::Option<::std::string::String> {
151        self.inner.get_target_aws_account()
152    }
153    /// <p>The transfer message.</p>
154    pub fn transfer_message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155        self.inner = self.inner.transfer_message(input.into());
156        self
157    }
158    /// <p>The transfer message.</p>
159    pub fn set_transfer_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160        self.inner = self.inner.set_transfer_message(input);
161        self
162    }
163    /// <p>The transfer message.</p>
164    pub fn get_transfer_message(&self) -> &::std::option::Option<::std::string::String> {
165        self.inner.get_transfer_message()
166    }
167}