Merge pull request #15956 from zexi/automated-cherry-pick-of-#15955-upstream-master

Automated cherry pick of #15955: fix(climc): add measurements and databases api of unifiedmonitor
This commit is contained in:
Zexi Li
2023-02-16 22:46:22 +08:00
committed by GitHub
2 changed files with 44 additions and 1 deletions
+3 -1
View File
@@ -21,6 +21,8 @@ import (
)
func init() {
cmd := shell.NewResourceCmd(monitor.UnifiedMonitorManager).WithKeyword("monitor")
cmd := shell.NewResourceCmd(monitor.UnifiedMonitorManager).SetPrefix("monitor")
cmd.Show(&options.SimpleQueryOptions{})
cmd.GetProperty(&options.MeasurementsQueryOptions{})
cmd.GetProperty(&options.DatabasesQueryOptions{})
}
@@ -0,0 +1,41 @@
// 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 monitor
import "yunion.io/x/jsonutils"
type MeasurementsQueryOptions struct {
Scope string `json:"scope"`
ProjectDomainId string `json:"project_domin_id"`
ProjectId string `json:"project_id"`
}
func (o MeasurementsQueryOptions) Params() (jsonutils.JSONObject, error) {
return jsonutils.Marshal(o), nil
}
func (o MeasurementsQueryOptions) Property() string {
return "measurements"
}
type DatabasesQueryOptions struct{}
func (o DatabasesQueryOptions) Params() (jsonutils.JSONObject, error) {
return nil, nil
}
func (o DatabasesQueryOptions) Property() string {
return "databases"
}