Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package cloudwatchlogs |
||
2 | |||
3 | import ( |
||
4 | "context" |
||
5 | |||
6 | SDK "github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs" |
||
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 | // StopQuery executes `StopQuery` operation. |
||
13 | func (svc *CloudwatchLogs) StopQuery(ctx context.Context, r StopQueryRequest) (*StopQueryResult, error) { |
||
14 | out, err := svc.RawStopQuery(ctx, r.ToInput()) |
||
15 | if err != nil { |
||
16 | err = svc.errWrap(errors.ErrorData{ |
||
17 | Err: err, |
||
18 | AWSOperation: "StopQuery", |
||
19 | }) |
||
20 | svc.Errorf(err.Error()) |
||
|
|||
21 | return nil, err |
||
22 | } |
||
23 | return NewStopQueryResult(out), nil |
||
24 | } |
||
25 | |||
26 | // StopQueryRequest has parameters for `StopQuery` operation. |
||
27 | type StopQueryRequest struct { |
||
28 | QueryID string |
||
29 | } |
||
30 | |||
31 | func (r StopQueryRequest) ToInput() *SDK.StopQueryInput { |
||
32 | in := &SDK.StopQueryInput{} |
||
33 | |||
34 | if r.QueryID != "" { |
||
35 | in.QueryId = pointers.String(r.QueryID) |
||
36 | } |
||
37 | return in |
||
38 | } |
||
39 | |||
40 | type StopQueryResult struct { |
||
41 | Success bool |
||
42 | } |
||
43 | |||
44 | func NewStopQueryResult(o *SDK.StopQueryResponse) *StopQueryResult { |
||
45 | result := &StopQueryResult{} |
||
46 | if o == nil { |
||
47 | return result |
||
48 | } |
||
49 | |||
50 | if o.Success != nil { |
||
51 | result.Success = *o.Success |
||
52 | } |
||
53 | return result |
||
54 | } |
||
55 |