Passed
Push — master ( 9acbae...8ba3ae )
by eval
03:10 queued 01:28
created

sqs/client_op_change_message_visibility_batch.go   A

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 38
dl 0
loc 61
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A sqs.ChangeMessageVisibilityBatchRequest.ToInput 0 14 4
A sqs.*SQS.ChangeMessageVisibilityBatch 0 11 2
A sqs.NewChangeMessageVisibilityBatchResult 0 9 2
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
// ChangeMessageVisibilityBatch executes `ChangeMessageVisibilityBatch` operation.
13
func (svc *SQS) ChangeMessageVisibilityBatch(ctx context.Context, r ChangeMessageVisibilityBatchRequest) (*ChangeMessageVisibilityBatchResult, error) {
14
	out, err := svc.RawChangeMessageVisibilityBatch(ctx, r.ToInput())
15
	if err != nil {
16
		err = svc.errWrap(errors.ErrorData{
17
			Err:          err,
18
			AWSOperation: "ChangeMessageVisibilityBatch",
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 NewChangeMessageVisibilityBatchResult(out), nil
24
}
25
26
// ChangeMessageVisibilityBatchRequest has parameters for `ChangeMessageVisibilityBatch` operation.
27
type ChangeMessageVisibilityBatchRequest struct {
28
	Entries  []ChangeMessageVisibilityBatchRequestEntry
29
	QueueURL string
30
}
31
32
func (r ChangeMessageVisibilityBatchRequest) ToInput() *SDK.ChangeMessageVisibilityBatchInput {
0 ignored issues
show
introduced by
exported method ChangeMessageVisibilityBatchRequest.ToInput should have comment or be unexported
Loading history...
33
	in := &SDK.ChangeMessageVisibilityBatchInput{}
34
35
	if len(r.Entries) != 0 {
36
		list := make([]SDK.ChangeMessageVisibilityBatchRequestEntry, len(r.Entries))
37
		for i, v := range r.Entries {
38
			list[i] = v.ToSDK()
39
		}
40
		in.Entries = list
41
	}
42
	if r.QueueURL != "" {
43
		in.QueueUrl = pointers.String(r.QueueURL)
44
	}
45
	return in
46
}
47
48
type ChangeMessageVisibilityBatchResult struct {
0 ignored issues
show
introduced by
exported type ChangeMessageVisibilityBatchResult should have comment or be unexported
Loading history...
49
	Failed     []BatchResultErrorEntry                   `locationNameList:"BatchResultErrorEntry" type:"list" flattened:"true" required:"true"`
50
	Successful []ChangeMessageVisibilityBatchResultEntry `locationNameList:"ChangeMessageVisibilityBatchResultEntry" type:"list" flattened:"true" required:"true"`
51
}
52
53
func NewChangeMessageVisibilityBatchResult(o *SDK.ChangeMessageVisibilityBatchResponse) *ChangeMessageVisibilityBatchResult {
0 ignored issues
show
introduced by
exported function NewChangeMessageVisibilityBatchResult should have comment or be unexported
Loading history...
54
	result := &ChangeMessageVisibilityBatchResult{}
55
	if o == nil {
56
		return result
57
	}
58
59
	result.Failed = newBatchResultErrorEntryList(o.Failed)
60
	result.Successful = newChangeMessageVisibilityBatchResultEntryList(o.Successful)
61
	return result
62
}
63