CloudWatch: Use generated type from schema in backend (#66420)

* CloudWatch: Use generated type from schema in backend

* address comments

* don't explicity set default metric query type
This commit is contained in:
Kevin Yu
2023-04-18 11:56:00 -07:00
committed by GitHub
parent 255d8f3326
commit a21fdd9c81
9 changed files with 126 additions and 118 deletions
+4 -12
View File
@@ -27,21 +27,13 @@ import (
"github.com/grafana/grafana/pkg/services/query"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/clients"
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/kinds/dataquery"
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/models"
)
type DataQueryJson struct {
QueryType string `json:"type,omitempty"`
QueryMode string
PrefixMatching bool
Region string
Namespace string
MetricName string
Dimensions map[string]interface{}
Statistic *string
Period string
ActionPrefix string
AlarmNamePrefix string
dataquery.CloudWatchAnnotationQuery
Type string `json:"type,omitempty"`
}
type DataSource struct {
@@ -179,7 +171,7 @@ func (e *cloudWatchExecutor) QueryData(ctx context.Context, req *backend.QueryDa
}
var result *backend.QueryDataResponse
switch model.QueryType {
switch model.Type {
case annotationQuery:
result, err = e.executeAnnotationQuery(req.PluginContext, model, q)
case logAction: