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

sqs/client_op_purge_queue.go   A

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 28
dl 0
loc 48
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A sqs.*SQS.PurgeQueue 0 11 2
A sqs.NewPurgeQueueResult 0 7 2
A sqs.PurgeQueueRequest.ToInput 0 7 2
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
// PurgeQueue executes `PurgeQueue` operation.
13
func (svc *SQS) PurgeQueue(ctx context.Context, r PurgeQueueRequest) (*PurgeQueueResult, error) {
14
	out, err := svc.RawPurgeQueue(ctx, r.ToInput())
15
	if err != nil {
16
		err = svc.errWrap(errors.ErrorData{
17
			Err:          err,
18
			AWSOperation: "PurgeQueue",
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 NewPurgeQueueResult(out), nil
24
}
25
26
// PurgeQueueRequest has parameters for `PurgeQueue` operation.
27
type PurgeQueueRequest struct {
28
	QueueURL string
29
}
30
31
func (r PurgeQueueRequest) ToInput() *SDK.PurgeQueueInput {
0 ignored issues
show
introduced by
exported method PurgeQueueRequest.ToInput should have comment or be unexported
Loading history...
32
	in := &SDK.PurgeQueueInput{}
33
34
	if r.QueueURL != "" {
35
		in.QueueUrl = pointers.String(r.QueueURL)
36
	}
37
	return in
38
}
39
40
type PurgeQueueResult struct{}
0 ignored issues
show
introduced by
exported type PurgeQueueResult should have comment or be unexported
Loading history...
41
42
func NewPurgeQueueResult(o *SDK.PurgeQueueResponse) *PurgeQueueResult {
0 ignored issues
show
introduced by
exported function NewPurgeQueueResult should have comment or be unexported
Loading history...
43
	result := &PurgeQueueResult{}
44
	if o == nil {
45
		return result
46
	}
47
48
	return result
49
}
50