From dbcce8c98125e7cc9fe3b7b1ca75a3693ab895e9 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Fri, 30 Aug 2024 12:31:36 +0100 Subject: [PATCH] tier: Add force flag to remove a tier Sometimes, the tier is down or its address change and we could have many reasons why it is not possible to reach the tier server during removal of a tier. For that, we need to add a force flag. --- tier.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tier.go b/tier.go index c5d3a6b..432af2d 100644 --- a/tier.go +++ b/tier.go @@ -155,12 +155,17 @@ func (adm *AdminClient) EditTier(ctx context.Context, tierName string, creds Tie } // RemoveTier removes an empty tier identified by tierName -func (adm *AdminClient) RemoveTier(ctx context.Context, tierName string) error { +func (adm *AdminClient) RemoveTier(ctx context.Context, tierName string, force bool) error { if tierName == "" { return ErrTierNameEmpty } + + queryVals := url.Values{} + queryVals.Set("force", strconv.FormatBool(force)) + reqData := requestData{ - relPath: path.Join(adminAPIPrefix, tierAPI, tierName), + relPath: path.Join(adminAPIPrefix, tierAPI, tierName), + queryValues: queryVals, } // Execute DELETE on /minio/admin/v3/tier/tierName to remove an empty tier.