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

sqs/client_op_get_queue_url.go   A

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 34
dl 0
loc 60
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A sqs.NewGetQueueURLResult 0 10 3
A sqs.*SQS.GetQueueURL 0 11 2
A sqs.GetQueueURLRequest.ToInput 0 11 3
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())
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 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 {
0 ignored issues
show
introduced by
exported method GetQueueURLRequest.ToInput should have comment or be unexported
Loading history...
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 {
0 ignored issues
show
introduced by
exported type GetQueueURLResult should have comment or be unexported
Loading history...
48
	QueueURL string
49
}
50
51
func NewGetQueueURLResult(o *SDK.GetQueueUrlResponse) *GetQueueURLResult {
0 ignored issues
show
introduced by
exported function NewGetQueueURLResult should have comment or be unexported
Loading history...
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