From 567856cada42bbdb80261739236ff7e2a1fe570f Mon Sep 17 00:00:00 2001 From: Qiu Jian Date: Thu, 19 Aug 2021 01:49:19 +0800 Subject: [PATCH] fix: remove meter client codes --- cmd/climc/main.go | 1 - cmd/climc/shell/meter/account_balances.go | 74 -------- cmd/climc/shell/meter/amount_estimations.go | 34 ---- cmd/climc/shell/meter/associated_bills.go | 44 ----- cmd/climc/shell/meter/bill_analysises.go | 95 ---------- cmd/climc/shell/meter/bill_balances.go | 63 ------- cmd/climc/shell/meter/bill_cloudchecks.go | 59 ------ cmd/climc/shell/meter/bill_conditions.go | 57 ------ cmd/climc/shell/meter/bill_details.go | 62 ------ cmd/climc/shell/meter/bill_resources.go | 62 ------ cmd/climc/shell/meter/bill_tasks.go | 42 ----- cmd/climc/shell/meter/bills_dimension.go | 34 ---- cmd/climc/shell/meter/bucket_options.go | 46 ----- cmd/climc/shell/meter/budgets.go | 30 --- cmd/climc/shell/meter/cloud_sku_rates.go | 44 ----- cmd/climc/shell/meter/common.go | 30 --- cmd/climc/shell/meter/cost_conversions.go | 29 --- cmd/climc/shell/meter/costalerts.go | 145 --------------- cmd/climc/shell/meter/costreports.go | 29 --- cmd/climc/shell/meter/daily_bills.go | 42 ----- cmd/climc/shell/meter/meter-events.go | 29 --- cmd/climc/shell/meter/price_infos.go | 69 ------- cmd/climc/shell/meter/rates.go | 176 ------------------ cmd/climc/shell/meter/res_results.go | 74 -------- cmd/climc/shell/meter/res_tag_details.go | 53 ------ cmd/climc/shell/meter/reservations.go | 26 --- cmd/climc/shell/meter/resource_details.go | 59 ------ cmd/climc/shell/meter/resource_fees.go | 74 -------- cmd/climc/shell/meter/unused_resources.go | 69 ------- pkg/mcclient/modules/managers.go | 6 - pkg/mcclient/modules/mod_account_balances.go | 29 --- .../modules/mod_amount_estimations.go | 29 --- pkg/mcclient/modules/mod_associated_bills.go | 29 --- pkg/mcclient/modules/mod_bill_analysises.go | 35 ---- pkg/mcclient/modules/mod_bill_balances.go | 29 --- pkg/mcclient/modules/mod_bill_cloudchecks.go | 29 --- pkg/mcclient/modules/mod_bill_conditions.go | 29 --- pkg/mcclient/modules/mod_bill_details.go | 30 --- pkg/mcclient/modules/mod_bill_resources.go | 30 --- pkg/mcclient/modules/mod_bill_tasks.go | 29 --- .../modules/mod_billing_exchange_rates.go | 29 --- pkg/mcclient/modules/mod_bills_dimension.go | 63 ------- pkg/mcclient/modules/mod_bucket_options.go | 29 --- pkg/mcclient/modules/mod_budgets.go | 32 ---- pkg/mcclient/modules/mod_cloud_sku_rates.go | 29 --- pkg/mcclient/modules/mod_cost_conversions.go | 29 --- pkg/mcclient/modules/mod_costalerts.go | 31 --- pkg/mcclient/modules/mod_costreports.go | 29 --- pkg/mcclient/modules/mod_daily_bills.go | 32 ---- pkg/mcclient/modules/mod_meter_events.go | 28 --- pkg/mcclient/modules/mod_price_infos.go | 29 --- pkg/mcclient/modules/mod_rates.go | 29 --- pkg/mcclient/modules/mod_res_results.go | 30 --- pkg/mcclient/modules/mod_res_tag_details.go | 29 --- pkg/mcclient/modules/mod_reservations.go | 32 ---- pkg/mcclient/modules/mod_resource_details.go | 30 --- pkg/mcclient/modules/mod_resource_fees.go | 30 --- pkg/mcclient/modules/mod_unused_resources.go | 30 --- .../options/meter/billing_exchange_rates.go | 43 ----- pkg/mcclient/options/meter/bills_dimension.go | 104 ----------- pkg/mcclient/options/meter/budgets.go | 118 ------------ .../options/meter/cost_conversions.go | 58 ------ pkg/mcclient/options/meter/costreports.go | 73 -------- pkg/mcclient/options/meter/doc.go | 15 -- pkg/mcclient/options/meter/reservations.go | 36 ---- pkg/monitor/models/meteralert.go | 25 ++- 66 files changed, 18 insertions(+), 2979 deletions(-) delete mode 100644 cmd/climc/shell/meter/account_balances.go delete mode 100644 cmd/climc/shell/meter/amount_estimations.go delete mode 100644 cmd/climc/shell/meter/associated_bills.go delete mode 100644 cmd/climc/shell/meter/bill_analysises.go delete mode 100644 cmd/climc/shell/meter/bill_balances.go delete mode 100644 cmd/climc/shell/meter/bill_cloudchecks.go delete mode 100644 cmd/climc/shell/meter/bill_conditions.go delete mode 100644 cmd/climc/shell/meter/bill_details.go delete mode 100644 cmd/climc/shell/meter/bill_resources.go delete mode 100644 cmd/climc/shell/meter/bill_tasks.go delete mode 100644 cmd/climc/shell/meter/bills_dimension.go delete mode 100644 cmd/climc/shell/meter/bucket_options.go delete mode 100644 cmd/climc/shell/meter/budgets.go delete mode 100644 cmd/climc/shell/meter/cloud_sku_rates.go delete mode 100644 cmd/climc/shell/meter/common.go delete mode 100644 cmd/climc/shell/meter/cost_conversions.go delete mode 100644 cmd/climc/shell/meter/costalerts.go delete mode 100644 cmd/climc/shell/meter/costreports.go delete mode 100644 cmd/climc/shell/meter/daily_bills.go delete mode 100644 cmd/climc/shell/meter/meter-events.go delete mode 100644 cmd/climc/shell/meter/price_infos.go delete mode 100644 cmd/climc/shell/meter/rates.go delete mode 100644 cmd/climc/shell/meter/res_results.go delete mode 100644 cmd/climc/shell/meter/res_tag_details.go delete mode 100644 cmd/climc/shell/meter/reservations.go delete mode 100644 cmd/climc/shell/meter/resource_details.go delete mode 100644 cmd/climc/shell/meter/resource_fees.go delete mode 100644 cmd/climc/shell/meter/unused_resources.go delete mode 100644 pkg/mcclient/modules/mod_account_balances.go delete mode 100644 pkg/mcclient/modules/mod_amount_estimations.go delete mode 100644 pkg/mcclient/modules/mod_associated_bills.go delete mode 100644 pkg/mcclient/modules/mod_bill_analysises.go delete mode 100644 pkg/mcclient/modules/mod_bill_balances.go delete mode 100644 pkg/mcclient/modules/mod_bill_cloudchecks.go delete mode 100644 pkg/mcclient/modules/mod_bill_conditions.go delete mode 100644 pkg/mcclient/modules/mod_bill_details.go delete mode 100644 pkg/mcclient/modules/mod_bill_resources.go delete mode 100644 pkg/mcclient/modules/mod_bill_tasks.go delete mode 100644 pkg/mcclient/modules/mod_billing_exchange_rates.go delete mode 100644 pkg/mcclient/modules/mod_bills_dimension.go delete mode 100644 pkg/mcclient/modules/mod_bucket_options.go delete mode 100644 pkg/mcclient/modules/mod_budgets.go delete mode 100644 pkg/mcclient/modules/mod_cloud_sku_rates.go delete mode 100644 pkg/mcclient/modules/mod_cost_conversions.go delete mode 100644 pkg/mcclient/modules/mod_costalerts.go delete mode 100644 pkg/mcclient/modules/mod_costreports.go delete mode 100644 pkg/mcclient/modules/mod_daily_bills.go delete mode 100644 pkg/mcclient/modules/mod_meter_events.go delete mode 100644 pkg/mcclient/modules/mod_price_infos.go delete mode 100644 pkg/mcclient/modules/mod_rates.go delete mode 100644 pkg/mcclient/modules/mod_res_results.go delete mode 100644 pkg/mcclient/modules/mod_res_tag_details.go delete mode 100644 pkg/mcclient/modules/mod_reservations.go delete mode 100644 pkg/mcclient/modules/mod_resource_details.go delete mode 100644 pkg/mcclient/modules/mod_resource_fees.go delete mode 100644 pkg/mcclient/modules/mod_unused_resources.go delete mode 100644 pkg/mcclient/options/meter/billing_exchange_rates.go delete mode 100644 pkg/mcclient/options/meter/bills_dimension.go delete mode 100644 pkg/mcclient/options/meter/budgets.go delete mode 100644 pkg/mcclient/options/meter/cost_conversions.go delete mode 100644 pkg/mcclient/options/meter/costreports.go delete mode 100644 pkg/mcclient/options/meter/doc.go delete mode 100644 pkg/mcclient/options/meter/reservations.go diff --git a/cmd/climc/main.go b/cmd/climc/main.go index de12cef78f..c39537d554 100644 --- a/cmd/climc/main.go +++ b/cmd/climc/main.go @@ -31,7 +31,6 @@ import ( _ "yunion.io/x/onecloud/cmd/climc/shell/itsm" _ "yunion.io/x/onecloud/cmd/climc/shell/k8s" _ "yunion.io/x/onecloud/cmd/climc/shell/logger" - _ "yunion.io/x/onecloud/cmd/climc/shell/meter" _ "yunion.io/x/onecloud/cmd/climc/shell/misc" _ "yunion.io/x/onecloud/cmd/climc/shell/monitor" _ "yunion.io/x/onecloud/cmd/climc/shell/notifyv2" diff --git a/cmd/climc/shell/meter/account_balances.go b/cmd/climc/shell/meter/account_balances.go deleted file mode 100644 index 44e58e72fa..0000000000 --- a/cmd/climc/shell/meter/account_balances.go +++ /dev/null @@ -1,74 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - - type AccountBalancesListOptions struct { - options.BaseListOptions - StatMonth string `help:"stat_month of the query"` - StartDate string `help:"start_date of the query"` - EndDate string `help:"end_date of the query"` - QueryType string `help:"query_type of the query"` - Platform string `help:"platform of the query"` - ProjectId string `help:"project_id of the query"` - } - R(&AccountBalancesListOptions{}, "accountbalances-list", "List all account balances ", func(s *mcclient.ClientSession, args *AccountBalancesListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - - } - } - - if len(args.StatMonth) > 0 { - params.Add(jsonutils.NewString(args.StatMonth), "stat_month") - } - if len(args.StartDate) > 0 { - params.Add(jsonutils.NewString(args.StartDate), "start_date") - } - if len(args.EndDate) > 0 { - params.Add(jsonutils.NewString(args.EndDate), "end_date") - } - if len(args.QueryType) > 0 { - params.Add(jsonutils.NewString(args.QueryType), "query_type") - } - if len(args.Platform) > 0 { - params.Add(jsonutils.NewString(args.Platform), "platform") - } - if len(args.ProjectId) > 0 { - params.Add(jsonutils.NewString(args.ProjectId), "project_id") - } - - result, err := modules.AccountBalances.List(s, params) - if err != nil { - return err - } - - printList(result, modules.AccountBalances.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/amount_estimations.go b/cmd/climc/shell/meter/amount_estimations.go deleted file mode 100644 index 9e337b5733..0000000000 --- a/cmd/climc/shell/meter/amount_estimations.go +++ /dev/null @@ -1,34 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" -) - -func init() { - type AmountEstimationsNameOptions struct { - Name string `help:"name of amount estimation, example: month"` - } - R(&AmountEstimationsNameOptions{}, "amount-estimation-show", "show amount estimation of name", func(s *mcclient.ClientSession, args *AmountEstimationsNameOptions) error { - result, err := modules.AmountEstimations.Get(s, args.Name, nil) - if err != nil { - return err - } - printObject(result) - return nil - }) -} diff --git a/cmd/climc/shell/meter/associated_bills.go b/cmd/climc/shell/meter/associated_bills.go deleted file mode 100644 index 910f108d5f..0000000000 --- a/cmd/climc/shell/meter/associated_bills.go +++ /dev/null @@ -1,44 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - type AssociatedBillListOptions struct { - options.BaseListOptions - StartDay int `help:"time range of the associated bills, example: 20060102" required:"true"` - EndDay int `help:"time range of the associated bills, example: 20060102" required:"true"` - - ResourceId string `help:"resource id"` - } - R(&AssociatedBillListOptions{}, "associated-bill-list", "List associated bills", - func(s *mcclient.ClientSession, args *AssociatedBillListOptions) error { - params, err := options.ListStructToParams(args) - if err != nil { - return err - } - result, err := modules.AssociatedBills.List(s, params) - if err != nil { - return err - } - printList(result, modules.AssociatedBills.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/bill_analysises.go b/cmd/climc/shell/meter/bill_analysises.go deleted file mode 100644 index 431fcef7b7..0000000000 --- a/cmd/climc/shell/meter/bill_analysises.go +++ /dev/null @@ -1,95 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - - type BillAnalysisListOptions struct { - options.BaseListOptions - QUERYTYPE string `help:"query_type of the bill_analysis"` - STARTDATE string `help:"start_date of the bill_analysis"` - ENDDATE string `help:"end_date of the bill_analysis"` - DataType string `help:"data_type of the bill_analysis"` - ChargeType string `help:"charge_type of the bill_analysis"` - - Platform string `help:"platform of the bill_analysis"` - AccountId string `help:"account_id of the bill_analysis"` - RegionExtId string `help:"region_ext_id of the bill_analysis"` - ProjectId string `help:"project_id of the bill_analysis"` - } - R(&BillAnalysisListOptions{}, "billanalysis-list", "List all bill analysises", func(s *mcclient.ClientSession, args *BillAnalysisListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - - } - } - - if len(args.QUERYTYPE) > 0 { - params.Add(jsonutils.NewString(args.QUERYTYPE), "query_type") - } - - if len(args.STARTDATE) > 0 { - params.Add(jsonutils.NewString(args.STARTDATE), "start_date") - } - - if len(args.ENDDATE) > 0 { - params.Add(jsonutils.NewString(args.ENDDATE), "end_date") - } - - if len(args.DataType) > 0 { - params.Add(jsonutils.NewString(args.DataType), "data_type") - } - - if len(args.ChargeType) > 0 { - params.Add(jsonutils.NewString(args.ChargeType), "charge_type") - } - - if len(args.Platform) > 0 { - params.Add(jsonutils.NewString(args.Platform), "platform") - } - - if len(args.AccountId) > 0 { - params.Add(jsonutils.NewString(args.AccountId), "account_id") - } - - if len(args.RegionExtId) > 0 { - params.Add(jsonutils.NewString(args.RegionExtId), "region_ext_id") - } - - if len(args.ProjectId) > 0 { - params.Add(jsonutils.NewString(args.ProjectId), "project_id") - } - - result, err := modules.BillAnalysises.List(s, params) - if err != nil { - return err - } - - printList(result, modules.BillAnalysises.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/bill_balances.go b/cmd/climc/shell/meter/bill_balances.go deleted file mode 100644 index c554e9f899..0000000000 --- a/cmd/climc/shell/meter/bill_balances.go +++ /dev/null @@ -1,63 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - - type BillBalanceListOptions struct { - options.BaseListOptions - ACCOUNTID string `help:"accountId of the BillBalance" metavar:"accountList|account_id"` - } - R(&BillBalanceListOptions{}, "billbalance-list", "List all BillBalances ", func(s *mcclient.ClientSession, args *BillBalanceListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - } - } - - params.Add(jsonutils.NewString(args.ACCOUNTID), "account_id") - - result, err := modules.BillBalances.List(s, params) - if err != nil { - return err - } - - printList(result, modules.BillBalances.GetColumns(s)) - return nil - }) - - type BillBalanceShowOptions struct { - ACCOUNTID string `help:"accountId of the BillBalance to show"` - } - R(&BillBalanceShowOptions{}, "billbalance-show", "Show BillBalance details", func(s *mcclient.ClientSession, args *BillBalanceShowOptions) error { - result, err := modules.BillBalances.Get(s, args.ACCOUNTID, nil) - if err != nil { - return err - } - printObject(result) - return nil - }) -} diff --git a/cmd/climc/shell/meter/bill_cloudchecks.go b/cmd/climc/shell/meter/bill_cloudchecks.go deleted file mode 100644 index f434be79f2..0000000000 --- a/cmd/climc/shell/meter/bill_cloudchecks.go +++ /dev/null @@ -1,59 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - - type BillCloudCheckListOptions struct { - options.BaseListOptions - ACCOUNTID string `help:"accountId of the bill_cloudcheck"` - SUMMONTH string `help:"sum_month of the bill_cloudcheck"` - QUERYTYPE string `help:"query_type of the bill_cloudcheck"` - QueryItem string `help:"query_item of the bill_cloudcheck"` - } - R(&BillCloudCheckListOptions{}, "billcloudcheck-list", "List all BillCloudChecks ", func(s *mcclient.ClientSession, args *BillCloudCheckListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - } - } - - params.Add(jsonutils.NewString(args.ACCOUNTID), "account_id") - params.Add(jsonutils.NewString(args.SUMMONTH), "sum_month") - params.Add(jsonutils.NewString(args.QUERYTYPE), "query_type") - if len(args.QueryItem) > 0 { - params.Add(jsonutils.NewString(args.QueryItem), "query_item") - } - - result, err := modules.BillCloudChecks.List(s, params) - if err != nil { - return err - } - - printList(result, modules.BillCloudChecks.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/bill_conditions.go b/cmd/climc/shell/meter/bill_conditions.go deleted file mode 100644 index 9308fc0599..0000000000 --- a/cmd/climc/shell/meter/bill_conditions.go +++ /dev/null @@ -1,57 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - - type BillConditionListOptions struct { - options.BaseListOptions - QUERYTYPE string `help:"query type of the bill_condition"` - ParentId string `help:"parent id of the bill_condition"` - } - R(&BillConditionListOptions{}, "billcondition-list", "List all bill conditions", func(s *mcclient.ClientSession, args *BillConditionListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - - } - } - if len(args.QUERYTYPE) > 0 { - params.Add(jsonutils.NewString(args.QUERYTYPE), "query_type") - } - if len(args.ParentId) > 0 { - params.Add(jsonutils.NewString(args.ParentId), "parent_id") - } - - result, err := modules.BillConditions.List(s, params) - if err != nil { - return err - } - - printList(result, modules.BillConditions.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/bill_details.go b/cmd/climc/shell/meter/bill_details.go deleted file mode 100644 index af8b75cb3a..0000000000 --- a/cmd/climc/shell/meter/bill_details.go +++ /dev/null @@ -1,62 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - - type BillDetailListOptions struct { - options.BaseListOptions - STARTDATE string `help:"start date of the bill_detail"` - ENDDATE string `help:"end date of the bill_detail"` - ProjectId string `help:"project id of the bill_detail"` - } - R(&BillDetailListOptions{}, "billdetail-list", "List all bill details", func(s *mcclient.ClientSession, args *BillDetailListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - - } - } - if len(args.STARTDATE) > 0 { - params.Add(jsonutils.NewString(args.STARTDATE), "start_date") - } - if len(args.ENDDATE) > 0 { - params.Add(jsonutils.NewString(args.ENDDATE), "end_date") - } - - if len(args.ProjectId) > 0 { - params.Add(jsonutils.NewString(args.ProjectId), "project_id") - } - - result, err := modules.BillDetails.List(s, params) - if err != nil { - return err - } - - printList(result, modules.BillDetails.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/bill_resources.go b/cmd/climc/shell/meter/bill_resources.go deleted file mode 100644 index b7f6777c3c..0000000000 --- a/cmd/climc/shell/meter/bill_resources.go +++ /dev/null @@ -1,62 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - - type BillResourceListOptions struct { - options.BaseListOptions - STARTDATE string `help:"start date of the bill_resource"` - ENDDATE string `help:"end date of the bill_resource"` - ProjectId string `help:"project id of the bill_resource"` - } - R(&BillResourceListOptions{}, "billresource-list", "List all bill resources", func(s *mcclient.ClientSession, args *BillResourceListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - - } - } - if len(args.STARTDATE) > 0 { - params.Add(jsonutils.NewString(args.STARTDATE), "start_date") - } - if len(args.ENDDATE) > 0 { - params.Add(jsonutils.NewString(args.ENDDATE), "end_date") - } - - if len(args.ProjectId) > 0 { - params.Add(jsonutils.NewString(args.ProjectId), "project_id") - } - - result, err := modules.BillResources.List(s, params) - if err != nil { - return err - } - - printList(result, modules.BillResources.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/bill_tasks.go b/cmd/climc/shell/meter/bill_tasks.go deleted file mode 100644 index 336368b3db..0000000000 --- a/cmd/climc/shell/meter/bill_tasks.go +++ /dev/null @@ -1,42 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" -) - -func init() { - type BillTasksCreateOptions struct { - // options.BaseListOptions - CloudaccountId string `help:"cloudaccount Id" required:"true"` - StartDay int `help:"start day of billing cycle, example: 20060102"` - EndDay int `help:"end day of billing cycle, example: 20060102"` - TaskType string `help:"task type" choices:"bill_remove|bill_pulling"` - } - R(&BillTasksCreateOptions{}, "bill-tasks-create", "create bill task", - func(s *mcclient.ClientSession, args *BillTasksCreateOptions) error { - params := jsonutils.Marshal(args) - result, err := modules.BillTasks.Create(s, params) - if err != nil { - return err - } - printObject(result) - return nil - }) -} diff --git a/cmd/climc/shell/meter/bills_dimension.go b/cmd/climc/shell/meter/bills_dimension.go deleted file mode 100644 index 89f61316b1..0000000000 --- a/cmd/climc/shell/meter/bills_dimension.go +++ /dev/null @@ -1,34 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/onecloud/cmd/climc/shell" - "yunion.io/x/onecloud/pkg/mcclient/modules" - options "yunion.io/x/onecloud/pkg/mcclient/options/meter" -) - -func init() { - cmd := shell.NewResourceCmd(modules.BillingDimensionManager) - cmd.Create(&options.BillDimensionCreateOptions{}) - cmd.List(&options.BillDimensionListOptions{}) - cmd.Show(&options.BillDimensionShowOptions{}) - cmd.Delete(&options.BillDimensionDeleteOptions{}) - - cmdAnalysis := shell.NewResourceCmd(modules.BillingDimensionAnalysisManager) - cmdAnalysis.List(&options.BillDimensionAnalysisListOptions{}) - cmdAnalysis.Show(&options.BillDimensionAnalysisShowOptions{}) - -} diff --git a/cmd/climc/shell/meter/bucket_options.go b/cmd/climc/shell/meter/bucket_options.go deleted file mode 100644 index 91c36c7f33..0000000000 --- a/cmd/climc/shell/meter/bucket_options.go +++ /dev/null @@ -1,46 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - type BucketOptionsVerifyOptions struct { - options.BaseListOptions - CloudaccountId string `help:"cloudaccount Id" required:"true"` - BillingReportBucket string `help:"S3 bucket that stores account billing report"` - BillingFilePrefix string `help:"prefix of billing file name"` - BillingBucketAccount string `help:"Id of cloudaccount that can access billing bucket"` - UsageReportBucket string `help:"S3 bucket that stores account usage report"` - UsageFilePrefix string `help:"prefix of usage file name"` - UsageBucketAccount string `help:"Id of cloudaccount that can access usage bucket"` - } - R(&BucketOptionsVerifyOptions{}, "bucket-options-verify", "billing bucket connection test", - func(s *mcclient.ClientSession, args *BucketOptionsVerifyOptions) error { - params := jsonutils.Marshal(args) - result, err := modules.BucketOptions.PerformAction(s, args.CloudaccountId, "verify", params) - if err != nil { - return err - } - printObject(result) - return nil - }) -} diff --git a/cmd/climc/shell/meter/budgets.go b/cmd/climc/shell/meter/budgets.go deleted file mode 100644 index 7a5c55da05..0000000000 --- a/cmd/climc/shell/meter/budgets.go +++ /dev/null @@ -1,30 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/onecloud/cmd/climc/shell" - "yunion.io/x/onecloud/pkg/mcclient/modules" - options "yunion.io/x/onecloud/pkg/mcclient/options/meter" -) - -func init() { - cmd := shell.NewResourceCmd(&modules.Budgets).WithKeyword("budget") - cmd.List(new(options.BudgetListOptions)) - cmd.Create(new(options.BudgetCreateOptions)) - cmd.Update(new(options.BudgetUpdateOptions)) - cmd.Delete(new(options.BudgetDeleteOptions)) - cmd.Perform("sync-alerts", new(options.BudgetSyncAlertsOptions)) -} diff --git a/cmd/climc/shell/meter/cloud_sku_rates.go b/cmd/climc/shell/meter/cloud_sku_rates.go deleted file mode 100644 index 8461845d0e..0000000000 --- a/cmd/climc/shell/meter/cloud_sku_rates.go +++ /dev/null @@ -1,44 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" -) - -func init() { - - type CloudSkuRateListOptions struct { - PARAMKEYS string `help:"param_keys like key1$key2$key3, key=provider(lowercase)::region::name"` - } - - R(&CloudSkuRateListOptions{}, "cloud-sku-rate-list", "list cloud-sku-rates", func(s *mcclient.ClientSession, args *CloudSkuRateListOptions) error { - - params := jsonutils.NewDict() - - params.Add(jsonutils.NewString(args.PARAMKEYS), "param_keys") - - result, err := modules.CloudSkuRates.List(s, params) - if err != nil { - return err - } - - printList(result, modules.CloudSkuRates.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/common.go b/cmd/climc/shell/meter/common.go deleted file mode 100644 index 710fd07932..0000000000 --- a/cmd/climc/shell/meter/common.go +++ /dev/null @@ -1,30 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/onecloud/cmd/climc/shell" - "yunion.io/x/onecloud/pkg/util/printutils" -) - -var ( - R = shell.R - printList = printutils.PrintJSONList - printObject = printutils.PrintJSONObject - printBatchResults = printutils.PrintJSONBatchResults - - InvalidUpdateError = shell.InvalidUpdateError - printObjectRecursive = printutils.PrintJSONObjectRecursive -) diff --git a/cmd/climc/shell/meter/cost_conversions.go b/cmd/climc/shell/meter/cost_conversions.go deleted file mode 100644 index a4623cfd00..0000000000 --- a/cmd/climc/shell/meter/cost_conversions.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/onecloud/cmd/climc/shell" - "yunion.io/x/onecloud/pkg/mcclient/modules" - options "yunion.io/x/onecloud/pkg/mcclient/options/meter" -) - -func init() { - cmd := shell.NewResourceCmd(&modules.CostConversions).WithKeyword("cost-conversion") - cmd.List(new(options.CostConversionListOptions)) - cmd.Create(new(options.CostConversionCreateOptions)) - cmd.Update(new(options.CostConversionUpdateOptions)) - cmd.Delete(new(options.CostConversionDeleteOptions)) -} diff --git a/cmd/climc/shell/meter/costalerts.go b/cmd/climc/shell/meter/costalerts.go deleted file mode 100644 index ec942dfd94..0000000000 --- a/cmd/climc/shell/meter/costalerts.go +++ /dev/null @@ -1,145 +0,0 @@ -// 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 meter - -import ( - "strings" - - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - type CostAlertListOptions struct { - options.BaseListOptions - } - R(&CostAlertListOptions{}, "cost-alert-list", "list cost alerts", - func(s *mcclient.ClientSession, args *CostAlertListOptions) error { - params, err := options.ListStructToParams(args) - if err != nil { - return err - } - result, err := modules.CostAlerts.List(s, params) - if err != nil { - return err - } - printList(result, modules.CostAlerts.GetColumns(s)) - return nil - }) - - type CostAlertCreateOptions struct { - Brand string `help:"brand of cost filter" json:"brand"` - AccountId string `help:"cloudaccount id of cost filter" json:"account_id"` - Account string `help:"cloudaccount name of cost filter" json:"account"` - CloudproviderId string `help:"cloudprovider id of cost filter" json:"cloudprovider_id"` - CloudproviderName string `help:"cloudprovider name of cost filter" json:"cloudprovider_name"` - - RegionId string `help:"region id of cost filter" json:"region_id"` - Region string `help:"region name of cost filter" json:"region"` - - DomainIdFilter string `help:"domain id of cost filter" json:"domain_id_filter"` - ProjectIdFilter string `help:"project id of cost filter" json:"project_id_filter"` - DomainFilter string `help:"domain of cost filter" json:"domain_filter"` - ProjectFilter string `help:"project of cost filter" json:"project_filter"` - - ResourceType string `help:"resource type of cost filter" json:"resource_type"` - CostType string `help:"cost type, example:month/day" json:"cost_type"` - Currency string `help:"currency of cost filter" json:"currency"` - - Amount float64 `help:"cost amount threshold" json:"amount"` - - UserIds string `help:"user ids of notifications, example:id1,id2" json:"user_ids"` - } - R(&CostAlertCreateOptions{}, "cost-alert-create", "create cost alert", func(s *mcclient.ClientSession, args *CostAlertCreateOptions) error { - params, err := options.StructToParams(args) - if err != nil { - return err - } - if len(args.UserIds) > 0 { - userIds := strings.Split(args.UserIds, ",") - item := jsonutils.NewDict() - item.Set("content", jsonutils.NewStringArray(userIds)) - params.Set("user_ids", item) - } - - result, err := modules.CostAlerts.Create(s, params) - if err != nil { - return err - } - printObject(result) - return nil - }) - - type CostAlertUpdateOptions struct { - ID string `help:"ID of cost alert" json:"-"` - - Brand string `help:"brand of cost filter" json:"brand"` - AccountId string `help:"cloudaccount id of cost filter" json:"account_id"` - Account string `help:"cloudaccount name of cost filter" json:"account"` - CloudproviderId string `help:"cloudprovider id of cost filter" json:"cloudprovider_id"` - CloudproviderName string `help:"cloudprovider name of cost filter" json:"cloudprovider_name"` - - RegionId string `help:"region id of cost filter" json:"region_id"` - Region string `help:"region name of cost filter" json:"region"` - - DomainIdFilter string `help:"domain id of cost filter" json:"domain_id_filter"` - ProjectIdFilter string `help:"project id of cost filter" json:"project_id_filter"` - DomainFilter string `help:"domain of cost filter" json:"domain_filter"` - ProjectFilter string `help:"project of cost filter" json:"project_filter"` - - ResourceType string `help:"resource type of cost filter" json:"resource_type"` - CostType string `help:"cost type, example:month/day" json:"cost_type"` - Currency string `help:"currency of cost filter" json:"currency"` - - Amount float64 `help:"cost amount threshold" json:"amount"` - - UserIds string `help:"user ids of notifications, example:id1,id2" json:"user_ids"` - } - R(&CostAlertUpdateOptions{}, "cost-alert-update", "update cost alert", func(s *mcclient.ClientSession, args *CostAlertUpdateOptions) error { - params, err := options.StructToParams(args) - if err != nil { - return err - } - if len(args.UserIds) > 0 { - userIds := strings.Split(args.UserIds, ",") - item := jsonutils.NewDict() - item.Set("content", jsonutils.NewStringArray(userIds)) - params.Set("user_ids", item) - } - - result, err := modules.CostAlerts.Update(s, args.ID, params) - if err != nil { - return err - } - printObject(result) - return nil - }) - - type CostAlertDeleteOptions struct { - ID string `help:"ID of cost alert" json:"-"` - } - R(&CostAlertDeleteOptions{}, "cost-alert-delete", "delete cost alert", func(s *mcclient.ClientSession, args *CostAlertDeleteOptions) error { - result, err := modules.CostAlerts.Delete(s, args.ID, nil) - if err != nil { - return err - } - printObject(result) - return nil - }) - -} diff --git a/cmd/climc/shell/meter/costreports.go b/cmd/climc/shell/meter/costreports.go deleted file mode 100644 index a5dbb97bb5..0000000000 --- a/cmd/climc/shell/meter/costreports.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/onecloud/cmd/climc/shell" - "yunion.io/x/onecloud/pkg/mcclient/modules" - options "yunion.io/x/onecloud/pkg/mcclient/options/meter" -) - -func init() { - cmd := shell.NewResourceCmd(&modules.CostReports).WithKeyword("cost-report") - cmd.List(new(options.CostReportListOptions)) - cmd.Create(new(options.CostReportCreateOptions)) - cmd.Update(new(options.CostReportUpdateOptions)) - cmd.Delete(new(options.CostReportDeleteOptions)) -} diff --git a/cmd/climc/shell/meter/daily_bills.go b/cmd/climc/shell/meter/daily_bills.go deleted file mode 100644 index 360292bf02..0000000000 --- a/cmd/climc/shell/meter/daily_bills.go +++ /dev/null @@ -1,42 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - type DailyBillListOptions struct { - options.BaseListOptions - StartDay int `help:"time range of the daily bills, example: 20060102" required:"true"` - EndDay int `help:"time range of the daily bills, example: 20060102" required:"true"` - } - R(&DailyBillListOptions{}, "daily-bill-list", "List daily bills", - func(s *mcclient.ClientSession, args *DailyBillListOptions) error { - params, err := options.ListStructToParams(args) - if err != nil { - return err - } - result, err := modules.DailyBills.List(s, params) - if err != nil { - return err - } - printList(result, modules.DailyBills.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/meter-events.go b/cmd/climc/shell/meter/meter-events.go deleted file mode 100644 index db1bd258c9..0000000000 --- a/cmd/climc/shell/meter/meter-events.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/onecloud/cmd/climc/shell/events" - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" -) - -func doMeterEventList(s *mcclient.ClientSession, args *events.EventListOptions) error { - return events.DoEventList(modules.MeterLogs, s, args) -} - -func init() { - R(&events.EventListOptions{}, "meter-event-show", "Show operation meter event logs", doMeterEventList) -} diff --git a/cmd/climc/shell/meter/price_infos.go b/cmd/climc/shell/meter/price_infos.go deleted file mode 100644 index 94481d6f7e..0000000000 --- a/cmd/climc/shell/meter/price_infos.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - - type PriceInfoListOptions struct { - options.BaseListOptions - PROVIDER string `help:"provider of the priceinfo to show"` - QUANTITY string `help:"quantity of the priceinfo to show"` - Period string `help:"period of the priceinfo to show"` - Spec string `help:"spec of the priceinfo to show"` - PriceKey string `help:"priceKey of the priceinfo to show"` - RegionId string `help:"regionId of the priceinfo to show"` - } - R(&PriceInfoListOptions{}, "priceinfo-list", "List all PriceInfos ", func(s *mcclient.ClientSession, args *PriceInfoListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - } - } - - params.Add(jsonutils.NewString(args.PROVIDER), "provider") - params.Add(jsonutils.NewString(args.QUANTITY), "quantity") - if len(args.Period) > 0 { - params.Add(jsonutils.NewString(args.Period), "period") - } - if len(args.Spec) > 0 { - params.Add(jsonutils.NewString(args.Spec), "spec") - } - if len(args.PriceKey) > 0 { - params.Add(jsonutils.NewString(args.PriceKey), "price_key") - } - if len(args.RegionId) > 0 { - params.Add(jsonutils.NewString(args.RegionId), "region_id") - } - result, err := modules.PriceInfos.List(s, params) - if err != nil { - return err - } - - printList(result, modules.PriceInfos.GetColumns(s)) - return nil - }) - -} diff --git a/cmd/climc/shell/meter/rates.go b/cmd/climc/shell/meter/rates.go deleted file mode 100644 index 9ea5dbee45..0000000000 --- a/cmd/climc/shell/meter/rates.go +++ /dev/null @@ -1,176 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - /** - * 列出列表 - */ - type RateListOptions struct { - options.BaseListOptions - RESTYPE string `help:"res_type of the rate"` - ACTION string `help:"action of list :querygroup or queryhistory"` - SubResType string `help:"query the subResType"` - Id string `help:"ID of rate"` - } - R(&RateListOptions{}, "rate-list", "List all rates ", func(s *mcclient.ClientSession, args *RateListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - - } - } - - params.Add(jsonutils.NewString(args.RESTYPE), "res_type") - params.Add(jsonutils.NewString(args.ACTION), "action") - - if len(args.SubResType) > 0 { - params.Add(jsonutils.NewString(args.SubResType), "sub_res_type") - } - if len(args.Id) > 0 { - params.Add(jsonutils.NewString(args.Id), "id") - } - - result, err := modules.Rates.List(s, params) - if err != nil { - return err - } - - printList(result, modules.Rates.GetColumns(s)) - return nil - }) - - /** - * 根据ID查询详情 - */ - type RateShowOptions struct { - ID string `help:"ID of the rate to show"` - } - R(&RateShowOptions{}, "rate-show", "Show rate details", func(s *mcclient.ClientSession, args *RateShowOptions) error { - result, err := modules.Rates.Get(s, args.ID, nil) - if err != nil { - return err - } - printObject(result) - return nil - }) - - /** - * 删除 - */ - type RateDeleteOptions struct { - ID string `help:"ID of rate"` - } - R(&RateDeleteOptions{}, "rate-delete", "Delete a rate", func(s *mcclient.ClientSession, args *RateDeleteOptions) error { - rate, e := modules.Rates.Delete(s, args.ID, nil) - if e != nil { - return e - } - printObject(rate) - return nil - }) - - /** - * 创建 - */ - type RateCreateOptions struct { - RESTYPE string `help:"RESTYPE of the rate"` - SubResType string `help:"sub_res_type of the rate"` - DURATION string `help:"DURATION of the rate"` - UNIT string `help:"UNIT of the rate"` - Spec string `help:"Spec of the rate"` - RATE string `help:"RATE of the rate"` - EFFECTIVEDATE string `help:"EFFECTIVEDATE of the rate"` - Platform string `help:"Platform of the rate"` - } - - R(&RateCreateOptions{}, "rate-create", "Create a rate", func(s *mcclient.ClientSession, args *RateCreateOptions) error { - params := jsonutils.NewDict() - params.Add(jsonutils.NewString(args.RESTYPE), "res_type") - params.Add(jsonutils.NewString(args.SubResType), "sub_res_type") - params.Add(jsonutils.NewString(args.DURATION), "duration") - params.Add(jsonutils.NewString(args.UNIT), "unit") - params.Add(jsonutils.NewString(args.Spec), "spec") - params.Add(jsonutils.NewString(args.RATE), "rate") - params.Add(jsonutils.NewString(args.EFFECTIVEDATE), "effective_date") - params.Add(jsonutils.NewString(args.Platform), "platform") - - rate, err := modules.Rates.Create(s, params) - if err != nil { - return err - } - printObject(rate) - return nil - }) - - /** - * 修改 - */ - type RateUpdateOptions struct { - ID string `help:"ID of the rate"` - ResType string `help:"ResType of the rate"` - SubResType string `help:"SubResType of the rate"` - Duration string `help:"Duration of the rate"` - Unit string `help:"Unit of the rate"` - Spec string `help:"Spec of the rate"` - Rate string `help:"Rate of the rate"` - EffectiveDate string `help:"Effective Date of the rate"` - Platform string `help:"Platform of the rate"` - } - R(&RateUpdateOptions{}, "rate-update", "Update a rate", func(s *mcclient.ClientSession, args *RateUpdateOptions) error { - params := jsonutils.NewDict() - if len(args.ResType) > 0 { - params.Add(jsonutils.NewString(args.ResType), "res_type") - } - if len(args.SubResType) > 0 { - params.Add(jsonutils.NewString(args.SubResType), "sub_res_type") - } - if len(args.Duration) > 0 { - params.Add(jsonutils.NewString(args.Duration), "duration") - } - if len(args.Unit) > 0 { - params.Add(jsonutils.NewString(args.Unit), "unit") - } - if len(args.Spec) > 0 { - params.Add(jsonutils.NewString(args.Spec), "spec") - } - if len(args.Rate) > 0 { - params.Add(jsonutils.NewString(args.Rate), "rate") - } - if len(args.EffectiveDate) > 0 { - params.Add(jsonutils.NewString(args.EffectiveDate), "effective_date") - } - if len(args.Platform) > 0 { - params.Add(jsonutils.NewString(args.Platform), "platform") - } - rate, err := modules.Rates.Put(s, args.ID, params) - if err != nil { - return err - } - printObject(rate) - return nil - }) -} diff --git a/cmd/climc/shell/meter/res_results.go b/cmd/climc/shell/meter/res_results.go deleted file mode 100644 index 777d80cb43..0000000000 --- a/cmd/climc/shell/meter/res_results.go +++ /dev/null @@ -1,74 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - - type ResResultsListOptions struct { - options.BaseListOptions - StatMonth string `help:"stat_month of the query"` - StartDate string `help:"start_date of the query"` - EndDate string `help:"end_date of the query"` - ResType string `help:"res_type of the query"` - Platform string `help:"platform of the query"` - ProjectId string `help:"project_id of the query"` - } - R(&ResResultsListOptions{}, "resresult-list", "List all res results ", func(s *mcclient.ClientSession, args *ResResultsListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - - } - } - - if len(args.StatMonth) > 0 { - params.Add(jsonutils.NewString(args.StatMonth), "stat_month") - } - if len(args.StartDate) > 0 { - params.Add(jsonutils.NewString(args.StartDate), "start_date") - } - if len(args.EndDate) > 0 { - params.Add(jsonutils.NewString(args.EndDate), "end_date") - } - if len(args.ResType) > 0 { - params.Add(jsonutils.NewString(args.ResType), "res_type") - } - if len(args.Platform) > 0 { - params.Add(jsonutils.NewString(args.Platform), "platform") - } - if len(args.ProjectId) > 0 { - params.Add(jsonutils.NewString(args.ProjectId), "project_id") - } - - result, err := modules.ResResults.List(s, params) - if err != nil { - return err - } - - printList(result, modules.ResResults.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/res_tag_details.go b/cmd/climc/shell/meter/res_tag_details.go deleted file mode 100644 index 576963f12d..0000000000 --- a/cmd/climc/shell/meter/res_tag_details.go +++ /dev/null @@ -1,53 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - - type ResTagDetailListOptions struct { - options.BaseListOptions - RESTYPE string `help:"query res_type = server"` - } - R(&ResTagDetailListOptions{}, "restagdetail-list", "List all res tag detail", func(s *mcclient.ClientSession, args *ResTagDetailListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - - } - } - if len(args.RESTYPE) > 0 { - params.Add(jsonutils.NewString(args.RESTYPE), "res_type") - } - - result, err := modules.ResTagDetails.List(s, params) - if err != nil { - return err - } - - printList(result, modules.ResTagDetails.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/reservations.go b/cmd/climc/shell/meter/reservations.go deleted file mode 100644 index eeb972145a..0000000000 --- a/cmd/climc/shell/meter/reservations.go +++ /dev/null @@ -1,26 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/onecloud/cmd/climc/shell" - "yunion.io/x/onecloud/pkg/mcclient/modules" - options "yunion.io/x/onecloud/pkg/mcclient/options/meter" -) - -func init() { - cmd := shell.NewResourceCmd(&modules.Reservations).WithKeyword("reservation") - cmd.List(new(options.ReservationListOptions)) -} diff --git a/cmd/climc/shell/meter/resource_details.go b/cmd/climc/shell/meter/resource_details.go deleted file mode 100644 index 5073fd5946..0000000000 --- a/cmd/climc/shell/meter/resource_details.go +++ /dev/null @@ -1,59 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - /** - * 列出列表 - */ - type ResourceDetailListOptions struct { - options.BaseListOptions - QUERYTYPE string `help:"query type of the resource_detail"` - ProjectId string `help:"project id of the resource_detail"` - } - R(&ResourceDetailListOptions{}, "resourcedetail-list", "List all resource details", func(s *mcclient.ClientSession, args *ResourceDetailListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - - } - } - if len(args.QUERYTYPE) > 0 { - params.Add(jsonutils.NewString(args.QUERYTYPE), "query_type") - } - if len(args.ProjectId) > 0 { - params.Add(jsonutils.NewString(args.ProjectId), "project_Iid") - } - - result, err := modules.ResourceDetails.List(s, params) - if err != nil { - return err - } - - printList(result, modules.ResourceDetails.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/resource_fees.go b/cmd/climc/shell/meter/resource_fees.go deleted file mode 100644 index 661e00e555..0000000000 --- a/cmd/climc/shell/meter/resource_fees.go +++ /dev/null @@ -1,74 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - /** - * 列出列表 - */ - type ResourceFeeListOptions struct { - options.BaseListOptions - STATTYPE string `help:"stat type of the resource_fee"` - STATMONTH string `help:"stat month of the resource_fee"` - ProjectId string `help:"project id of the resource_fee"` - StartDay string `help:"start day of the resource_fee"` - EndDay string `help:"end day of the resource_fee"` - } - R(&ResourceFeeListOptions{}, "resourcefee-list", "List all resource fees", func(s *mcclient.ClientSession, args *ResourceFeeListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - - } - } - if len(args.STATTYPE) > 0 { - params.Add(jsonutils.NewString(args.STATTYPE), "stat_type") - } - if len(args.STATMONTH) > 0 { - params.Add(jsonutils.NewString(args.STATMONTH), "stat_month") - } - - if len(args.ProjectId) > 0 { - params.Add(jsonutils.NewString(args.ProjectId), "project_id") - } - - if len(args.StartDay) > 0 { - params.Add(jsonutils.NewString(args.StartDay), "start_day") - } - - if len(args.EndDay) > 0 { - params.Add(jsonutils.NewString(args.EndDay), "end_day") - } - - result, err := modules.ResourceFees.List(s, params) - if err != nil { - return err - } - - printList(result, modules.ResourceFees.GetColumns(s)) - return nil - }) -} diff --git a/cmd/climc/shell/meter/unused_resources.go b/cmd/climc/shell/meter/unused_resources.go deleted file mode 100644 index 7ad70c37d3..0000000000 --- a/cmd/climc/shell/meter/unused_resources.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient" - "yunion.io/x/onecloud/pkg/mcclient/modules" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -func init() { - - type UnusedResourceListOptions struct { - options.BaseListOptions - ProjectId string `help:"project id of the unused resources"` - StartDate string `help:"start_date of the unused resources"` - EndDate string `help:"end_date of the unused resources"` - ResType string `help:"res_type of the unused resources"` - Platform string `help:"platform of the unused resources"` - } - R(&UnusedResourceListOptions{}, "unusedresources-list", "List all unused resources", func(s *mcclient.ClientSession, args *UnusedResourceListOptions) error { - var params *jsonutils.JSONDict - { - var err error - params, err = args.BaseListOptions.Params() - if err != nil { - return err - - } - } - if len(args.ProjectId) > 0 { - params.Add(jsonutils.NewString(args.ProjectId), "project_id") - } - if len(args.StartDate) > 0 { - params.Add(jsonutils.NewString(args.StartDate), "start_date") - } - if len(args.EndDate) > 0 { - params.Add(jsonutils.NewString(args.EndDate), "end_date") - } - if len(args.ResType) > 0 { - params.Add(jsonutils.NewString(args.ResType), "res_type") - } - if len(args.Platform) > 0 { - params.Add(jsonutils.NewString(args.Platform), "platform") - } - - result, err := modules.UnusedResources.List(s, params) - if err != nil { - return err - } - - printList(result, modules.UnusedResources.GetColumns(s)) - return nil - }) -} diff --git a/pkg/mcclient/modules/managers.go b/pkg/mcclient/modules/managers.go index 4586e40f84..b6f1ed905b 100644 --- a/pkg/mcclient/modules/managers.go +++ b/pkg/mcclient/modules/managers.go @@ -138,12 +138,6 @@ func NewSchedulerManager(keyword, keywordPlural string, columns, adminColumns [] Keyword: keyword, KeywordPlural: keywordPlural} } -func NewMeterManager(keyword, keywordPlural string, columns, adminColumns []string) modulebase.ResourceManager { - return modulebase.ResourceManager{ - BaseManager: *modulebase.NewBaseManager(apis.SERVICE_TYPE_METER, "", "", columns, adminColumns), - Keyword: keyword, KeywordPlural: keywordPlural} -} - func NewYunionAgentManager(keyword, keywordPlural string, columns, adminColumns []string) modulebase.ResourceManager { return modulebase.ResourceManager{ BaseManager: *modulebase.NewBaseManager(apis.SERVICE_TYPE_YUNIONAGENT, "", "", columns, adminColumns), diff --git a/pkg/mcclient/modules/mod_account_balances.go b/pkg/mcclient/modules/mod_account_balances.go deleted file mode 100644 index 17c0448e4f..0000000000 --- a/pkg/mcclient/modules/mod_account_balances.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - AccountBalances modulebase.ResourceManager -) - -func init() { - AccountBalances = NewMeterManager("account_balance", "account_balances", - []string{"account_type", "available_amount", "current_outcome", "current_income"}, - []string{}, - ) - register(&AccountBalances) -} diff --git a/pkg/mcclient/modules/mod_amount_estimations.go b/pkg/mcclient/modules/mod_amount_estimations.go deleted file mode 100644 index 85cee09dc7..0000000000 --- a/pkg/mcclient/modules/mod_amount_estimations.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - AmountEstimations modulebase.ResourceManager -) - -func init() { - AmountEstimations = NewMeterManager("amount_estimation", "amount_estimations", - []string{"amount"}, - []string{}, - ) - register(&AmountEstimations) -} diff --git a/pkg/mcclient/modules/mod_associated_bills.go b/pkg/mcclient/modules/mod_associated_bills.go deleted file mode 100644 index 2c24d4968f..0000000000 --- a/pkg/mcclient/modules/mod_associated_bills.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - AssociatedBills modulebase.ResourceManager -) - -func init() { - AssociatedBills = NewMeterManager("associated_bill", "associated_bills", - []string{"account", "brand", "resource_id", "resource_name", "amount"}, - []string{}, - ) - register(&AssociatedBills) -} diff --git a/pkg/mcclient/modules/mod_bill_analysises.go b/pkg/mcclient/modules/mod_bill_analysises.go deleted file mode 100644 index db814b858c..0000000000 --- a/pkg/mcclient/modules/mod_bill_analysises.go +++ /dev/null @@ -1,35 +0,0 @@ -// 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 ( - BillAnalysises modulebase.ResourceManager - BillsUpgradeAnalysises modulebase.ResourceManager -) - -func init() { - BillAnalysises = NewMeterManager("bill_analysis", "bill_analysises", - []string{"stat_date", "stat_value", "res_name", "res_type", "project_name", "res_fee"}, - []string{}, - ) - - BillsUpgradeAnalysises = NewMeterManager("billsanalysis", "billsanalysises", - []string{"project", "project_id", "domain", "domain_id", "amount", "year_amount"}, - []string{}) - register(&BillAnalysises) - register(&BillsUpgradeAnalysises) -} diff --git a/pkg/mcclient/modules/mod_bill_balances.go b/pkg/mcclient/modules/mod_bill_balances.go deleted file mode 100644 index d2089040e4..0000000000 --- a/pkg/mcclient/modules/mod_bill_balances.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - BillBalances modulebase.ResourceManager -) - -func init() { - BillBalances = NewMeterManager("bill_balance", "bill_balances", - []string{"provider", "account", "account_name", "query_date", "balance", "currency", "today_fee", "month_fee"}, - []string{}, - ) - register(&BillBalances) -} diff --git a/pkg/mcclient/modules/mod_bill_cloudchecks.go b/pkg/mcclient/modules/mod_bill_cloudchecks.go deleted file mode 100644 index 38222e82bd..0000000000 --- a/pkg/mcclient/modules/mod_bill_cloudchecks.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - BillCloudChecks modulebase.ResourceManager -) - -func init() { - BillCloudChecks = NewMeterManager("bill_cloudcheck", "bill_cloudchecks", - []string{"provider", "account_id", "sum_month", "res_type", "res_id", "res_name", "external_id", "cloud_fee", "kvm_fee", "diff_fee", "diff_percent"}, - []string{}, - ) - register(&BillCloudChecks) -} diff --git a/pkg/mcclient/modules/mod_bill_conditions.go b/pkg/mcclient/modules/mod_bill_conditions.go deleted file mode 100644 index 2ef53e7c84..0000000000 --- a/pkg/mcclient/modules/mod_bill_conditions.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - BillConditions modulebase.ResourceManager -) - -func init() { - BillConditions = NewMeterManager("bill_condition", "bill_conditions", - []string{"item_id", "item_name"}, - []string{}, - ) - register(&BillConditions) -} diff --git a/pkg/mcclient/modules/mod_bill_details.go b/pkg/mcclient/modules/mod_bill_details.go deleted file mode 100644 index d31e06e096..0000000000 --- a/pkg/mcclient/modules/mod_bill_details.go +++ /dev/null @@ -1,30 +0,0 @@ -// 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 ( - BillDetails modulebase.ResourceManager -) - -func init() { - BillDetails = NewMeterManager("bill_detail", "bill_details", - []string{"bill_id", "account", "platform", "region", "manager_project", "res_id", - "res_type", "res_name", "start_time", "end_time", "charge_type", "item_rate", "item_fee"}, - []string{}, - ) - register(&BillDetails) -} diff --git a/pkg/mcclient/modules/mod_bill_resources.go b/pkg/mcclient/modules/mod_bill_resources.go deleted file mode 100644 index be8f0265ad..0000000000 --- a/pkg/mcclient/modules/mod_bill_resources.go +++ /dev/null @@ -1,30 +0,0 @@ -// 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 ( - BillResources modulebase.ResourceManager -) - -func init() { - BillResources = NewMeterManager("bill_resource", "bill_resources", - []string{"account", "platform", "region", "manager_project", "res_id", - "res_type", "res_name", "charge_type", "res_fee"}, - []string{}, - ) - register(&BillResources) -} diff --git a/pkg/mcclient/modules/mod_bill_tasks.go b/pkg/mcclient/modules/mod_bill_tasks.go deleted file mode 100644 index 7fce08f456..0000000000 --- a/pkg/mcclient/modules/mod_bill_tasks.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - BillTasks modulebase.ResourceManager -) - -func init() { - BillTasks = NewMeterManager("bill_task", "bill_tasks", - []string{"status"}, - []string{}, - ) - register(&BillTasks) -} diff --git a/pkg/mcclient/modules/mod_billing_exchange_rates.go b/pkg/mcclient/modules/mod_billing_exchange_rates.go deleted file mode 100644 index 3c90895d8f..0000000000 --- a/pkg/mcclient/modules/mod_billing_exchange_rates.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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/modules/mod_bills_dimension.go b/pkg/mcclient/modules/mod_bills_dimension.go deleted file mode 100644 index 619f478e45..0000000000 --- a/pkg/mcclient/modules/mod_bills_dimension.go +++ /dev/null @@ -1,63 +0,0 @@ -// 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" - -type SBillsDimensionManager struct { - *modulebase.ResourceManager -} - -var ( - BillingDimensionManager *SBillsDimensionManager - BillingDimensionAnalysisManager *SBillsDimensionManager - BillingDimensionJointManager *SBillsDimensionManager -) - -func NewBillingDimensionManager() *SBillsDimensionManager { - man := NewMeterManager("billsdimension", "billsdimensions", - []string{"id", "name", "dimension_type", "dimension_items"}, - []string{}) - return &SBillsDimensionManager{ - ResourceManager: &man, - } -} - -func NewBillingDimensionAnalysisManager() *SBillsDimensionManager { - man := NewMeterManager("billsdimensionsanalysis", "billsdimensionsanalysis", - []string{"id", "name", "usage_type", "resource_type", "brand", "description"}, - []string{}) - return &SBillsDimensionManager{ - ResourceManager: &man, - } -} - -func NewBillingDimensionJointManager() *SBillsDimensionManager { - man := NewMeterManager("dimensionjoint", "dimensionjoints", - []string{"id", "name", "data"}, - []string{}) - return &SBillsDimensionManager{ - ResourceManager: &man, - } -} - -func init() { - BillingDimensionManager = NewBillingDimensionManager() - BillingDimensionAnalysisManager = NewBillingDimensionAnalysisManager() - BillingDimensionJointManager = NewBillingDimensionJointManager() - register(BillingDimensionManager) - register(BillingDimensionAnalysisManager) - register(BillingDimensionJointManager) -} diff --git a/pkg/mcclient/modules/mod_bucket_options.go b/pkg/mcclient/modules/mod_bucket_options.go deleted file mode 100644 index 3abb252581..0000000000 --- a/pkg/mcclient/modules/mod_bucket_options.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - BucketOptions modulebase.ResourceManager -) - -func init() { - BucketOptions = NewMeterManager("bucket_option", "bucket_options", - []string{"status"}, - []string{}, - ) - register(&BucketOptions) -} diff --git a/pkg/mcclient/modules/mod_budgets.go b/pkg/mcclient/modules/mod_budgets.go deleted file mode 100644 index 847a1044bb..0000000000 --- a/pkg/mcclient/modules/mod_budgets.go +++ /dev/null @@ -1,32 +0,0 @@ -// 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 ( - Budgets modulebase.ResourceManager -) - -func init() { - Budgets = NewMeterManager("budget", "budgets", - []string{"period_type", "start_time", "end_time", "brand", "cloudaccount_id", "cloudaccount", - "cloudprovider_id", "cloudprovider_name", "region_id", "region", - "domain_id_filter", "domain_filter", "project_id_filter", "project_filter", - "resource_type", "currency", "amount", "alerts", "availability_status", "budget_scope"}, - []string{}, - ) - register(&Budgets) -} diff --git a/pkg/mcclient/modules/mod_cloud_sku_rates.go b/pkg/mcclient/modules/mod_cloud_sku_rates.go deleted file mode 100644 index 561dbe34bb..0000000000 --- a/pkg/mcclient/modules/mod_cloud_sku_rates.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - CloudSkuRates modulebase.ResourceManager -) - -func init() { - CloudSkuRates = NewMeterManager("cloud_sku_rate", "cloud_sku_rates", - []string{"id", "data_id", "data_key", "hour_price", "month_price", "year_price"}, - []string{}, - ) - register(&CloudSkuRates) -} diff --git a/pkg/mcclient/modules/mod_cost_conversions.go b/pkg/mcclient/modules/mod_cost_conversions.go deleted file mode 100644 index f970c17d12..0000000000 --- a/pkg/mcclient/modules/mod_cost_conversions.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - CostConversions modulebase.ResourceManager -) - -func init() { - CostConversions = NewMeterManager("cost_conversion", "cost_conversions", - []string{"is_public_cloud", "brand", "cloudaccount_id", "cloudprovider_id", "domain_id_filter", "enable_date", "ratio"}, - []string{}, - ) - register(&CostConversions) -} diff --git a/pkg/mcclient/modules/mod_costalerts.go b/pkg/mcclient/modules/mod_costalerts.go deleted file mode 100644 index 8f2739dc26..0000000000 --- a/pkg/mcclient/modules/mod_costalerts.go +++ /dev/null @@ -1,31 +0,0 @@ -// 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 ( - CostAlerts modulebase.ResourceManager -) - -func init() { - CostAlerts = NewMeterManager("costalert", "costalerts", - []string{"brand", "account_id", "account", "cloudprovider_id", "cloudprovider_name", "region_id", "region", - "domain_id_filter", "domain_filter", "project_id_filter", "project_filter", - "resource_type", "currency", "amount", "cost_type", "user_ids"}, - []string{}, - ) - register(&CostAlerts) -} diff --git a/pkg/mcclient/modules/mod_costreports.go b/pkg/mcclient/modules/mod_costreports.go deleted file mode 100644 index f17ea92bee..0000000000 --- a/pkg/mcclient/modules/mod_costreports.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - CostReports modulebase.ResourceManager -) - -func init() { - CostReports = NewMeterManager("costreport", "costreports", - []string{"period_type", "day", "colon_timer", "disable", "emails", "scope", "start_run"}, - []string{}, - ) - register(&CostReports) -} diff --git a/pkg/mcclient/modules/mod_daily_bills.go b/pkg/mcclient/modules/mod_daily_bills.go deleted file mode 100644 index e242e6c7d2..0000000000 --- a/pkg/mcclient/modules/mod_daily_bills.go +++ /dev/null @@ -1,32 +0,0 @@ -// 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 ( - DailyBills modulebase.ResourceManager -) - -func init() { - DailyBills = NewMeterManager("daily_bill", "daily_bills", - []string{"account", "account_id", "charge_type", "region", "region_id", "domain", "domain_id", "project", - "tenant_id", "brand", "resource_id", "resource_type", "resource_name", "rate", "reserved", "spec", - "usage_type", "associate_id", "day", "price_unit", "currency", "cloudprovider_id", "cloudprovider_name", - "amount", "gross_amount", "usage"}, - []string{}, - ) - register(&DailyBills) -} diff --git a/pkg/mcclient/modules/mod_meter_events.go b/pkg/mcclient/modules/mod_meter_events.go deleted file mode 100644 index 4472e80755..0000000000 --- a/pkg/mcclient/modules/mod_meter_events.go +++ /dev/null @@ -1,28 +0,0 @@ -// 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 ( - MeterLogs modulebase.ResourceManager -) - -func init() { - MeterLogs = NewMeterManager("meter_event", "meter_events", - []string{"id", "ops_time", "obj_id", "obj_type", "obj_name", "user", "user_id", "tenant", "tenant_id", "owner_tenant_id", "action", "notes"}, - []string{}) - register(&MeterLogs) -} diff --git a/pkg/mcclient/modules/mod_price_infos.go b/pkg/mcclient/modules/mod_price_infos.go deleted file mode 100644 index 2275de2f7f..0000000000 --- a/pkg/mcclient/modules/mod_price_infos.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - PriceInfos modulebase.ResourceManager -) - -func init() { - PriceInfos = NewMeterManager("price_info", "price_infos", - []string{"provider", "currency", "sum_price", "spec", "quantity", "period", "price_key", "region_id"}, - []string{}, - ) - register(&PriceInfos) -} diff --git a/pkg/mcclient/modules/mod_rates.go b/pkg/mcclient/modules/mod_rates.go deleted file mode 100644 index 73e1b545d4..0000000000 --- a/pkg/mcclient/modules/mod_rates.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - Rates modulebase.ResourceManager -) - -func init() { - Rates = NewMeterManager("rate", "rates", - []string{"id", "brand", "model", "res_type", "sub_res_type", "duration", "unit", "spec", "rate", "effective_date", "platform", "effective_flag"}, - []string{}, - ) - register(&Rates) -} diff --git a/pkg/mcclient/modules/mod_res_results.go b/pkg/mcclient/modules/mod_res_results.go deleted file mode 100644 index 931a8b499e..0000000000 --- a/pkg/mcclient/modules/mod_res_results.go +++ /dev/null @@ -1,30 +0,0 @@ -// 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 ( - ResResults modulebase.ResourceManager -) - -func init() { - ResResults = NewMeterManager("res_result", "res_results", - []string{"res_id", "res_name", "cpu", "mem", "sys_disk", "data_disk", "ips", "res_type", "band_width", "os_distribution", "os_version", "platform", "region_id", - "project_name", "user_name", "start_time", "end_time", "time_length", "cpu_amount", "mem_amount", "disk_amount", "baremetal_amount", "gpu_amount", "res_fee"}, - []string{}, - ) - register(&ResResults) -} diff --git a/pkg/mcclient/modules/mod_res_tag_details.go b/pkg/mcclient/modules/mod_res_tag_details.go deleted file mode 100644 index eca0a0d963..0000000000 --- a/pkg/mcclient/modules/mod_res_tag_details.go +++ /dev/null @@ -1,29 +0,0 @@ -// 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 ( - ResTagDetails modulebase.ResourceManager -) - -func init() { - ResTagDetails = NewMeterManager("res_tag_detail", "res_tag_details", - []string{"key", "value"}, - []string{}, - ) - register(&ResTagDetails) -} diff --git a/pkg/mcclient/modules/mod_reservations.go b/pkg/mcclient/modules/mod_reservations.go deleted file mode 100644 index 886ae1859c..0000000000 --- a/pkg/mcclient/modules/mod_reservations.go +++ /dev/null @@ -1,32 +0,0 @@ -// 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 ( - Reservations modulebase.ResourceManager -) - -func init() { - Reservations = NewMeterManager("reservation", "reservations", - []string{"cloudaccount_id", "resource_type", "reservation_years", "lookback_days", "payment_option", - "offering_class", "category", "spec", "instance_amount", "monthly_savings_amount", "upfront_cost", - "average_utilization", "monthly_cost", "total_savings_amount", "total_savings_percentage", - "currency", "details"}, - []string{}, - ) - register(&Reservations) -} diff --git a/pkg/mcclient/modules/mod_resource_details.go b/pkg/mcclient/modules/mod_resource_details.go deleted file mode 100644 index a29d423b9f..0000000000 --- a/pkg/mcclient/modules/mod_resource_details.go +++ /dev/null @@ -1,30 +0,0 @@ -// 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 ( - ResourceDetails modulebase.ResourceManager -) - -func init() { - ResourceDetails = NewMeterManager("resource_detail", "resource_details", - []string{"res_type", "res_id", "res_name", "start_time", "end_time", "project_name", "user_name", "res_fee"}, - - []string{}, - ) - register(&ResourceDetails) -} diff --git a/pkg/mcclient/modules/mod_resource_fees.go b/pkg/mcclient/modules/mod_resource_fees.go deleted file mode 100644 index fd6ba832d7..0000000000 --- a/pkg/mcclient/modules/mod_resource_fees.go +++ /dev/null @@ -1,30 +0,0 @@ -// 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 ( - ResourceFees modulebase.ResourceManager -) - -func init() { - ResourceFees = NewMeterManager("resource_fee", "resource_fees", - []string{"baremetal_fee", "server_fee", "gpu_fee", "disk_fee", "res_fee", "item_name", "stat_type", "stat_month", "month_total"}, - - []string{}, - ) - register(&ResourceFees) -} diff --git a/pkg/mcclient/modules/mod_unused_resources.go b/pkg/mcclient/modules/mod_unused_resources.go deleted file mode 100644 index d4809fb800..0000000000 --- a/pkg/mcclient/modules/mod_unused_resources.go +++ /dev/null @@ -1,30 +0,0 @@ -// 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 ( - UnusedResources modulebase.ResourceManager -) - -func init() { - UnusedResources = NewMeterManager("unused_resource", "unused_resources", - []string{"res_id", "res_name", "res_type", "start_time", "end_time", "project_name", "spec", - "platform", "action", "quantity", "medium_type", "storage_type", "event_id"}, - []string{}, - ) - register(&UnusedResources) -} diff --git a/pkg/mcclient/options/meter/billing_exchange_rates.go b/pkg/mcclient/options/meter/billing_exchange_rates.go deleted file mode 100644 index 31ff87d694..0000000000 --- a/pkg/mcclient/options/meter/billing_exchange_rates.go +++ /dev/null @@ -1,43 +0,0 @@ -// 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 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 -} diff --git a/pkg/mcclient/options/meter/bills_dimension.go b/pkg/mcclient/options/meter/bills_dimension.go deleted file mode 100644 index c200fb8dbf..0000000000 --- a/pkg/mcclient/options/meter/bills_dimension.go +++ /dev/null @@ -1,104 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/apis" - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -type BillDimensionCreateOptions struct { - apis.StatusStandaloneResourceCreateInput - - DimensionAnalysisIds []string `json:"dimension_analysis_ids" help:"ids of DimensionAnalysis"` - DimensionItemName string `json:"dimension_item_name" help:"name of dimension item" required:"true"` - DimensionType string `json:"dimension_type" choices:"bill|resource_type"` -} - -func (o *BillDimensionCreateOptions) Params() (jsonutils.JSONObject, error) { - data := jsonutils.NewDict() - data.Add(jsonutils.NewString(o.Name), "name") - data.Add(jsonutils.NewString(o.DimensionType), "dimension_type") - - dimensionItem := jsonutils.NewDict() - dimensionItem.Add(jsonutils.NewString(o.DimensionItemName)) - dimensionItem.Add(jsonutils.NewStringArray(o.DimensionAnalysisIds), "dimension_analysis_ids") - - data.Add(jsonutils.NewArray(dimensionItem), "dimension_items") - return data, nil - -} - -type BillDimensionListOptions struct { - options.BaseListOptions - apis.EnabledResourceBaseListInput - - DimensionType string `json:"dimension_type"` -} - -func (o *BillDimensionListOptions) Params() (jsonutils.JSONObject, error) { - return options.ListStructToParams(o) -} - -type BillDimensionShowOptions struct { - ID string `help:"ID of bill dimension " json:"-"` -} - -func (o *BillDimensionShowOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(o) -} - -func (o *BillDimensionShowOptions) GetId() string { - return o.ID -} - -type BillDimensionDeleteOptions struct { - ID string `json:"-"` -} - -func (o *BillDimensionDeleteOptions) GetId() string { - return o.ID -} - -func (o *BillDimensionDeleteOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(o) -} - -type BillDimensionAnalysisListOptions struct { - options.BaseListOptions - apis.EnabledResourceBaseListInput - - UsageType string `json:"usage_type"` - ResourceType string `json:"resource_type"` - Description string `json:"description"` -} - -func (o *BillDimensionAnalysisListOptions) Params() (jsonutils.JSONObject, error) { - return options.ListStructToParams(o) -} - -type BillDimensionAnalysisShowOptions struct { - ID string `help:"ID of bill dimension " json:"-"` -} - -func (o *BillDimensionAnalysisShowOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(o) -} - -func (o *BillDimensionAnalysisShowOptions) GetId() string { - return o.ID -} diff --git a/pkg/mcclient/options/meter/budgets.go b/pkg/mcclient/options/meter/budgets.go deleted file mode 100644 index beb8c5ef57..0000000000 --- a/pkg/mcclient/options/meter/budgets.go +++ /dev/null @@ -1,118 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -type BudgetListOptions struct { - options.BaseListOptions -} - -func (opt *BudgetListOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -type BudgetCreateOptions struct { - Name string - PeriodType string `help:"period of budget, example:year/quarter/month/day" json:"period_type"` - StartTime string `help:"start time of budget" json:"start_time"` - EndTime string `help:"end time of budget" json:"end_time"` - - Brand string `help:"brand of budget cost filter" json:"brand"` - CloudaccountId string `help:"cloudaccount id of budget cost filter" json:"cloudaccount_id"` - Cloudaccount string `help:"cloudaccount name of budget cost filter" json:"cloudaccount"` - CloudproviderId string `help:"cloudprovider id of budget cost filter" json:"cloudprovider_id"` - CloudproviderName string `help:"cloudprovider name of budget cost filter" json:"cloudprovider_name"` - RegionId string `help:"region id of budget cost filter" json:"region_id"` - Region string `help:"region name of budget cost filter" json:"region"` - DomainIdFilter string `help:"domain id of budget cost filter" json:"domain_id_filter"` - ProjectIdFilter string `help:"project id of budget cost filter" json:"project_id_filter"` - DomainFilter string `help:"domain of budget cost filter" json:"domain_filter"` - ProjectFilter string `help:"project of budget cost filter" json:"project_filter"` - ResourceType string `help:"resource type of budget cost filter" json:"resource_type"` - Currency string `help:"currency of budget cost filter" json:"currency"` - - Amount float64 `help:"amount of budget cost" json:"amount"` -} - -func (opt *BudgetCreateOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -type BudgetUpdateOptions struct { - ID string `help:"ID of budget" json:"-"` - - Brand string `help:"brand of budget cost filter" json:"brand"` - CloudaccountId string `help:"cloudaccount id of budget cost filter" json:"cloudaccount_id"` - Cloudaccount string `help:"cloudaccount name of budget cost filter" json:"cloudaccount"` - CloudproviderId string `help:"cloudprovider id of budget cost filter" json:"cloudprovider_id"` - CloudproviderName string `help:"cloudprovider name of budget cost filter" json:"cloudprovider_name"` - RegionId string `help:"region id of budget cost filter" json:"region_id"` - Region string `help:"region name of budget cost filter" json:"region"` - DomainIdFilter string `help:"domain id of budget cost filter" json:"domain_id_filter"` - ProjectIdFilter string `help:"project id of budget cost filter" json:"project_id_filter"` - DomainFilter string `help:"domain of budget cost filter" json:"domain_filter"` - ProjectFilter string `help:"project of budget cost filter" json:"project_filter"` - ResourceType string `help:"resource type of budget cost filter" json:"resource_type"` - Currency string `help:"currency of budget cost filter" json:"currency"` - - Amount float64 `help:"amount of budget cost" json:"amount"` -} - -func (opt *BudgetUpdateOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -func (opt *BudgetUpdateOptions) GetId() string { - return opt.ID -} - -type BudgetDeleteOptions struct { - ID string `help:"ID of budget" json:"-"` -} - -func (opt *BudgetDeleteOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -func (opt *BudgetDeleteOptions) GetId() string { - return opt.ID -} - -type BudgetSyncAlertsOptions struct { - ID string `help:"ID of budget" json:"-"` - - Alerts []BudgetAlert `help:"alerts of budget" json:"alerts"` -} - -type BudgetAlert struct { - AlertType string `help:"alert type, example:cost" json:"alert_type"` - - AlertThresholdType string `help:"alert type, example:percert/amount" json:"alert_threshold_type"` - AlertThreshold float64 `help:"alert amount" json:"alert_threshold"` - UserIds []string `help:"id of users" json:"user_ids"` -} - -func (opt *BudgetSyncAlertsOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -func (opt *BudgetSyncAlertsOptions) GetId() string { - return opt.ID -} diff --git a/pkg/mcclient/options/meter/cost_conversions.go b/pkg/mcclient/options/meter/cost_conversions.go deleted file mode 100644 index 595e746b78..0000000000 --- a/pkg/mcclient/options/meter/cost_conversions.go +++ /dev/null @@ -1,58 +0,0 @@ -package meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -type CostConversionListOptions struct { - options.BaseListOptions -} - -func (opt *CostConversionListOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -type CostConversionCreateOptions struct { - Name string - - IsPublicCloud string `help:"public cloud filter of cost conversion" json:"is_public_cloud"` - Brand string `help:"brand filter of cost conversion" json:"brand"` - CloudaccountId string `help:"cloudaccount filter of cost conversion" json:"cloudaccount_id"` - CloudproviderId string `help:"cloudprovider filter of cost conversion" json:"cloudprovider_id"` - DomainIdFilter string `help:"domain filter of cost conversion" json:"domain_id_filter"` - - EnableDate string `help:"enable date of conversion ratio, example:202107" json:"enable_date"` - Ratio float64 `help:"cost conversion ratio" json:"ratio"` -} - -func (opt *CostConversionCreateOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -type CostConversionUpdateOptions struct { - ID string `help:"ID of cost conversion" json:"-"` - - Ratio float64 `help:"cost conversion ratio" json:"ratio"` -} - -func (opt *CostConversionUpdateOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -func (opt *CostConversionUpdateOptions) GetId() string { - return opt.ID -} - -type CostConversionDeleteOptions struct { - ID string `help:"ID of cost conversion" json:"-"` -} - -func (opt *CostConversionDeleteOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -func (opt *CostConversionDeleteOptions) GetId() string { - return opt.ID -} diff --git a/pkg/mcclient/options/meter/costreports.go b/pkg/mcclient/options/meter/costreports.go deleted file mode 100644 index df41d98faa..0000000000 --- a/pkg/mcclient/options/meter/costreports.go +++ /dev/null @@ -1,73 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -type CostReportListOptions struct { - options.BaseListOptions -} - -func (opt *CostReportListOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -type CostReportCreateOptions struct { - Scope string `help:"scope of cost report" json:"scope"` - - PeriodType string `help:"period of cost report send, e.g. month, week, day" json:"period_type"` - Day int `help:"day of cost report send" json:"day"` - ColonTimer string `help:"hour and minute of cost report send, e.g. HH:mm" json:"colon_timer"` - Emails []string `help:"emails of cost report send" json:"emails"` - StartRun bool `help:"whether cost report sends instantly" json:"start_run"` -} - -func (opt *CostReportCreateOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -type CostReportUpdateOptions struct { - ID string `help:"ID of cost report" json:"-"` - - PeriodType string `help:"period of cost report send, e.g. month, week, day" json:"period_type"` - Day int `help:"day of cost report send" json:"day"` - ColonTimer string `help:"hour and minute of cost report send, e.g. HH:mm" json:"colon_timer"` - Emails []string `help:"emails of cost report send" json:"emails"` - StartRun bool `help:"whether cost report sends instantly" json:"start_run"` -} - -func (opt *CostReportUpdateOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -func (opt *CostReportUpdateOptions) GetId() string { - return opt.ID -} - -type CostReportDeleteOptions struct { - ID string `help:"ID of cost report" json:"-"` -} - -func (opt *CostReportDeleteOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} - -func (opt *CostReportDeleteOptions) GetId() string { - return opt.ID -} diff --git a/pkg/mcclient/options/meter/doc.go b/pkg/mcclient/options/meter/doc.go deleted file mode 100644 index da93f1f2f5..0000000000 --- a/pkg/mcclient/options/meter/doc.go +++ /dev/null @@ -1,15 +0,0 @@ -// 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 meter // import "yunion.io/x/onecloud/pkg/mcclient/options/meter" diff --git a/pkg/mcclient/options/meter/reservations.go b/pkg/mcclient/options/meter/reservations.go deleted file mode 100644 index 90cc7cc591..0000000000 --- a/pkg/mcclient/options/meter/reservations.go +++ /dev/null @@ -1,36 +0,0 @@ -// 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 meter - -import ( - "yunion.io/x/jsonutils" - - "yunion.io/x/onecloud/pkg/mcclient/options" -) - -type ReservationListOptions struct { - options.BaseListOptions - - CloudaccountId string `help:"cloudaccount id of reservation" json:"cloudaccount_id"` - ResourceType string `help:"resource type of reservation" json:"resource_type"` - ReservationYears string `help:"number of reservation years" json:"reservation_years"` - LookbackDays string `help:"number of previous days will be consider" json:"lookback_days"` - PaymentOption string `help:"payment option of reservation, example:all_upfront/partial_upfront/no_upfront" json:"payment_option"` - OfferingClass string `help:"offering class of reservation, example:standard/convertible" json:"offering_class"` -} - -func (opt *ReservationListOptions) Params() (jsonutils.JSONObject, error) { - return options.StructToParams(opt) -} diff --git a/pkg/monitor/models/meteralert.go b/pkg/monitor/models/meteralert.go index 3dfd7bf291..21d7076d50 100644 --- a/pkg/monitor/models/meteralert.go +++ b/pkg/monitor/models/meteralert.go @@ -101,14 +101,25 @@ func (man *SMeterAlertManager) genName(ctx context.Context, ownerId mcclient.IId func (man *SMeterAlertManager) getAllBillAccounts(ctx context.Context) ([]jsonutils.JSONObject, error) { s := auth.GetAdminSession(ctx, options.Options.Region, "") - q := jsonutils.NewDict() - q.Add(jsonutils.NewString("accountList"), "account_id") - q.Add(jsonutils.NewInt(-1), "limit") - ret, err := modules.BillBalances.List(s, q) - if err != nil { - return nil, err + results := make([]jsonutils.JSONObject, 0) + for { + q := jsonutils.NewDict() + q.Add(jsonutils.NewString("system"), "scope") + q.Add(jsonutils.NewInt(int64(len(results))), "offset") + q.Add(jsonutils.NewInt(2048), "limit") + ret, err := modules.Cloudaccounts.List(s, q) + if err != nil { + return nil, err + } + if len(ret.Data) == 0 { + break + } + results = append(results, ret.Data...) + if ret.Total <= len(results) { + break + } } - return ret.Data, nil + return results, nil } func (man *SMeterAlertManager) getAllBillAccountIds(ctx context.Context) ([]string, error) {