Passed
Push — master ( 6fcdf1...cf907b )
by Tolga
01:19 queued 17s
created

servers.*HealthServer.AuthFuncOverride   A

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 servers
2
3
import (
4
	"context"
5
6
	"google.golang.org/grpc/codes"
7
	health "google.golang.org/grpc/health/grpc_health_v1"
8
	"google.golang.org/grpc/status"
9
)
10
11
// HealthServer - Structure for Health Server
12
type HealthServer struct {
13
	health.UnimplementedHealthServer
14
}
15
16
// NewHealthServer - Creates new HealthServer Server
17
func NewHealthServer() *HealthServer {
18
	return &HealthServer{}
19
}
20
21
// Check - Return health check status response
22
func (s *HealthServer) Check(_ context.Context, _ *health.HealthCheckRequest) (*health.HealthCheckResponse, error) {
23
	return &health.HealthCheckResponse{Status: health.HealthCheckResponse_SERVING}, nil
24
}
25
26
// Watch - TO:DO
27
func (s *HealthServer) Watch(_ *health.HealthCheckRequest, _ health.Health_WatchServer) error {
28
	// Example of how to register both methods but only implement the Check method.
29
	return status.Error(codes.Unimplemented, "unimplemented")
30
}
31
32
// AuthFuncOverride is called instead of authn.
33
func (s *HealthServer) AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error) {
34
	return ctx, nil
35
}
36