CloudWatch: Refactor to extract DataQuery grouping by region out of request parsing (#57392)

* CloudWatch: Extract request parsing grouping by region from ParseQueries

* Rename ParseQueries to ParseMetricDataQueries
This commit is contained in:
Shirley
2022-10-24 14:57:32 +02:00
committed by GitHub
parent 1bda67ab11
commit 9ebed91eed
5 changed files with 169 additions and 11 deletions
@@ -5,6 +5,7 @@ import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface"
"github.com/stretchr/testify/mock"
)
type FakeMetricsAPI struct {
@@ -56,3 +57,14 @@ func chunkSlice(slice []*cloudwatch.Metric, chunkSize int) [][]*cloudwatch.Metri
return chunks
}
type MetricsClient struct {
cloudwatchiface.CloudWatchAPI
mock.Mock
}
func (m *MetricsClient) GetMetricDataWithContext(ctx aws.Context, input *cloudwatch.GetMetricDataInput, opts ...request.Option) (*cloudwatch.GetMetricDataOutput, error) {
args := m.Called(ctx, input, opts)
return args.Get(0).(*cloudwatch.GetMetricDataOutput), args.Error(1)
}