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

sqs.NewSetQueueAttributesResult   A

Complexity

Conditions 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
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