fix(region): fix sync project bug and add climc choices

This commit is contained in:
mhf
2022-12-15 15:24:19 +08:00
parent e465a65dcc
commit 4190f2b6b9
3 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -517,8 +517,8 @@ type SyncRangeInput struct {
Host []string `json:"host"`
// 按资源类型同步,可输入多个
// enmu: compute, network, loadbalancer, objectstore, rds, cache, nat, nas, waf, mongodb, es, kafka, app, container
Resources []string `json:"resources" choices:"compute|network|loadbalancer|objectstore|rds|cache|nat|nas|waf|mongodb|es|kafka|app|container|eip|tablestore"`
// enmu: project, compute, network, eip, loadbalancer, objectstore, rds, cache, event, cloudid, dnszone, public_ip, intervpcnetwork, saml_auth, quota, nat, nas, waf, mongodb, es, kafka, app, cdn, container, ipv6_gateway, tablestore, modelarts, vpcpeer, misc
Resources []string `json:"resources" choices:"project|compute|network|eip|loadbalancer|objectstore|rds|cache|event|cloudid|dnszone|public_ip|intervpcnetwork|saml_auth|quota|nat|nas|waf|mongodb|es|kafka|app|cdn|container|ipv6_gateway|tablestore|modelarts|vpcpeer|misc"`
}
type SAccountPermission struct {
+4
View File
@@ -509,6 +509,10 @@ func (sr *SSyncRange) GetRegionIds() ([]string, error) {
}
func (sr *SSyncRange) NeedSyncResource(res string) bool {
if sr.FullSync {
return true
}
if len(sr.Resources) == 0 {
return true
}
+3 -5
View File
@@ -83,11 +83,9 @@ func (self *CloudAccountSyncInfoTask) OnCloudaccountSyncReady(ctx context.Contex
return
}
if syncRange.FullSync {
err := models.SyncCloudaccountResources(ctx, self.GetUserCred(), cloudaccount, &syncRange)
if err != nil {
log.Errorf("SyncAccountResources error: %v", err)
}
err := models.SyncCloudaccountResources(ctx, self.GetUserCred(), cloudaccount, &syncRange)
if err != nil {
log.Errorf("SyncAccountResources error: %v", err)
}
cloudproviders := cloudaccount.GetEnabledCloudproviders()