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()) |
|
|
|
|
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 { |
|
|
|
|
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 { |
|
|
|
|
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 { |
|
|
|
|
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
|
|
|
|