frostfs-s3-gw/neofs/api/handler/api.go

38 lines
559 B
Go
Raw Normal View History

2020-07-24 16:10:41 +00:00
package handler
import (
2020-08-06 10:49:25 +00:00
"errors"
2020-07-24 16:10:41 +00:00
"github.com/minio/minio/neofs/api"
2020-08-06 10:49:25 +00:00
"github.com/minio/minio/neofs/layer"
2020-07-24 16:10:41 +00:00
"go.uber.org/zap"
)
type (
handler struct {
log *zap.Logger
2020-08-06 10:49:25 +00:00
obj layer.Client
2020-07-24 16:10:41 +00:00
}
Params struct {
Log *zap.Logger
2020-08-06 10:49:25 +00:00
Obj layer.Client
2020-07-24 16:10:41 +00:00
}
)
var _ api.Handler = (*handler)(nil)
2020-08-06 10:49:25 +00:00
func New(log *zap.Logger, obj layer.Client) (api.Handler, error) {
2020-07-24 16:10:41 +00:00
switch {
2020-08-06 10:49:25 +00:00
case obj == nil:
return nil, errors.New("empty NeoFS Object Layer")
case log == nil:
2020-07-24 16:10:41 +00:00
return nil, errors.New("empty logger")
}
return &handler{
2020-08-06 10:49:25 +00:00
log: log,
obj: obj,
2020-07-24 16:10:41 +00:00
}, nil
}