-
Notifications
You must be signed in to change notification settings - Fork 623
/
api_op_StartQuery.go
170 lines (140 loc) · 5.14 KB
/
api_op_StartQuery.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
165
166
167
168
169
170
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type StartQueryInput struct {
_ struct{} `type:"structure"`
// The end of the time range to query. The range is inclusive, so the specified
// end time is included in the query. Specified as epoch time, the number of
// seconds since January 1, 1970, 00:00:00 UTC.
//
// EndTime is a required field
EndTime *int64 `locationName:"endTime" type:"long" required:"true"`
// The maximum number of log events to return in the query. If the query string
// uses the fields command, only the specified fields and their values are returned.
Limit *int64 `locationName:"limit" min:"1" type:"integer"`
// The log group on which to perform the query.
//
// A StartQuery operation must include a logGroupNames or a logGroupName parameter,
// but not both.
LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"`
// The list of log groups to be queried. You can include up to 20 log groups.
//
// A StartQuery operation must include a logGroupNames or a logGroupName parameter,
// but not both.
LogGroupNames []string `locationName:"logGroupNames" type:"list"`
// The query string to use. For more information, see CloudWatch Logs Insights
// Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html).
//
// QueryString is a required field
QueryString *string `locationName:"queryString" type:"string" required:"true"`
// The beginning of the time range to query. The range is inclusive, so the
// specified start time is included in the query. Specified as epoch time, the
// number of seconds since January 1, 1970, 00:00:00 UTC.
//
// StartTime is a required field
StartTime *int64 `locationName:"startTime" type:"long" required:"true"`
}
// String returns the string representation
func (s StartQueryInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *StartQueryInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "StartQueryInput"}
if s.EndTime == nil {
invalidParams.Add(aws.NewErrParamRequired("EndTime"))
}
if s.Limit != nil && *s.Limit < 1 {
invalidParams.Add(aws.NewErrParamMinValue("Limit", 1))
}
if s.LogGroupName != nil && len(*s.LogGroupName) < 1 {
invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1))
}
if s.QueryString == nil {
invalidParams.Add(aws.NewErrParamRequired("QueryString"))
}
if s.StartTime == nil {
invalidParams.Add(aws.NewErrParamRequired("StartTime"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
type StartQueryOutput struct {
_ struct{} `type:"structure"`
// The unique ID of the query.
QueryId *string `locationName:"queryId" type:"string"`
}
// String returns the string representation
func (s StartQueryOutput) String() string {
return awsutil.Prettify(s)
}
const opStartQuery = "StartQuery"
// StartQueryRequest returns a request value for making API operation for
// Amazon CloudWatch Logs.
//
// Schedules a query of a log group using CloudWatch Logs Insights. You specify
// the log group and time range to query, and the query string to use.
//
// For more information, see CloudWatch Logs Insights Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html).
//
// Queries time out after 15 minutes of execution. If your queries are timing
// out, reduce the time range being searched, or partition your query into a
// number of queries.
//
// // Example sending a request using StartQueryRequest.
// req := client.StartQueryRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/StartQuery
func (c *Client) StartQueryRequest(input *StartQueryInput) StartQueryRequest {
op := &aws.Operation{
Name: opStartQuery,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &StartQueryInput{}
}
req := c.newRequest(op, input, &StartQueryOutput{})
return StartQueryRequest{Request: req, Input: input, Copy: c.StartQueryRequest}
}
// StartQueryRequest is the request type for the
// StartQuery API operation.
type StartQueryRequest struct {
*aws.Request
Input *StartQueryInput
Copy func(*StartQueryInput) StartQueryRequest
}
// Send marshals and sends the StartQuery API request.
func (r StartQueryRequest) Send(ctx context.Context) (*StartQueryResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &StartQueryResponse{
StartQueryOutput: r.Request.Data.(*StartQueryOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// StartQueryResponse is the response type for the
// StartQuery API operation.
type StartQueryResponse struct {
*StartQueryOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// StartQuery request.
func (r *StartQueryResponse) SDKResponseMetdata() *aws.Response {
return r.response
}