cost_conversions.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package meter
  15. import (
  16. "yunion.io/x/jsonutils"
  17. "yunion.io/x/onecloud/pkg/mcclient/options"
  18. )
  19. type CostConversionListOptions struct {
  20. options.BaseListOptions
  21. }
  22. func (opt *CostConversionListOptions) Params() (jsonutils.JSONObject, error) {
  23. return options.StructToParams(opt)
  24. }
  25. type CostConversionCreateOptions struct {
  26. Name string
  27. IsPublicCloud string `help:"public cloud filter of cost conversion" json:"is_public_cloud"`
  28. Brand string `help:"brand filter of cost conversion" json:"brand"`
  29. CloudaccountId string `help:"cloudaccount filter of cost conversion" json:"cloudaccount_id"`
  30. CloudproviderId string `help:"cloudprovider filter of cost conversion" json:"cloudprovider_id"`
  31. DomainIdFilter string `help:"domain filter of cost conversion" json:"domain_id_filter"`
  32. EnableDate string `help:"enable date of conversion ratio, example:202107" json:"enable_date"`
  33. Ratio float64 `help:"cost conversion ratio" json:"ratio"`
  34. }
  35. func (opt *CostConversionCreateOptions) Params() (jsonutils.JSONObject, error) {
  36. return options.StructToParams(opt)
  37. }
  38. type CostConversionUpdateOptions struct {
  39. ID string `help:"ID of cost conversion" json:"-"`
  40. Ratio float64 `help:"cost conversion ratio" json:"ratio"`
  41. }
  42. func (opt *CostConversionUpdateOptions) Params() (jsonutils.JSONObject, error) {
  43. return options.StructToParams(opt)
  44. }
  45. func (opt *CostConversionUpdateOptions) GetId() string {
  46. return opt.ID
  47. }
  48. type CostConversionDeleteOptions struct {
  49. ID string `help:"ID of cost conversion" json:"-"`
  50. }
  51. func (opt *CostConversionDeleteOptions) Params() (jsonutils.JSONObject, error) {
  52. return options.StructToParams(opt)
  53. }
  54. func (opt *CostConversionDeleteOptions) GetId() string {
  55. return opt.ID
  56. }