aws_sdk_kms/operation/update_primary_region/builders.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::update_primary_region::_update_primary_region_output::UpdatePrimaryRegionOutputBuilder;
pub use crate::operation::update_primary_region::_update_primary_region_input::UpdatePrimaryRegionInputBuilder;
impl crate::operation::update_primary_region::builders::UpdatePrimaryRegionInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::update_primary_region::UpdatePrimaryRegionOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::update_primary_region::UpdatePrimaryRegionError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.update_primary_region();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `UpdatePrimaryRegion`.
///
/// <p>Changes the primary key of a multi-Region key.</p>
/// <p>This operation changes the replica key in the specified Region to a primary key and changes the former primary key to a replica key. For example, suppose you have a primary key in <code>us-east-1</code> and a replica key in <code>eu-west-2</code>. If you run <code>UpdatePrimaryRegion</code> with a <code>PrimaryRegion</code> value of <code>eu-west-2</code>, the primary key is now the key in <code>eu-west-2</code>, and the key in <code>us-east-1</code> becomes a replica key. For details, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-manage.html#multi-region-update">Updating the primary Region</a> in the <i>Key Management Service Developer Guide</i>.</p>
/// <p>This operation supports <i>multi-Region keys</i>, an KMS feature that lets you create multiple interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">Multi-Region keys in KMS</a> in the <i>Key Management Service Developer Guide</i>.</p>
/// <p>The <i>primary key</i> of a multi-Region key is the source for properties that are always shared by primary and replica keys, including the key material, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-id">key ID</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-spec">key spec</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-usage">key usage</a>, <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-origin">key material origin</a>, and <a href="https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html">automatic key rotation</a>. It's the only key that can be replicated. You cannot <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_ScheduleKeyDeletion.html">delete the primary key</a> until all replica keys are deleted.</p>
/// <p>The key ID and primary Region that you specify uniquely identify the replica key that will become the primary key. The primary Region must already have a replica key. This operation does not create a KMS key in the specified Region. To find the replica keys, use the <code>DescribeKey</code> operation on the primary key or any replica key. To create a replica key, use the <code>ReplicateKey</code> operation.</p>
/// <p>You can run this operation while using the affected multi-Region keys in cryptographic operations. This operation should not delay, interrupt, or cause failures in cryptographic operations.</p>
/// <p>Even after this operation completes, the process of updating the primary Region might still be in progress for a few more seconds. Operations such as <code>DescribeKey</code> might display both the old and new primary keys as replicas. The old and new primary keys have a transient key state of <code>Updating</code>. The original key state is restored when the update is complete. While the key state is <code>Updating</code>, you can use the keys in cryptographic operations, but you cannot replicate the new primary key or perform certain management operations, such as enabling or disabling these keys. For details about the <code>Updating</code> key state, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key states of KMS keys</a> in the <i>Key Management Service Developer Guide</i>.</p>
/// <p>This operation does not return any output. To verify that primary key is changed, use the <code>DescribeKey</code> operation.</p>
/// <p><b>Cross-account use</b>: No. You cannot use this operation in a different Amazon Web Services account.</p>
/// <p><b>Required permissions</b>:</p>
/// <ul>
/// <li>
/// <p><code>kms:UpdatePrimaryRegion</code> on the current primary key (in the primary key's Region). Include this permission primary key's key policy.</p></li>
/// <li>
/// <p><code>kms:UpdatePrimaryRegion</code> on the current replica key (in the replica key's Region). Include this permission in the replica key's key policy.</p></li>
/// </ul>
/// <p><b>Related operations</b></p>
/// <ul>
/// <li>
/// <p><code>CreateKey</code></p></li>
/// <li>
/// <p><code>ReplicateKey</code></p></li>
/// </ul>
/// <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>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct UpdatePrimaryRegionFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::update_primary_region::builders::UpdatePrimaryRegionInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::update_primary_region::UpdatePrimaryRegionOutput,
crate::operation::update_primary_region::UpdatePrimaryRegionError,
> for UpdatePrimaryRegionFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::update_primary_region::UpdatePrimaryRegionOutput,
crate::operation::update_primary_region::UpdatePrimaryRegionError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl UpdatePrimaryRegionFluentBuilder {
/// Creates a new `UpdatePrimaryRegionFluentBuilder`.
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
config_override: ::std::option::Option::None,
}
}
/// Access the UpdatePrimaryRegion as a reference.
pub fn as_input(&self) -> &crate::operation::update_primary_region::builders::UpdatePrimaryRegionInputBuilder {
&self.inner
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::update_primary_region::UpdatePrimaryRegionOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::update_primary_region::UpdatePrimaryRegionError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let input = self
.inner
.build()
.map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
let runtime_plugins = crate::operation::update_primary_region::UpdatePrimaryRegion::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::update_primary_region::UpdatePrimaryRegion::orchestrate(&runtime_plugins, input).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being sent.
pub fn customize(
self,
) -> crate::client::customize::CustomizableOperation<
crate::operation::update_primary_region::UpdatePrimaryRegionOutput,
crate::operation::update_primary_region::UpdatePrimaryRegionError,
Self,
> {
crate::client::customize::CustomizableOperation::new(self)
}
pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
self.set_config_override(::std::option::Option::Some(config_override.into()));
self
}
pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
self.config_override = config_override;
self
}
/// <p>Identifies the current primary key. When the operation completes, this KMS key will be a replica key.</p>
/// <p>Specify the key ID or key ARN of a multi-Region primary key.</p>
/// <p>For example:</p>
/// <ul>
/// <li>
/// <p>Key ID: <code>mrk-1234abcd12ab34cd56ef1234567890ab</code></p></li>
/// <li>
/// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab</code></p></li>
/// </ul>
/// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.key_id(input.into());
self
}
/// <p>Identifies the current primary key. When the operation completes, this KMS key will be a replica key.</p>
/// <p>Specify the key ID or key ARN of a multi-Region primary key.</p>
/// <p>For example:</p>
/// <ul>
/// <li>
/// <p>Key ID: <code>mrk-1234abcd12ab34cd56ef1234567890ab</code></p></li>
/// <li>
/// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab</code></p></li>
/// </ul>
/// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_key_id(input);
self
}
/// <p>Identifies the current primary key. When the operation completes, this KMS key will be a replica key.</p>
/// <p>Specify the key ID or key ARN of a multi-Region primary key.</p>
/// <p>For example:</p>
/// <ul>
/// <li>
/// <p>Key ID: <code>mrk-1234abcd12ab34cd56ef1234567890ab</code></p></li>
/// <li>
/// <p>Key ARN: <code>arn:aws:kms:us-east-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab</code></p></li>
/// </ul>
/// <p>To get the key ID and key ARN for a KMS key, use <code>ListKeys</code> or <code>DescribeKey</code>.</p>
pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_key_id()
}
/// <p>The Amazon Web Services Region of the new primary key. Enter the Region ID, such as <code>us-east-1</code> or <code>ap-southeast-2</code>. There must be an existing replica key in this Region.</p>
/// <p>When the operation completes, the multi-Region key in this Region will be the primary key.</p>
pub fn primary_region(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.primary_region(input.into());
self
}
/// <p>The Amazon Web Services Region of the new primary key. Enter the Region ID, such as <code>us-east-1</code> or <code>ap-southeast-2</code>. There must be an existing replica key in this Region.</p>
/// <p>When the operation completes, the multi-Region key in this Region will be the primary key.</p>
pub fn set_primary_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_primary_region(input);
self
}
/// <p>The Amazon Web Services Region of the new primary key. Enter the Region ID, such as <code>us-east-1</code> or <code>ap-southeast-2</code>. There must be an existing replica key in this Region.</p>
/// <p>When the operation completes, the multi-Region key in this Region will be the primary key.</p>
pub fn get_primary_region(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_primary_region()
}
}