Total Lines | 60 |
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 | // GetQueueURL executes `GetQueueURL` operation. |
||
13 | func (svc *SQS) GetQueueURL(ctx context.Context, r GetQueueURLRequest) (*GetQueueURLResult, error) { |
||
14 | out, err := svc.RawGetQueueUrl(ctx, r.ToInput()) |
||
15 | if err != nil { |
||
16 | err = svc.errWrap(errors.ErrorData{ |
||
17 | Err: err, |
||
18 | AWSOperation: "GetQueueURL", |
||
19 | }) |
||
20 | svc.Errorf(err.Error()) |
||
|
|||
21 | return nil, err |
||
22 | } |
||
23 | return NewGetQueueURLResult(out), nil |
||
24 | } |
||
25 | |||
26 | // GetQueueURLRequest has parameters for `GetQueueURL` operation. |
||
27 | type GetQueueURLRequest struct { |
||
28 | QueueName string |
||
29 | |||
30 | // optional |
||
31 | QueueOwnerAWSAccountID string |
||
32 | } |
||
33 | |||
34 | func (r GetQueueURLRequest) ToInput() *SDK.GetQueueUrlInput { |
||
35 | in := &SDK.GetQueueUrlInput{} |
||
36 | |||
37 | if r.QueueName != "" { |
||
38 | in.QueueName = pointers.String(r.QueueName) |
||
39 | } |
||
40 | |||
41 | if r.QueueOwnerAWSAccountID != "" { |
||
42 | in.QueueOwnerAWSAccountId = pointers.String(r.QueueOwnerAWSAccountID) |
||
43 | } |
||
44 | return in |
||
45 | } |
||
46 | |||
47 | type GetQueueURLResult struct { |
||
48 | QueueURL string |
||
49 | } |
||
50 | |||
51 | func NewGetQueueURLResult(o *SDK.GetQueueUrlResponse) *GetQueueURLResult { |
||
52 | result := &GetQueueURLResult{} |
||
53 | if o == nil { |
||
54 | return result |
||
55 | } |
||
56 | |||
57 | if o.QueueUrl != nil { |
||
58 | result.QueueURL = *o.QueueUrl |
||
59 | } |
||
60 | return result |
||
61 | } |
||
62 |