Skip to content

Commit

Permalink
feat: gRPC version API (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik authored Mar 10, 2021
1 parent 4343c4a commit 89cc46f
Show file tree
Hide file tree
Showing 8 changed files with 768 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/driver/registry_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"net/http"

acl "github.com/ory/keto/proto/ory/keto/acl/v1alpha1"

grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
"github.com/ory/x/reqlog"
"github.com/urfave/negroni"
Expand Down Expand Up @@ -36,6 +38,7 @@ var (
_ x.WriterProvider = (*RegistryDefault)(nil)
_ x.LoggerProvider = (*RegistryDefault)(nil)
_ Registry = (*RegistryDefault)(nil)
_ acl.VersionServiceServer = (*RegistryDefault)(nil)
)

type (
Expand Down Expand Up @@ -91,6 +94,10 @@ func (r *RegistryDefault) HealthServer() *health.Server {
return r.healthServer
}

func (r *RegistryDefault) GetVersion(_ context.Context, _ *acl.GetVersionRequest) (*acl.GetVersionResponse, error) {
return &acl.GetVersionResponse{Version: config.Version}, nil
}

func (r *RegistryDefault) Tracer() *tracing.Tracer {
panic("implement me")
}
Expand Down Expand Up @@ -240,6 +247,7 @@ func (r *RegistryDefault) ReadGRPCServer() *grpc.Server {
)

grpcHealthV1.RegisterHealthServer(s, r.HealthServer())
acl.RegisterVersionServiceServer(s, r)
reflection.Register(s)

for _, h := range r.allHandlers() {
Expand All @@ -266,6 +274,7 @@ func (r *RegistryDefault) WriteGRPCServer() *grpc.Server {
)

grpcHealthV1.RegisterHealthServer(s, r.HealthServer())
acl.RegisterVersionServiceServer(s, r)
reflection.Register(s)

for _, h := range r.allHandlers() {
Expand Down
220 changes: 220 additions & 0 deletions proto/ory/keto/acl/v1alpha1/version.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions proto/ory/keto/acl/v1alpha1/version.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

package ory.keto.acl.v1alpha1;

option go_package = "github.com/ory/keto/proto/ory/keto/acl/v1alpha1;acl";
option csharp_namespace = "Ory.Keto.Acl.V1Alpha1";
option java_multiple_files = true;
option java_outer_classname = "VersionServiceProto";
option java_package = "sh.ory.keto.acl.v1alpha1";
option php_namespace = "Ory\\Keto\\Acl\\V1alpha1";

service VersionService {
rpc GetVersion(GetVersionRequest) returns (GetVersionResponse);
}

message GetVersionRequest {}

message GetVersionResponse {
string version = 1;
}
99 changes: 99 additions & 0 deletions proto/ory/keto/acl/v1alpha1/version_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 89cc46f

Please sign in to comment.