Skip to content

rebalance_slots_in_global_replication_group

rebalance_slots_in_global_replication_group(
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    global_replication_group_id: Optional[String] = None,
    apply_immediately: Optional[Boolean] = None,
) -> RebalanceSlotsInGlobalReplicationGroupResult

Redistribute slots to ensure uniform distribution across existing shards in the cluster.

Parameters:

  • global_replication_group_id (Optional[String], default: None ) –

    The name of the Global datastore

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

    If True, redistribution is applied immediately.

Raises:

Source code in docs_src/capo_elasticache/_services/elasti_cache.py
def rebalance_slots_in_global_replication_group(
    self,
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    global_replication_group_id: Optional[
        "capo_elasticache.types.string.String"
    ] = None,
    apply_immediately: Optional["capo_elasticache.types.boolean.Boolean"] = None,
) -> "capo_elasticache.types.rebalance_slots_in_global_replication_group_result.RebalanceSlotsInGlobalReplicationGroupResult":
    """<p>Redistribute slots to ensure uniform distribution across existing shards in the cluster.</p>

    Args:
        global_replication_group_id: <p>The name of the Global datastore</p>
        apply_immediately: <p>If <code>True</code>, redistribution is applied immediately.</p>

    Raises:
        capo_elasticache.errors.global_replication_group_not_found_fault.GlobalReplicationGroupNotFoundFault: <p>The Global datastore does not exist</p>
        capo_elasticache.errors.invalid_global_replication_group_state_fault.InvalidGlobalReplicationGroupStateFault: <p>The Global datastore is not available or in primary-only state.</p>
        capo_elasticache.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value for a parameter is invalid.</p>
        capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_elasticache.types.rebalance_slots_in_global_replication_group_message.RebalanceSlotsInGlobalReplicationGroupMessage]",
    ) -> OperationResponse[
        "capo_elasticache.types.rebalance_slots_in_global_replication_group_result.RebalanceSlotsInGlobalReplicationGroupResult"
    ]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.rebalance_slots_in_global_replication_group

        output, http_response = (
            capo_elasticache._operations.amazon_elasti_cache_v9.rebalance_slots_in_global_replication_group.rebalance_slots_in_global_replication_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RebalanceSlotsInGlobalReplicationGroup")
    )
    input_: capo_elasticache.types.rebalance_slots_in_global_replication_group_message.RebalanceSlotsInGlobalReplicationGroupMessage = {}
    if global_replication_group_id is not None:
        input_["global_replication_group_id"] = global_replication_group_id
    if apply_immediately is not None:
        input_["apply_immediately"] = apply_immediately

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