mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
fix(region): add waf and app tags sync
This commit is contained in:
@@ -639,3 +639,18 @@ func (self *SAppGatewayWaf) GetCloudResources() ([]cloudprovider.SCloudResource,
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (self *SAppGatewayWaf) SetTags(tags map[string]string, replace bool) error {
|
||||
if !replace {
|
||||
for k, v := range self.Tags {
|
||||
if _, ok := tags[k]; !ok {
|
||||
tags[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
_, err := self.region.client.SetTags(self.ID, tags)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "SetTags")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -300,3 +300,18 @@ func (a *SApp) GetOsType() cloudprovider.TOsType {
|
||||
}
|
||||
return cloudprovider.OsTypeWindows
|
||||
}
|
||||
|
||||
func (self *SApp) SetTags(tags map[string]string, replace bool) error {
|
||||
if !replace {
|
||||
for k, v := range self.Tags {
|
||||
if _, ok := tags[k]; !ok {
|
||||
tags[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
_, err := self.region.client.SetTags(self.Id, tags)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "SetTags")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user