Removes the link between a primary secret in your account and a cross-account replica secret, and stops replication to the replica secret. Call this operation on the primary secret. This action removes the replica association created by AssociateCrossAccountReplica.
Disassociating the replica from the primary does not delete the replica secret or convert the replica secret to a standalone secret. The replica secret remains in the other account and its replication status changes to Detached. Secrets Manager no longer sends updates from the primary secret to the replica secret after disassociation. To convert a detached replica into a standalone secret, call StopReplicationToReplica on the replica secret.
You must disassociate a cross-account replica before you call DeleteSecret for the primary secret. The DeleteSecret call fails if any replicas are still associated with the primary secret.
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 Logging Secrets Manager events with CloudTrail.
Required permissions: secretsmanager:DisassociateCrossAccountReplica. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.
Parameters:
-
secret_id
(SecretIdType)
–
The ARN or name of the primary secret in your account.
For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
-
cross_account_replica_arn
(SecretARNType)
–
The ARN of the cross-account replica secret to unlink from the primary secret.
Raises:
Examples:
To stop replicating a secret to another account from the primary account
The following example, called from the primary account, removes the link between a primary secret and its cross-account replica and stops replication. The replica secret remains in the other account, now with a replication status of Detached.
>>> await client.disassociate_cross_account_replica(secret_id='MyTestDatabaseSecret', cross_account_replica_arn='arn:aws:secretsmanager:us-west-2:222222222222:secret:MyReplicaSecret-a1b2c3')
Source code in docs_src/capo_secrets_manager/_services/async_secrets_manager.py
| async def disassociate_cross_account_replica(
self,
secret_id: "capo_secrets_manager.types.secret_id_type.SecretIdType",
cross_account_replica_arn: "capo_secrets_manager.types.secret_arn_type.SecretARNType",
*,
config_overrides: Optional[AsyncSecretsManagerClientConfig] = None,
) -> "capo_secrets_manager.types.disassociate_cross_account_replica_response.DisassociateCrossAccountReplicaResponse":
"""<p>Removes the link between a primary secret in your account and a cross-account replica secret, and stops replication to the replica secret. Call this operation on the primary secret. This action removes the replica association created by <a>AssociateCrossAccountReplica</a>.</p> <p>Disassociating the replica from the primary does not delete the replica secret or convert the replica secret to a standalone secret. The replica secret remains in the other account and its replication status changes to <code>Detached</code>. Secrets Manager no longer sends updates from the primary secret to the replica secret after disassociation. To convert a detached replica into a standalone secret, call <a>StopReplicationToReplica</a> on the replica secret.</p> <p>You must disassociate a cross-account replica before you call <a>DeleteSecret</a> for the primary secret. The <a>DeleteSecret</a> call fails if any replicas are still associated with the primary secret.</p> <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> <p> <b>Required permissions: </b> <code>secretsmanager:DisassociateCrossAccountReplica</code>. 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>
Args:
secret_id: <p>The ARN or name of the primary secret in your account.</p> <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>
cross_account_replica_arn: <p>The ARN of the cross-account replica secret to unlink from the primary secret.</p>
Raises:
capo_secrets_manager.errors.internal_service_error.InternalServiceError: <p>An error occurred on the server side.</p>
capo_secrets_manager.errors.invalid_parameter_exception.InvalidParameterException: <p>The parameter name or value is invalid.</p>
capo_secrets_manager.errors.invalid_request_exception.InvalidRequestException: <p>A parameter value is not valid for the current state of the resource.</p> <p>Possible causes:</p> <ul> <li> <p>The secret is scheduled for deletion.</p> </li> <li> <p>You tried to enable rotation on a secret that doesn't already have a Lambda function ARN configured and you didn't include such an ARN as a parameter in this call. </p> </li> <li> <p>The secret is managed by another service, and you must use that service to update it. For more information, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/service-linked-secrets.html">Secrets managed by other Amazon Web Services services</a>.</p> </li> </ul>
capo_secrets_manager.errors.resource_not_found_exception.ResourceNotFoundException: <p>Secrets Manager can't find the resource that you asked for.</p>
capo_secrets_manager.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To stop replicating a secret to another account from the primary account
The following example, called from the primary account, removes the link between a primary secret and its cross-account replica and stops replication. The replica secret remains in the other account, now with a replication status of Detached.
>>> await client.disassociate_cross_account_replica(secret_id='MyTestDatabaseSecret', cross_account_replica_arn='arn:aws:secretsmanager:us-west-2:222222222222:secret:MyReplicaSecret-a1b2c3')
"""
async def _handler(
req: "AsyncOperationRequest[capo_secrets_manager.types.disassociate_cross_account_replica_request.DisassociateCrossAccountReplicaRequest]",
) -> AsyncOperationResponse[
"capo_secrets_manager.types.disassociate_cross_account_replica_response.DisassociateCrossAccountReplicaResponse"
]:
import capo_secrets_manager._operations.secretsmanager.disassociate_cross_account_replica
(
output,
http_response,
) = await capo_secrets_manager._operations.secretsmanager.disassociate_cross_account_replica.async_disassociate_cross_account_replica(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DisassociateCrossAccountReplica")
)
input_: capo_secrets_manager.types.disassociate_cross_account_replica_request.DisassociateCrossAccountReplicaRequest = {
"secret_id": secret_id,
"cross_account_replica_arn": cross_account_replica_arn,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|