From 01e6372de3467fbb9552ac768827cc92b4e7655c Mon Sep 17 00:00:00 2001 From: Google APIs Date: Tue, 27 Oct 2020 14:04:29 -0700 Subject: [PATCH] feat: Add schema for providing GAPIC metadata. This allows each (API,version,language) combination to provide a mapping between RPCs and library methods invoking those RPCs. PiperOrigin-RevId: 339325081 --- gapic/metadata/BUILD.bazel | 1 + gapic/metadata/gapic_metadata.proto | 84 +++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 gapic/metadata/BUILD.bazel create mode 100644 gapic/metadata/gapic_metadata.proto diff --git a/gapic/metadata/BUILD.bazel b/gapic/metadata/BUILD.bazel new file mode 100644 index 00000000..22f66e65 --- /dev/null +++ b/gapic/metadata/BUILD.bazel @@ -0,0 +1 @@ +exports_files(glob(["*.proto"])) diff --git a/gapic/metadata/gapic_metadata.proto b/gapic/metadata/gapic_metadata.proto new file mode 100644 index 00000000..0d0f1c15 --- /dev/null +++ b/gapic/metadata/gapic_metadata.proto @@ -0,0 +1,84 @@ +// Copyright 2020 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.gapic.metadata; + +// Metadata about a GAPIC library for a specific combination of API, version, and +// computer language. +message GapicMetadata { + // Schema version of this proto. Current value: 1.0 + string schema = 1; + + // Any human-readable comments to be included in this file. + string comment = 2; + + // Computer language of this generated language. This must be + // spelled out as it spoken in English, with no capitalization or + // separators (e.g. "csharp", "nodejs"). + string language = 3; + + // The proto package containing the API definition for which this + // GAPIC library was generated. + string proto_package = 4; + + // The language-specific library package for this GAPIC library. + string library_package = 5; + + // A map from each proto-defined service to ServiceForTransports, + // which allows listing information about transport-specific + // implementations of the service. + // + // The key is the name of the service as it appears in the .proto + // file. + map services = 6; + + // A map from a transport name to ServiceAsClient, which allows + // listing information about the client objects that implement the + // parent RPC service for the specified transport. + // + // The key name is the transport, lower-cased with no separators + // (e.g. "grpc", "rest"). + message ServiceForTransport { + map clients = 1; + } + + // Information about a specific client implementing a proto-defined service. + message ServiceAsClient { + // The name of the library client formatted as it appears in the source code + string library_client = 1; + + // A mapping from each proto-defined RPC name to the the list of + // methods in library_client that implement it. There can be more + // than one library_client method for each RPC. RPCs with no + // library_client methods need not be included. + // + // The key name is the name of the RPC as defined and formated in + // the proto file. + map rpcs = 2; + } + + // List of GAPIC client methods implementing the proto-defined RPC + // for the transport and service specified in the containing + // structures. + message MethodList { + // List of methods for a specific proto-service client in the + // GAPIC. These names should be formatted as they appear in the + // source code. + repeated string methods = 1; + } + +}