Skip to content

failover_shard

failover_shard(
    cluster_name: String,
    shard_name: String,
    *,
    config_overrides: Optional[MemoryDBClientConfig] = None,
) -> FailoverShardResponse

Used to failover a shard. This API is designed for testing the behavior of your application in case of MemoryDB failover. It is not designed to be used as a production-level tool for initiating a failover to overcome a problem you may have with the cluster. Moreover, in certain conditions such as large scale operational events, Amazon may block this API.

Parameters:

  • cluster_name (String) –

    The cluster being failed over.

  • shard_name (String) –

    The name of the shard.

Raises:

Source code in docs_src/capo_memorydb/_services/memory_db.py
def failover_shard(
    self,
    cluster_name: "capo_memorydb.types.string.String",
    shard_name: "capo_memorydb.types.string.String",
    *,
    config_overrides: Optional[MemoryDBClientConfig] = None,
) -> "capo_memorydb.types.failover_shard_response.FailoverShardResponse":
    """<p>Used to failover a shard. This API is designed for testing the behavior of your application in case of MemoryDB failover. It is not designed to be used as a production-level tool for initiating a failover to overcome a problem you may have with the cluster. Moreover, in certain conditions such as large scale operational events, Amazon may block this API. </p>

    Args:
        cluster_name: <p>The cluster being failed over.</p>
        shard_name: <p>The name of the shard.</p>

    Raises:
        capo_memorydb.errors.api_call_rate_for_customer_exceeded_fault.APICallRateForCustomerExceededFault: <p>The customer has exceeded the maximum number of API requests allowed per time period.</p>
        capo_memorydb.errors.cluster_not_found_fault.ClusterNotFoundFault: <p>The specified cluster does not exist.</p>
        capo_memorydb.errors.invalid_cluster_state_fault.InvalidClusterStateFault: <p>The cluster is not in a valid state for the requested operation.</p>
        capo_memorydb.errors.invalid_kms_key_fault.InvalidKMSKeyFault: <p>The specified KMS key is not valid or accessible.</p>
        capo_memorydb.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>The specified parameter combination is not valid.</p>
        capo_memorydb.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The specified parameter value is not valid.</p>
        capo_memorydb.errors.shard_not_found_fault.ShardNotFoundFault: <p>The specified shard does not exist.</p>
        capo_memorydb.errors.test_failover_not_available_fault.TestFailoverNotAvailableFault: <p>Test failover is not available for this cluster configuration.</p>
        capo_memorydb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_memorydb.types.failover_shard_request.FailoverShardRequest]",
    ) -> OperationResponse[
        "capo_memorydb.types.failover_shard_response.FailoverShardResponse"
    ]:
        import capo_memorydb._operations.amazon_memory_db.failover_shard

        output, http_response = (
            capo_memorydb._operations.amazon_memory_db.failover_shard.failover_shard(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("FailoverShard")
    )
    input_: capo_memorydb.types.failover_shard_request.FailoverShardRequest = {
        "cluster_name": cluster_name,
        "shard_name": shard_name,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output