mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
Merge pull request #11945 from swordqiu/hotfix/qj-remove-meter-client-codes
fix: remove meter client codes
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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{})
|
||||
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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))
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
)
|
||||
@@ -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))
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
|
||||
}
|
||||
@@ -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))
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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))
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -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),
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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"
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user