From 49f0b39ecc1ef12e61cd9ebc4f7af794efb7d3dc Mon Sep 17 00:00:00 2001 From: Mike Eltsufin Date: Wed, 20 Oct 2021 17:45:50 -0400 Subject: [PATCH] fix: Use parent type instead of child_type in method doc sample Fixes: #852. --- .../protoparser/MethodSignatureParser.java | 12 +- .../composer/common/TestProtoLoader.java | 22 ++ .../grpc/ServiceClientClassComposerTest.java | 13 + .../grpc/goldens/DatastreamClient.golden | 372 ++++++++++++++++++ .../api/generator/gapic/testdata/BUILD.bazel | 1 + .../generator/gapic/testdata/compliance.proto | 1 - .../generator/gapic/testdata/datastream.proto | 164 ++++++++ test/integration/goldens/README.md | 2 +- .../cloud/logging/v2/MetricsClient.java | 2 +- .../cloud/pubsub/v1/SchemaServiceClient.java | 2 +- 10 files changed, 586 insertions(+), 5 deletions(-) create mode 100644 src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DatastreamClient.golden create mode 100644 src/test/java/com/google/api/generator/gapic/testdata/datastream.proto diff --git a/src/main/java/com/google/api/generator/gapic/protoparser/MethodSignatureParser.java b/src/main/java/com/google/api/generator/gapic/protoparser/MethodSignatureParser.java index 9ca9825def..4d62a6c1ed 100644 --- a/src/main/java/com/google/api/generator/gapic/protoparser/MethodSignatureParser.java +++ b/src/main/java/com/google/api/generator/gapic/protoparser/MethodSignatureParser.java @@ -206,7 +206,17 @@ private static Map parseTypeFromArgumentName( resourceNames, patternsToResourceNames); outputArgResourceNames.addAll(resourceNameArgs); - typeToField.put(TypeNode.STRING, field); + if (resourceNameArgs.size() == 1) { + typeToField.put( + TypeNode.STRING, + field + .toBuilder() + .setResourceReference( + ResourceReference.withType(resourceNameArgs.get(0).resourceTypeString())) + .build()); + } else { + typeToField.put(TypeNode.STRING, field); + } typeToField.putAll( resourceNameArgs.stream() .collect( diff --git a/src/test/java/com/google/api/generator/gapic/composer/common/TestProtoLoader.java b/src/test/java/com/google/api/generator/gapic/composer/common/TestProtoLoader.java index e9eb95721d..4ba785a10e 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/common/TestProtoLoader.java +++ b/src/test/java/com/google/api/generator/gapic/composer/common/TestProtoLoader.java @@ -28,6 +28,7 @@ import com.google.api.generator.gapic.protoparser.Parser; import com.google.api.generator.gapic.protoparser.ServiceConfigParser; import com.google.bookshop.v1beta1.BookshopProto; +import com.google.cloud.datastream.v1alpha1.CloudDatastreamServiceProto; import com.google.logging.v2.LogEntryProto; import com.google.logging.v2.LoggingConfigProto; import com.google.logging.v2.LoggingMetricsProto; @@ -170,6 +171,27 @@ public GapicContext parseShowcaseIdentity() { .build(); } + public GapicContext parseDatastream() { + FileDescriptor fileDescriptor = CloudDatastreamServiceProto.getDescriptor(); + ServiceDescriptor datastreamService = fileDescriptor.getServices().get(0); + assertEquals(datastreamService.getName(), "Datastream"); + + Map messageTypes = Parser.parseMessages(fileDescriptor); + Map resourceNames = Parser.parseResourceNames(fileDescriptor); + Set outputResourceNames = new HashSet<>(); + List services = + Parser.parseService( + fileDescriptor, messageTypes, resourceNames, Optional.empty(), outputResourceNames); + + return GapicContext.builder() + .setMessages(messageTypes) + .setResourceNames(resourceNames) + .setServices(services) + .setHelperResourceNames(outputResourceNames) + .setTransport(transport) + .build(); + } + public GapicContext parseShowcaseTesting() { FileDescriptor testingFileDescriptor = TestingOuterClass.getDescriptor(); ServiceDescriptor testingService = testingFileDescriptor.getServices().get(0); diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientClassComposerTest.java b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientClassComposerTest.java index 331b94e484..c340669d8e 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientClassComposerTest.java +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/ServiceClientClassComposerTest.java @@ -78,4 +78,17 @@ public void generateServiceClasses_bookshopNameConflicts() { Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "BookshopClient.golden"); assertCodeEquals(goldenFilePath, visitor.write()); } + + @Test + public void generateServiceClasses_childTypeParentInJavadoc() { + GapicContext context = GrpcTestProtoLoader.instance().parseDatastream(); + Service protoService = context.services().get(0); + GapicClass clazz = ServiceClientClassComposer.instance().generate(context, protoService); + + JavaWriterVisitor visitor = new JavaWriterVisitor(); + clazz.classDefinition().accept(visitor); + Utils.saveCodegenToFile(this.getClass(), "DatastreamClient.golden", visitor.write()); + Path goldenFilePath = Paths.get(Utils.getGoldenDir(this.getClass()), "DatastreamClient.golden"); + assertCodeEquals(goldenFilePath, visitor.write()); + } } diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DatastreamClient.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DatastreamClient.golden new file mode 100644 index 0000000000..cf122b81b3 --- /dev/null +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DatastreamClient.golden @@ -0,0 +1,372 @@ +package com.google.cloud.datastream.v1alpha1; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.datastream.v1alpha1.stub.DatastreamStub; +import com.google.cloud.datastream.v1alpha1.stub.DatastreamStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * This class provides the ability to make remote calls to the backing service through method calls + * that map to API methods. Sample code to get started: + * + *
{@code
+ * try (DatastreamClient datastreamClient = DatastreamClient.create()) {
+ *   PrivateConnectionName parent =
+ *       PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]");
+ *   for (Route element : datastreamClient.listRoutes(parent).iterateAll()) {
+ *     // doThingsWith(element);
+ *   }
+ * }
+ * }
+ * + *

