mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
rds postpaid instance create fix
This commit is contained in:
@@ -355,14 +355,17 @@ func (man *SDBInstanceManager) ValidateCreateData(ctx context.Context, userCred
|
||||
if err != nil {
|
||||
return nil, httperrors.NewInputParameterError("invalid duration %s", input.Duration)
|
||||
}
|
||||
if !region.GetDriver().IsSupportedBillingCycle(billingCycle, man.KeywordPlural()) {
|
||||
return nil, httperrors.NewInputParameterError("unsupported duration %s", input.Duration)
|
||||
}
|
||||
|
||||
if !utils.IsInStringArray(input.BillingType, []string{billing_api.BILLING_TYPE_PREPAID, billing_api.BILLING_TYPE_POSTPAID}) {
|
||||
input.BillingType = billing_api.BILLING_TYPE_PREPAID
|
||||
}
|
||||
|
||||
if input.BillingType == billing_api.BILLING_TYPE_PREPAID {
|
||||
if !region.GetDriver().IsSupportedBillingCycle(billingCycle, man.KeywordPlural()) {
|
||||
return nil, httperrors.NewInputParameterError("unsupported duration %s", input.Duration)
|
||||
}
|
||||
}
|
||||
|
||||
tm := time.Time{}
|
||||
input.BillingCycle = billingCycle.String()
|
||||
input.ExpiredAt = billingCycle.EndAt(tm)
|
||||
|
||||
Reference in New Issue
Block a user