diff --git a/dependencies.properties b/dependencies.properties index 82383c9711..df163a3dd0 100644 --- a/dependencies.properties +++ b/dependencies.properties @@ -20,6 +20,7 @@ maven.com_google_guava_guava=com.google.guava:guava:26.0-jre maven.com_google_code_findbugs_jsr305=com.google.code.findbugs:jsr305:3.0.0 maven.com_google_auto_value_auto_value=com.google.auto.value:auto-value:1.7.2 maven.com_google_auto_value_auto_value_annotations=com.google.auto.value:auto-value-annotations:1.7.2 +maven.com_google_code_gson=com.google.code.gson:gson:2.8.6 maven.com_google_protobuf_protobuf_java=com.google.protobuf:protobuf-java:3.12.2 maven.io_github_java_diff_utils=io.github.java-diff-utils:java-diff-utils:4.0 maven.javax_annotation_javax_annotation_api=javax.annotation:javax.annotation-api:1.3.2 @@ -33,7 +34,7 @@ maven.org_threeten_threetenbp=org.threeten:threetenbp:1.3.3 # Testing. maven.junit_junit=junit:junit:4.13 -# This hamcrest-core dependency is for running JUnit test manually, before JUnit 4.11 it's wrapped along with JUnit package. +# This hamcrest-core dependency is for running JUnit test manually, before JUnit 4.11 it's wrapped along with JUnit package. # But now it has to be explicitly added. maven.org_hamcrest_hamcrest_core=org.hamcrest:hamcrest-core:1.3 maven.org_mockito_mockito_core=org.mockito:mockito-core:2.21.0 diff --git a/src/main/java/com/google/api/generator/gapic/model/BUILD.bazel b/src/main/java/com/google/api/generator/gapic/model/BUILD.bazel index 5c2eea6a14..63684561aa 100644 --- a/src/main/java/com/google/api/generator/gapic/model/BUILD.bazel +++ b/src/main/java/com/google/api/generator/gapic/model/BUILD.bazel @@ -21,6 +21,7 @@ java_library( "@com_google_auto_value_auto_value//jar", "@com_google_auto_value_auto_value_annotations//jar", "@com_google_code_findbugs_jsr305//jar", + "@com_google_googleapis//google/api:api_java_proto", "@com_google_googleapis//google/rpc:rpc_java_proto", "@com_google_guava_guava//jar", "@com_google_protobuf//:protobuf_java", diff --git a/src/main/java/com/google/api/generator/gapic/model/GapicContext.java b/src/main/java/com/google/api/generator/gapic/model/GapicContext.java index 59dbc06806..1ed089c4b5 100644 --- a/src/main/java/com/google/api/generator/gapic/model/GapicContext.java +++ b/src/main/java/com/google/api/generator/gapic/model/GapicContext.java @@ -38,6 +38,13 @@ public abstract class GapicContext { @Nullable public abstract GapicServiceConfig serviceConfig(); + @Nullable + public abstract com.google.api.Service serviceYamlProto(); + + public boolean hasServiceYamlProto() { + return serviceYamlProto() != null; + } + public static Builder builder() { return new AutoValue_GapicContext.Builder(); } @@ -54,6 +61,8 @@ public abstract static class Builder { public abstract Builder setServiceConfig(GapicServiceConfig serviceConfig); + public abstract Builder setServiceYamlProto(com.google.api.Service serviceYamlProto); + public abstract GapicContext build(); } } diff --git a/src/main/java/com/google/api/generator/gapic/protoparser/BUILD.bazel b/src/main/java/com/google/api/generator/gapic/protoparser/BUILD.bazel index bc14e4a480..c67204e22b 100644 --- a/src/main/java/com/google/api/generator/gapic/protoparser/BUILD.bazel +++ b/src/main/java/com/google/api/generator/gapic/protoparser/BUILD.bazel @@ -27,6 +27,7 @@ java_library( "//src/main/java/com/google/api/generator/gapic/utils", "@com_google_api_api_common//jar", "@com_google_code_findbugs_jsr305//jar", + "@com_google_code_gson//jar", "@com_google_googleapis//google/api:api_java_proto", "@com_google_googleapis//google/longrunning:longrunning_java_proto", "@com_google_guava_guava//jar", diff --git a/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java b/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java index 98e7fe5f5d..8c2ca268eb 100644 --- a/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java +++ b/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java @@ -65,8 +65,8 @@ public class Parser { private static final String COMMA = ","; private static final String COLON = ":"; - private static final String DOT = "."; private static final String DEFAULT_PORT = "443"; + private static final String DOT = "."; // Allow other parsers to access this. protected static final SourceCodeInfoParser SOURCE_CODE_INFO_PARSER = new SourceCodeInfoParser(); @@ -88,6 +88,11 @@ public static GapicContext parse(CodeGeneratorRequest request) { Optional serviceConfigOpt = ServiceConfigParser.parse(serviceConfigPath, batchingSettingsOpt); + Optional serviceYamlConfigPathOpt = + PluginArgumentParser.parseServiceYamlConfigPath(request); + Optional serviceYamlProtoOpt = + ServiceYamlParser.parse(serviceYamlConfigPathOpt.get()); + // Keep message and resource name parsing separate for cleaner logic. // While this takes an extra pass through the protobufs, the extra time is relatively trivial // and is worth the larger reduced maintenance cost. @@ -96,13 +101,15 @@ public static GapicContext parse(CodeGeneratorRequest request) { messages = updateResourceNamesInMessages(messages, resourceNames.values()); Set outputArgResourceNames = new HashSet<>(); List services = - parseServices(request, messages, resourceNames, outputArgResourceNames); + parseServices( + request, messages, resourceNames, outputArgResourceNames, serviceYamlProtoOpt); return GapicContext.builder() .setServices(services) .setMessages(messages) .setResourceNames(resourceNames) .setHelperResourceNames(outputArgResourceNames) .setServiceConfig(serviceConfigOpt.isPresent() ? serviceConfigOpt.get() : null) + .setServiceYamlProto(serviceYamlProtoOpt.isPresent() ? serviceYamlProtoOpt.get() : null) .build(); } @@ -110,8 +117,10 @@ public static List parseServices( CodeGeneratorRequest request, Map messageTypes, Map resourceNames, - Set outputArgResourceNames) { + Set outputArgResourceNames, + Optional serviceYamlProtoOpt) { Map fileDescriptors = getFilesToGenerate(request); + List services = new ArrayList<>(); for (String fileToGenerate : request.getFileToGenerateList()) { FileDescriptor fileDescriptor = diff --git a/src/main/java/com/google/api/generator/gapic/protoparser/PluginArgumentParser.java b/src/main/java/com/google/api/generator/gapic/protoparser/PluginArgumentParser.java index 784a9ae496..7cf29a1d29 100644 --- a/src/main/java/com/google/api/generator/gapic/protoparser/PluginArgumentParser.java +++ b/src/main/java/com/google/api/generator/gapic/protoparser/PluginArgumentParser.java @@ -27,9 +27,11 @@ public class PluginArgumentParser { // Synced to rules_java_gapic/java_gapic.bzl. @VisibleForTesting static final String KEY_GRPC_SERVICE_CONFIG = "grpc-service-config"; @VisibleForTesting static final String KEY_GAPIC_CONFIG = "gapic-config"; + @VisibleForTesting static final String KEY_SERVICE_YAML_CONFIG = "gapic-service-config"; private static final String JSON_FILE_ENDING = "grpc_service_config.json"; private static final String GAPIC_YAML_FILE_ENDING = "gapic.yaml"; + private static final String SERVICE_YAML_FILE_ENDING = ".yaml"; static Optional parseJsonConfigPath(CodeGeneratorRequest request) { return parseJsonConfigPath(request.getParameter()); @@ -39,6 +41,10 @@ static Optional parseGapicYamlConfigPath(CodeGeneratorRequest request) { return parseGapicYamlConfigPath(request.getParameter()); } + static Optional parseServiceYamlConfigPath(CodeGeneratorRequest request) { + return parseServiceYamlConfigPath(request.getParameter()); + } + /** Expects a comma-separated list of file paths. */ @VisibleForTesting static Optional parseJsonConfigPath(String pluginProtocArgument) { @@ -50,6 +56,11 @@ static Optional parseGapicYamlConfigPath(String pluginProtocArgument) { return parseArgument(pluginProtocArgument, KEY_GAPIC_CONFIG, GAPIC_YAML_FILE_ENDING); } + @VisibleForTesting + static Optional parseServiceYamlConfigPath(String pluginProtocArgument) { + return parseArgument(pluginProtocArgument, KEY_SERVICE_YAML_CONFIG, SERVICE_YAML_FILE_ENDING); + } + private static Optional parseArgument( String pluginProtocArgument, String key, String fileEnding) { if (Strings.isNullOrEmpty(pluginProtocArgument)) { @@ -62,7 +73,12 @@ private static Optional parseArgument( } String keyVal = args[0]; String valueVal = args[1]; - if (keyVal.equals(key) && valueVal.endsWith(fileEnding)) { + boolean valueMeetsCriteria = keyVal.equals(key) && valueVal.endsWith(fileEnding); + if (fileEnding.equals(SERVICE_YAML_FILE_ENDING)) { + valueMeetsCriteria &= !valueVal.endsWith(GAPIC_YAML_FILE_ENDING); + } + + if (valueMeetsCriteria) { return Optional.of(valueVal); } } diff --git a/src/main/java/com/google/api/generator/gapic/protoparser/ServiceYamlParser.java b/src/main/java/com/google/api/generator/gapic/protoparser/ServiceYamlParser.java new file mode 100644 index 0000000000..839903d460 --- /dev/null +++ b/src/main/java/com/google/api/generator/gapic/protoparser/ServiceYamlParser.java @@ -0,0 +1,59 @@ +// 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. + +package com.google.api.generator.gapic.protoparser; + +import com.google.common.base.Strings; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.util.JsonFormat; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Optional; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.constructor.SafeConstructor; + +public class ServiceYamlParser { + public static Optional parse(String serviceYamlFilePath) { + if (Strings.isNullOrEmpty(serviceYamlFilePath) || !(new File(serviceYamlFilePath)).exists()) { + return Optional.empty(); + } + + String fileContents = null; + try { + fileContents = new String(Files.readAllBytes(Paths.get(serviceYamlFilePath))); + } catch (IOException e) { + return Optional.empty(); + } + + Yaml yaml = new Yaml(new SafeConstructor()); + Map yamlMap = yaml.load(fileContents); + Gson gson = new GsonBuilder().setPrettyPrinting().setLenient().create(); + String jsonString = gson.toJson(yamlMap, LinkedHashMap.class); + // Use the full name instead of an import, to avoid reader confusion with this and + // model.Service. + com.google.api.Service.Builder serviceBuilder = com.google.api.Service.newBuilder(); + try { + JsonFormat.parser().ignoringUnknownFields().merge(jsonString, serviceBuilder); + } catch (InvalidProtocolBufferException e) { + return Optional.empty(); + } + return Optional.of(serviceBuilder.build()); + } +} diff --git a/src/test/java/com/google/api/generator/gapic/protoparser/BUILD.bazel b/src/test/java/com/google/api/generator/gapic/protoparser/BUILD.bazel index a7df4ab20b..b4af740184 100644 --- a/src/test/java/com/google/api/generator/gapic/protoparser/BUILD.bazel +++ b/src/test/java/com/google/api/generator/gapic/protoparser/BUILD.bazel @@ -11,6 +11,7 @@ TESTS = [ "ResourceNameParserTest", "ResourceReferenceParserTest", "ServiceConfigParserTest", + "ServiceYamlParserTest", "SourceCodeInfoParserTest", ] @@ -26,6 +27,7 @@ filegroup( "//src/test/java/com/google/api/generator/gapic/testdata:basic_proto_descriptor", "//src/test/java/com/google/api/generator/gapic/testdata:gapic_config_files", "//src/test/java/com/google/api/generator/gapic/testdata:service_config_files", + "//src/test/java/com/google/api/generator/gapic/testdata:service_yaml_files", ], test_class = "com.google.api.generator.gapic.protoparser.{0}".format(test_name), deps = [ @@ -39,6 +41,7 @@ filegroup( "//src/test/java/com/google/api/generator/gapic/testdata:showcase_java_proto", "//src/test/java/com/google/api/generator/gapic/testdata:testgapic_java_proto", "@com_google_api_api_common//jar", + "@com_google_googleapis//google/api:api_java_proto", "@com_google_googleapis//google/rpc:rpc_java_proto", "@com_google_protobuf//:protobuf_java", "@com_google_protobuf//:protobuf_java_util", diff --git a/src/test/java/com/google/api/generator/gapic/protoparser/PluginArgumentParserTest.java b/src/test/java/com/google/api/generator/gapic/protoparser/PluginArgumentParserTest.java index e8bbd21de9..c8a84d4f82 100644 --- a/src/test/java/com/google/api/generator/gapic/protoparser/PluginArgumentParserTest.java +++ b/src/test/java/com/google/api/generator/gapic/protoparser/PluginArgumentParserTest.java @@ -148,6 +148,83 @@ public void parseGapicYamlPath_noneFound() { assertFalse(PluginArgumentParser.parseGapicYamlConfigPath(rawArgument).isPresent()); } + @Test + public void parseServiceYamlPath_onlyOnePresent() { + String servicePath = "/tmp/something.yaml"; + assertEquals( + servicePath, + PluginArgumentParser.parseServiceYamlConfigPath(createServiceConfig(servicePath)).get()); + } + + @Test + public void parseServiceYamlPath_returnsFirstOneFound() { + String servicePathOne = "/tmp/something.yaml"; + String servicePathTwo = "/tmp/other.yaml"; + assertEquals( + servicePathOne, + PluginArgumentParser.parseServiceYamlConfigPath( + String.join( + ",", + Arrays.asList( + createServiceConfig(servicePathOne), createServiceConfig(servicePathTwo)))) + .get()); + } + + @Test + public void parseServiceYamlPath_gapicFilePresent() { + String gapicPath = "/tmp/something_gapic.yaml"; + String servicePath = "/tmp/something.yaml"; + // Both passed under the service yaml flag. + String rawArgument = + String.join( + ",", Arrays.asList(createServiceConfig(gapicPath), createServiceConfig(servicePath))); + assertEquals(servicePath, PluginArgumentParser.parseServiceYamlConfigPath(rawArgument).get()); + + // Passed under the right flags. + rawArgument = + String.join( + ",", Arrays.asList(createGapicConfig(gapicPath), createServiceConfig(servicePath))); + assertEquals(servicePath, PluginArgumentParser.parseServiceYamlConfigPath(rawArgument).get()); + + // Swapped flags. + rawArgument = + String.join( + ",", Arrays.asList(createGapicConfig(servicePath), createServiceConfig(gapicPath))); + assertFalse(PluginArgumentParser.parseServiceYamlConfigPath(rawArgument).isPresent()); + + // Both passed under the Gapic yaml flag. + rawArgument = + String.join( + ",", Arrays.asList(createGapicConfig(gapicPath), createGapicConfig(servicePath))); + assertFalse(PluginArgumentParser.parseServiceYamlConfigPath(rawArgument).isPresent()); + } + + @Test + public void parseServiceYamlPath_similarFileAppearsFirst() { + String jsonPath = "/tmp/foo_grpc_service_config.json"; + String gapicPath = "/tmp/something_gapic.yaml"; + String servicePath = "/tmp/something.yaml"; + String rawArgument = + String.join( + ",", + Arrays.asList( + createGrpcServiceConfig(jsonPath), + createGapicConfig("/tmp/something.yaml"), + createGapicConfig("/tmp/some_gapicyaml"), + createServiceConfig(gapicPath), + createServiceConfig(servicePath))); + assertEquals(servicePath, PluginArgumentParser.parseServiceYamlConfigPath(rawArgument).get()); + } + + @Test + public void parseServiceYamlPath_noneFound() { + String jsonPath = "/tmp/foo_grpc_service_config.json"; + String gapicPath = ""; + String rawArgument = + String.join(",", Arrays.asList(createGrpcServiceConfig(jsonPath), gapicPath)); + assertFalse(PluginArgumentParser.parseServiceYamlConfigPath(rawArgument).isPresent()); + } + private static String createGrpcServiceConfig(String path) { return String.format("%s=%s", PluginArgumentParser.KEY_GRPC_SERVICE_CONFIG, path); } @@ -155,4 +232,8 @@ private static String createGrpcServiceConfig(String path) { private static String createGapicConfig(String path) { return String.format("%s=%s", PluginArgumentParser.KEY_GAPIC_CONFIG, path); } + + private static String createServiceConfig(String path) { + return String.format("%s=%s", PluginArgumentParser.KEY_SERVICE_YAML_CONFIG, path); + } } diff --git a/src/test/java/com/google/api/generator/gapic/protoparser/ServiceYamlParserTest.java b/src/test/java/com/google/api/generator/gapic/protoparser/ServiceYamlParserTest.java new file mode 100644 index 0000000000..615aacc9b0 --- /dev/null +++ b/src/test/java/com/google/api/generator/gapic/protoparser/ServiceYamlParserTest.java @@ -0,0 +1,40 @@ +// 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. + +package com.google.api.generator.gapic.protoparser; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertTrue; + +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Optional; +import org.junit.Test; + +public class ServiceYamlParserTest { + private static final String YAML_DIRECTORY = + "src/test/java/com/google/api/generator/gapic/testdata/"; + + @Test + public void parseServiceYaml_basic() { + String yamlFilename = "logging.yaml"; + Path yamlPath = Paths.get(YAML_DIRECTORY, yamlFilename); + Optional serviceYamlProtoOpt = + ServiceYamlParser.parse(yamlPath.toString()); + assertTrue(serviceYamlProtoOpt.isPresent()); + + com.google.api.Service serviceYamlProto = serviceYamlProtoOpt.get(); + assertEquals("logging.googleapis.com", serviceYamlProto.getName()); + } +} diff --git a/src/test/java/com/google/api/generator/gapic/testdata/BUILD.bazel b/src/test/java/com/google/api/generator/gapic/testdata/BUILD.bazel index 9682b5c414..9b425d8013 100644 --- a/src/test/java/com/google/api/generator/gapic/testdata/BUILD.bazel +++ b/src/test/java/com/google/api/generator/gapic/testdata/BUILD.bazel @@ -13,6 +13,11 @@ filegroup( srcs = glob(["*_gapic.yaml"]), ) +filegroup( + name = "service_yaml_files", + srcs = ["logging.yaml"], +) + genrule( name = "basic_proto_descriptor", srcs = [ diff --git a/src/test/java/com/google/api/generator/gapic/testdata/logging.yaml b/src/test/java/com/google/api/generator/gapic/testdata/logging.yaml new file mode 100644 index 0000000000..74a39696ef --- /dev/null +++ b/src/test/java/com/google/api/generator/gapic/testdata/logging.yaml @@ -0,0 +1,126 @@ +type: google.api.Service +config_version: 3 +name: logging.googleapis.com +title: Cloud Logging API + +apis: +- name: google.logging.v2.ConfigServiceV2 +- name: google.logging.v2.LoggingServiceV2 +- name: google.logging.v2.MetricsServiceV2 + +documentation: + summary: |- + Writes log entries and manages your Cloud Logging configuration. The table + entries below are presented in alphabetical order, not in order of common + use. For explanations of the concepts found in the table entries, read the + documentation at https://cloud.google.com/logging/docs. + overview: '# Introduction + +The Cloud Logging service.' + +backend: + rules: + - selector: 'google.logging.v2.ConfigServiceV2.*' + deadline: 60.0 + - selector: 'google.logging.v2.LoggingServiceV2.*' + deadline: 60.0 + - selector: google.logging.v2.LoggingServiceV2.ListLogEntries + deadline: 10.0 + - selector: 'google.logging.v2.MetricsServiceV2.*' + deadline: 60.0 + +authentication: + rules: + - selector: 'google.logging.v2.ConfigServiceV2.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/logging.admin + - selector: google.logging.v2.ConfigServiceV2.GetBucket + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.read + - selector: google.logging.v2.ConfigServiceV2.GetCmekSettings + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.read + - selector: google.logging.v2.ConfigServiceV2.GetExclusion + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.read + - selector: google.logging.v2.ConfigServiceV2.GetSink + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.read + - selector: google.logging.v2.ConfigServiceV2.ListBuckets + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.read + - selector: google.logging.v2.ConfigServiceV2.ListExclusions + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.read + - selector: google.logging.v2.ConfigServiceV2.ListSinks + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.read + - selector: 'google.logging.v2.LoggingServiceV2.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.read + - selector: google.logging.v2.LoggingServiceV2.DeleteLog + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/logging.admin + - selector: google.logging.v2.LoggingServiceV2.WriteLogEntries + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.write + - selector: 'google.logging.v2.MetricsServiceV2.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.write + - selector: google.logging.v2.MetricsServiceV2.GetLogMetric + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.read + - selector: google.logging.v2.MetricsServiceV2.ListLogMetrics + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/logging.admin, + https://www.googleapis.com/auth/logging.read + diff --git a/test/integration/BUILD.bazel b/test/integration/BUILD.bazel index 0de6dfdd1e..086f641051 100644 --- a/test/integration/BUILD.bazel +++ b/test/integration/BUILD.bazel @@ -36,6 +36,7 @@ java_gapic_library( srcs = ["@com_google_googleapis//google/cloud/asset/v1:asset_proto_with_info"], grpc_service_config = "@com_google_googleapis//google/cloud/asset/v1:cloudasset_grpc_service_config.json", package = "google.cloud.asset.v1", + service_yaml = "@com_google_googleapis//google/cloud/asset/v1:cloudasset_v1.yaml", test_deps = [ "@com_google_googleapis//google/cloud/asset/v1:asset_java_grpc", "@com_google_googleapis//google/iam/v1:iam_java_grpc", @@ -63,6 +64,7 @@ java_gapic_library( srcs = ["redis_proto_with_info"], grpc_service_config = "@com_google_googleapis//google/cloud/redis/v1:redis_grpc_service_config.json", package = "google.cloud.redis.v1", + service_yaml = "@com_google_googleapis//google/cloud/redis/v1:redis_v1.yaml", test_deps = [ "@com_google_googleapis//google/cloud/redis/v1:redis_java_grpc", ], @@ -76,6 +78,7 @@ java_gapic_library( srcs = ["@com_google_googleapis//google/logging/v2:logging_proto_with_info"], grpc_service_config = "@com_google_googleapis//google/logging/v2:logging_grpc_service_config.json", package = "google.logging.v2", + service_yaml = "@com_google_googleapis//google/logging/v2:logging.yaml", test_deps = [ "@com_google_googleapis//google/logging/v2:logging_java_grpc", ],