From 1fc005397c734b224bee39c1423e07c8e6408b34 Mon Sep 17 00:00:00 2001 From: ioito Date: Fri, 15 Apr 2022 17:33:54 +0800 Subject: [PATCH] fix(region): azure created time sync --- pkg/multicloud/azure/azure.go | 2 +- pkg/multicloud/azure/disk.go | 4 ++-- pkg/multicloud/azure/instance.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/multicloud/azure/azure.go b/pkg/multicloud/azure/azure.go index 1491ac3ff9..5c2f5e8b3e 100644 --- a/pkg/multicloud/azure/azure.go +++ b/pkg/multicloud/azure/azure.go @@ -443,7 +443,7 @@ func (self *SAzureClient) _apiVersion(resource string, params url.Values) string return "2020-06-01" } if utils.IsInStringArray("virtualmachines", info) { - return "2018-04-01" + return "2021-11-01" } if utils.IsInStringArray("skus", info) { return "2019-04-01" diff --git a/pkg/multicloud/azure/disk.go b/pkg/multicloud/azure/disk.go index beb7ecd0c9..61fc848bc0 100644 --- a/pkg/multicloud/azure/disk.go +++ b/pkg/multicloud/azure/disk.go @@ -59,7 +59,7 @@ func (ai TAzureInt32) Int32() int32 { } type DiskProperties struct { - //TimeCreated time.Time //??? 序列化出错? + TimeCreated time.Time `json:"timeCreated,omitempty"` OsType string `json:"osType,omitempty"` CreationData CreationData `json:"creationData,omitempty"` DiskSizeGB TAzureInt32 `json:"diskSizeGB,omitempty"` @@ -297,7 +297,7 @@ func (self *SDisk) GetBillingType() string { } func (self *SDisk) GetCreatedAt() time.Time { - return time.Time{} + return self.Properties.TimeCreated } func (self *SDisk) GetExpiredAt() time.Time { diff --git a/pkg/multicloud/azure/instance.go b/pkg/multicloud/azure/instance.go index 6d68f6ac50..c2a27f94d0 100644 --- a/pkg/multicloud/azure/instance.go +++ b/pkg/multicloud/azure/instance.go @@ -155,6 +155,7 @@ type VirtualMachineProperties struct { DebugProfile *DebugProfile `json:"debugProfile,omitempty"` OsProfile OsProfile `json:"osProfile,omitempty"` VmId string `json:"vmId,omitempty"` + TimeCreated time.Time `json:"timeCreated,omitempty"` } type SExtensionResourceProperties struct { @@ -1023,7 +1024,7 @@ func (self *SInstance) GetBillingType() string { } func (self *SInstance) GetCreatedAt() time.Time { - return time.Time{} + return self.Properties.TimeCreated } func (self *SInstance) GetExpiredAt() time.Time {