From b972963934be2d8be0f9a38f12a0215e789d6b57 Mon Sep 17 00:00:00 2001 From: Ruan Bekker Date: Thu, 23 Jul 2020 13:02:25 +0200 Subject: [PATCH] Cloudwatch: Add af-south-1 region (#26513) * Adds af-south-1 region to cloudwatch datasource * Fix test Co-authored-by: Sofia Papagiannaki --- pkg/tsdb/cloudwatch/metric_find_query.go | 2 +- pkg/tsdb/cloudwatch/metric_find_query_test.go | 7 ++++--- .../datasource/cloudwatch/components/ConfigEditor.tsx | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/tsdb/cloudwatch/metric_find_query.go b/pkg/tsdb/cloudwatch/metric_find_query.go index f767b4f3ff8..d892966c02f 100644 --- a/pkg/tsdb/cloudwatch/metric_find_query.go +++ b/pkg/tsdb/cloudwatch/metric_find_query.go @@ -23,7 +23,7 @@ import ( // Known AWS regions. var knownRegions = []string{ - "ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ap-south-1", "ap-southeast-1", + "af-south-1", "ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "cn-north-1", "cn-northwest-1", "eu-central-1", "eu-north-1", "eu-west-1", "eu-west-2", "eu-west-3", "me-south-1", "sa-east-1", "us-east-1", "us-east-2", "us-gov-east-1", "us-gov-west-1", "us-iso-east-1", "us-isob-east-1", "us-west-1", "us-west-2", diff --git a/pkg/tsdb/cloudwatch/metric_find_query_test.go b/pkg/tsdb/cloudwatch/metric_find_query_test.go index 3fadc217124..b2c085d83c2 100644 --- a/pkg/tsdb/cloudwatch/metric_find_query_test.go +++ b/pkg/tsdb/cloudwatch/metric_find_query_test.go @@ -123,9 +123,10 @@ func TestCloudWatchMetrics(t *testing.T) { result, err := executor.handleGetRegions(context.Background(), simplejson.New(), &tsdb.TsdbQuery{}) require.NoError(t, err) - assert.Equal(t, "ap-east-1", result[0].Text) - assert.Equal(t, "ap-northeast-1", result[1].Text) - assert.Equal(t, "ap-northeast-2", result[2].Text) + assert.Equal(t, "af-south-1", result[0].Text) + assert.Equal(t, "ap-east-1", result[1].Text) + assert.Equal(t, "ap-northeast-1", result[2].Text) + assert.Equal(t, "ap-northeast-2", result[3].Text) }) t.Run("When calling handleGetEc2InstanceAttribute", func(t *testing.T) { diff --git a/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.tsx b/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.tsx index 89cb8bc6d19..87fda626f34 100644 --- a/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.tsx @@ -70,6 +70,7 @@ export class ConfigEditor extends PureComponent { }, (err: any) => { const regions = [ + 'af-south-1', 'ap-east-1', 'ap-northeast-1', 'ap-northeast-2',