Passed
Push — master ( 9acbae...dd6fe7 )
by eval
04:36 queued 02:53
created

ses.*SES.GetClient   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
package ses
2
3
import (
4
	SDK "github.com/aws/aws-sdk-go-v2/service/ses"
5
6
	"github.com/evalphobia/aws-sdk-go-v2-wrapper/config"
7
	"github.com/evalphobia/aws-sdk-go-v2-wrapper/errors"
8
	"github.com/evalphobia/aws-sdk-go-v2-wrapper/log"
9
)
10
11
const (
12
	serviceName = "SES"
13
)
14
15
// SES has SES client.
16
type SES struct {
17
	client *SDK.Client
18
19
	logger  log.Logger
20
	errWrap func(errors.ErrorData) error
21
22
	// for xapi values
23
	defaultConfigurationSet string
24
}
25
26
// New returns initialized *SES.
27
func New(conf config.Config) (*SES, error) {
28
	c, err := conf.AWSConfig()
29
	if err != nil {
30
		return nil, err
31
	}
32
	if conf.Endpoints.HasSES() {
33
		c.EndpointResolver = conf.Endpoints.GetSES()
34
	}
35
36
	svc := &SES{
37
		client:  SDK.New(c),
38
		logger:  conf.GetLogger(),
39
		errWrap: conf.GetErrWrap(),
40
	}
41
	return svc, nil
42
}
43
44
// GetClient gets original SDK client.
45
func (svc *SES) GetClient() *SDK.Client {
46
	return svc.client
47
}
48
49
// SetDefaultConfigurationSet sets defaultConfigurationSet.
50
func (svc *SES) SetDefaultConfigurationSet(s string) {
51
	svc.defaultConfigurationSet = s
52
}
53
54
// SetLogger sets logger.
55
func (svc *SES) SetLogger(logger log.Logger) {
56
	svc.logger = logger
57
}
58
59
// Infof logging information.
60
func (svc *SES) Infof(format string, v ...interface{}) {
61
	svc.logger.Infof(serviceName, format, v...)
62
}
63
64
// Errorf logging error information.
65
func (svc *SES) Errorf(format string, v ...interface{}) {
66
	svc.logger.Errorf(serviceName, format, v...)
0 ignored issues
show
introduced by
no formatting directive in Errorf call
Loading history...
67
}
68