-
Notifications
You must be signed in to change notification settings - Fork 116
/
aws.go
45 lines (35 loc) · 974 Bytes
/
aws.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package kinesis
import (
"errors"
"github.com/golang/protobuf/ptypes/any"
"github.com/uber-go/tally/v4"
"go.uber.org/zap"
kinesisv1 "github.com/lyft/clutch/backend/api/aws/kinesis/v1"
"github.com/lyft/clutch/backend/module"
"github.com/lyft/clutch/backend/service"
"github.com/lyft/clutch/backend/service/aws"
)
const (
Name = "clutch.module.kinesis"
)
func New(*any.Any, *zap.Logger, tally.Scope) (module.Module, error) {
awsClient, ok := service.Registry["clutch.service.aws"]
if !ok {
return nil, errors.New("could not find service")
}
c, ok := awsClient.(aws.Client)
if !ok {
return nil, errors.New("service was not the correct type")
}
mod := &mod{
kinesis: newKinesisAPI(c),
}
return mod, nil
}
type mod struct {
kinesis kinesisv1.KinesisAPIServer
}
func (m *mod) Register(r module.Registrar) error {
kinesisv1.RegisterKinesisAPIServer(r.GRPCServer(), m.kinesis)
return r.RegisterJSONGateway(kinesisv1.RegisterKinesisAPIHandler)
}