|
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
|
|
|
// GetQueryExecution executes `GetQueryExecution` operation. |
|
13
|
|
|
func (svc *Athena) GetQueryExecution(ctx context.Context, r GetQueryExecutionRequest) (*GetQueryExecutionResult, error) { |
|
14
|
|
|
out, err := svc.RawGetQueryExecution(ctx, r.ToInput()) |
|
15
|
|
|
if err != nil { |
|
16
|
|
|
err = svc.errWrap(errors.ErrorData{ |
|
17
|
|
|
Err: err, |
|
18
|
|
|
AWSOperation: "GetQueryExecution", |
|
19
|
|
|
}) |
|
20
|
|
|
svc.Errorf(err.Error()) |
|
|
|
|
|
|
21
|
|
|
return nil, err |
|
22
|
|
|
} |
|
23
|
|
|
return NewGetQueryExecutionResult(out), nil |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
// GetQueryExecutionRequest has parameters for `GetQueryExecution` operation. |
|
27
|
|
|
type GetQueryExecutionRequest struct { |
|
28
|
|
|
QueryExecutionID string |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
func (r GetQueryExecutionRequest) ToInput() *SDK.GetQueryExecutionInput { |
|
|
|
|
|
|
32
|
|
|
in := &SDK.GetQueryExecutionInput{} |
|
33
|
|
|
|
|
34
|
|
|
if r.QueryExecutionID != "" { |
|
35
|
|
|
in.QueryExecutionId = pointers.String(r.QueryExecutionID) |
|
36
|
|
|
} |
|
37
|
|
|
return in |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
type GetQueryExecutionResult struct { |
|
|
|
|
|
|
41
|
|
|
Query string |
|
42
|
|
|
QueryExecutionContext QueryExecutionContext |
|
43
|
|
|
QueryExecutionID string |
|
44
|
|
|
ResultConfiguration ResultConfiguration |
|
45
|
|
|
StatementType StatementType |
|
46
|
|
|
Statistics QueryExecutionStatistics |
|
47
|
|
|
Status QueryExecutionStatus |
|
48
|
|
|
WorkGroup string |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
func NewGetQueryExecutionResult(o *SDK.GetQueryExecutionResponse) *GetQueryExecutionResult { |
|
|
|
|
|
|
52
|
|
|
r := &GetQueryExecutionResult{} |
|
53
|
|
|
if o == nil { |
|
54
|
|
|
return r |
|
55
|
|
|
} |
|
56
|
|
|
oo := o.GetQueryExecutionOutput |
|
57
|
|
|
if oo == nil { |
|
58
|
|
|
return r |
|
59
|
|
|
} |
|
60
|
|
|
v := oo.QueryExecution |
|
61
|
|
|
if v == nil { |
|
62
|
|
|
return r |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
if v.Query != nil { |
|
66
|
|
|
r.Query = *v.Query |
|
67
|
|
|
} |
|
68
|
|
|
if v.QueryExecutionId != nil { |
|
69
|
|
|
r.QueryExecutionID = *v.QueryExecutionId |
|
70
|
|
|
} |
|
71
|
|
|
if v.WorkGroup != nil { |
|
72
|
|
|
r.WorkGroup = *v.WorkGroup |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
r.QueryExecutionContext = NewQueryExecutionContext(v.QueryExecutionContext) |
|
76
|
|
|
r.ResultConfiguration = NewResultConfiguration(v.ResultConfiguration) |
|
77
|
|
|
r.Statistics = NewQueryExecutionStatistics(v.Statistics) |
|
78
|
|
|
r.Status = NewQueryExecutionStatus(v.Status) |
|
79
|
|
|
r.StatementType = StatementType(v.StatementType) |
|
80
|
|
|
return r |
|
81
|
|
|
} |
|
82
|
|
|
|