mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
CloudWatch: Refactor around handleGetRegions (#65713)
* Create minimal EC2 interface * convert regions variable to a function returning a copy * Add test for multiple calls to regions to check regionsCache * Add returns to handler after error * Refactor handleGetRegions
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
|
||||
"github.com/aws/aws-sdk-go/service/cloudwatchlogs/cloudwatchlogsiface"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
|
||||
"github.com/aws/aws-sdk-go/service/oam"
|
||||
"github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi"
|
||||
"github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/resourcegroupstaggingapiiface"
|
||||
@@ -53,7 +52,7 @@ var NewCWLogsClient = func(sess *session.Session) cloudwatchlogsiface.CloudWatch
|
||||
// EC2 client factory.
|
||||
//
|
||||
// Stubbable by tests.
|
||||
var newEC2Client = func(provider client.ConfigProvider) ec2iface.EC2API {
|
||||
var newEC2Client = func(provider client.ConfigProvider) models.EC2APIProvider {
|
||||
return ec2.New(provider)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user