Skip to content

Commit

Permalink
Merge pull request #1182 from ioito/automated-cherry-pick-of-#1181-up…
Browse files Browse the repository at this point in the history
…stream-release-3.11

Automated cherry pick of #1181: fix(region): change billing type auto renew
  • Loading branch information
ioito authored Feb 14, 2025
2 parents 8ba2b93 + 015ecf9 commit 798f62b
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 798f62b

Please sign in to comment.