Skip to content

add_replication_peer async

add_replication_peer(
    domain_name: DomainName,
    peer_domain_arn: DomainArn,
    *,
    config_overrides: Optional[AsyncOpenSearchClientConfig] = None,
    dry_run: Optional[Boolean] = None,
) -> AddReplicationPeerResponse

Starts replicating a domain to a peer domain in another AWS Region. A domain can have one peer. The domain you call becomes the primary and the peer becomes the secondary, which receives a copy of the primary's indexes and serves read requests.

Replication is established asynchronously. Use the DescribeDomainReplication operation to check whether the relationship has reached the ACTIVE state.

Parameters:

  • peer_domain_arn (DomainArn) –

    The Amazon Resource Name (ARN) of the domain to replicate to. The peer must be in a different Region from the domain you are calling, and in the same AWS account.

  • dry_run (Optional[Boolean], default: None ) –

    When true, validates the request and reports whether replication could be established, without changing either domain.

Raises:

Source code in docs_src/capo_opensearch/_services/async_open_search.py
async def add_replication_peer(
    self,
    domain_name: "capo_opensearch.types.domain_name.DomainName",
    peer_domain_arn: "capo_opensearch.types.domain_arn.DomainArn",
    *,
    config_overrides: Optional[AsyncOpenSearchClientConfig] = None,
    dry_run: Optional["capo_opensearch.types.boolean.Boolean"] = None,
) -> (
    "capo_opensearch.types.add_replication_peer_response.AddReplicationPeerResponse"
):
    """<p>Starts replicating a domain to a peer domain in another AWS Region. A domain can have one peer. The domain you call becomes the primary and the peer becomes the secondary, which receives a copy of the primary's indexes and serves read requests.</p> <p>Replication is established asynchronously. Use the <code>DescribeDomainReplication</code> operation to check whether the relationship has reached the <code>ACTIVE</code> state.</p>

    Args:
        peer_domain_arn: <p>The Amazon Resource Name (ARN) of the domain to replicate to. The peer must be in a different Region from the domain you are calling, and in the same AWS account.</p>
        dry_run: <p>When <code>true</code>, validates the request and reports whether replication could be established, without changing either domain.</p>

    Raises:
        capo_opensearch.errors.disabled_operation_exception.DisabledOperationException: <p>An error occured because the client wanted to access an unsupported operation.</p>
        capo_opensearch.errors.internal_exception.InternalException: <p>Request processing failed because of an unknown error, exception, or internal failure.</p>
        capo_opensearch.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>An exception for creating a resource that already exists.</p>
        capo_opensearch.errors.resource_not_found_exception.ResourceNotFoundException: <p>An exception for accessing or deleting a resource that doesn't exist.</p>
        capo_opensearch.errors.validation_exception.ValidationException: <p>An exception for accessing or deleting a resource that doesn't exist.</p>
        capo_opensearch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_opensearch.types.add_replication_peer_request.AddReplicationPeerRequest]",
    ) -> AsyncOperationResponse[
        "capo_opensearch.types.add_replication_peer_response.AddReplicationPeerResponse"
    ]:
        import capo_opensearch._operations.amazon_open_search_service.add_replication_peer

        (
            output,
            http_response,
        ) = await capo_opensearch._operations.amazon_open_search_service.add_replication_peer.async_add_replication_peer(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AddReplicationPeer")
    )
    input_: capo_opensearch.types.add_replication_peer_request.AddReplicationPeerRequest = {
        "domain_name": domain_name,
        "peer_domain_arn": peer_domain_arn,
    }
    if dry_run is not None:
        input_["dry_run"] = dry_run

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output