Passed
Push — master ( dd6fe7...ccccae )
by eval
02:05
created

sqs.*SQS.ChangeMessageVisibility   A

Complexity

Conditions 2

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nop 2
dl 0
loc 11
rs 9.95
c 0
b 0
f 0
1
package sqs
2
3
import (
4
	"context"
5
6
	SDK "github.com/aws/aws-sdk-go-v2/service/sqs"
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
// ChangeMessageVisibility executes `ChangeMessageVisibility` operation.
13
func (svc *SQS) ChangeMessageVisibility(ctx context.Context, r ChangeMessageVisibilityRequest) (*ChangeMessageVisibilityResult, error) {
14
	out, err := svc.RawChangeMessageVisibility(ctx, r.ToInput())
15
	if err != nil {
16
		err = svc.errWrap(errors.ErrorData{
17
			Err:          err,
18
			AWSOperation: "ChangeMessageVisibility",
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 NewChangeMessageVisibilityResult(out), nil
24
}
25
26
// ChangeMessageVisibilityRequest has parameters for `ChangeMessageVisibility` operation.
27
type ChangeMessageVisibilityRequest struct {
28
	QueueURL          string
29
	ReceiptHandle     string
30
	VisibilityTimeout int64
31
}
32
33
func (r ChangeMessageVisibilityRequest) ToInput() *SDK.ChangeMessageVisibilityInput {
0 ignored issues
show
introduced by
exported method ChangeMessageVisibilityRequest.ToInput should have comment or be unexported
Loading history...
34
	in := &SDK.ChangeMessageVisibilityInput{}
35
36
	if r.QueueURL != "" {
37
		in.QueueUrl = pointers.String(r.QueueURL)
38
	}
39
	if r.ReceiptHandle != "" {
40
		in.ReceiptHandle = pointers.String(r.ReceiptHandle)
41
	}
42
	in.VisibilityTimeout = pointers.Long64(r.VisibilityTimeout)
43
	return in
44
}
45
46
type ChangeMessageVisibilityResult struct{}
0 ignored issues
show
introduced by
exported type ChangeMessageVisibilityResult should have comment or be unexported
Loading history...
47
48
func NewChangeMessageVisibilityResult(o *SDK.ChangeMessageVisibilityResponse) *ChangeMessageVisibilityResult {
0 ignored issues
show
introduced by
exported function NewChangeMessageVisibilityResult should have comment or be unexported
Loading history...
49
	result := &ChangeMessageVisibilityResult{}
50
	if o == nil {
51
		return result
52
	}
53
54
	return result
55
}
56