fix(climc): support set bill report for azure account (#19449)

This commit is contained in:
屈轩
2024-02-05 15:14:12 +08:00
committed by GitHub
parent 1cd886faae
commit dced4221c2
+9
View File
@@ -749,6 +749,9 @@ type SAzureCloudAccountUpdateOptions struct {
OptionsBalanceKey string `help:"update cloud balance account key, such as Azure EA key" json:"-"`
RemoveOptionsBalanceKey bool `help:"remove cloud blance account key" json:"-"`
OptionsBillingReportBucket string `help:"update Azure bucket that stores account billing report" json:"-"`
RemoveOptionsBillingReportBucket bool `help:"remove Azure bucket that stores account billing report" json:"-"`
}
func (opts *SAzureCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
@@ -758,6 +761,9 @@ func (opts *SAzureCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, err
if len(opts.OptionsBalanceKey) > 0 {
options.Add(jsonutils.NewString(opts.OptionsBalanceKey), "balance_key")
}
if len(opts.OptionsBillingReportBucket) > 0 {
options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket")
}
if options.Size() > 0 {
params.Add(options, "options")
}
@@ -765,6 +771,9 @@ func (opts *SAzureCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, err
if opts.RemoveOptionsBalanceKey {
removeOptions = append(removeOptions, "balance_key")
}
if opts.RemoveOptionsBillingReportBucket {
removeOptions = append(removeOptions, "billing_report_bucket")
}
if len(removeOptions) > 0 {
params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
}