Explicitly specify default region in CloudWatch datasource (#9440)

The datasource uses the default region in the query if the region
is "" in the settings. However setting the region to an empty string
is almost impossible and rendered incorrectly.

This commit introduces a special value "default" for region which
is shown in the drop down and is translated to the default region
of the data source when performing queries.
This commit is contained in:
Mikael Olenfalk
2017-12-11 09:37:27 +01:00
committed by Torkel Ödegaard
parent 0506cfdc1d
commit 8e7166b5c4
5 changed files with 98 additions and 10 deletions
+5
View File
@@ -141,6 +141,11 @@ func ec2RoleProvider(sess *session.Session) credentials.Provider {
}
func (e *CloudWatchExecutor) getDsInfo(region string) *DatasourceInfo {
defaultRegion := e.DataSource.JsonData.Get("defaultRegion").MustString()
if region == "default" {
region = defaultRegion
}
authType := e.DataSource.JsonData.Get("authType").MustString()
assumeRoleArn := e.DataSource.JsonData.Get("assumeRoleArn").MustString()
accessKey := ""