Note: close() needs to be called on the DatastreamClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of DatastreamSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * DatastreamSettings datastreamSettings =
+ *     DatastreamSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * DatastreamSettings datastreamSettings =
+ *     DatastreamSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * DatastreamClient datastreamClient = DatastreamClient.create(datastreamSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class DatastreamClient implements BackgroundResource { + private final DatastreamSettings settings; + private final DatastreamStub stub; + + /** Constructs an instance of DatastreamClient with default settings. */ + public static final DatastreamClient create() throws IOException { + return create(DatastreamSettings.newBuilder().build()); + } + + /** + * Constructs an instance of DatastreamClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final DatastreamClient create(DatastreamSettings settings) throws IOException { + return new DatastreamClient(settings); + } + + /** + * Constructs an instance of DatastreamClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(DatastreamSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final DatastreamClient create(DatastreamStub stub) { + return new DatastreamClient(stub); + } + + /** + * Constructs an instance of DatastreamClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected DatastreamClient(DatastreamSettings settings) throws IOException { + this.settings = settings; + this.stub = ((DatastreamStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected DatastreamClient(DatastreamStub stub) { + this.settings = null; + this.stub = stub; + } + + public final DatastreamSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public DatastreamStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *

{@code
+   * try (DatastreamClient datastreamClient = DatastreamClient.create()) {
+   *   PrivateConnectionName parent =
+   *       PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]");
+   *   for (Route element : datastreamClient.listRoutes(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListRoutesPagedResponse listRoutes(PrivateConnectionName parent) { + ListRoutesRequest request = + ListRoutesRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); + return listRoutes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *
{@code
+   * try (DatastreamClient datastreamClient = DatastreamClient.create()) {
+   *   String parent =
+   *       PrivateConnectionName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]").toString();
+   *   for (Route element : datastreamClient.listRoutes(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListRoutesPagedResponse listRoutes(String parent) { + ListRoutesRequest request = ListRoutesRequest.newBuilder().setParent(parent).build(); + return listRoutes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *
{@code
+   * try (DatastreamClient datastreamClient = DatastreamClient.create()) {
+   *   ListRoutesRequest request =
+   *       ListRoutesRequest.newBuilder()
+   *           .setParent(
+   *               RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]")
+   *                   .toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .build();
+   *   for (Route element : datastreamClient.listRoutes(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListRoutesPagedResponse listRoutes(ListRoutesRequest request) { + return listRoutesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *
{@code
+   * try (DatastreamClient datastreamClient = DatastreamClient.create()) {
+   *   ListRoutesRequest request =
+   *       ListRoutesRequest.newBuilder()
+   *           .setParent(
+   *               RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]")
+   *                   .toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .build();
+   *   ApiFuture future = datastreamClient.listRoutesPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Route element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listRoutesPagedCallable() { + return stub.listRoutesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *
{@code
+   * try (DatastreamClient datastreamClient = DatastreamClient.create()) {
+   *   ListRoutesRequest request =
+   *       ListRoutesRequest.newBuilder()
+   *           .setParent(
+   *               RouteName.of("[PROJECT]", "[LOCATION]", "[PRIVATE_CONNECTION]", "[ROUTE]")
+   *                   .toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .build();
+   *   while (true) {
+   *     ListRoutesResponse response = datastreamClient.listRoutesCallable().call(request);
+   *     for (Route element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listRoutesCallable() { + return stub.listRoutesCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListRoutesPagedResponse + extends AbstractPagedListResponse< + ListRoutesRequest, + ListRoutesResponse, + Route, + ListRoutesPage, + ListRoutesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListRoutesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, input -> new ListRoutesPagedResponse(input), MoreExecutors.directExecutor()); + } + + private ListRoutesPagedResponse(ListRoutesPage page) { + super(page, ListRoutesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListRoutesPage + extends AbstractPage { + + private ListRoutesPage( + PageContext context, + ListRoutesResponse response) { + super(context, response); + } + + private static ListRoutesPage createEmptyPage() { + return new ListRoutesPage(null, null); + } + + @Override + protected ListRoutesPage createPage( + PageContext context, + ListRoutesResponse response) { + return new ListRoutesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListRoutesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListRoutesRequest, + ListRoutesResponse, + Route, + ListRoutesPage, + ListRoutesFixedSizeCollection> { + + private ListRoutesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListRoutesFixedSizeCollection createEmptyCollection() { + return new ListRoutesFixedSizeCollection(null, 0); + } + + @Override + protected ListRoutesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListRoutesFixedSizeCollection(pages, collectionSize); + } + } +} 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 ecbdd6a532..82ecd69531 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 @@ -50,6 +50,7 @@ proto_library( "echo.proto", "identity.proto", "testing.proto", + "datastream.proto", ], deps = [ "@com_google_googleapis//google/api:annotations_proto", diff --git a/src/test/java/com/google/api/generator/gapic/testdata/compliance.proto b/src/test/java/com/google/api/generator/gapic/testdata/compliance.proto index 4467a387ab..c602452b13 100644 --- a/src/test/java/com/google/api/generator/gapic/testdata/compliance.proto +++ b/src/test/java/com/google/api/generator/gapic/testdata/compliance.proto @@ -16,7 +16,6 @@ syntax = "proto3"; import "google/api/annotations.proto"; import "google/api/client.proto"; -import "google/cloud/extended_operations.proto"; package google.showcase.v1beta1; diff --git a/src/test/java/com/google/api/generator/gapic/testdata/datastream.proto b/src/test/java/com/google/api/generator/gapic/testdata/datastream.proto new file mode 100644 index 0000000000..d9a6314b1b --- /dev/null +++ b/src/test/java/com/google/api/generator/gapic/testdata/datastream.proto @@ -0,0 +1,164 @@ +// Copyright 2021 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.cloud.datastream.v1alpha1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Datastream.V1Alpha1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1;datastream"; +option java_multiple_files = true; +option java_outer_classname = "CloudDatastreamServiceProto"; +option java_package = "com.google.cloud.datastream.v1alpha1"; +option php_namespace = "Google\\Cloud\\Datastream\\V1alpha1"; +option ruby_package = "Google::Cloud::Datastream::V1alpha1"; + +// Datastream service +service Datastream { + option (google.api.default_host) = "datastream.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Use this method to list routes created for a private connectivity in a + // project and location. + rpc ListRoutes(ListRoutesRequest) returns (ListRoutesResponse) { + option (google.api.http) = { + get: "/v1alpha1/{parent=projects/*/locations/*/privateConnections/*}/routes" + }; + option (google.api.method_signature) = "parent"; + } +} + + +// route list request +message ListRoutesRequest { + // Required. The parent that owns the collection of Routess. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/Route" + } + ]; + + // Maximum number of Routes to return. The service may return + // fewer than this value. If unspecified, at most 50 Routes + // will be returned. The maximum value is 1000; values above 1000 will be + // coerced to 1000. + int32 page_size = 2; + + // Page token received from a previous `ListRoutes` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListRoutes` must match the call that provided the page + // token. + string page_token = 3; + + // Filter request. + string filter = 4; + + // Order by fields for the result. + string order_by = 5; +} + +// route list response +message ListRoutesResponse { + // List of Routes. + repeated Route routes = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// The Route resource is the child of the PrivateConnection resource. +// It used to define a route for a PrivateConnection setup. +message Route { + option (google.api.resource) = { + type: "datastream.googleapis.com/Route" + pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}" + }; + + // Output only. The resource's name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The create time of the resource. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The update time of the resource. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels. + map labels = 4; + + // Required. Display name. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Destination address for connection + string destination_address = 6 [(google.api.field_behavior) = REQUIRED]; + + // Destination port for connection + int32 destination_port = 7; +} + +// The PrivateConnection resource is used to establish private connectivity +// between Datastream and a customer's network. +message PrivateConnection { + option (google.api.resource) = { + type: "datastream.googleapis.com/PrivateConnection" + pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}" + }; + + // Private Connection state. + enum State { + STATE_UNSPECIFIED = 0; + + // The private connection is in creation state - creating resources. + CREATING = 1; + + // The private connection has been created with all of it's resources. + CREATED = 2; + + // The private connection creation has failed. + FAILED = 3; + } + + // Output only. The resource's name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The create time of the resource. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The update time of the resource. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels. + map labels = 4; + + // Required. Display name. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The state of the Private Connection. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} \ No newline at end of file diff --git a/test/integration/goldens/README.md b/test/integration/goldens/README.md index 09a1368027..9f94046ebb 100644 --- a/test/integration/goldens/README.md +++ b/test/integration/goldens/README.md @@ -20,5 +20,5 @@ If the actual generated Java source files are not identical with the goldens fil update the goldens using source files. Run the command below to overwrite the goldens files in `redis` folder. ```sh -bazel run //test/integration:redis_goldens_update +bazel run //test/integration:redis_update ``` diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsClient.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsClient.java index e1fdf43653..0670b07988 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsClient.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/MetricsClient.java @@ -423,7 +423,7 @@ public final LogMetric createLogMetric(ProjectName parent, LogMetric metric) { * *
{@code
    * try (MetricsClient metricsClient = MetricsClient.create()) {
-   *   String parent = LogMetricName.of("[PROJECT]", "[METRIC]").toString();
+   *   String parent = ProjectName.of("[PROJECT]").toString();
    *   LogMetric metric = LogMetric.newBuilder().build();
    *   LogMetric response = metricsClient.createLogMetric(parent, metric);
    * }
diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceClient.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceClient.java
index fa217f1637..6568dfcec0 100644
--- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceClient.java
+++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/SchemaServiceClient.java
@@ -210,7 +210,7 @@ public final Schema createSchema(ProjectName parent, Schema schema, String schem
    *
    * 
{@code
    * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
-   *   String parent = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
+   *   String parent = ProjectName.of("[PROJECT]").toString();
    *   Schema schema = Schema.newBuilder().build();
    *   String schemaId = "schemaId-697673060";
    *   Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);