aws_sdk_kms/operation/retire_grant/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::retire_grant::_retire_grant_output::RetireGrantOutputBuilder;
3
4pub use crate::operation::retire_grant::_retire_grant_input::RetireGrantInputBuilder;
5
6impl crate::operation::retire_grant::builders::RetireGrantInputBuilder {
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::retire_grant::RetireGrantOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::retire_grant::RetireGrantError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.retire_grant();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `RetireGrant`.
24///
25/// <p>Deletes a grant. Typically, you retire a grant when you no longer need its permissions. To identify the grant to retire, use a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">grant token</a>, or both the grant ID and a key identifier (key ID or key ARN) of the KMS key. The <code>CreateGrant</code> operation returns both values.</p>
26/// <p>This operation can be called by the <i>retiring principal</i> for a grant, by the <i>grantee principal</i> if the grant allows the <code>RetireGrant</code> operation, and by the Amazon Web Services account in which the grant is created. It can also be called by principals to whom permission for retiring a grant is delegated. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#grant-delete">Retiring and revoking grants</a> in the <i>Key Management Service Developer Guide</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. You can retire a grant on a KMS key in a different Amazon Web Services account.</p>
29/// <p><b>Required permissions</b>: Permission to retire a grant is determined primarily by the grant. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#grant-delete">Retiring and revoking grants</a> in the <i>Key Management Service Developer Guide</i>.</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>RevokeGrant</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 RetireGrantFluentBuilder {
44    handle: ::std::sync::Arc<crate::client::Handle>,
45    inner: crate::operation::retire_grant::builders::RetireGrantInputBuilder,
46    config_override: ::std::option::Option<crate::config::Builder>,
47}
48impl
49    crate::client::customize::internal::CustomizableSend<
50        crate::operation::retire_grant::RetireGrantOutput,
51        crate::operation::retire_grant::RetireGrantError,
52    > for RetireGrantFluentBuilder
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::retire_grant::RetireGrantOutput,
60            crate::operation::retire_grant::RetireGrantError,
61        >,
62    > {
63        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
64    }
65}
66impl RetireGrantFluentBuilder {
67    /// Creates a new `RetireGrantFluentBuilder`.
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 RetireGrant as a reference.
76    pub fn as_input(&self) -> &crate::operation::retire_grant::builders::RetireGrantInputBuilder {
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::retire_grant::RetireGrantOutput,
91        ::aws_smithy_runtime_api::client::result::SdkError<
92            crate::operation::retire_grant::RetireGrantError,
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::retire_grant::RetireGrant::operation_runtime_plugins(
101            self.handle.runtime_plugins.clone(),
102            &self.handle.conf,
103            self.config_override,
104        );
105        crate::operation::retire_grant::RetireGrant::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::retire_grant::RetireGrantOutput,
113        crate::operation::retire_grant::RetireGrantError,
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>Identifies the grant to be retired. You can use a grant token to identify a new grant even before it has achieved eventual consistency.</p>
128    /// <p>Only the <code>CreateGrant</code> operation returns a grant token. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-eventual-consistency">Eventual consistency</a> in the <i>Key Management Service Developer Guide</i>.</p>
129    pub fn grant_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.grant_token(input.into());
131        self
132    }
133    /// <p>Identifies the grant to be retired. You can use a grant token to identify a new grant even before it has achieved eventual consistency.</p>
134    /// <p>Only the <code>CreateGrant</code> operation returns a grant token. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-eventual-consistency">Eventual consistency</a> in the <i>Key Management Service Developer Guide</i>.</p>
135    pub fn set_grant_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_grant_token(input);
137        self
138    }
139    /// <p>Identifies the grant to be retired. You can use a grant token to identify a new grant even before it has achieved eventual consistency.</p>
140    /// <p>Only the <code>CreateGrant</code> operation returns a grant token. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token">Grant token</a> and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-eventual-consistency">Eventual consistency</a> in the <i>Key Management Service Developer Guide</i>.</p>
141    pub fn get_grant_token(&self) -> &::std::option::Option<::std::string::String> {
142        self.inner.get_grant_token()
143    }
144    /// <p>The key ARN KMS key associated with the grant. To find the key ARN, use the <code>ListKeys</code> operation.</p>
145    /// <p>For example: <code>arn:aws:kms:us-east-2:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p>
146    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.key_id(input.into());
148        self
149    }
150    /// <p>The key ARN KMS key associated with the grant. To find the key ARN, use the <code>ListKeys</code> operation.</p>
151    /// <p>For example: <code>arn:aws:kms:us-east-2:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p>
152    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153        self.inner = self.inner.set_key_id(input);
154        self
155    }
156    /// <p>The key ARN KMS key associated with the grant. To find the key ARN, use the <code>ListKeys</code> operation.</p>
157    /// <p>For example: <code>arn:aws:kms:us-east-2:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab</code></p>
158    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
159        self.inner.get_key_id()
160    }
161    /// <p>Identifies the grant to retire. To get the grant ID, use <code>CreateGrant</code>, <code>ListGrants</code>, or <code>ListRetirableGrants</code>.</p>
162    /// <ul>
163    /// <li>
164    /// <p>Grant ID Example - 0123456789012345678901234567890123456789012345678901234567890123</p></li>
165    /// </ul>
166    pub fn grant_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167        self.inner = self.inner.grant_id(input.into());
168        self
169    }
170    /// <p>Identifies the grant to retire. To get the grant ID, use <code>CreateGrant</code>, <code>ListGrants</code>, or <code>ListRetirableGrants</code>.</p>
171    /// <ul>
172    /// <li>
173    /// <p>Grant ID Example - 0123456789012345678901234567890123456789012345678901234567890123</p></li>
174    /// </ul>
175    pub fn set_grant_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
176        self.inner = self.inner.set_grant_id(input);
177        self
178    }
179    /// <p>Identifies the grant to retire. To get the grant ID, use <code>CreateGrant</code>, <code>ListGrants</code>, or <code>ListRetirableGrants</code>.</p>
180    /// <ul>
181    /// <li>
182    /// <p>Grant ID Example - 0123456789012345678901234567890123456789012345678901234567890123</p></li>
183    /// </ul>
184    pub fn get_grant_id(&self) -> &::std::option::Option<::std::string::String> {
185        self.inner.get_grant_id()
186    }
187    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
188    /// <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>
189    pub fn dry_run(mut self, input: bool) -> Self {
190        self.inner = self.inner.dry_run(input);
191        self
192    }
193    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
194    /// <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>
195    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
196        self.inner = self.inner.set_dry_run(input);
197        self
198    }
199    /// <p>Checks if your request will succeed. <code>DryRun</code> is an optional parameter.</p>
200    /// <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>
201    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
202        self.inner.get_dry_run()
203    }
204}