From aa3b205b5e4785155c134a9d18262266f9de8253 Mon Sep 17 00:00:00 2001 From: Daisuke Kobayashi Date: Tue, 13 Aug 2024 15:32:41 +0900 Subject: [PATCH] rpadmin: add TriggerBalancer method Wrapper of the existing POST /v1/partitions/rebalance endpoint --- rpadmin/api_partition.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rpadmin/api_partition.go b/rpadmin/api_partition.go index 37f298f..8078120 100644 --- a/rpadmin/api_partition.go +++ b/rpadmin/api_partition.go @@ -216,3 +216,8 @@ func (a *AdminAPI) TransferLeadership(ctx context.Context, ns, topic string, par path := fmt.Sprintf("/v1/partitions/%s/%s/%d/transfer_leadership?target=%s", ns, topic, partition, target) return a.sendOne(ctx, http.MethodPost, path, nil, nil, false) } + +// Trigger on-demand balancer. +func (a *AdminAPI) TriggerBalancer(ctx context.Context) error { + return a.sendToLeader(ctx, http.MethodPost, "/v1/partitions/rebalance", nil, nil) +}