Passed
Push — master ( ad04e3...c5b8de )
by eval
01:47
created

cloudwatchlogs.StopQueryRequest.ToInput   A

Complexity

Conditions 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 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())
0 ignored issues
show
introduced by
can't check non-constant format in call to Errorf
Loading history...
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 {
0 ignored issues
show
introduced by
exported method StopQueryRequest.ToInput should have comment or be unexported
Loading history...
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 {
0 ignored issues
show
introduced by
exported type StopQueryResult should have comment or be unexported
Loading history...
41
	Success bool
42
}
43
44
func NewStopQueryResult(o *SDK.StopQueryResponse) *StopQueryResult {
0 ignored issues
show
introduced by
exported function NewStopQueryResult should have comment or be unexported
Loading history...
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