-
Notifications
You must be signed in to change notification settings - Fork 2
/
client.go
34 lines (28 loc) · 1.54 KB
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package redshiftdatasqldriver
import (
"context"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/redshiftdata"
)
type RedshiftDataClient interface {
ExecuteStatement(ctx context.Context, params *redshiftdata.ExecuteStatementInput, optFns ...func(*redshiftdata.Options)) (*redshiftdata.ExecuteStatementOutput, error)
DescribeStatement(ctx context.Context, params *redshiftdata.DescribeStatementInput, optFns ...func(*redshiftdata.Options)) (*redshiftdata.DescribeStatementOutput, error)
CancelStatement(ctx context.Context, params *redshiftdata.CancelStatementInput, optFns ...func(*redshiftdata.Options)) (*redshiftdata.CancelStatementOutput, error)
BatchExecuteStatement(ctx context.Context, params *redshiftdata.BatchExecuteStatementInput, optFns ...func(*redshiftdata.Options)) (*redshiftdata.BatchExecuteStatementOutput, error)
redshiftdata.GetStatementResultAPIClient
}
var RedshiftDataClientConstructor func(ctx context.Context, cfg *RedshiftDataConfig) (RedshiftDataClient, error)
func newRedshiftDataClient(ctx context.Context, cfg *RedshiftDataConfig) (RedshiftDataClient, error) {
if RedshiftDataClientConstructor != nil {
return RedshiftDataClientConstructor(ctx, cfg)
}
return DefaultRedshiftDataClientConstructor(ctx, cfg)
}
func DefaultRedshiftDataClientConstructor(ctx context.Context, cfg *RedshiftDataConfig) (RedshiftDataClient, error) {
awsCfg, err := config.LoadDefaultConfig(ctx)
if err != nil {
return nil, err
}
client := redshiftdata.NewFromConfig(awsCfg, cfg.RedshiftDataOptFns...)
return client, nil
}