From b55a39cc84e43087aa4ee545bba411db71bd2a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Wed, 27 Dec 2023 11:07:41 +0800 Subject: [PATCH] fix(climc): support set tencent cloud bill report (#19108) --- pkg/mcclient/options/cloudaccounts.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/pkg/mcclient/options/cloudaccounts.go b/pkg/mcclient/options/cloudaccounts.go index 85b540d84a..984b224833 100644 --- a/pkg/mcclient/options/cloudaccounts.go +++ b/pkg/mcclient/options/cloudaccounts.go @@ -755,10 +755,29 @@ func (opts *SAzureCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, err type SQcloudCloudAccountUpdateOptions struct { SCloudAccountUpdateBaseOptions + + OptionsBillingReportBucket string `help:"update Aliyun S3 bucket that stores account billing report" json:"-"` + RemoveOptionsBillingReportBucket bool `help:"remove Aliyun S3 bucket that stores account billing report" json:"-"` } func (opts *SQcloudCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) { - return jsonutils.Marshal(opts), nil + params := jsonutils.Marshal(opts).(*jsonutils.JSONDict) + + options := jsonutils.NewDict() + if len(opts.OptionsBillingReportBucket) > 0 { + options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket") + } + if options.Size() > 0 { + params.Add(options, "options") + } + removeOptions := make([]string, 0) + if opts.RemoveOptionsBillingReportBucket { + removeOptions = append(removeOptions, "billing_report_bucket") + } + if len(removeOptions) > 0 { + params.Add(jsonutils.NewStringArray(removeOptions), "remove_options") + } + return params, nil } type SGoogleCloudAccountUpdateOptions struct {