Passed
Push — master ( b5915d...a6ac05 )
by eval
01:23
created

ses/client_op_get_template.go   A

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A ses.GetTemplateRequest.ToInput 0 7 2
A ses.*SES.GetTemplate 0 11 2
A ses.NewGetTemplateResult 0 8 2
1
package ses
2
3
import (
4
	"context"
5
6
	SDK "github.com/aws/aws-sdk-go-v2/service/ses"
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
// GetTemplate executes `GetTemplate` operation.
13
func (svc *SES) GetTemplate(ctx context.Context, r GetTemplateRequest) (*GetTemplateResult, error) {
14
	out, err := svc.RawGetTemplate(ctx, r.ToInput())
15
	if err != nil {
16
		err = svc.errWrap(errors.ErrorData{
17
			Err:          err,
18
			AWSOperation: "GetTemplate",
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 NewGetTemplateResult(out), nil
24
}
25
26
// GetTemplateRequest has parameters for `GetTemplate` operation.
27
type GetTemplateRequest struct {
28
	TemplateName string
29
}
30
31
func (r GetTemplateRequest) ToInput() *SDK.GetTemplateInput {
0 ignored issues
show
introduced by
exported method GetTemplateRequest.ToInput should have comment or be unexported
Loading history...
32
	in := &SDK.GetTemplateInput{}
33
34
	if r.TemplateName != "" {
35
		in.TemplateName = pointers.String(r.TemplateName)
36
	}
37
	return in
38
}
39
40
type GetTemplateResult struct {
0 ignored issues
show
introduced by
exported type GetTemplateResult should have comment or be unexported
Loading history...
41
	Template Template
42
}
43
44
func NewGetTemplateResult(o *SDK.GetTemplateResponse) *GetTemplateResult {
0 ignored issues
show
introduced by
exported function NewGetTemplateResult should have comment or be unexported
Loading history...
45
	result := &GetTemplateResult{}
46
	if o == nil {
47
		return result
48
	}
49
50
	result.Template = newTemplate(o.Template)
51
	return result
52
}
53