|
1
|
|
|
package pinpointemail |
|
2
|
|
|
|
|
3
|
|
|
import ( |
|
4
|
|
|
SDK "github.com/aws/aws-sdk-go-v2/service/pinpointemail" |
|
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 = "PinpointEmail" |
|
13
|
|
|
) |
|
14
|
|
|
|
|
15
|
|
|
// PinpointEmail has PinpointEmail client. |
|
16
|
|
|
type PinpointEmail struct { |
|
17
|
|
|
client *SDK.Client |
|
18
|
|
|
|
|
19
|
|
|
logger log.Logger |
|
20
|
|
|
errWrap func(errors.ErrorData) error |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
// New returns initialized *PinpointEmail. |
|
24
|
|
|
func New(conf config.Config) (*PinpointEmail, error) { |
|
25
|
|
|
c, err := conf.AWSConfig() |
|
26
|
|
|
if err != nil { |
|
27
|
|
|
return nil, err |
|
28
|
|
|
} |
|
29
|
|
|
if conf.Endpoints.HasPinpointEmail() { |
|
30
|
|
|
c.EndpointResolver = conf.Endpoints.GetPinpointEmail() |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
svc := &PinpointEmail{ |
|
34
|
|
|
client: SDK.New(c), |
|
35
|
|
|
logger: conf.GetLogger(), |
|
36
|
|
|
errWrap: conf.GetErrWrap(), |
|
37
|
|
|
} |
|
38
|
|
|
return svc, nil |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
// GetClient gets original SDK client. |
|
42
|
|
|
func (svc *PinpointEmail) GetClient() *SDK.Client { |
|
43
|
|
|
return svc.client |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
// SetLogger sets logger. |
|
47
|
|
|
func (svc *PinpointEmail) SetLogger(logger log.Logger) { |
|
48
|
|
|
svc.logger = logger |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
// Infof logging information. |
|
52
|
|
|
func (svc *PinpointEmail) Infof(format string, v ...interface{}) { |
|
53
|
|
|
svc.logger.Infof(serviceName, format, v...) |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
// Errorf logging error information. |
|
57
|
|
|
func (svc *PinpointEmail) Errorf(format string, v ...interface{}) { |
|
58
|
|
|
svc.logger.Errorf(serviceName, format, v...) |
|
|
|
|
|
|
59
|
|
|
} |
|
60
|
|
|
|