Switches over the specified secondary Amazon DocumentDB cluster to be the new primary Amazon DocumentDB cluster in the global database cluster.
Parameters:
-
global_cluster_identifier
(Optional[GlobalClusterIdentifier], default:
None
)
–
The identifier of the Amazon DocumentDB global database cluster to switch over. The identifier is the unique key assigned by the user when the cluster is created. In other words, it's the name of the global cluster. This parameter isn’t case-sensitive.
Constraints:
Pattern: [A-Za-z][0-9A-Za-z-:._]*
-
target_db_cluster_identifier
(Optional[DBClusterIdentifier], default:
None
)
–
The identifier of the secondary Amazon DocumentDB cluster to promote to the new primary for the global database cluster. Use the Amazon Resource Name (ARN) for the identifier so that Amazon DocumentDB can locate the cluster in its Amazon Web Services region.
Constraints:
Pattern: [A-Za-z][0-9A-Za-z-:._]*
Raises:
Source code in docs_src/capo_docdb/_services/doc_db.py
| def switchover_global_cluster(
self,
*,
config_overrides: Optional[DocDBClientConfig] = None,
global_cluster_identifier: Optional[
"capo_docdb.types.global_cluster_identifier.GlobalClusterIdentifier"
] = None,
target_db_cluster_identifier: Optional[
"capo_docdb.types.db_cluster_identifier.DBClusterIdentifier"
] = None,
) -> "capo_docdb.types.switchover_global_cluster_result.SwitchoverGlobalClusterResult":
"""<p>Switches over the specified secondary Amazon DocumentDB cluster to be the new primary Amazon DocumentDB cluster in the global database cluster.</p>
Args:
global_cluster_identifier: <p>The identifier of the Amazon DocumentDB global database cluster to switch over. The identifier is the unique key assigned by the user when the cluster is created. In other words, it's the name of the global cluster. This parameter isn’t case-sensitive.</p> <p>Constraints:</p> <ul> <li> <p>Must match the identifier of an existing global cluster (Amazon DocumentDB global database).</p> </li> <li> <p>Minimum length of 1. Maximum length of 255.</p> </li> </ul> <p>Pattern: <code>[A-Za-z][0-9A-Za-z-:._]*</code> </p>
target_db_cluster_identifier: <p>The identifier of the secondary Amazon DocumentDB cluster to promote to the new primary for the global database cluster. Use the Amazon Resource Name (ARN) for the identifier so that Amazon DocumentDB can locate the cluster in its Amazon Web Services region.</p> <p>Constraints:</p> <ul> <li> <p>Must match the identifier of an existing secondary cluster.</p> </li> <li> <p>Minimum length of 1. Maximum length of 255.</p> </li> </ul> <p>Pattern: <code>[A-Za-z][0-9A-Za-z-:._]*</code> </p>
Raises:
capo_docdb.errors.db_cluster_not_found_fault.DBClusterNotFoundFault: <p> <code>DBClusterIdentifier</code> doesn't refer to an existing cluster. </p>
capo_docdb.errors.global_cluster_not_found_fault.GlobalClusterNotFoundFault: <p>The <code>GlobalClusterIdentifier</code> doesn't refer to an existing global cluster.</p>
capo_docdb.errors.invalid_db_cluster_state_fault.InvalidDBClusterStateFault: <p>The cluster isn't in a valid state.</p>
capo_docdb.errors.invalid_global_cluster_state_fault.InvalidGlobalClusterStateFault: <p>The requested operation can't be performed while the cluster is in this state.</p>
capo_docdb.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_docdb.types.switchover_global_cluster_message.SwitchoverGlobalClusterMessage]",
) -> OperationResponse[
"capo_docdb.types.switchover_global_cluster_result.SwitchoverGlobalClusterResult"
]:
import capo_docdb._operations.amazon_rd_sv19.switchover_global_cluster
output, http_response = (
capo_docdb._operations.amazon_rd_sv19.switchover_global_cluster.switchover_global_cluster(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("SwitchoverGlobalCluster")
)
input_: capo_docdb.types.switchover_global_cluster_message.SwitchoverGlobalClusterMessage = {}
if global_cluster_identifier is not None:
input_["global_cluster_identifier"] = global_cluster_identifier
if target_db_cluster_identifier is not None:
input_["target_db_cluster_identifier"] = target_db_cluster_identifier
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|