1
|
|
|
package athena |
2
|
|
|
|
3
|
|
|
import ( |
4
|
|
|
"context" |
5
|
|
|
|
6
|
|
|
SDK "github.com/aws/aws-sdk-go-v2/service/athena" |
7
|
|
|
|
8
|
|
|
"github.com/evalphobia/aws-sdk-go-v2-wrapper/errors" |
9
|
|
|
"github.com/evalphobia/aws-sdk-go-v2-wrapper/private/pointers" |
10
|
|
|
) |
11
|
|
|
|
12
|
|
|
// StartQueryExecution executes `StartQueryExecution` operation. |
13
|
|
|
func (svc *Athena) StartQueryExecution(ctx context.Context, r StartQueryExecutionRequest) (*StartQueryExecutionResult, error) { |
14
|
|
|
out, err := svc.RawStartQueryExecution(ctx, r.ToInput()) |
15
|
|
|
if err != nil { |
16
|
|
|
err = svc.errWrap(errors.ErrorData{ |
17
|
|
|
Err: err, |
18
|
|
|
AWSOperation: "StartQueryExecution", |
19
|
|
|
}) |
20
|
|
|
svc.Errorf(err.Error()) |
|
|
|
|
21
|
|
|
return nil, err |
22
|
|
|
} |
23
|
|
|
return NewStartQueryExecutionResult(out), nil |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
// StartQueryExecutionRequest has parameters for `StartQueryExecution` operation. |
27
|
|
|
type StartQueryExecutionRequest struct { |
28
|
|
|
QueryString string |
29
|
|
|
|
30
|
|
|
// optional |
31
|
|
|
ClientRequestToken string |
32
|
|
|
QueryExecutionContext QueryExecutionContext |
33
|
|
|
ResultConfiguration ResultConfiguration |
34
|
|
|
WorkGroup string |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
func (r StartQueryExecutionRequest) ToInput() *SDK.StartQueryExecutionInput { |
|
|
|
|
38
|
|
|
in := &SDK.StartQueryExecutionInput{} |
39
|
|
|
|
40
|
|
|
if r.QueryString != "" { |
41
|
|
|
in.QueryString = pointers.String(r.QueryString) |
42
|
|
|
} |
43
|
|
|
if r.WorkGroup != "" { |
44
|
|
|
in.WorkGroup = pointers.String(r.WorkGroup) |
45
|
|
|
} |
46
|
|
|
in.QueryExecutionContext = r.QueryExecutionContext.ToSDK() |
47
|
|
|
in.ResultConfiguration = r.ResultConfiguration.ToSDK() |
48
|
|
|
return in |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
type StartQueryExecutionResult struct { |
|
|
|
|
52
|
|
|
QueryExecutionID string |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
func NewStartQueryExecutionResult(o *SDK.StartQueryExecutionResponse) *StartQueryExecutionResult { |
|
|
|
|
56
|
|
|
result := &StartQueryExecutionResult{} |
57
|
|
|
if o == nil { |
58
|
|
|
return result |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
if o.QueryExecutionId != nil { |
62
|
|
|
result.QueryExecutionID = *o.QueryExecutionId |
63
|
|
|
} |
64
|
|
|
return result |
65
|
|
|
} |
66
|
|
|
|