Revert "Cloudwatch: Migrate to aws-sdk-go-v2" (#102738)

Revert "Cloudwatch: Migrate to aws-sdk-go-v2 (#99643)"

This reverts commit 5bb1d5f2c3.
This commit is contained in:
Stephanie Hingtgen
2025-03-24 19:11:04 +00:00
committed by GitHub
parent 53d355813e
commit 5dd0aa2c73
62 changed files with 1617 additions and 1495 deletions
+8 -9
View File
@@ -5,13 +5,12 @@ import (
"encoding/json"
"testing"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/cloudwatch"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -23,7 +22,7 @@ func TestQuery_AnnotationQuery(t *testing.T) {
})
var client fakeCWAnnotationsClient
NewCWClient = func(aws.Config) models.CWClient {
NewCWClient = func(sess *session.Session) cloudwatchiface.CloudWatchAPI {
return &client
}
@@ -54,8 +53,8 @@ func TestQuery_AnnotationQuery(t *testing.T) {
assert.Equal(t, &cloudwatch.DescribeAlarmsForMetricInput{
Namespace: aws.String("custom"),
MetricName: aws.String("CPUUtilization"),
Statistic: "Average",
Period: aws.Int32(300),
Statistic: aws.String("Average"),
Period: aws.Int64(300),
}, client.calls.describeAlarmsForMetric[0])
})
@@ -87,7 +86,7 @@ func TestQuery_AnnotationQuery(t *testing.T) {
require.Len(t, client.calls.describeAlarms, 1)
assert.Equal(t, &cloudwatch.DescribeAlarmsInput{
MaxRecords: aws.Int32(100),
MaxRecords: aws.Int64(100),
ActionPrefix: aws.String("some_action_prefix"),
AlarmNamePrefix: aws.String("some_alarm_name_prefix"),
}, client.calls.describeAlarms[0])