-
Notifications
You must be signed in to change notification settings - Fork 604
/
api_op_StartQueryExecution.go
164 lines (137 loc) · 5.59 KB
/
api_op_StartQueryExecution.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package athena
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StartQueryExecutionInput
type StartQueryExecutionInput struct {
_ struct{} `type:"structure"`
// A unique case-sensitive string used to ensure the request to create the query
// is idempotent (executes only once). If another StartQueryExecution request
// is received, the same response is returned and another query is not created.
// If a parameter has changed, for example, the QueryString, an error is returned.
//
// This token is listed as not required because AWS SDKs (for example the AWS
// SDK for Java) auto-generate the token for users. If you are not using the
// AWS SDK or the AWS CLI, you must provide this token or the action will fail.
ClientRequestToken *string `min:"32" type:"string" idempotencyToken:"true"`
// The database within which the query executes.
QueryExecutionContext *QueryExecutionContext `type:"structure"`
// The SQL query statements to be executed.
//
// QueryString is a required field
QueryString *string `min:"1" type:"string" required:"true"`
// Specifies information about where and how to save the results of the query
// execution. If the query runs in a workgroup, then workgroup's settings may
// override query settings. This affects the query results location. The workgroup
// settings override is specified in EnforceWorkGroupConfiguration (true/false)
// in the WorkGroupConfiguration. See WorkGroupConfiguration$EnforceWorkGroupConfiguration.
ResultConfiguration *ResultConfiguration `type:"structure"`
// The name of the workgroup in which the query is being started.
WorkGroup *string `type:"string"`
}
// String returns the string representation
func (s StartQueryExecutionInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *StartQueryExecutionInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "StartQueryExecutionInput"}
if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 32 {
invalidParams.Add(aws.NewErrParamMinLen("ClientRequestToken", 32))
}
if s.QueryString == nil {
invalidParams.Add(aws.NewErrParamRequired("QueryString"))
}
if s.QueryString != nil && len(*s.QueryString) < 1 {
invalidParams.Add(aws.NewErrParamMinLen("QueryString", 1))
}
if s.QueryExecutionContext != nil {
if err := s.QueryExecutionContext.Validate(); err != nil {
invalidParams.AddNested("QueryExecutionContext", err.(aws.ErrInvalidParams))
}
}
if s.ResultConfiguration != nil {
if err := s.ResultConfiguration.Validate(); err != nil {
invalidParams.AddNested("ResultConfiguration", err.(aws.ErrInvalidParams))
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StartQueryExecutionOutput
type StartQueryExecutionOutput struct {
_ struct{} `type:"structure"`
// The unique ID of the query that ran as a result of this request.
QueryExecutionId *string `type:"string"`
}
// String returns the string representation
func (s StartQueryExecutionOutput) String() string {
return awsutil.Prettify(s)
}
const opStartQueryExecution = "StartQueryExecution"
// StartQueryExecutionRequest returns a request value for making API operation for
// Amazon Athena.
//
// Runs the SQL query statements contained in the Query. Requires you to have
// access to the workgroup in which the query ran.
//
// For code samples using the AWS SDK for Java, see Examples and Code Samples
// (http://docs.aws.amazon.com/athena/latest/ug/code-samples.html) in the Amazon
// Athena User Guide.
//
// // Example sending a request using StartQueryExecutionRequest.
// req := client.StartQueryExecutionRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StartQueryExecution
func (c *Client) StartQueryExecutionRequest(input *StartQueryExecutionInput) StartQueryExecutionRequest {
op := &aws.Operation{
Name: opStartQueryExecution,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &StartQueryExecutionInput{}
}
req := c.newRequest(op, input, &StartQueryExecutionOutput{})
return StartQueryExecutionRequest{Request: req, Input: input, Copy: c.StartQueryExecutionRequest}
}
// StartQueryExecutionRequest is the request type for the
// StartQueryExecution API operation.
type StartQueryExecutionRequest struct {
*aws.Request
Input *StartQueryExecutionInput
Copy func(*StartQueryExecutionInput) StartQueryExecutionRequest
}
// Send marshals and sends the StartQueryExecution API request.
func (r StartQueryExecutionRequest) Send(ctx context.Context) (*StartQueryExecutionResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &StartQueryExecutionResponse{
StartQueryExecutionOutput: r.Request.Data.(*StartQueryExecutionOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// StartQueryExecutionResponse is the response type for the
// StartQueryExecution API operation.
type StartQueryExecutionResponse struct {
*StartQueryExecutionOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// StartQueryExecution request.
func (r *StartQueryExecutionResponse) SDKResponseMetdata() *aws.Response {
return r.response
}