|
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
|
|
|
// GetQueueAttributes executes `GetQueueAttributes` operation. |
|
13
|
|
|
func (svc *SQS) GetQueueAttributes(ctx context.Context, r GetQueueAttributesRequest) (*GetQueueAttributesResult, error) { |
|
14
|
|
|
out, err := svc.RawGetQueueAttributes(ctx, r.ToInput()) |
|
15
|
|
|
if err != nil { |
|
16
|
|
|
err = svc.errWrap(errors.ErrorData{ |
|
17
|
|
|
Err: err, |
|
18
|
|
|
AWSOperation: "GetQueueAttributes", |
|
19
|
|
|
}) |
|
20
|
|
|
svc.Errorf(err.Error()) |
|
|
|
|
|
|
21
|
|
|
return nil, err |
|
22
|
|
|
} |
|
23
|
|
|
return NewGetQueueAttributesResult(out), nil |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
// GetQueueAttributesRequest has parameters for `GetQueueAttributes` operation. |
|
27
|
|
|
type GetQueueAttributesRequest struct { |
|
28
|
|
|
QueueURL string |
|
29
|
|
|
|
|
30
|
|
|
// optional |
|
31
|
|
|
AttributeNames []QueueAttributeName |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
func (r GetQueueAttributesRequest) ToInput() *SDK.GetQueueAttributesInput { |
|
|
|
|
|
|
35
|
|
|
in := &SDK.GetQueueAttributesInput{} |
|
36
|
|
|
|
|
37
|
|
|
if r.QueueURL != "" { |
|
38
|
|
|
in.QueueUrl = pointers.String(r.QueueURL) |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
if len(r.AttributeNames) != 0 { |
|
42
|
|
|
list := make([]SDK.QueueAttributeName, len(r.AttributeNames)) |
|
43
|
|
|
for i, v := range r.AttributeNames { |
|
44
|
|
|
list[i] = SDK.QueueAttributeName(v) |
|
45
|
|
|
} |
|
46
|
|
|
in.AttributeNames = list |
|
47
|
|
|
} |
|
48
|
|
|
return in |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
type GetQueueAttributesResult struct { |
|
|
|
|
|
|
52
|
|
|
Attributes map[string]string |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
func NewGetQueueAttributesResult(o *SDK.GetQueueAttributesResponse) *GetQueueAttributesResult { |
|
|
|
|
|
|
56
|
|
|
result := &GetQueueAttributesResult{} |
|
57
|
|
|
if o == nil { |
|
58
|
|
|
return result |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
result.Attributes = o.Attributes |
|
62
|
|
|
return result |
|
63
|
|
|
} |
|
64
|
|
|
|