Skip to content

Commit 42e126b

Browse files
authored
Merge pull request #1181 from ioito/hotfix/qx-aliyun-change-billing-type-auto-renew
fix(region): change billing type auto renew
2 parents c4099ce + ff1e76f commit 42e126b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pkg/multicloud/aliyun/instance.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,18 @@ func (region *SRegion) ModifyInstanceChargeType(vmId string, billingType string)
10181018
return fmt.Errorf("invalid billing_type %s", billingType)
10191019
}
10201020
_, err := region.ecsRequest("ModifyInstanceChargeType", params)
1021-
return err
1021+
if err != nil {
1022+
return err
1023+
}
1024+
if billingType == billing_api.BILLING_TYPE_PREPAID {
1025+
cycle := billing.SBillingCycle{
1026+
AutoRenew: true,
1027+
Count: 1,
1028+
Unit: billing.BillingCycleMonth,
1029+
}
1030+
region.SetInstanceAutoRenew(vmId, cycle)
1031+
}
1032+
return nil
10221033
}
10231034

10241035
func (self *SInstance) GetCreatedAt() time.Time {

0 commit comments

Comments
 (0)