Merge pull request #18787 from swordqiu/hotfix/qj-cloud-account-update-aliyun-billing-scope

fix: cloud account update aliyun billing scope
This commit is contained in:
Zexi Li
2023-11-27 19:06:37 +08:00
committed by GitHub
+8
View File
@@ -684,6 +684,8 @@ type SAliyunCloudAccountUpdateOptions struct {
RemoveOptionsBillingBucketAccount bool `help:"remove id of account that can access bucket, blank if this account can access" json:"-"`
OptionsBillingFilePrefix string `help:"update prefix of billing file name" json:"-"`
RemoveOptionsBillingFilePrefix bool `help:"remove prefix of billing file name" json:"-"`
OptionsBillingScope string `help:"update billing scope" choices:"all|managed" json:"-"`
RemoveOptionsBillingScope bool `help:"remove billing scope" json:"-"`
}
func (opts *SAliyunCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
@@ -699,6 +701,9 @@ func (opts *SAliyunCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, er
if len(opts.OptionsBillingFilePrefix) > 0 {
options.Add(jsonutils.NewString(opts.OptionsBillingFilePrefix), "billing_file_prefix")
}
if len(opts.OptionsBillingScope) > 0 {
options.Add(jsonutils.NewString(opts.OptionsBillingScope), "billing_scope")
}
if options.Size() > 0 {
params.Add(options, "options")
}
@@ -712,6 +717,9 @@ func (opts *SAliyunCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, er
if opts.RemoveOptionsBillingFilePrefix {
removeOptions = append(removeOptions, "billing_file_prefix")
}
if opts.RemoveOptionsBillingScope {
removeOptions = append(removeOptions, "billing_scope")
}
if len(removeOptions) > 0 {
params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
}