mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
validate prepaid resource delete condition
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
@@ -697,6 +698,10 @@ func (self *SElasticcache) ValidateDeleteCondition(ctx context.Context) error {
|
||||
return httperrors.NewInvalidStatusError("Elastic cache is locked, cannot delete")
|
||||
}
|
||||
|
||||
if self.GetChargeType() == billing.BILLING_TYPE_PREPAID && self.ExpiredAt.Sub(time.Now()).Seconds() > 0 {
|
||||
return httperrors.NewInvalidStatusError("Elastic cache is not expired, cannot delete")
|
||||
}
|
||||
|
||||
return self.ValidatePurgeCondition(ctx)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user