560be84dc8
* CloudWatch: Backport aws-sdk-go-v2 update from external plugin (#107136) (cherry picked froma18ea34688) * Datasources: Update grafana-aws-sdk for new sigv4 middleware and aws-sdk-go v1 removal (#107522) (cherry picked from commit66d9a33cc9) * CloudWatch: Fix proxy transport issue (#107807) (cherry picked fromc3eeb1fcd9) * CloudWatch: Fix http client handling + assume role bug (#107893) (cherry picked from commitf34a9fc0c2) * CloudWatch: Use default region when query region is unset (#109089) (cherry picked from commit5f4097a159) * CloudWatch: Fix handling region for legacy alerts (#109217) (cherry picked from commit2bf9aea8ef) * Update go.mod owners --------- Co-authored-by: Isabella Siu <Isabella.siu@grafana.com>
69 lines
2.5 KiB
Go
69 lines
2.5 KiB
Go
package mocks
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs"
|
|
"github.com/stretchr/testify/mock"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/models/resources"
|
|
)
|
|
|
|
type LogsAPI struct {
|
|
mock.Mock
|
|
}
|
|
|
|
func (l *LogsAPI) DescribeLogGroups(_ context.Context, input *cloudwatchlogs.DescribeLogGroupsInput, _ ...func(*cloudwatchlogs.Options)) (*cloudwatchlogs.DescribeLogGroupsOutput, error) {
|
|
args := l.Called(input)
|
|
|
|
return args.Get(0).(*cloudwatchlogs.DescribeLogGroupsOutput), args.Error(1)
|
|
}
|
|
|
|
func (l *LogsAPI) GetLogGroupFields(_ context.Context, input *cloudwatchlogs.GetLogGroupFieldsInput, _ ...func(*cloudwatchlogs.Options)) (*cloudwatchlogs.GetLogGroupFieldsOutput, error) {
|
|
args := l.Called(input)
|
|
|
|
return args.Get(0).(*cloudwatchlogs.GetLogGroupFieldsOutput), args.Error(1)
|
|
}
|
|
|
|
type LogsService struct {
|
|
mock.Mock
|
|
}
|
|
|
|
func (l *LogsService) GetLogGroups(_ context.Context, request resources.LogGroupsRequest) ([]resources.ResourceResponse[resources.LogGroup], error) {
|
|
args := l.Called(request)
|
|
|
|
return args.Get(0).([]resources.ResourceResponse[resources.LogGroup]), args.Error(1)
|
|
}
|
|
|
|
func (l *LogsService) GetLogGroupFields(_ context.Context, request resources.LogGroupFieldsRequest) ([]resources.ResourceResponse[resources.LogGroupField], error) {
|
|
args := l.Called(request)
|
|
|
|
return args.Get(0).([]resources.ResourceResponse[resources.LogGroupField]), args.Error(1)
|
|
}
|
|
|
|
type MockLogEvents struct {
|
|
mock.Mock
|
|
}
|
|
|
|
func (m *MockLogEvents) StartQuery(context.Context, *cloudwatchlogs.StartQueryInput, ...func(*cloudwatchlogs.Options)) (*cloudwatchlogs.StartQueryOutput, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (m *MockLogEvents) StopQuery(context.Context, *cloudwatchlogs.StopQueryInput, ...func(*cloudwatchlogs.Options)) (*cloudwatchlogs.StopQueryOutput, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (m *MockLogEvents) GetQueryResults(context.Context, *cloudwatchlogs.GetQueryResultsInput, ...func(*cloudwatchlogs.Options)) (*cloudwatchlogs.GetQueryResultsOutput, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (m *MockLogEvents) DescribeLogGroups(context.Context, *cloudwatchlogs.DescribeLogGroupsInput, ...func(*cloudwatchlogs.Options)) (*cloudwatchlogs.DescribeLogGroupsOutput, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (m *MockLogEvents) GetLogEvents(ctx context.Context, input *cloudwatchlogs.GetLogEventsInput, optFns ...func(*cloudwatchlogs.Options)) (*cloudwatchlogs.GetLogEventsOutput, error) {
|
|
args := m.Called(ctx, input, optFns)
|
|
|
|
return args.Get(0).(*cloudwatchlogs.GetLogEventsOutput), args.Error(1)
|
|
}
|