From 6037e2bfe7a085d9210a8bc3a2f826d1d4fbda24 Mon Sep 17 00:00:00 2001 From: Brandon Domen Date: Thu, 18 May 2023 18:17:47 +0000 Subject: [PATCH] PR Feedback --- build/grpc_gateway/BUILD.bazel | 4 +- build/grpc_gateway/defs.bzl | 7 ++- build/repositories.bzl | 2 +- .../reporting/bff/v1alpha/BUILD.bazel | 48 +++---------------- .../reporting/bff/v1alpha/metric.proto | 4 +- .../reporting/bff/v1alpha/report.proto | 6 +-- .../bff/v1alpha/reports_service.proto | 30 ++---------- 7 files changed, 21 insertions(+), 80 deletions(-) diff --git a/build/grpc_gateway/BUILD.bazel b/build/grpc_gateway/BUILD.bazel index dffb138ff0e..7f9ca22886f 100644 --- a/build/grpc_gateway/BUILD.bazel +++ b/build/grpc_gateway/BUILD.bazel @@ -36,9 +36,9 @@ go_proto_compiler( visibility = ["//visibility:public"], deps = [ "@com_github_golang_protobuf//descriptor:go_default_library_gen", - "@com_github_grpc_ecosystem_grpc_gateway//runtime:go_default_library", - "@com_github_grpc_ecosystem_grpc_gateway//utilities:go_default_library", "@go_googleapis//google/api:annotations_go_proto", + "@grpc_ecosystem_grpc_gateway//runtime:go_default_library", + "@grpc_ecosystem_grpc_gateway//utilities:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes:go_default_library", "@org_golang_google_grpc//grpclog:go_default_library", diff --git a/build/grpc_gateway/defs.bzl b/build/grpc_gateway/defs.bzl index 8863d6ba8ed..6eb52b6e6d1 100644 --- a/build/grpc_gateway/defs.bzl +++ b/build/grpc_gateway/defs.bzl @@ -16,7 +16,7 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") -def go_grpc_gateway_proto_library(name, import_path, protos, embed = []): +def go_grpc_gateway_proto_library(name, visibility = None, **kwargs): go_proto_library( name = name, compilers = [ @@ -24,7 +24,6 @@ def go_grpc_gateway_proto_library(name, import_path, protos, embed = []): "//build/grpc_gateway:go_grpc", "//build/grpc_gateway:go_grpc_gateway", ], - embed = embed, - importpath = import_path, - protos = protos, + visibility = visibility, + **kwargs ) diff --git a/build/repositories.bzl b/build/repositories.bzl index 987910eb855..9bc82818971 100644 --- a/build/repositories.bzl +++ b/build/repositories.bzl @@ -107,7 +107,7 @@ def wfa_measurement_system_repositories(): ) http_archive( - name = "com_github_grpc_ecosystem_grpc_gateway", + name = "grpc_ecosystem_grpc_gateway", sha256 = "0675f7f8300f659a23e7ea4b8be5b38726c173b506a4d25c4309e93b4f1616ae", strip_prefix = "grpc-gateway-2.15.2", urls = ["https://github.com/grpc-ecosystem/grpc-gateway/archive/refs/tags/v2.15.2.tar.gz"], diff --git a/src/main/proto/wfa/measurement/reporting/bff/v1alpha/BUILD.bazel b/src/main/proto/wfa/measurement/reporting/bff/v1alpha/BUILD.bazel index b8b5dc1232e..097d372be7b 100644 --- a/src/main/proto/wfa/measurement/reporting/bff/v1alpha/BUILD.bazel +++ b/src/main/proto/wfa/measurement/reporting/bff/v1alpha/BUILD.bazel @@ -1,5 +1,4 @@ load("@rules_proto//proto:defs.bzl", "proto_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("//build/grpc_gateway:defs.bzl", "go_grpc_gateway_proto_library") package(default_visibility = ["//visibility:public"]) @@ -63,41 +62,22 @@ proto_library( ], ) -go_proto_library( +go_grpc_gateway_proto_library( name = "metric_go_proto", - compilers = [ - "//build/grpc_gateway:go_apiv2", - "//build/grpc_gateway:go_grpc", - "//build/grpc_gateway:go_grpc_gateway", - ], - embed = [ - ":time_interval_go_proto", - ], + embed = [":time_interval_go_proto"], importpath = GO_IMPORT_PATH, protos = [":metric_proto"], ) -go_proto_library( +go_grpc_gateway_proto_library( name = "time_interval_go_proto", - compilers = [ - "//build/grpc_gateway:go_apiv2", - "//build/grpc_gateway:go_grpc", - "//build/grpc_gateway:go_grpc_gateway", - ], importpath = GO_IMPORT_PATH, protos = [":time_interval_proto"], ) -go_proto_library( +go_grpc_gateway_proto_library( name = "report_go_proto", - compilers = [ - "//build/grpc_gateway:go_apiv2", - "//build/grpc_gateway:go_grpc", - "//build/grpc_gateway:go_grpc_gateway", - ], - embed = [ - ":metric_go_proto", - ], + embed = [":metric_go_proto"], importpath = GO_IMPORT_PATH, protos = [":report_proto"], ) @@ -105,22 +85,6 @@ go_proto_library( go_grpc_gateway_proto_library( name = "reports_service_go_proto", embed = [":report_go_proto"], - import_path = GO_IMPORT_PATH, + importpath = GO_IMPORT_PATH, protos = [":reports_service_proto"], ) - -# go_proto_library( -# name = "reports_service_go_proto", -# compilers = [ -# "//build/grpc_gateway:go_apiv2", -# "//build/grpc_gateway:go_grpc", -# "//build/grpc_gateway:go_grpc_gateway", -# ], -# embed = [ -# ":report_go_proto", -# ], -# importpath = GO_IMPORT_PATH, -# protos = [ -# ":reports_service_proto", -# ], -# ) diff --git a/src/main/proto/wfa/measurement/reporting/bff/v1alpha/metric.proto b/src/main/proto/wfa/measurement/reporting/bff/v1alpha/metric.proto index 625259e36bd..39ac762c317 100644 --- a/src/main/proto/wfa/measurement/reporting/bff/v1alpha/metric.proto +++ b/src/main/proto/wfa/measurement/reporting/bff/v1alpha/metric.proto @@ -188,7 +188,7 @@ message MetricResult { // The metric value once calculated is stored in `MetricResult`. message Metric { option (google.api.resource) = { - type: "reporting.halo-cmm.org/Metric" + type: "ui.reporting.halo-cmm.org/Metric" pattern: "measurementConsumers/{measurement_consumer}/metrics/{metric}" }; // Resource name @@ -199,7 +199,7 @@ message Metric { (google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = IMMUTABLE, (google.api.resource_reference) = { - type: "reporting.halo-cmm.org/ReportingSet" + type: "ui.reporting.halo-cmm.org/ReportingSet" } ]; diff --git a/src/main/proto/wfa/measurement/reporting/bff/v1alpha/report.proto b/src/main/proto/wfa/measurement/reporting/bff/v1alpha/report.proto index 11035fc69a8..95482f5006d 100644 --- a/src/main/proto/wfa/measurement/reporting/bff/v1alpha/report.proto +++ b/src/main/proto/wfa/measurement/reporting/bff/v1alpha/report.proto @@ -33,7 +33,7 @@ option go_package = "wfa/measurement/reporting/bff/v1alpha/reportingpb"; // of `Grouping`s defined in `MetricCalculationSpec`. message Report { option (google.api.resource) = { - type: "reporting.halo-cmm.org/Report" + type: "ui.reporting.halo-cmm.org/Report" pattern: "measurementConsumers/{measurement_consumer}/reports/{report}" }; @@ -90,7 +90,7 @@ message Report { string key = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { - type: "reporting.halo-cmm.org/ReportingSet" + type: "ui.reporting.halo-cmm.org/ReportingSet" } ]; // Value of the map entry. @@ -137,7 +137,7 @@ message Report { // The reporting set associated with this `MetricCalculationSpec`. string reporting_set = 2 [(google.api.resource_reference) = { - type: "reporting.halo-cmm.org/ReportingSet" + type: "ui.reporting.halo-cmm.org/ReportingSet" }]; // Whether the results for a given time interval is cumulative with those of diff --git a/src/main/proto/wfa/measurement/reporting/bff/v1alpha/reports_service.proto b/src/main/proto/wfa/measurement/reporting/bff/v1alpha/reports_service.proto index 14d65e8bb02..4f9e60ab5c7 100644 --- a/src/main/proto/wfa/measurement/reporting/bff/v1alpha/reports_service.proto +++ b/src/main/proto/wfa/measurement/reporting/bff/v1alpha/reports_service.proto @@ -41,15 +41,6 @@ service Reports { }; option (google.api.method_signature) = "parent"; } - - // // Creates a `Report`. - // rpc CreateReport(CreateReportRequest) returns (Report) { - // option (google.api.http) = { - // post: "/v1alpha/{parent=measurementConsumers/*}/reports" - // body: "report" - // }; - // option (google.api.method_signature) = "parent,report"; - // } } // Request message for `GetReport` method. @@ -58,7 +49,9 @@ message GetReportRequest { // Format: measurementConsumers/{measurement_consumer}/reports/{report} string name = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "reporting.halo-cmm.org/Report" } + (google.api.resource_reference) = { + type: "ui.reporting.halo-cmm.org/Report" + } ]; } @@ -68,7 +61,7 @@ message ListReportsRequest { string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { - child_type: "reporting.halo-cmm.org/Report" + child_type: "ui.reporting.halo-cmm.org/Report" } ]; @@ -95,18 +88,3 @@ message ListReportsResponse { // If this field is omitted, there are no subsequent pages. string next_page_token = 2; } - -// // Request message for `CreateReport` method. -// message CreateReportRequest { -// // The parent resource where this report will be created. -// // Format: measurementConsumers/{measurement_consumer} -// string parent = 1 [ -// (google.api.field_behavior) = REQUIRED, -// (google.api.resource_reference) = { -// child_type: "reporting.halo-cmm.org/Report" -// } -// ]; - -// // The report to create. -// Report report = 2 [(google.api.field_behavior) = REQUIRED]; -// }