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

sqs/client_op_list_queues.go   A

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 9
eloc 39
dl 0
loc 64
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A sqs.NewListQueuesResult 0 11 3
A sqs.*SQS.ListQueues 0 11 2
A sqs.ListQueuesRequest.ToInput 0 13 4
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
// ListQueues executes `ListQueues` operation.
13
func (svc *SQS) ListQueues(ctx context.Context, r ListQueuesRequest) (*ListQueuesResult, error) {
14
	out, err := svc.RawListQueues(ctx, r.ToInput())
15
	if err != nil {
16
		err = svc.errWrap(errors.ErrorData{
17
			Err:          err,
18
			AWSOperation: "ListQueues",
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 NewListQueuesResult(out), nil
24
}
25
26
// ListQueuesRequest has parameters for `ListQueues` operation.
27
type ListQueuesRequest struct {
28
	// optional
29
	MaxResults      int64
30
	NextToken       string
31
	QueueNamePrefix string
32
}
33
34
func (r ListQueuesRequest) ToInput() *SDK.ListQueuesInput {
0 ignored issues
show
introduced by
exported method ListQueuesRequest.ToInput should have comment or be unexported
Loading history...
35
	in := &SDK.ListQueuesInput{}
36
37
	if r.MaxResults != 0 {
38
		in.MaxResults = pointers.Long64(r.MaxResults)
39
	}
40
	if r.NextToken != "" {
41
		in.NextToken = pointers.String(r.NextToken)
42
	}
43
	if r.QueueNamePrefix != "" {
44
		in.QueueNamePrefix = pointers.String(r.QueueNamePrefix)
45
	}
46
	return in
47
}
48
49
type ListQueuesResult struct {
0 ignored issues
show
introduced by
exported type ListQueuesResult should have comment or be unexported
Loading history...
50
	NextToken string
51
	QueueURLs []string
52
}
53
54
func NewListQueuesResult(o *SDK.ListQueuesResponse) *ListQueuesResult {
0 ignored issues
show
introduced by
exported function NewListQueuesResult should have comment or be unexported
Loading history...
55
	result := &ListQueuesResult{}
56
	if o == nil {
57
		return result
58
	}
59
60
	if o.NextToken != nil {
61
		result.NextToken = *o.NextToken
62
	}
63
	result.QueueURLs = o.QueueUrls
64
	return result
65
}
66