mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-29 17:58:36 +08:00
fix(region): sync dns zone ns info (#23115)
This commit is contained in:
@@ -96,7 +96,7 @@ require (
|
||||
k8s.io/cri-api v0.22.17
|
||||
k8s.io/klog/v2 v2.20.0
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250813115411-5660a2f63397
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250819082913-5b97102b53a7
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
|
||||
|
||||
@@ -1408,8 +1408,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.20250813115411-5660a2f63397 h1:r9bYIrW/2Hr6yefxHF615oRflbPvx02xRn/IjpB6XbE=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250813115411-5660a2f63397/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250819082913-5b97102b53a7 h1:qKZKOQDe1TUxAdjPYM6JOxhsTwH8jEEmTSV09h9JYdM=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250819082913-5b97102b53a7/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0 h1:msG4SiDSVU7CrXH06WuHlNEZXIooTcmNbfrIGHuIHBU=
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
|
||||
@@ -15,7 +15,11 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"yunion.io/x/cloudmux/pkg/apis/compute"
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/gotypes"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
@@ -97,3 +101,19 @@ type DnsZoneRemoveVpcsInput struct {
|
||||
|
||||
type DnsZonePurgeInput struct {
|
||||
}
|
||||
|
||||
type SNameServers []string
|
||||
|
||||
func (ns SNameServers) String() string {
|
||||
return jsonutils.Marshal(ns).String()
|
||||
}
|
||||
|
||||
func (ns SNameServers) IsZero() bool {
|
||||
return len(ns) == 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
gotypes.RegisterSerializable(reflect.TypeOf(&SNameServers{}), func() gotypes.ISerializable {
|
||||
return &SNameServers{}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -70,7 +70,11 @@ type SDnsZone struct {
|
||||
db.SExternalizedResourceBase
|
||||
SManagedResourceBase
|
||||
|
||||
NameServers *api.SNameServers `width:"256" charset:"utf8" nullable:"true" list:"user" create:"optional"`
|
||||
OriginalNameServers *api.SNameServers `width:"256" charset:"utf8" nullable:"true" list:"user" create:"optional"`
|
||||
|
||||
ZoneType string `width:"32" charset:"ascii" nullable:"false" list:"domain" create:"domain_required"`
|
||||
Registrar string `width:"32" charset:"ascii" nullable:"true" list:"domain" create:"domain_optional"`
|
||||
ProductType string `width:"32" charset:"ascii" nullable:"false" list:"domain" create:"domain_optional"`
|
||||
}
|
||||
|
||||
@@ -465,7 +469,7 @@ func (self *SCloudprovider) SyncDnsZones(ctx context.Context, userCred mcclient.
|
||||
|
||||
if !xor {
|
||||
for i := 0; i < len(commondb); i += 1 {
|
||||
err = commondb[i].syncWithDnsZone(ctx, userCred, self, commonext[i])
|
||||
err = commondb[i].SyncWithDnsZone(ctx, userCred, commonext[i])
|
||||
if err != nil {
|
||||
result.UpdateError(err)
|
||||
continue
|
||||
@@ -516,18 +520,30 @@ func (self *SDnsZone) GetICloudDnsZone(ctx context.Context) (cloudprovider.IClou
|
||||
return provider.GetICloudDnsZoneById(self.ExternalId)
|
||||
}
|
||||
|
||||
func (self *SDnsZone) syncWithDnsZone(ctx context.Context, userCred mcclient.TokenCredential, provider *SCloudprovider, ext cloudprovider.ICloudDnsZone) error {
|
||||
func (self *SDnsZone) SyncWithDnsZone(ctx context.Context, userCred mcclient.TokenCredential, ext cloudprovider.ICloudDnsZone) error {
|
||||
_, err := db.Update(self, func() error {
|
||||
self.ExternalId = ext.GetGlobalId()
|
||||
self.Status = ext.GetStatus()
|
||||
self.ProductType = string(ext.GetDnsProductType())
|
||||
if v, err := ext.GetNameServers(); err == nil {
|
||||
ns := api.SNameServers{}
|
||||
ns = append(ns, v...)
|
||||
self.NameServers = &ns
|
||||
}
|
||||
if v, err := ext.GetOriginalNameServers(); err == nil {
|
||||
ns := api.SNameServers{}
|
||||
ns = append(ns, v...)
|
||||
self.OriginalNameServers = &ns
|
||||
}
|
||||
self.Registrar = ext.GetRegistrar()
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
privider := self.GetCloudprovider()
|
||||
if privider != nil {
|
||||
provider := self.GetCloudprovider()
|
||||
if provider != nil {
|
||||
if account, _ := provider.GetCloudaccount(); account != nil {
|
||||
syncVirtualResourceMetadata(ctx, userCred, self, ext, account.ReadOnly)
|
||||
}
|
||||
@@ -546,6 +562,17 @@ func (self *SCloudprovider) newFromCloudDnsZone(ctx context.Context, userCred mc
|
||||
zone.Enabled = tristate.True
|
||||
zone.ZoneType = string(ext.GetZoneType())
|
||||
zone.ProductType = string(ext.GetDnsProductType())
|
||||
if v, err := ext.GetNameServers(); err == nil {
|
||||
ns := api.SNameServers{}
|
||||
ns = append(ns, v...)
|
||||
zone.NameServers = &ns
|
||||
}
|
||||
if v, err := ext.GetOriginalNameServers(); err == nil {
|
||||
ns := api.SNameServers{}
|
||||
ns = append(ns, v...)
|
||||
zone.OriginalNameServers = &ns
|
||||
}
|
||||
zone.Registrar = ext.GetRegistrar()
|
||||
zone.SetModelManager(DnsZoneManager, zone)
|
||||
err := DnsZoneManager.TableSpec().Insert(ctx, zone)
|
||||
if err != nil {
|
||||
|
||||
@@ -88,12 +88,9 @@ func (self *DnsZoneCreateTask) OnInit(ctx context.Context, obj db.IStandaloneMod
|
||||
self.taskFailed(ctx, zone, errors.Wrapf(err, "CreateICloudDnsZone"))
|
||||
return
|
||||
}
|
||||
_, err = db.Update(zone, func() error {
|
||||
zone.ExternalId = iZone.GetGlobalId()
|
||||
return nil
|
||||
})
|
||||
err = zone.SyncWithDnsZone(ctx, self.UserCred, iZone)
|
||||
if err != nil {
|
||||
self.taskFailed(ctx, zone, errors.Wrapf(err, "set external id"))
|
||||
self.taskFailed(ctx, zone, errors.Wrapf(err, "SyncWithDnsZone"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -104,6 +101,5 @@ func (self *DnsZoneCreateTask) OnInit(ctx context.Context, obj db.IStandaloneMod
|
||||
}
|
||||
|
||||
func (self *DnsZoneCreateTask) taskComplete(ctx context.Context, zone *models.SDnsZone) {
|
||||
zone.SetStatus(ctx, self.GetUserCred(), api.DNS_ZONE_STATUS_AVAILABLE, "")
|
||||
self.SetStageComplete(ctx, nil)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1852,7 +1852,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.20250813115411-5660a2f63397
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250819082913-5b97102b53a7
|
||||
## explicit; go 1.21
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
|
||||
+4
@@ -1354,6 +1354,10 @@ type ICloudDnsZone interface {
|
||||
|
||||
AddDnsRecord(*DnsRecord) (string, error)
|
||||
|
||||
GetNameServers() ([]string, error)
|
||||
GetOriginalNameServers() ([]string, error)
|
||||
GetRegistrar() string
|
||||
|
||||
Delete() error
|
||||
|
||||
GetDnsProductType() TDnsProductType
|
||||
|
||||
+20
-1
@@ -247,7 +247,26 @@ func (alb *SAlb) GetEgressMbps() int {
|
||||
}
|
||||
|
||||
func (alb *SAlb) GetIEIPs() ([]cloudprovider.ICloudEIP, error) {
|
||||
return []cloudprovider.ICloudEIP{}, nil
|
||||
ret := []cloudprovider.ICloudEIP{}
|
||||
info, err := alb.region.GetAlbDetail(alb.LoadBalancerId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, zone := range info.ZoneMappings {
|
||||
for _, addr := range zone.LoadBalancerAddresses {
|
||||
if len(addr.Address) > 0 {
|
||||
eips, err := alb.region.GetEips("", "", addr.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for i := range eips {
|
||||
eips[i].region = alb.region
|
||||
ret = append(ret, &eips[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (alb *SAlb) Start() error {
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import (
|
||||
)
|
||||
|
||||
type SDomain struct {
|
||||
multicloud.SVirtualResourceBase
|
||||
multicloud.SDnsZoneBase
|
||||
AliyunTags
|
||||
client *SAliyunClient
|
||||
ttlMinValue int64
|
||||
|
||||
+28
-24
@@ -240,15 +240,10 @@ func (self *SEipAddress) ChangeBandwidth(bw int) error {
|
||||
return self.region.UpdateEipBandwidth(self.AllocationId, bw)
|
||||
}
|
||||
|
||||
func (region *SRegion) GetEips(eipId string, associatedId, addr string, offset int, limit int) ([]SEipAddress, int, error) {
|
||||
if limit > 50 || limit <= 0 {
|
||||
limit = 50
|
||||
}
|
||||
|
||||
func (region *SRegion) GetEips(eipId string, associatedId, addr string) ([]SEipAddress, error) {
|
||||
params := make(map[string]string)
|
||||
params["RegionId"] = region.RegionId
|
||||
params["PageSize"] = fmt.Sprintf("%d", limit)
|
||||
params["PageNumber"] = fmt.Sprintf("%d", (offset/limit)+1)
|
||||
params["PageSize"] = "100"
|
||||
if len(addr) > 0 {
|
||||
params["EipAddress"] = addr
|
||||
}
|
||||
@@ -266,27 +261,36 @@ func (region *SRegion) GetEips(eipId string, associatedId, addr string, offset i
|
||||
}
|
||||
}
|
||||
|
||||
body, err := region.vpcRequest("DescribeEipAddresses", params)
|
||||
if err != nil {
|
||||
log.Errorf("DescribeEipAddresses fail %s", err)
|
||||
return nil, 0, err
|
||||
pageNumber := 1
|
||||
ret := []SEipAddress{}
|
||||
for {
|
||||
params["PageNumber"] = fmt.Sprintf("%d", pageNumber)
|
||||
body, err := region.vpcRequest("DescribeEipAddresses", params)
|
||||
if err != nil {
|
||||
log.Errorf("DescribeEipAddresses fail %s", err)
|
||||
return nil, err
|
||||
}
|
||||
part := struct {
|
||||
EipAddresses struct {
|
||||
EipAddress []SEipAddress
|
||||
} `json:"EipAddresses"`
|
||||
TotalCount int `json:"TotalCount"`
|
||||
}{}
|
||||
err = body.Unmarshal(&part)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Unmarshal EipAddress details")
|
||||
}
|
||||
ret = append(ret, part.EipAddresses.EipAddress...)
|
||||
if len(ret) >= part.TotalCount {
|
||||
break
|
||||
}
|
||||
pageNumber++
|
||||
}
|
||||
|
||||
eips := make([]SEipAddress, 0)
|
||||
err = body.Unmarshal(&eips, "EipAddresses", "EipAddress")
|
||||
if err != nil {
|
||||
log.Errorf("Unmarshal EipAddress details fail %s", err)
|
||||
return nil, 0, err
|
||||
}
|
||||
total, _ := body.Int("TotalCount")
|
||||
for i := 0; i < len(eips); i += 1 {
|
||||
eips[i].region = region
|
||||
}
|
||||
return eips, int(total), nil
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (region *SRegion) GetEip(eipId string) (*SEipAddress, error) {
|
||||
eips, _, err := region.GetEips(eipId, "", "", 0, 1)
|
||||
eips, err := region.GetEips(eipId, "", "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+1
-1
@@ -317,7 +317,7 @@ func (lb *SLoadbalancer) GetIEIPs() ([]cloudprovider.ICloudEIP, error) {
|
||||
}
|
||||
return []cloudprovider.ICloudEIP{&eip}, nil
|
||||
}
|
||||
eips, _, err := lb.region.GetEips("", lb.LoadBalancerId, "", 0, 1)
|
||||
eips, err := lb.region.GetEips("", lb.LoadBalancerId, "")
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "lb.region.GetEips(%s)", lb.LoadBalancerId)
|
||||
}
|
||||
|
||||
+7
-14
@@ -155,23 +155,16 @@ func (nat *SNatGateway) GetExpiredAt() time.Time {
|
||||
}
|
||||
|
||||
func (nat *SNatGateway) GetIEips() ([]cloudprovider.ICloudEIP, error) {
|
||||
eips := []SEipAddress{}
|
||||
for {
|
||||
parts, total, err := nat.vpc.region.GetEips("", nat.NatGatewayId, "", len(eips), 50)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
eips = append(eips, parts...)
|
||||
if len(eips) >= total {
|
||||
break
|
||||
}
|
||||
eips, err := nat.vpc.region.GetEips("", nat.NatGatewayId, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ieips := []cloudprovider.ICloudEIP{}
|
||||
for i := 0; i < len(eips); i++ {
|
||||
ret := []cloudprovider.ICloudEIP{}
|
||||
for i := range eips {
|
||||
eips[i].region = nat.vpc.region
|
||||
ieips = append(ieips, &eips[i])
|
||||
ret = append(ret, &eips[i])
|
||||
}
|
||||
return ieips, nil
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (nat *SNatGateway) GetINatDTable() ([]cloudprovider.ICloudNatDEntry, error) {
|
||||
|
||||
+15
-1
@@ -16,6 +16,7 @@ package aliyun
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
@@ -251,7 +252,20 @@ func (nlb *SNlb) GetEgressMbps() int {
|
||||
}
|
||||
|
||||
func (nlb *SNlb) GetIEIPs() ([]cloudprovider.ICloudEIP, error) {
|
||||
return []cloudprovider.ICloudEIP{}, nil
|
||||
ret := []cloudprovider.ICloudEIP{}
|
||||
for _, zone := range nlb.ZoneMappings {
|
||||
for _, addr := range zone.LoadBalancerAddresses {
|
||||
if strings.HasPrefix(addr.AllocationId, "eip-") {
|
||||
eip, err := nlb.region.GetEip(addr.AllocationId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
eip.region = nlb.region
|
||||
ret = append(ret, eip)
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (nlb *SNlb) Start() error {
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ type SPvtzBindVpcs struct {
|
||||
}
|
||||
|
||||
type SPrivateZone struct {
|
||||
multicloud.SResourceBase
|
||||
multicloud.SDnsZoneBase
|
||||
AliyunTags
|
||||
client *SAliyunClient
|
||||
|
||||
|
||||
+10
-18
@@ -871,37 +871,24 @@ func (self *SRegion) UpdateInstancePassword(instId string, passwd string) error
|
||||
}
|
||||
|
||||
func (self *SRegion) GetIEips() ([]cloudprovider.ICloudEIP, error) {
|
||||
eips, total, err := self.GetEips("", "", "", 0, 50)
|
||||
eips, err := self.GetEips("", "", "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for len(eips) < total {
|
||||
var parts []SEipAddress
|
||||
parts, total, err = self.GetEips("", "", "", len(eips), 50)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
eips = append(eips, parts...)
|
||||
}
|
||||
ret := make([]cloudprovider.ICloudEIP, len(eips))
|
||||
for i := 0; i < len(eips); i += 1 {
|
||||
for i := range eips {
|
||||
eips[i].region = self
|
||||
ret[i] = &eips[i]
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (self *SRegion) GetIEipById(eipId string) (cloudprovider.ICloudEIP, error) {
|
||||
eips, total, err := self.GetEips(eipId, "", "", 0, 1)
|
||||
eip, err := self.GetEip(eipId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if total == 0 {
|
||||
return nil, cloudprovider.ErrNotFound
|
||||
}
|
||||
if total > 1 {
|
||||
return nil, cloudprovider.ErrDuplicateId
|
||||
}
|
||||
return &eips[0], nil
|
||||
return eip, nil
|
||||
}
|
||||
|
||||
func (region *SRegion) GetISecurityGroupById(secgroupId string) (cloudprovider.ICloudSecurityGroup, error) {
|
||||
@@ -955,6 +942,11 @@ func (region *SRegion) GetILoadBalancers() ([]cloudprovider.ICloudLoadbalancer,
|
||||
}
|
||||
|
||||
func (region *SRegion) GetILoadBalancerById(loadbalancerId string) (cloudprovider.ICloudLoadbalancer, error) {
|
||||
if strings.HasPrefix(loadbalancerId, "alb-") {
|
||||
return region.GetAlbDetail(loadbalancerId)
|
||||
} else if strings.HasPrefix(loadbalancerId, "nlb-") {
|
||||
return region.GetNlbDetail(loadbalancerId)
|
||||
}
|
||||
return region.GetLoadbalancerDetail(loadbalancerId)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ type AssociatedVPC struct {
|
||||
}
|
||||
|
||||
type SDnsZone struct {
|
||||
multicloud.SVirtualResourceBase
|
||||
multicloud.SDnsZoneBase
|
||||
AwsTags
|
||||
client *SAwsClient
|
||||
|
||||
|
||||
+8
-7
@@ -113,14 +113,15 @@ func (self *SNatGateway) Refresh() error {
|
||||
}
|
||||
|
||||
func (self *SNatGateway) GetIEips() ([]cloudprovider.ICloudEIP, error) {
|
||||
eips, err := self.region.GetEips("", "", self.NatGatewayId)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetEIPs")
|
||||
}
|
||||
ret := []cloudprovider.ICloudEIP{}
|
||||
for i := range eips {
|
||||
eips[i].region = self.region
|
||||
ret = append(ret, &eips[i])
|
||||
for _, addr := range self.NatGatewayAddresses {
|
||||
if len(addr.PublicIp) > 0 {
|
||||
eip, err := self.region.GetEipByIpAddress(addr.PublicIp)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetEipByIpAddress")
|
||||
}
|
||||
ret = append(ret, eip)
|
||||
}
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package multicloud
|
||||
|
||||
import (
|
||||
"yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
"yunion.io/x/pkg/errors"
|
||||
)
|
||||
|
||||
type SDnsZoneBase struct {
|
||||
SVirtualResourceBase
|
||||
}
|
||||
|
||||
func (self *SDnsZoneBase) GetNameServers() ([]string, error) {
|
||||
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetNameServers")
|
||||
}
|
||||
|
||||
func (self *SDnsZoneBase) GetOriginalNameServers() ([]string, error) {
|
||||
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetOriginalNameServers")
|
||||
}
|
||||
|
||||
func (self *SDnsZoneBase) GetRegistrar() string {
|
||||
return ""
|
||||
}
|
||||
+3
@@ -135,6 +135,9 @@ func (addr *SAddress) GetAssociationType() string {
|
||||
if strings.Contains(user, "/forwardingRules/") {
|
||||
return api.EIP_ASSOCIATE_TYPE_LOADBALANCER
|
||||
}
|
||||
if strings.Contains(user, "/routers/") {
|
||||
return api.EIP_ASSOCIATE_TYPE_NAT_GATEWAY
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ import (
|
||||
)
|
||||
|
||||
type SDomian struct {
|
||||
multicloud.SVirtualResourceBase
|
||||
multicloud.SDnsZoneBase
|
||||
QcloudTags
|
||||
client *SQcloudClient
|
||||
|
||||
|
||||
+9
-10
@@ -322,17 +322,16 @@ func (self *SLoadbalancer) GetILoadBalancerBackendGroups() ([]cloudprovider.IClo
|
||||
}
|
||||
|
||||
func (self *SLoadbalancer) GetIEIPs() ([]cloudprovider.ICloudEIP, error) {
|
||||
if self.LoadBalancerType == "OPEN" && len(self.LoadBalancerVips) > 0 {
|
||||
return []cloudprovider.ICloudEIP{&SEipAddress{
|
||||
region: self.region,
|
||||
AddressId: self.LoadBalancerId,
|
||||
AddressIp: self.LoadBalancerVips[0],
|
||||
AddressType: EIP_STATUS_BIND,
|
||||
InstanceId: self.LoadBalancerId,
|
||||
CreatedTime: self.CreateTime,
|
||||
}}, nil
|
||||
eips, _, err := self.region.GetEips("", self.LoadBalancerId, 0, 50)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetEips")
|
||||
}
|
||||
return nil, nil
|
||||
ret := []cloudprovider.ICloudEIP{}
|
||||
for i := range eips {
|
||||
eips[i].region = self.region
|
||||
ret = append(ret, &eips[i])
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (self *SRegion) GetLoadbalancers(ids []string, limit, offset int) ([]SLoadbalancer, int, error) {
|
||||
|
||||
Reference in New Issue
Block a user