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
+7 -2
View File
@@ -10,6 +10,7 @@ import (
"github.com/aws/aws-sdk-go/service/cloudwatchlogs/cloudwatchlogsiface"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/kinds/dataquery"
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/models"
)
@@ -29,7 +30,9 @@ var executeSyncLogQuery = func(ctx context.Context, e *cloudWatchExecutor, req *
}
logsQuery.Subtype = "StartQuery"
logsQuery.QueryString = logsQuery.Expression
if logsQuery.Expression != nil {
logsQuery.QueryString = *logsQuery.Expression
}
region := logsQuery.Region
if logsQuery.Region == "" || region == defaultRegion {
@@ -86,7 +89,9 @@ func (e *cloudWatchExecutor) syncQuery(ctx context.Context, logsClient cloudwatc
}
requestParams := models.LogsQuery{
Region: logsQuery.Region,
CloudWatchLogsQuery: dataquery.CloudWatchLogsQuery{
Region: logsQuery.Region,
},
QueryId: *startQueryOutput.QueryId,
}