Passed
Push — master ( dd6fe7...ccccae )
by eval
02:05
created

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