Skip to content

Commit

Permalink
fix(region): change billing type auto renew
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito committed Feb 13, 2025
1 parent c4099ce commit ff1e76f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/multicloud/aliyun/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,18 @@ func (region *SRegion) ModifyInstanceChargeType(vmId string, billingType string)
return fmt.Errorf("invalid billing_type %s", billingType)
}
_, err := region.ecsRequest("ModifyInstanceChargeType", params)
return err
if err != nil {
return err
}
if billingType == billing_api.BILLING_TYPE_PREPAID {
cycle := billing.SBillingCycle{
AutoRenew: true,
Count: 1,
Unit: billing.BillingCycleMonth,
}
region.SetInstanceAutoRenew(vmId, cycle)
}
return nil
}

func (self *SInstance) GetCreatedAt() time.Time {
Expand Down

0 comments on commit ff1e76f

Please sign in to comment.