fix(region): vendor update (#21490)

This commit is contained in:
屈轩
2024-10-29 18:26:13 +08:00
committed by GitHub
parent 8aa76d2176
commit 13c3ea0ee0
6 changed files with 14 additions and 43 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ require (
k8s.io/client-go v0.19.3
k8s.io/cluster-bootstrap v0.19.3
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241025091256-d552aef5b421
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241029090712-4a5b6fd13960
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
yunion.io/x/jsonutils v1.0.1-0.20240930100528-1671a2d0d22f
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
+2 -2
View File
@@ -1274,8 +1274,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241025091256-d552aef5b421 h1:oE9ZrlZv1br/OGlLxZJDlQPrYzxJllqvtjMqVDUKxjM=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241025091256-d552aef5b421/go.mod h1:rj/pb3DitJlQaQD8UW1oxx/KD+PzDZqoywzqRJaFE9A=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241029090712-4a5b6fd13960 h1:1O5sJZ9KjaUTEXKTuioLFU6/+poCWHTwWjid8i2W8vc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241029090712-4a5b6fd13960/go.mod h1:rj/pb3DitJlQaQD8UW1oxx/KD+PzDZqoywzqRJaFE9A=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
+1 -1
View File
@@ -1576,7 +1576,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
# sigs.k8s.io/yaml v1.2.0
## explicit; go 1.12
sigs.k8s.io/yaml
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241025091256-d552aef5b421
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241029090712-4a5b6fd13960
## explicit; go 1.21
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
+7 -9
View File
@@ -20,7 +20,6 @@ import (
"yunion.io/x/jsonutils"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/util/timeutils"
"yunion.io/x/pkg/utils"
billing_api "yunion.io/x/cloudmux/pkg/apis/billing"
@@ -45,12 +44,12 @@ type SEip struct {
Tags string
CreatedAt time.Time
UpdatedAt time.Time
ExpiredAt string
ExpiredAt time.Time
ProjectId string
}
func (self *SEip) GetBillingType() string {
if len(self.ExpiredAt) > 0 {
if !self.ExpiredAt.IsZero() {
return billing_api.BILLING_TYPE_PREPAID
}
return billing_api.BILLING_TYPE_POSTPAID
@@ -61,11 +60,7 @@ func (self *SEip) GetCreatedAt() time.Time {
}
func (self *SEip) GetExpiredAt() time.Time {
if len(self.ExpiredAt) > 0 {
t, _ := timeutils.ParseTimeStr(self.ExpiredAt)
return t
}
return time.Time{}
return self.ExpiredAt
}
func (self *SEip) GetId() string {
@@ -133,7 +128,10 @@ func (self *SEip) GetBandwidth() int {
}
func (self *SEip) GetInternetChargeType() string {
return ""
if self.GetBillingType() == billing_api.BILLING_TYPE_PREPAID {
return api.EIP_CHARGE_TYPE_BY_BANDWIDTH
}
return api.EIP_CHARGE_TYPE_BY_TRAFFIC
}
func (self *SEip) Delete() error {
+3 -8
View File
@@ -17,7 +17,6 @@ package ctyun
import (
"context"
"fmt"
"strconv"
"strings"
"time"
@@ -41,7 +40,7 @@ type SInstance struct {
image *SImage
AzName string
ExpiredTime string
ExpiredTime time.Time
CreatedTime time.Time
ProjectId string
AttachedVolume []string
@@ -96,7 +95,7 @@ type SInstance struct {
}
func (self *SInstance) GetBillingType() string {
if len(self.ExpiredTime) > 0 {
if !self.OnDemand {
return billing_api.BILLING_TYPE_PREPAID
}
return billing_api.BILLING_TYPE_POSTPAID
@@ -107,11 +106,7 @@ func (self *SInstance) GetCreatedAt() time.Time {
}
func (self *SInstance) GetExpiredAt() time.Time {
if len(self.ExpiredTime) > 0 {
expire, _ := strconv.Atoi(self.ExpiredTime)
return time.Unix(int64(expire/1000), 0)
}
return time.Time{}
return self.ExpiredTime
}
func (self *SInstance) GetId() string {
-22
View File
@@ -184,28 +184,6 @@ func (self *SInstance) Refresh() error {
return jsonutils.Update(self, new)
}
func (self *SInstance) IsEmulated() bool {
return false
}
func (self *SInstance) GetSysTags() map[string]string {
data := map[string]string{}
// todo: add price key here
data["zone_ext_id"] = self.host.zone.GetGlobalId()
if len(self.BasicImageID) > 0 {
if image, err := self.host.zone.region.GetImage(self.BasicImageID); err != nil {
log.Errorf("Failed to find image %s for instance %s", self.BasicImageID, self.GetName())
} else {
meta := image.GetSysTags()
for k, v := range meta {
data[k] = v
}
}
}
return data
}
// 计费模式,枚举值为: Year,按年付费; Month,按月付费; Dynamic,按需付费(需开启权限);
func (self *SInstance) GetBillingType() string {
switch self.ChargeType {