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

sqs/client_op_set_queue_attributes.go   A

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 30
dl 0
loc 50
rs 10
c 0
b 0
f 0

3 Methods

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