-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.go
57 lines (47 loc) · 2.07 KB
/
server.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
46
47
48
49
50
51
52
53
54
55
56
57
// Package qualitymilestonedefinition contains the server to manage QualityMilestoneDefinitions.
package qualitymilestonedefinition
import (
"context"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/pkg/errors"
"github.com/stackrox/infra-auth-lib/service/middleware"
v1 "github.com/stackrox/release-registry/gen/go/proto/api/v1"
"github.com/stackrox/release-registry/pkg/logging"
"google.golang.org/grpc"
)
type qualityMilestoneDefinitionImpl struct {
v1.UnimplementedQualityMilestoneDefinitionServiceServer
}
var (
_ middleware.APIService = (*qualityMilestoneDefinitionImpl)(nil)
_ v1.QualityMilestoneDefinitionServiceServer = (*qualityMilestoneDefinitionImpl)(nil)
)
//nolint:gochecknoglobals
var log = logging.CreateProductionLogger()
// NewQualityMilestoneDefinitionService creates a new QualityMilestoneDefinitionService.
//
//nolint:ireturn,nolintlint
func NewQualityMilestoneDefinitionService() (middleware.APIService, error) {
return &qualityMilestoneDefinitionImpl{}, nil
}
// RegisterServiceServer registers this service with the given gRPC Server.
func (s *qualityMilestoneDefinitionImpl) RegisterServiceServer(server *grpc.Server) {
v1.RegisterQualityMilestoneDefinitionServiceServer(server, s)
}
// RegisterServiceHandler registers this service with the given gRPC Gateway endpoint.
func (s *qualityMilestoneDefinitionImpl) RegisterServiceHandler(
ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn,
) error {
if err := v1.RegisterQualityMilestoneDefinitionServiceHandler(ctx, mux, conn); err != nil {
return errors.Wrap(err, "could not register qualitymilestonedefinition service handler")
}
return nil
}
// Access configures access for this service.
func (s *qualityMilestoneDefinitionImpl) Access() map[string]middleware.Access {
return map[string]middleware.Access{
"/proto.api.v1.QualityMilestoneDefinitionService/Create": middleware.Authenticated,
"/proto.api.v1.QualityMilestoneDefinitionService/Get": middleware.Anonymous,
"/proto.api.v1.QualityMilestoneDefinitionService/List": middleware.Anonymous,
}
}