Skip to main content

aws_sdk_secretsmanager/operation/associate_cross_account_replica/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::associate_cross_account_replica::_associate_cross_account_replica_input::AssociateCrossAccountReplicaInputBuilder;
3
4pub use crate::operation::associate_cross_account_replica::_associate_cross_account_replica_output::AssociateCrossAccountReplicaOutputBuilder;
5
6impl crate::operation::associate_cross_account_replica::builders::AssociateCrossAccountReplicaInputBuilder {
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::associate_cross_account_replica::AssociateCrossAccountReplicaOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::associate_cross_account_replica::AssociateCrossAccountReplicaError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.associate_cross_account_replica();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `AssociateCrossAccountReplica`.
24///
25/// <p>Links a primary secret in your account to a replica secret in a different Amazon Web Services account and starts replication to this replica. The replica secret must already exist in the other Amazon Web Services account. Create the replica with <code>CreateSecret</code> and set its <code>CrossAccountPrimaryARN</code> field set to this primary secret's ARN. When you call AssociateCrossAccountReplica, Secrets Manager calls AcceptCrossAccountReplication on the replica secret on your behalf.</p>
26/// <p>The primary and replica secrets must be in the same Amazon Web Services Region and partition, and you must call this operation from the account that owns the primary secret. A primary secret can have at most one cross-account replica. This operation is idempotent, so you can call it again for the same replica to repair replication. If the association fails, Secrets Manager does not modify either the primary or replica secret.</p>
27/// <p>Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieve-ct-entries.html">Logging Secrets Manager events with CloudTrail</a>.</p>
28/// <p><b>Required permissions: </b> <code>secretsmanager:AssociateCrossAccountReplica</code>, <code>secretsmanager:GetSecretValue</code> on the primary secret, and <code>secretsmanager:AcceptCrossAccountReplication</code> on the replica secret. You must also have <code>kms:Decrypt</code> permission for the Key Management Service (KMS) key that encrypts the primary secret, and <code>kms:Encrypt</code> permission for the Amazon Web Services KMS key that encrypts the replica secret. If you supply <code>ReplicationRoleARN</code>, you also need <code>iam:PassRole</code> for that role. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#reference_iam-permissions_actions"> IAM policy actions for Secrets Manager</a> and <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html">Authentication and access control in Secrets Manager</a>.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct AssociateCrossAccountReplicaFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::associate_cross_account_replica::builders::AssociateCrossAccountReplicaInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::associate_cross_account_replica::AssociateCrossAccountReplicaOutput,
38        crate::operation::associate_cross_account_replica::AssociateCrossAccountReplicaError,
39    > for AssociateCrossAccountReplicaFluentBuilder
40{
41    fn send(
42        self,
43        config_override: crate::config::Builder,
44    ) -> crate::client::customize::internal::BoxFuture<
45        crate::client::customize::internal::SendResult<
46            crate::operation::associate_cross_account_replica::AssociateCrossAccountReplicaOutput,
47            crate::operation::associate_cross_account_replica::AssociateCrossAccountReplicaError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl AssociateCrossAccountReplicaFluentBuilder {
54    /// Creates a new `AssociateCrossAccountReplicaFluentBuilder`.
55    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56        Self {
57            handle,
58            inner: ::std::default::Default::default(),
59            config_override: ::std::option::Option::None,
60        }
61    }
62    /// Access the AssociateCrossAccountReplica as a reference.
63    pub fn as_input(&self) -> &crate::operation::associate_cross_account_replica::builders::AssociateCrossAccountReplicaInputBuilder {
64        &self.inner
65    }
66    /// Sends the request and returns the response.
67    ///
68    /// If an error occurs, an `SdkError` will be returned with additional details that
69    /// can be matched against.
70    ///
71    /// By default, any retryable failures will be retried twice. Retry behavior
72    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73    /// set when configuring the client.
74    pub async fn send(
75        self,
76    ) -> ::std::result::Result<
77        crate::operation::associate_cross_account_replica::AssociateCrossAccountReplicaOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::associate_cross_account_replica::AssociateCrossAccountReplicaError,
80            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81        >,
82    > {
83        let input = self
84            .inner
85            .build()
86            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87        let runtime_plugins = crate::operation::associate_cross_account_replica::AssociateCrossAccountReplica::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::associate_cross_account_replica::AssociateCrossAccountReplica::orchestrate(&runtime_plugins, input).await
93    }
94
95    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96    pub fn customize(
97        self,
98    ) -> crate::client::customize::CustomizableOperation<
99        crate::operation::associate_cross_account_replica::AssociateCrossAccountReplicaOutput,
100        crate::operation::associate_cross_account_replica::AssociateCrossAccountReplicaError,
101        Self,
102    > {
103        crate::client::customize::CustomizableOperation::new(self)
104    }
105    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106        self.set_config_override(::std::option::Option::Some(config_override.into()));
107        self
108    }
109
110    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111        self.config_override = config_override;
112        self
113    }
114    /// <p>The ARN or name of the primary secret in your account to replicate.</p>
115    /// <p>For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen">Finding a secret from a partial ARN</a>.</p>
116    pub fn secret_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.inner = self.inner.secret_id(input.into());
118        self
119    }
120    /// <p>The ARN or name of the primary secret in your account to replicate.</p>
121    /// <p>For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen">Finding a secret from a partial ARN</a>.</p>
122    pub fn set_secret_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.inner = self.inner.set_secret_id(input);
124        self
125    }
126    /// <p>The ARN or name of the primary secret in your account to replicate.</p>
127    /// <p>For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen">Finding a secret from a partial ARN</a>.</p>
128    pub fn get_secret_id(&self) -> &::std::option::Option<::std::string::String> {
129        self.inner.get_secret_id()
130    }
131    /// <p>The ARN of the replica secret in the other Amazon Web Services account. The replica secret must be in the same Region and partition as the primary secret. Additionally, the replica account owner must have created the replica secret as a cross-account replica of the primary secret. For more information see <code>CreateSecret</code>.</p>
132    pub fn cross_account_replica_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133        self.inner = self.inner.cross_account_replica_arn(input.into());
134        self
135    }
136    /// <p>The ARN of the replica secret in the other Amazon Web Services account. The replica secret must be in the same Region and partition as the primary secret. Additionally, the replica account owner must have created the replica secret as a cross-account replica of the primary secret. For more information see <code>CreateSecret</code>.</p>
137    pub fn set_cross_account_replica_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.inner = self.inner.set_cross_account_replica_arn(input);
139        self
140    }
141    /// <p>The ARN of the replica secret in the other Amazon Web Services account. The replica secret must be in the same Region and partition as the primary secret. Additionally, the replica account owner must have created the replica secret as a cross-account replica of the primary secret. For more information see <code>CreateSecret</code>.</p>
142    pub fn get_cross_account_replica_arn(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_cross_account_replica_arn()
144    }
145    /// <p>Whether the replica account must belong to the same Amazon Web Services organization as the primary account:</p>
146    /// <ul>
147    /// <li>
148    /// <p><code>SameOrg</code>, which requires the replica account to be in the same organization as the primary account. This is the default.</p></li>
149    /// <li>
150    /// <p><code>NoRestriction</code>, which allows the replica account to be in any organization.</p></li>
151    /// </ul>
152    pub fn replica_restriction(mut self, input: crate::types::ReplicaRestrictionType) -> Self {
153        self.inner = self.inner.replica_restriction(input);
154        self
155    }
156    /// <p>Whether the replica account must belong to the same Amazon Web Services organization as the primary account:</p>
157    /// <ul>
158    /// <li>
159    /// <p><code>SameOrg</code>, which requires the replica account to be in the same organization as the primary account. This is the default.</p></li>
160    /// <li>
161    /// <p><code>NoRestriction</code>, which allows the replica account to be in any organization.</p></li>
162    /// </ul>
163    pub fn set_replica_restriction(mut self, input: ::std::option::Option<crate::types::ReplicaRestrictionType>) -> Self {
164        self.inner = self.inner.set_replica_restriction(input);
165        self
166    }
167    /// <p>Whether the replica account must belong to the same Amazon Web Services organization as the primary account:</p>
168    /// <ul>
169    /// <li>
170    /// <p><code>SameOrg</code>, which requires the replica account to be in the same organization as the primary account. This is the default.</p></li>
171    /// <li>
172    /// <p><code>NoRestriction</code>, which allows the replica account to be in any organization.</p></li>
173    /// </ul>
174    pub fn get_replica_restriction(&self) -> &::std::option::Option<crate::types::ReplicaRestrictionType> {
175        self.inner.get_replica_restriction()
176    }
177    /// <p>The ARN of an IAM role in the primary account that Secrets Manager assumes to perform replication. If you don't include this field, Secrets Manager replicates using the credentials of caller who updates the primary secret. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/cross-account-replicate-permissions.html"> Cross-account replication permissions</a>.</p>
178    pub fn replication_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
179        self.inner = self.inner.replication_role_arn(input.into());
180        self
181    }
182    /// <p>The ARN of an IAM role in the primary account that Secrets Manager assumes to perform replication. If you don't include this field, Secrets Manager replicates using the credentials of caller who updates the primary secret. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/cross-account-replicate-permissions.html"> Cross-account replication permissions</a>.</p>
183    pub fn set_replication_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
184        self.inner = self.inner.set_replication_role_arn(input);
185        self
186    }
187    /// <p>The ARN of an IAM role in the primary account that Secrets Manager assumes to perform replication. If you don't include this field, Secrets Manager replicates using the credentials of caller who updates the primary secret. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/cross-account-replicate-permissions.html"> Cross-account replication permissions</a>.</p>
188    pub fn get_replication_role_arn(&self) -> &::std::option::Option<::std::string::String> {
189        self.inner.get_replication_role_arn()
190    }
191}