mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
add qcloud elb zone1 details
This commit is contained in:
@@ -174,6 +174,7 @@ type LoadbalancerDetails struct {
|
||||
|
||||
VpcResourceInfoBase
|
||||
ZoneResourceInfoBase
|
||||
Zone1ResourceInfoBase
|
||||
NetworkResourceInfoBase
|
||||
|
||||
SLoadbalancer
|
||||
|
||||
@@ -88,13 +88,26 @@ type ZoneDetails struct {
|
||||
|
||||
type ZoneResourceInfoBase struct {
|
||||
// 可用区名称
|
||||
// example: zone1
|
||||
// example: 北京一区
|
||||
Zone string `json:"zone"`
|
||||
|
||||
// 纳管云的zoneId
|
||||
ZoneExtId string `json:"zone_ext_id"`
|
||||
}
|
||||
|
||||
type Zone1ResourceInfoBase struct {
|
||||
// 可用区名称
|
||||
// example: 北京2区
|
||||
Zone1 string `json:"zone_1"`
|
||||
|
||||
// 可用区ID
|
||||
// example: cn-beijing-2
|
||||
Zone1Id string `json:"zone_1_id"`
|
||||
|
||||
// 纳管云的zoneId
|
||||
Zone1ExtId string `json:"zone_1_ext_id"`
|
||||
}
|
||||
|
||||
type ZoneResourceInfo struct {
|
||||
ZoneResourceInfoBase
|
||||
|
||||
|
||||
@@ -614,6 +614,7 @@ func (man *SLoadbalancerManager) FetchCustomizeColumns(
|
||||
regRows := man.SCloudregionResourceBaseManager.FetchCustomizeColumns(ctx, userCred, query, objs, fields, isList)
|
||||
vpcRows := man.SVpcResourceBaseManager.FetchCustomizeColumns(ctx, userCred, query, objs, fields, isList)
|
||||
zoneRows := man.SZoneResourceBaseManager.FetchCustomizeColumns(ctx, userCred, query, objs, fields, isList)
|
||||
zone1Rows := man.FetchZone1ResourceInfos(ctx, userCred, query, objs)
|
||||
netRows := man.SNetworkResourceBaseManager.FetchCustomizeColumns(ctx, userCred, query, objs, fields, isList)
|
||||
|
||||
for i := range rows {
|
||||
@@ -625,6 +626,7 @@ func (man *SLoadbalancerManager) FetchCustomizeColumns(
|
||||
CloudregionResourceInfo: regRows[i],
|
||||
VpcResourceInfoBase: vpcRows[i].VpcResourceInfoBase,
|
||||
ZoneResourceInfoBase: zoneRows[i].ZoneResourceInfoBase,
|
||||
Zone1ResourceInfoBase: zone1Rows[i],
|
||||
NetworkResourceInfoBase: netRows[i].NetworkResourceInfoBase,
|
||||
}
|
||||
rows[i], _ = objs[i].(*SLoadbalancer).getMoreDetails(rows[i])
|
||||
@@ -632,6 +634,38 @@ func (man *SLoadbalancerManager) FetchCustomizeColumns(
|
||||
|
||||
return rows
|
||||
}
|
||||
|
||||
func (lb *SLoadbalancerManager) FetchZone1ResourceInfos(ctx context.Context,
|
||||
userCred mcclient.TokenCredential,
|
||||
query jsonutils.JSONObject,
|
||||
objs []interface{}) []api.Zone1ResourceInfoBase {
|
||||
rows := make([]api.Zone1ResourceInfoBase, len(objs))
|
||||
zoneIds := []string{}
|
||||
for i := range objs {
|
||||
zone1 := objs[i].(*SLoadbalancer).Zone1
|
||||
if len(zone1) > 0 {
|
||||
zoneIds = append(zoneIds, zone1)
|
||||
}
|
||||
}
|
||||
|
||||
zones := make(map[string]SZone)
|
||||
err := db.FetchStandaloneObjectsByIds(ZoneManager, zoneIds, &zones)
|
||||
if err != nil {
|
||||
log.Errorf("FetchStandaloneObjectsByIds fail %s", err)
|
||||
return rows
|
||||
}
|
||||
|
||||
for i := range objs {
|
||||
if zone, ok := zones[objs[i].(*SLoadbalancer).Zone1]; ok {
|
||||
rows[i].Zone1 = zone.GetName()
|
||||
rows[i].Zone1Id = zone.GetId()
|
||||
rows[i].Zone1ExtId = zone.GetExternalId()
|
||||
}
|
||||
}
|
||||
|
||||
return rows
|
||||
}
|
||||
|
||||
func (lb *SLoadbalancer) GetExtraDetails(
|
||||
ctx context.Context,
|
||||
userCred mcclient.TokenCredential,
|
||||
|
||||
Reference in New Issue
Block a user