aws_sdk_acmpca/operation/create_permission/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_permission::_create_permission_output::CreatePermissionOutputBuilder;
3
4pub use crate::operation::create_permission::_create_permission_input::CreatePermissionInputBuilder;
5
6impl crate::operation::create_permission::builders::CreatePermissionInputBuilder {
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::create_permission::CreatePermissionOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_permission::CreatePermissionError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_permission();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreatePermission`.
24///
25/// <p>Grants one or more permissions on a private CA to the Certificate Manager (ACM) service principal (<code>acm.amazonaws.com</code>). These permissions allow ACM to issue and renew ACM certificates that reside in the same Amazon Web Services account as the CA.</p>
26/// <p>You can list current permissions with the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_ListPermissions.html">ListPermissions</a> action and revoke them with the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_DeletePermission.html">DeletePermission</a> action.</p>
27/// <p class="title"><b>About Permissions</b></p>
28/// <ul>
29/// <li>
30/// <p>If the private CA and the certificates it issues reside in the same account, you can use <code>CreatePermission</code> to grant permissions for ACM to carry out automatic certificate renewals.</p></li>
31/// <li>
32/// <p>For automatic certificate renewal to succeed, the ACM service principal needs permissions to create, retrieve, and list certificates.</p></li>
33/// <li>
34/// <p>If the private CA and the ACM certificates reside in different accounts, then permissions cannot be used to enable automatic renewals. Instead, the ACM certificate owner must set up a resource-based policy to enable cross-account issuance and renewals. For more information, see <a href="https://docs.aws.amazon.com/privateca/latest/userguide/pca-rbp.html">Using a Resource Based Policy with Amazon Web Services Private CA</a>.</p></li>
35/// </ul>
36#[derive(::std::clone::Clone, ::std::fmt::Debug)]
37pub struct CreatePermissionFluentBuilder {
38 handle: ::std::sync::Arc<crate::client::Handle>,
39 inner: crate::operation::create_permission::builders::CreatePermissionInputBuilder,
40 config_override: ::std::option::Option<crate::config::Builder>,
41}
42impl
43 crate::client::customize::internal::CustomizableSend<
44 crate::operation::create_permission::CreatePermissionOutput,
45 crate::operation::create_permission::CreatePermissionError,
46 > for CreatePermissionFluentBuilder
47{
48 fn send(
49 self,
50 config_override: crate::config::Builder,
51 ) -> crate::client::customize::internal::BoxFuture<
52 crate::client::customize::internal::SendResult<
53 crate::operation::create_permission::CreatePermissionOutput,
54 crate::operation::create_permission::CreatePermissionError,
55 >,
56 > {
57 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
58 }
59}
60impl CreatePermissionFluentBuilder {
61 /// Creates a new `CreatePermissionFluentBuilder`.
62 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
63 Self {
64 handle,
65 inner: ::std::default::Default::default(),
66 config_override: ::std::option::Option::None,
67 }
68 }
69 /// Access the CreatePermission as a reference.
70 pub fn as_input(&self) -> &crate::operation::create_permission::builders::CreatePermissionInputBuilder {
71 &self.inner
72 }
73 /// Sends the request and returns the response.
74 ///
75 /// If an error occurs, an `SdkError` will be returned with additional details that
76 /// can be matched against.
77 ///
78 /// By default, any retryable failures will be retried twice. Retry behavior
79 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
80 /// set when configuring the client.
81 pub async fn send(
82 self,
83 ) -> ::std::result::Result<
84 crate::operation::create_permission::CreatePermissionOutput,
85 ::aws_smithy_runtime_api::client::result::SdkError<
86 crate::operation::create_permission::CreatePermissionError,
87 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
88 >,
89 > {
90 let input = self
91 .inner
92 .build()
93 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
94 let runtime_plugins = crate::operation::create_permission::CreatePermission::operation_runtime_plugins(
95 self.handle.runtime_plugins.clone(),
96 &self.handle.conf,
97 self.config_override,
98 );
99 crate::operation::create_permission::CreatePermission::orchestrate(&runtime_plugins, input).await
100 }
101
102 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
103 pub fn customize(
104 self,
105 ) -> crate::client::customize::CustomizableOperation<
106 crate::operation::create_permission::CreatePermissionOutput,
107 crate::operation::create_permission::CreatePermissionError,
108 Self,
109 > {
110 crate::client::customize::CustomizableOperation::new(self)
111 }
112 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
113 self.set_config_override(::std::option::Option::Some(config_override.into()));
114 self
115 }
116
117 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
118 self.config_override = config_override;
119 self
120 }
121 /// <p>The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_ListCertificateAuthorities.html">ListCertificateAuthorities</a> action. This must have the following form:</p>
122 /// <p><code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code>.</p>
123 pub fn certificate_authority_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124 self.inner = self.inner.certificate_authority_arn(input.into());
125 self
126 }
127 /// <p>The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_ListCertificateAuthorities.html">ListCertificateAuthorities</a> action. This must have the following form:</p>
128 /// <p><code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code>.</p>
129 pub fn set_certificate_authority_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130 self.inner = self.inner.set_certificate_authority_arn(input);
131 self
132 }
133 /// <p>The Amazon Resource Name (ARN) of the CA that grants the permissions. You can find the ARN by calling the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_ListCertificateAuthorities.html">ListCertificateAuthorities</a> action. This must have the following form:</p>
134 /// <p><code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code>.</p>
135 pub fn get_certificate_authority_arn(&self) -> &::std::option::Option<::std::string::String> {
136 self.inner.get_certificate_authority_arn()
137 }
138 /// <p>The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal is <code>acm.amazonaws.com</code>.</p>
139 pub fn principal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140 self.inner = self.inner.principal(input.into());
141 self
142 }
143 /// <p>The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal is <code>acm.amazonaws.com</code>.</p>
144 pub fn set_principal(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
145 self.inner = self.inner.set_principal(input);
146 self
147 }
148 /// <p>The Amazon Web Services service or identity that receives the permission. At this time, the only valid principal is <code>acm.amazonaws.com</code>.</p>
149 pub fn get_principal(&self) -> &::std::option::Option<::std::string::String> {
150 self.inner.get_principal()
151 }
152 /// <p>The ID of the calling account.</p>
153 pub fn source_account(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
154 self.inner = self.inner.source_account(input.into());
155 self
156 }
157 /// <p>The ID of the calling account.</p>
158 pub fn set_source_account(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
159 self.inner = self.inner.set_source_account(input);
160 self
161 }
162 /// <p>The ID of the calling account.</p>
163 pub fn get_source_account(&self) -> &::std::option::Option<::std::string::String> {
164 self.inner.get_source_account()
165 }
166 ///
167 /// Appends an item to `Actions`.
168 ///
169 /// To override the contents of this collection use [`set_actions`](Self::set_actions).
170 ///
171 /// <p>The actions that the specified Amazon Web Services service principal can use. These include <code>IssueCertificate</code>, <code>GetCertificate</code>, and <code>ListPermissions</code>.</p>
172 pub fn actions(mut self, input: crate::types::ActionType) -> Self {
173 self.inner = self.inner.actions(input);
174 self
175 }
176 /// <p>The actions that the specified Amazon Web Services service principal can use. These include <code>IssueCertificate</code>, <code>GetCertificate</code>, and <code>ListPermissions</code>.</p>
177 pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ActionType>>) -> Self {
178 self.inner = self.inner.set_actions(input);
179 self
180 }
181 /// <p>The actions that the specified Amazon Web Services service principal can use. These include <code>IssueCertificate</code>, <code>GetCertificate</code>, and <code>ListPermissions</code>.</p>
182 pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ActionType>> {
183 self.inner.get_actions()
184 }
185}