Merge pull request #9726 from zhaoxiangchun/automated-cherry-pick-of-#9724-upstream-release-3.7

Automated cherry pick of #9724: feat(suggestion,apigateway): add analysispredict climc
This commit is contained in:
Zexi Li
2020-12-30 18:54:48 +08:00
committed by GitHub
9 changed files with 107 additions and 69 deletions
@@ -0,0 +1,23 @@
package modules
import "yunion.io/x/onecloud/pkg/mcclient/modulebase"
var (
AnalysisPredictManager *SAnalysisPredict
)
func init() {
AnalysisPredictManager = NewAnalysisPredict()
Register(AnalysisPredictManager)
}
type SAnalysisPredict struct {
*modulebase.ResourceManager
}
func NewAnalysisPredict() *SAnalysisPredict {
man := NewSuggestionManager("analysispredict", "analysispredicts", []string{}, []string{})
return &SAnalysisPredict{
ResourceManager: &man,
}
}
@@ -25,10 +25,22 @@ type SuggestSysAlertListOptions struct {
Type string `help:"Type of suggest rule" choices:"EIP_UNUSED|"`
}
func (o *SuggestSysAlertListOptions) Params() (jsonutils.JSONObject, error) {
return options.ListStructToParams(o)
}
type SSuggestAlertShowOptions struct {
ID string `help:"ID or name of the alert" json:"-"`
}
func (o *SSuggestAlertShowOptions) Params() (jsonutils.JSONObject, error) {
return options.StructToParams(o)
}
func (o *SSuggestAlertShowOptions) GetId() string {
return o.ID
}
type SuggestAlertIgnoreOptions struct {
ID string `help:"ID or name of the alert" json:"-"`
Scope string `help:"Resource scope" choices:"system|domain|project" default:"project"`
@@ -36,6 +48,10 @@ type SuggestAlertIgnoreOptions struct {
Project string `help:"'Owner project ID or Name" json:"project"`
}
func (opt *SuggestAlertIgnoreOptions) Params() (*jsonutils.JSONDict, error) {
func (opt *SuggestAlertIgnoreOptions) Params() (jsonutils.JSONObject, error) {
return options.StructToParams(opt)
}
func (o *SuggestAlertIgnoreOptions) GetId() string {
return o.ID
}
@@ -0,0 +1,24 @@
package suggestion
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
type AnalysisPredictConfigOptions struct {
ID string `help:"ID or name of the alert" json:"-"`
options.BaseListOptions
QueryType string `help:"query_type of the analysis" choices:"expense_trend" json:"query_type"`
StartDate string `help:"start_date of the analysis" json:"start_date"`
EndDate string `help:"end_date of the analysis" json:"end_date"`
DataType string `help:"data_type of the analysis" choices:"day|month" json:"data_type"`
}
func (o *AnalysisPredictConfigOptions) Params() (jsonutils.JSONObject, error) {
return options.ListStructToParams(o)
}
func (o *AnalysisPredictConfigOptions) GetId() string {
return o.ID
}
+1
View File
@@ -0,0 +1 @@
package suggestion // import "yunion.io/x/onecloud/pkg/mcclient/options/suggestion"