athena.*Athena.Errorf   A
last analyzed

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 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
package athena
2
3
import (
4
	SDK "github.com/aws/aws-sdk-go-v2/service/athena"
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 = "athena"
13
)
14
15
// Athena has Athena client.
16
type Athena struct {
17
	client *SDK.Client
18
19
	logger  log.Logger
20
	errWrap func(errors.ErrorData) error
21
}
22
23
// New returns initialized *Athena.
24
func New(conf config.Config) (*Athena, error) {
25
	c, err := conf.AWSConfig()
26
	if err != nil {
27
		return nil, err
28
	}
29
	if conf.Endpoints.HasAthena() {
30
		c.EndpointResolver = conf.Endpoints.GetAthena()
31
	}
32
33
	svc := &Athena{
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 *Athena) GetClient() *SDK.Client {
43
	return svc.client
44
}
45
46
// SetLogger sets logger.
47
func (svc *Athena) SetLogger(logger log.Logger) {
48
	svc.logger = logger
49
}
50
51
// Infof logging information.
52
func (svc *Athena) Infof(format string, v ...interface{}) {
53
	svc.logger.Infof(serviceName, format, v...)
54
}
55
56
// Errorf logging error information.
57
func (svc *Athena) Errorf(format string, v ...interface{}) {
58
	svc.logger.Errorf(serviceName, format, v...)
0 ignored issues
show
introduced by
no formatting directive in Errorf call
Loading history...
59
}
60