mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
redis prepaid create autorenew bugfix
This commit is contained in:
@@ -200,6 +200,10 @@ type ElasticcacheCreateInput struct {
|
||||
// 包年包月时间周期
|
||||
Duration string `json:"duration"`
|
||||
|
||||
// 是否自动续费(仅包年包月时生效)
|
||||
// default: false
|
||||
AutoRenew bool `json:"auto_renew"`
|
||||
|
||||
// swagger:ignore
|
||||
ExpiredAt time.Time `json:"expired_at"`
|
||||
|
||||
|
||||
@@ -865,6 +865,7 @@ func (self *SElasticcache) GetCreateAliyunElasticcacheParams(data *jsonutils.JSO
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "elasticcache.GetCreateAliyunElasticcacheParams.BillingCycle")
|
||||
}
|
||||
billingCycle.AutoRenew = self.AutoRenew
|
||||
input.BC = &billingCycle
|
||||
default:
|
||||
input.ChargeType = "PostPaid"
|
||||
@@ -956,6 +957,7 @@ func (self *SElasticcache) GetCreateHuaweiElasticcacheParams(data *jsonutils.JSO
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "elasticcache.GetCreateHuaweiElasticcacheParams.BillingCycle")
|
||||
}
|
||||
billingCycle.AutoRenew = self.AutoRenew
|
||||
input.BC = &billingCycle
|
||||
default:
|
||||
input.ChargeType = "PostPaid"
|
||||
@@ -1043,6 +1045,7 @@ func (self *SElasticcache) GetCreateQCloudElasticcacheParams(data *jsonutils.JSO
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "elasticcache.GetCreateHuaweiElasticcacheParams.BillingCycle")
|
||||
}
|
||||
billingCycle.AutoRenew = self.AutoRenew
|
||||
input.BC = &billingCycle
|
||||
default:
|
||||
input.ChargeType = "PostPaid"
|
||||
|
||||
@@ -488,7 +488,7 @@ func (self *SRegion) CreateIElasticcaches(ec *cloudprovider.SCloudElasticCacheIn
|
||||
bssParam := jsonutils.NewDict()
|
||||
bssParam.Set("charging_mode", jsonutils.NewString("prePaid"))
|
||||
bssParam.Set("is_auto_pay", jsonutils.NewString("true"))
|
||||
bssParam.Set("is_auto_renew", jsonutils.NewString("false"))
|
||||
bssParam.Set("is_auto_renew", jsonutils.NewString(fmt.Sprintf("%v", ec.BC.AutoRenew)))
|
||||
if ec.BC.GetMonths() >= 1 && ec.BC.GetMonths() >= 9 {
|
||||
bssParam.Set("period_type", jsonutils.NewString("month"))
|
||||
bssParam.Set("period_num", jsonutils.NewInt(int64(ec.BC.GetMonths())))
|
||||
|
||||
Reference in New Issue
Block a user