From 43ac9870827fc8a0c63b3923efe0ffd491feed70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Tue, 30 Apr 2024 19:28:03 +0800 Subject: [PATCH] fix(region): add enable auto sync resource field (#20187) --- pkg/apis/compute/cloudaccount.go | 4 ++++ pkg/compute/models/cloudaccounts.go | 2 ++ pkg/mcclient/options/base.go | 2 +- pkg/mcclient/options/cloudaccounts.go | 9 +++++---- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pkg/apis/compute/cloudaccount.go b/pkg/apis/compute/cloudaccount.go index 2361edf047..da43216c5c 100644 --- a/pkg/apis/compute/cloudaccount.go +++ b/pkg/apis/compute/cloudaccount.go @@ -224,6 +224,8 @@ type CloudaccountCreateInput struct { // 货币类型 // enmu: CNY, USD Currency string `json:"currency"` + + EnableAutoSyncResource *bool `json:"enable_auto_sync_resource"` } type SProjectMappingResourceInput struct { @@ -405,6 +407,8 @@ type CloudaccountUpdateInput struct { ReadOnly bool `json:"read_only"` Currency string `json:"currency"` + + EnableAutoSyncResource *bool `json:"enable_auto_sync_resource"` } type CloudaccountPerformPublicInput struct { diff --git a/pkg/compute/models/cloudaccounts.go b/pkg/compute/models/cloudaccounts.go index b47c3765f3..211e3a8b78 100644 --- a/pkg/compute/models/cloudaccounts.go +++ b/pkg/compute/models/cloudaccounts.go @@ -177,6 +177,8 @@ type SCloudaccount struct { // 跳过部分资源同步 SkipSyncResources *api.SkipSyncResources `length:"medium" get:"user" update:"domain" list:"user"` + + EnableAutoSyncResource tristate.TriState `get:"user" update:"domain" create:"optional" list:"user" default:"true"` } func (acnt *SCloudaccount) IsNotSkipSyncResource(res lockman.ILockedClass) bool { diff --git a/pkg/mcclient/options/base.go b/pkg/mcclient/options/base.go index da2ae5ea58..2346139540 100644 --- a/pkg/mcclient/options/base.go +++ b/pkg/mcclient/options/base.go @@ -245,7 +245,7 @@ type BaseListOptions struct { Manager []string `help:"List objects belonging to the cloud provider" json:"manager,omitempty"` Account string `help:"List objects belonging to the cloud account" json:"account,omitempty"` - Provider []string `help:"List objects from the provider" choices:"OneCloud|VMware|Aliyun|Apsara|Qcloud|Azure|Aws|Huawei|OpenStack|Ucloud|VolcEngine|ZStack|Google|Ctyun|Cloudpods|Nutanix|BingoCloud|IncloudSphere|JDcloud|Proxmox|Ceph|Ecloud|HCSO|HCS|HCSOP|H3C|S3|RemoteFile|Ksyun|Baidu|QingCloud" json:"provider,omitempty"` + Provider []string `help:"List objects from the provider" choices:"OneCloud|VMware|Aliyun|Apsara|Qcloud|Azure|Aws|Huawei|OpenStack|Ucloud|VolcEngine|ZStack|Google|Ctyun|Cloudpods|Nutanix|BingoCloud|IncloudSphere|JDcloud|Proxmox|Ceph|CephFS|Ecloud|HCSO|HCS|HCSOP|H3C|S3|RemoteFile|Ksyun|Baidu|QingCloud|OracleCloud" json:"provider,omitempty"` Brand []string `help:"List objects belonging to a special brand"` CloudEnv string `help:"Cloud environment" choices:"public|private|onpremise|private_or_onpremise" json:"cloud_env,omitempty"` PublicCloud *bool `help:"List objects belonging to public cloud" json:"public_cloud"` diff --git a/pkg/mcclient/options/cloudaccounts.go b/pkg/mcclient/options/cloudaccounts.go index 4add3dc6aa..55845d7fbe 100644 --- a/pkg/mcclient/options/cloudaccounts.go +++ b/pkg/mcclient/options/cloudaccounts.go @@ -664,10 +664,11 @@ type SCloudAccountUpdateBaseOptions struct { SCloudAccountIdOptions Name string `help:"New name to update"` - SyncIntervalSeconds *int `help:"auto synchornize interval in seconds"` - AutoCreateProject *bool `help:"automatically create local project for new remote project" negative:"no_auto_create_project"` - ProxySetting string `help:"proxy setting name or id" json:"proxy_setting"` - SamlAuth string `help:"Enable or disable saml auth" choices:"true|false"` + SyncIntervalSeconds *int `help:"auto synchornize interval in seconds"` + AutoCreateProject *bool `help:"automatically create local project for new remote project" negative:"no_auto_create_project"` + EnableAutoSyncResource *bool `help:"automatically sync resources" negative:"disable_auto_sync_resource"` + ProxySetting string `help:"proxy setting name or id" json:"proxy_setting"` + SamlAuth string `help:"Enable or disable saml auth" choices:"true|false"` ReadOnly *bool `help:"is account read only" negative:"no_read_only"`