diff --git a/protobuf/buf.gen.go-server.yaml b/protobuf/buf.gen.go-server.yaml index cc2dd86..7dbb5b1 100644 --- a/protobuf/buf.gen.go-server.yaml +++ b/protobuf/buf.gen.go-server.yaml @@ -3,16 +3,16 @@ managed: enabled: true plugins: - plugin: buf.build/protocolbuffers/go - out: ../proto/go-server + out: ./proto/go-server opt: - paths=source_relative - plugin: buf.build/grpc/go:v1.3.0 - out: ../proto/go-server + out: ./proto/go-server opt: - require_unimplemented_servers=false - paths=source_relative - - plugin: buf.build/grpc-ecosystem/plugins/grpc-gateway:v2.10.3-1 - out: ../proto/go-server + - plugin: buf.build/grpc-ecosystem/gateway:v2.18.1 + out: ./proto/go-server opt: - paths=source_relative - generate_unbound_methods=true \ No newline at end of file diff --git a/protobuf/schema/v1/schema.proto b/protobuf/schema/v1/schema.proto index 048e65c..c2fe0e2 100644 --- a/protobuf/schema/v1/schema.proto +++ b/protobuf/schema/v1/schema.proto @@ -4,6 +4,9 @@ package schema.v1; option go_package = "schema/service/v1"; +// well know type by google, gRPC gateway uses HTTP annotation. +import "google/api/annotations.proto"; + message AnalyzeRequest { string backend = 1; string namespace = 2; @@ -116,8 +119,21 @@ message ListIntegrationsResponse { } service ServerService { - rpc Analyze(AnalyzeRequest) returns (AnalyzeResponse) {} + rpc Analyze(AnalyzeRequest) returns (AnalyzeResponse) { + // option type is http + option (google.api.http) = { + // this is url, for RESTfull/JSON api and method + // this line means when a HTTP post request comes with "/v1/analyze" call this rpc method over this service + get: "/v1/analyze" + }; + } rpc AddConfig(AddConfigRequest) returns (AddConfigResponse) {} rpc RemoveConfig(RemoveConfigRequest) returns (RemoveConfigResponse) {} - rpc ListIntegrations(ListIntegrationsRequest) returns (ListIntegrationsResponse) {} + rpc ListIntegrations(ListIntegrationsRequest) returns (ListIntegrationsResponse) { + // option type is http + option (google.api.http) = { + // this line means when a HTTP GET request comes with "/v1/list" call this rpc method over this service + get: "/v1/list" + }; + } }