aws_sdk_acm/operation/import_certificate/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::import_certificate::_import_certificate_output::ImportCertificateOutputBuilder;
3
4pub use crate::operation::import_certificate::_import_certificate_input::ImportCertificateInputBuilder;
5
6impl crate::operation::import_certificate::builders::ImportCertificateInputBuilder {
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_certificate::ImportCertificateOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::import_certificate::ImportCertificateError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.import_certificate();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ImportCertificate`.
24///
25/// <p>Imports a certificate into Certificate Manager (ACM) to use with services that are integrated with ACM. Note that <a href="https://docs.aws.amazon.com/acm/latest/userguide/acm-services.html">integrated services</a> allow only certificate types and keys they support to be associated with their resources. Further, their support differs depending on whether the certificate is imported into IAM or into ACM. For more information, see the documentation for each service. For more information about importing certificates into ACM, see <a href="https://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html">Importing Certificates</a> in the <i>Certificate Manager User Guide</i>.</p><note>
26/// <p>ACM does not provide <a href="https://docs.aws.amazon.com/acm/latest/userguide/acm-renewal.html">managed renewal</a> for certificates that you import.</p>
27/// </note>
28/// <p>Note the following guidelines when importing third party certificates:</p>
29/// <ul>
30/// <li>
31/// <p>You must enter the private key that matches the certificate you are importing.</p></li>
32/// <li>
33/// <p>The private key must be unencrypted. You cannot import a private key that is protected by a password or a passphrase.</p></li>
34/// <li>
35/// <p>The private key must be no larger than 5 KB (5,120 bytes).</p></li>
36/// <li>
37/// <p>The certificate, private key, and certificate chain must be PEM-encoded.</p></li>
38/// <li>
39/// <p>The current time must be between the <code>Not Before</code> and <code>Not After</code> certificate fields.</p></li>
40/// <li>
41/// <p>The <code>Issuer</code> field must not be empty.</p></li>
42/// <li>
43/// <p>The OCSP authority URL, if present, must not exceed 1000 characters.</p></li>
44/// <li>
45/// <p>To import a new certificate, omit the <code>CertificateArn</code> argument. Include this argument only when you want to replace a previously imported certificate.</p></li>
46/// <li>
47/// <p>When you import a certificate by using the CLI, you must specify the certificate, the certificate chain, and the private key by their file names preceded by <code>fileb://</code>. For example, you can specify a certificate saved in the <code>C:\temp</code> folder as <code>fileb://C:\temp\certificate_to_import.pem</code>. If you are making an HTTP or HTTPS Query request, include these arguments as BLOBs.</p></li>
48/// <li>
49/// <p>When you import a certificate by using an SDK, you must specify the certificate, the certificate chain, and the private key files in the manner required by the programming language you're using.</p></li>
50/// <li>
51/// <p>The cryptographic algorithm of an imported certificate must match the algorithm of the signing CA. For example, if the signing CA key type is RSA, then the certificate key type must also be RSA.</p></li>
52/// </ul>
53/// <p>This operation returns the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of the imported certificate.</p>
54#[derive(::std::clone::Clone, ::std::fmt::Debug)]
55pub struct ImportCertificateFluentBuilder {
56    handle: ::std::sync::Arc<crate::client::Handle>,
57    inner: crate::operation::import_certificate::builders::ImportCertificateInputBuilder,
58    config_override: ::std::option::Option<crate::config::Builder>,
59}
60impl
61    crate::client::customize::internal::CustomizableSend<
62        crate::operation::import_certificate::ImportCertificateOutput,
63        crate::operation::import_certificate::ImportCertificateError,
64    > for ImportCertificateFluentBuilder
65{
66    fn send(
67        self,
68        config_override: crate::config::Builder,
69    ) -> crate::client::customize::internal::BoxFuture<
70        crate::client::customize::internal::SendResult<
71            crate::operation::import_certificate::ImportCertificateOutput,
72            crate::operation::import_certificate::ImportCertificateError,
73        >,
74    > {
75        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
76    }
77}
78impl ImportCertificateFluentBuilder {
79    /// Creates a new `ImportCertificateFluentBuilder`.
80    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
81        Self {
82            handle,
83            inner: ::std::default::Default::default(),
84            config_override: ::std::option::Option::None,
85        }
86    }
87    /// Access the ImportCertificate as a reference.
88    pub fn as_input(&self) -> &crate::operation::import_certificate::builders::ImportCertificateInputBuilder {
89        &self.inner
90    }
91    /// Sends the request and returns the response.
92    ///
93    /// If an error occurs, an `SdkError` will be returned with additional details that
94    /// can be matched against.
95    ///
96    /// By default, any retryable failures will be retried twice. Retry behavior
97    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
98    /// set when configuring the client.
99    pub async fn send(
100        self,
101    ) -> ::std::result::Result<
102        crate::operation::import_certificate::ImportCertificateOutput,
103        ::aws_smithy_runtime_api::client::result::SdkError<
104            crate::operation::import_certificate::ImportCertificateError,
105            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
106        >,
107    > {
108        let input = self
109            .inner
110            .build()
111            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
112        let runtime_plugins = crate::operation::import_certificate::ImportCertificate::operation_runtime_plugins(
113            self.handle.runtime_plugins.clone(),
114            &self.handle.conf,
115            self.config_override,
116        );
117        crate::operation::import_certificate::ImportCertificate::orchestrate(&runtime_plugins, input).await
118    }
119
120    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
121    pub fn customize(
122        self,
123    ) -> crate::client::customize::CustomizableOperation<
124        crate::operation::import_certificate::ImportCertificateOutput,
125        crate::operation::import_certificate::ImportCertificateError,
126        Self,
127    > {
128        crate::client::customize::CustomizableOperation::new(self)
129    }
130    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
131        self.set_config_override(::std::option::Option::Some(config_override.into()));
132        self
133    }
134
135    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
136        self.config_override = config_override;
137        self
138    }
139    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of an imported certificate to replace. To import a new certificate, omit this field.</p>
140    pub fn certificate_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.certificate_arn(input.into());
142        self
143    }
144    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of an imported certificate to replace. To import a new certificate, omit this field.</p>
145    pub fn set_certificate_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.inner = self.inner.set_certificate_arn(input);
147        self
148    }
149    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of an imported certificate to replace. To import a new certificate, omit this field.</p>
150    pub fn get_certificate_arn(&self) -> &::std::option::Option<::std::string::String> {
151        self.inner.get_certificate_arn()
152    }
153    /// <p>The certificate to import.</p>
154    pub fn certificate(mut self, input: ::aws_smithy_types::Blob) -> Self {
155        self.inner = self.inner.certificate(input);
156        self
157    }
158    /// <p>The certificate to import.</p>
159    pub fn set_certificate(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
160        self.inner = self.inner.set_certificate(input);
161        self
162    }
163    /// <p>The certificate to import.</p>
164    pub fn get_certificate(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
165        self.inner.get_certificate()
166    }
167    /// <p>The private key that matches the public key in the certificate.</p>
168    pub fn private_key(mut self, input: ::aws_smithy_types::Blob) -> Self {
169        self.inner = self.inner.private_key(input);
170        self
171    }
172    /// <p>The private key that matches the public key in the certificate.</p>
173    pub fn set_private_key(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
174        self.inner = self.inner.set_private_key(input);
175        self
176    }
177    /// <p>The private key that matches the public key in the certificate.</p>
178    pub fn get_private_key(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
179        self.inner.get_private_key()
180    }
181    /// <p>The PEM encoded certificate chain.</p>
182    pub fn certificate_chain(mut self, input: ::aws_smithy_types::Blob) -> Self {
183        self.inner = self.inner.certificate_chain(input);
184        self
185    }
186    /// <p>The PEM encoded certificate chain.</p>
187    pub fn set_certificate_chain(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
188        self.inner = self.inner.set_certificate_chain(input);
189        self
190    }
191    /// <p>The PEM encoded certificate chain.</p>
192    pub fn get_certificate_chain(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
193        self.inner.get_certificate_chain()
194    }
195    ///
196    /// Appends an item to `Tags`.
197    ///
198    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
199    ///
200    /// <p>One or more resource tags to associate with the imported certificate.</p>
201    /// <p>Note: You cannot apply tags when reimporting a certificate.</p>
202    pub fn tags(mut self, input: crate::types::Tag) -> Self {
203        self.inner = self.inner.tags(input);
204        self
205    }
206    /// <p>One or more resource tags to associate with the imported certificate.</p>
207    /// <p>Note: You cannot apply tags when reimporting a certificate.</p>
208    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
209        self.inner = self.inner.set_tags(input);
210        self
211    }
212    /// <p>One or more resource tags to associate with the imported certificate.</p>
213    /// <p>Note: You cannot apply tags when reimporting a certificate.</p>
214    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
215        self.inner.get_tags()
216    }
217}