Cloudwatch: Revert aws sdk go v2 (#103644)
* Revert "CloudWatch: Import new grafana-aws-sdk with PDC fix (#103249)" This reverts commitf2b5b4e0c0. * Revert "CloudWatch: Migrate to aws-sdk-go-v2 (#103106)" This reverts commita65cc0df93. * make update-workspace
This commit is contained in:
@@ -3,9 +3,9 @@ package services
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
|
||||
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/models"
|
||||
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/models/resources"
|
||||
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/utils"
|
||||
@@ -20,9 +20,9 @@ func NewLogGroupsService(logsClient models.CloudWatchLogsAPIProvider, isCrossAcc
|
||||
return &LogGroupsService{logGroupsAPI: logsClient, isCrossAccountEnabled: isCrossAccountEnabled}
|
||||
}
|
||||
|
||||
func (s *LogGroupsService) GetLogGroups(ctx context.Context, req resources.LogGroupsRequest) ([]resources.ResourceResponse[resources.LogGroup], error) {
|
||||
func (s *LogGroupsService) GetLogGroupsWithContext(ctx context.Context, req resources.LogGroupsRequest) ([]resources.ResourceResponse[resources.LogGroup], error) {
|
||||
input := &cloudwatchlogs.DescribeLogGroupsInput{
|
||||
Limit: aws.Int32(req.Limit),
|
||||
Limit: aws.Int64(req.Limit),
|
||||
LogGroupNamePrefix: req.LogGroupNamePrefix,
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ func (s *LogGroupsService) GetLogGroups(ctx context.Context, req resources.LogGr
|
||||
}
|
||||
if !req.IsTargetingAllAccounts() {
|
||||
// TODO: accept more than one account id in search
|
||||
input.AccountIdentifiers = []string{*req.AccountId}
|
||||
input.AccountIdentifiers = []*string{req.AccountId}
|
||||
}
|
||||
}
|
||||
result := []resources.ResourceResponse[resources.LogGroup]{}
|
||||
|
||||
for {
|
||||
response, err := s.logGroupsAPI.DescribeLogGroups(ctx, input)
|
||||
response, err := s.logGroupsAPI.DescribeLogGroupsWithContext(ctx, input)
|
||||
if err != nil || response == nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -63,7 +63,7 @@ func (s *LogGroupsService) GetLogGroups(ctx context.Context, req resources.LogGr
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (s *LogGroupsService) GetLogGroupFields(ctx context.Context, request resources.LogGroupFieldsRequest) ([]resources.ResourceResponse[resources.LogGroupField], error) {
|
||||
func (s *LogGroupsService) GetLogGroupFieldsWithContext(ctx context.Context, request resources.LogGroupFieldsRequest, option ...request.Option) ([]resources.ResourceResponse[resources.LogGroupField], error) {
|
||||
input := &cloudwatchlogs.GetLogGroupFieldsInput{
|
||||
LogGroupName: aws.String(request.LogGroupName),
|
||||
}
|
||||
@@ -73,7 +73,7 @@ func (s *LogGroupsService) GetLogGroupFields(ctx context.Context, request resour
|
||||
// input.LogGroupName = nil
|
||||
// }
|
||||
|
||||
getLogGroupFieldsOutput, err := s.logGroupsAPI.GetLogGroupFields(ctx, input)
|
||||
getLogGroupFieldsOutput, err := s.logGroupsAPI.GetLogGroupFieldsWithContext(ctx, input)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -83,7 +83,7 @@ func (s *LogGroupsService) GetLogGroupFields(ctx context.Context, request resour
|
||||
result = append(result, resources.ResourceResponse[resources.LogGroupField]{
|
||||
Value: resources.LogGroupField{
|
||||
Name: *logGroupField.Name,
|
||||
Percent: int64(logGroupField.Percent),
|
||||
Percent: *logGroupField.Percent,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user