Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 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 | // SetQueueAttributes executes `SetQueueAttributes` operation. |
||
13 | func (svc *SQS) SetQueueAttributes(ctx context.Context, r SetQueueAttributesRequest) (*SetQueueAttributesResult, error) { |
||
14 | out, err := svc.RawSetQueueAttributes(ctx, r.ToInput()) |
||
15 | if err != nil { |
||
16 | err = svc.errWrap(errors.ErrorData{ |
||
17 | Err: err, |
||
18 | AWSOperation: "SetQueueAttributes", |
||
19 | }) |
||
20 | svc.Errorf(err.Error()) |
||
|
|||
21 | return nil, err |
||
22 | } |
||
23 | return NewSetQueueAttributesResult(out), nil |
||
24 | } |
||
25 | |||
26 | // SetQueueAttributesRequest has parameters for `SetQueueAttributes` operation. |
||
27 | type SetQueueAttributesRequest struct { |
||
28 | Attributes map[string]string |
||
29 | QueueURL string |
||
30 | } |
||
31 | |||
32 | func (r SetQueueAttributesRequest) ToInput() *SDK.SetQueueAttributesInput { |
||
33 | in := &SDK.SetQueueAttributesInput{} |
||
34 | |||
35 | in.Attributes = r.Attributes |
||
36 | if r.QueueURL != "" { |
||
37 | in.QueueUrl = pointers.String(r.QueueURL) |
||
38 | } |
||
39 | return in |
||
40 | } |
||
41 | |||
42 | type SetQueueAttributesResult struct{} |
||
43 | |||
44 | func NewSetQueueAttributesResult(o *SDK.SetQueueAttributesResponse) *SetQueueAttributesResult { |
||
45 | result := &SetQueueAttributesResult{} |
||
46 | if o == nil { |
||
47 | return result |
||
48 | } |
||
49 | |||
50 | return result |
||
51 | } |
||
52 |