cloudwatch: return a distinct list of regions

This commit is contained in:
Marcus Efraimsson 2018-10-17 10:58:06 +02:00
parent 518e485e36
commit 52f398e7f7
No known key found for this signature in database
GPG Key ID: EBFE0FB04612DD4A

View File

@ -249,7 +249,18 @@ func (e *CloudWatchExecutor) handleGetRegions(ctx context.Context, parameters *s
plog.Error("Failed to get regions", "error", err)
} else {
for _, region := range r.Regions {
regions = append(regions, *region.RegionName)
exists := false
for _, existingRegion := range regions {
if existingRegion == *region.RegionName {
exists = true
break
}
}
if !exists {
regions = append(regions, *region.RegionName)
}
}
}
sort.Strings(regions)