From f88ea19a76e724f44dbebff4c18b7b5744aae643 Mon Sep 17 00:00:00 2001 From: "bistuzx@163.com" Date: Thu, 17 Jun 2021 19:36:35 +0800 Subject: [PATCH] add module billing exchange rate --- .../modules/mod_billing_exchange_rates.go | 29 +++++++++++++++++++ .../options/meter/billing_exchange_rates.go | 29 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 pkg/mcclient/modules/mod_billing_exchange_rates.go create mode 100644 pkg/mcclient/options/meter/billing_exchange_rates.go diff --git a/pkg/mcclient/modules/mod_billing_exchange_rates.go b/pkg/mcclient/modules/mod_billing_exchange_rates.go new file mode 100644 index 0000000000..3c90895d8f --- /dev/null +++ b/pkg/mcclient/modules/mod_billing_exchange_rates.go @@ -0,0 +1,29 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package modules + +import "yunion.io/x/onecloud/pkg/mcclient/modulebase" + +var ( + BillingExchangeRates modulebase.ResourceManager +) + +func init() { + BillingExchangeRates = NewMeterManager("billing_exchange_rate", "billing_exchange_rates", + []string{"src", "dest", "rate", "date"}, + []string{}, + ) + register(&BillingExchangeRates) +} diff --git a/pkg/mcclient/options/meter/billing_exchange_rates.go b/pkg/mcclient/options/meter/billing_exchange_rates.go new file mode 100644 index 0000000000..a2c1baa2fc --- /dev/null +++ b/pkg/mcclient/options/meter/billing_exchange_rates.go @@ -0,0 +1,29 @@ +package meter + +import ( + "yunion.io/x/jsonutils" + + "yunion.io/x/onecloud/pkg/mcclient/options" +) + +type BillingExchangeRateListOptions struct { + options.BaseListOptions +} + +func (opt *BillingExchangeRateListOptions) Params() (jsonutils.JSONObject, error) { + return options.StructToParams(opt) +} + +type BillingExchangeRateUpdateOptions struct { + ID string `help:"ID of billing exchange rate" json:"-"` + + Rate float64 `help:"exchange rate" json:"rate"` +} + +func (opt *BillingExchangeRateUpdateOptions) Params() (jsonutils.JSONObject, error) { + return options.StructToParams(opt) +} + +func (opt *BillingExchangeRateUpdateOptions) GetId() string { + return opt.ID +}