Skip to content

Commit

Permalink
tier: Add force flag to remove a tier
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Anis Eleuch committed Aug 30, 2024
1 parent fe52a32 commit dbcce8c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tier.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit dbcce8c

Please sign in to comment.