aws_sdk_kms/operation/revoke_grant/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::revoke_grant::_revoke_grant_output::RevokeGrantOutputBuilder;
3
4pub use crate::operation::revoke_grant::_revoke_grant_input::RevokeGrantInputBuilder;
5
6impl crate::operation::revoke_grant::builders::RevokeGrantInputBuilder {
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::revoke_grant::RevokeGrantOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::revoke_grant::RevokeGrantError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.revoke_grant();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `RevokeGrant`.
24///
25/// <p>Deletes the specified grant. You revoke a grant to terminate the permissions that the grant allows. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#grant-delete">Retiring and revoking grants</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p>
26/// <p>When you create, retire, or revoke a grant, there might be a brief delay, usually less than five minutes, until the grant is available throughout KMS. This state is known as <i>eventual consistency</i>. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-eventual-consistency">Eventual consistency</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p>
27/// <p>For detailed information about grants, including grant terminology, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html">Grants in KMS</a> in the <i> <i>Key Management Service Developer Guide</i> </i>. For examples of working with grants in several programming languages, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-grants.html">Programming grants</a>.</p>
28/// <p><b>Cross-account use</b>: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key ARN in the value of the <code>KeyId</code> parameter.</p>
29/// <p><b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:RevokeGrant</a> (key policy).</p>
30/// <p><b>Related operations:</b></p>
31/// <ul>
32/// <li>
33/// <p><code>CreateGrant</code></p></li>
34/// <li>
35/// <p><code>ListGrants</code></p></li>
36/// <li>
37/// <p><code>ListRetirableGrants</code></p></li>
38/// <li>
39/// <p><code>RetireGrant</code></p></li>
40/// </ul>
41/// <p><b>Eventual consistency</b>: The KMS API follows an eventual consistency model. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html">KMS eventual consistency</a>.</p>
42#[derive(::std::clone::Clone, ::std::fmt::Debug)]
43pub struct RevokeGrantFluentBuilder {
44 handle: ::std::sync::Arc<crate::client::Handle>,
45 inner: crate::operation::revoke_grant::builders::RevokeGrantInputBuilder,
46 config_override: ::std::option::Option<crate::config::Builder>,
47}
48impl
49 crate::client::customize::internal::CustomizableSend<
50 crate::operation::revoke_grant::RevokeGrantOutput,
51 crate::operation::revoke_grant::RevokeGrantError,
52 > for RevokeGrantFluentBuilder
53{
54 fn send(
55 self,
56 config_override: crate::config::Builder,
57 ) -> crate::client::customize::internal::BoxFuture<
58 crate::client::customize::internal::SendResult<
59 crate::operation::revoke_grant::RevokeGrantOutput,
60 crate::operation::revoke_grant::RevokeGrantError,
61 >,
62 > {
63 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
64 }
65}
66impl RevokeGrantFluentBuilder {
67 /// Creates a new `RevokeGrantFluentBuilder`.
68 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
69 Self {
70 handle,
71 inner: ::std::default::Default::default(),
72 config_override: ::std::option::Option::None,
73 }
74 }
75 /// Access the RevokeGrant as a reference.
76 pub fn as_input(&self) -> &crate::operation::revoke_grant::builders::RevokeGrantInputBuilder {
77 &self.inner
78 }
79 /// Sends the request and returns the response.
80 ///
81 /// If an error occurs, an `SdkError` will be returned with additional details that
82 /// can be matched against.
83 ///
84 /// By default, any retryable failures will be retried twice. Retry behavior
85 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
86 /// set when configuring the client.
87 pub async fn send(
88 self,
89 ) -> ::std::result::Result<
90 crate::operation::revoke_grant::RevokeGrantOutput,
91 ::aws_smithy_runtime_api::client::result::SdkError<
92 crate::operation::revoke_grant::RevokeGrantError,
93 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
94 >,
95 > {
96 let input = self
97 .inner
98 .build()
99 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
100 let runtime_plugins = crate::operation::revoke_grant::RevokeGrant::operation_runtime_plugins(
101 self.handle.runtime_plugins.clone(),
102 &self.handle.conf,
103 self.config_override,
104 );
105 crate::operation::revoke_grant::RevokeGrant::orchestrate(&runtime_plugins, input).await
106 }
107
108 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
109 pub fn customize(
110 self,
111 ) -> crate::client::customize::CustomizableOperation<
112 crate::operation::revoke_grant::RevokeGrantOutput,
113 crate::operation::revoke_grant::RevokeGrantError,
114 Self,
115 > {
116 crate::client::customize::CustomizableOperation::new(self)
117 }
118 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
119 self.set_config_override(::std::option::Option::Some(config_override.into()));
120 self
121 }
122
123 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
124 self.config_override = config_override;
125 self
126 }
127 /// <p>A unique identifier for the KMS key associated with the grant. To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
128 /// <p>Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN.</p>
129 /// <p>For example:</p>
130 /// <ul>
131 /// <li>
132 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
133 /// <li>
134 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
135 /// </ul>
136 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
137 pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138 self.inner = self.inner.key_id(input.into());
139 self
140 }
141 /// <p>A unique identifier for the KMS key associated with the grant. To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
142 /// <p>Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN.</p>
143 /// <p>For example:</p>
144 /// <ul>
145 /// <li>
146 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
147 /// <li>
148 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
149 /// </ul>
150 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
151 pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152 self.inner = self.inner.set_key_id(input);
153 self
154 }
155 /// <p>A unique identifier for the KMS key associated with the grant. To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
156 /// <p>Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN.</p>
157 /// <p>For example:</p>
158 /// <ul>
159 /// <li>
160 /// <p>Key ID: <code>1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
161 /// <li>
162 /// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p></li>
163 /// </ul>
164 /// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
165 pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
166 self.inner.get_key_id()
167 }
168 /// <p>Identifies the grant to revoke. To get the grant ID, use <code>CreateGrant</code>, <code>ListGrants</code>, or <code>ListRetirableGrants</code>.</p>
169 pub fn grant_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170 self.inner = self.inner.grant_id(input.into());
171 self
172 }
173 /// <p>Identifies the grant to revoke. To get the grant ID, use <code>CreateGrant</code>, <code>ListGrants</code>, or <code>ListRetirableGrants</code>.</p>
174 pub fn set_grant_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175 self.inner = self.inner.set_grant_id(input);
176 self
177 }
178 /// <p>Identifies the grant to revoke. To get the grant ID, use <code>CreateGrant</code>, <code>ListGrants</code>, or <code>ListRetirableGrants</code>.</p>
179 pub fn get_grant_id(&self) -> &::std::option::Option<::std::string::String> {
180 self.inner.get_grant_id()
181 }
182 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
183 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html">Testing your KMS API calls</a> in the <i>Key Management Service Developer Guide</i>.</p>
184 pub fn dry_run(mut self, input: bool) -> Self {
185 self.inner = self.inner.dry_run(input);
186 self
187 }
188 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
189 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html">Testing your KMS API calls</a> in the <i>Key Management Service Developer Guide</i>.</p>
190 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
191 self.inner = self.inner.set_dry_run(input);
192 self
193 }
194 /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
195 /// <p>To learn more about how to use this parameter, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html">Testing your KMS API calls</a> in the <i>Key Management Service Developer Guide</i>.</p>
196 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
197 self.inner.get_dry_run()
198 }
199}