mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #11191 from ioito/hotfix/qx-azure-tags
fix(region): azure uniform tags
This commit is contained in:
@@ -48,6 +48,12 @@ const (
|
||||
|
||||
type TAzureResource string
|
||||
|
||||
type TAzureTags map[string]string
|
||||
|
||||
func (self TAzureTags) GetTags() (map[string]string, error) {
|
||||
return self, nil
|
||||
}
|
||||
|
||||
var (
|
||||
GraphResource = TAzureResource("graph")
|
||||
DefaultResource = TAzureResource("default")
|
||||
|
||||
@@ -40,7 +40,7 @@ type SClassicSecurityGroup struct {
|
||||
Name string
|
||||
Location string
|
||||
Type string
|
||||
Tags map[string]string
|
||||
Tags TAzureTags
|
||||
}
|
||||
|
||||
type ClassicSecurityGroupProperties struct {
|
||||
@@ -120,10 +120,6 @@ func (self *SClassicSecurityGroup) GetVpcId() string {
|
||||
return "classic"
|
||||
}
|
||||
|
||||
func (self *SClassicSecurityGroup) GetTags() (map[string]string, error) {
|
||||
return self.Tags, nil
|
||||
}
|
||||
|
||||
func (self *SClassicSecurityGroup) GetId() string {
|
||||
return self.ID
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ type SDBInstance struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Tags map[string]string `json:"tags"`
|
||||
Tags TAzureTags `json:"tags"`
|
||||
}
|
||||
|
||||
func (self *SRegion) GetIDBInstances() ([]cloudprovider.ICloudDBInstance, error) {
|
||||
|
||||
@@ -80,7 +80,7 @@ type SDisk struct {
|
||||
Location string `json:"location,omitempty"`
|
||||
Properties DiskProperties `json:"properties,omitempty"`
|
||||
|
||||
Tags map[string]string `json:"tags,omitempty"`
|
||||
Tags TAzureTags `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
func (self *SRegion) CreateDisk(storageType string, name string, sizeGb int32, imageId, snapshotId, resourceGroup string) (*SDisk, error) {
|
||||
|
||||
@@ -60,6 +60,7 @@ type SEipAddress struct {
|
||||
Location string
|
||||
Properties PublicIPAddressPropertiesFormat `json:"properties,omitempty"`
|
||||
Type string
|
||||
Tags TAzureTags
|
||||
Sku *PublicIPAddressSku
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ type SInstance struct {
|
||||
Type string
|
||||
Location string
|
||||
vmSize *SVMSize
|
||||
Tags map[string]string
|
||||
Tags TAzureTags
|
||||
|
||||
Resources []SExtensionResource
|
||||
}
|
||||
|
||||
@@ -381,20 +381,26 @@ func (region *SRegion) GetEips() ([]SEipAddress, error) {
|
||||
func (region *SRegion) GetIEips() ([]cloudprovider.ICloudEIP, error) {
|
||||
eips, err := region.GetEips()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrapf(err, "GetEips")
|
||||
}
|
||||
classicEips, err := region.GetClassicEips()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrapf(err, "GetClassicEips")
|
||||
}
|
||||
ieips := make([]cloudprovider.ICloudEIP, len(eips)+len(classicEips))
|
||||
ieips := []cloudprovider.ICloudEIP{}
|
||||
for i := 0; i < len(eips); i++ {
|
||||
if len(eips[i].GetIpAddr()) == 0 {
|
||||
continue
|
||||
}
|
||||
eips[i].region = region
|
||||
ieips[i] = &eips[i]
|
||||
ieips = append(ieips, &eips[i])
|
||||
}
|
||||
for i := 0; i < len(classicEips); i++ {
|
||||
if len(classicEips[i].GetIpAddr()) == 0 {
|
||||
continue
|
||||
}
|
||||
classicEips[i].region = region
|
||||
ieips[len(eips)+i] = &classicEips[i]
|
||||
ieips = append(ieips, &classicEips[i])
|
||||
}
|
||||
return ieips, nil
|
||||
}
|
||||
|
||||
@@ -75,11 +75,7 @@ type SSecurityGroup struct {
|
||||
Name string
|
||||
Location string
|
||||
Type string
|
||||
Tags map[string]string
|
||||
}
|
||||
|
||||
func (self *SSecurityGroup) GetTags() (map[string]string, error) {
|
||||
return self.Tags, nil
|
||||
Tags TAzureTags
|
||||
}
|
||||
|
||||
func parseCIDR(cidr string) (*net.IPNet, error) {
|
||||
|
||||
@@ -94,7 +94,7 @@ type SStorageAccount struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Tags map[string]string
|
||||
Tags TAzureTags
|
||||
|
||||
Properties AccountProperties `json:"properties"`
|
||||
}
|
||||
@@ -715,8 +715,12 @@ func (b *SStorageAccount) MaxPartCount() int {
|
||||
return 50000
|
||||
}
|
||||
|
||||
func (b *SStorageAccount) GetTags() (map[string]string, error) {
|
||||
return b.Tags, nil
|
||||
}
|
||||
|
||||
func (b *SStorageAccount) GetProjectId() string {
|
||||
return ""
|
||||
return getResourceGroup(b.ID)
|
||||
}
|
||||
|
||||
func (b *SStorageAccount) GetGlobalId() string {
|
||||
|
||||
@@ -51,7 +51,7 @@ type SVpc struct {
|
||||
Etag string
|
||||
Type string
|
||||
Location string
|
||||
Tags map[string]string
|
||||
Tags TAzureTags
|
||||
Properties VirtualNetworkPropertiesFormat `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user