diff --git a/java-maps-routing/.OwlBot.yaml b/java-maps-routing/.OwlBot.yaml
new file mode 100644
index 000000000000..407154bdb9b7
--- /dev/null
+++ b/java-maps-routing/.OwlBot.yaml
@@ -0,0 +1,33 @@
+# Copyright 2022 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.
+
+
+deep-remove-regex:
+- "/java-maps-routing/grpc-google-.*/src"
+- "/java-maps-routing/proto-google-.*/src"
+- "/java-maps-routing/google-.*/src"
+
+deep-preserve-regex:
+- "/java-maps-routing/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java"
+
+deep-copy-regex:
+- source: "/google/maps/routing/(v.*)/.*-java/proto-google-.*/src"
+ dest: "/owl-bot-staging/java-maps-routing/$1/proto-google-maps-routing-$1/src"
+- source: "/google/maps/routing/(v.*)/.*-java/grpc-google-.*/src"
+ dest: "/owl-bot-staging/java-maps-routing/$1/grpc-google-maps-routing-$1/src"
+- source: "/google/maps/routing/(v.*)/.*-java/gapic-google-.*/src"
+ dest: "/owl-bot-staging/java-maps-routing/$1/google-maps-routing/src"
+
+
+api-name: java-maps-routing
\ No newline at end of file
diff --git a/java-maps-routing/.repo-metadata.json b/java-maps-routing/.repo-metadata.json
new file mode 100644
index 000000000000..70b3b7d17941
--- /dev/null
+++ b/java-maps-routing/.repo-metadata.json
@@ -0,0 +1,16 @@
+{
+ "api_shortname": "maps-routing",
+ "name_pretty": "Routes API",
+ "product_documentation": "https://developers.google.com/maps/documentation/routes",
+ "api_description": "Routes API is the next generation, performance optimized version of the existing Directions API and Distance Matrix API. It helps you find the ideal route from A to Z, calculates ETAs and distances for matrices of origin and destination locations, and also offers new features.",
+ "client_documentation": "https://cloud.google.com/java/docs/reference/google-maps-routing/latest/overview",
+ "release_level": "preview",
+ "transport": "grpc",
+ "language": "java",
+ "repo": "googleapis/java-maps-routing",
+ "repo_short": "java-maps-routing",
+ "distribution_name": "com.google.maps:google-maps-routing",
+ "api_id": "routes.googleapis.com",
+ "library_type": "GAPIC_AUTO",
+ "requires_billing": true
+}
\ No newline at end of file
diff --git a/java-maps-routing/README.md b/java-maps-routing/README.md
new file mode 100644
index 000000000000..9d9fd9de2cf7
--- /dev/null
+++ b/java-maps-routing/README.md
@@ -0,0 +1,201 @@
+# Google Routes API Client for Java
+
+Java idiomatic client for [Routes API][product-docs].
+
+[![Maven][maven-version-image]][maven-version-link]
+![Stability][stability-image]
+
+- [Product Documentation][product-docs]
+- [Client Library Documentation][javadocs]
+
+> Note: This client is a work-in-progress, and may occasionally
+> make backwards-incompatible changes.
+
+
+## Quickstart
+
+
+If you are using Maven, add this to your pom.xml file:
+
+
+```xml
+
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 + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (RoutesClient routesClient = RoutesClient.create()) { + * ComputeRoutesRequest request = + * ComputeRoutesRequest.newBuilder() + * .setOrigin(Waypoint.newBuilder().build()) + * .setDestination(Waypoint.newBuilder().build()) + * .addAllIntermediates(new ArrayList+ * + *()) + * .setTravelMode(RouteTravelMode.forNumber(0)) + * .setRoutingPreference(RoutingPreference.forNumber(0)) + * .setPolylineQuality(PolylineQuality.forNumber(0)) + * .setPolylineEncoding(PolylineEncoding.forNumber(0)) + * .setDepartureTime(Timestamp.newBuilder().build()) + * .setComputeAlternativeRoutes(true) + * .setRouteModifiers(RouteModifiers.newBuilder().build()) + * .setLanguageCode("languageCode-2092349083") + * .setUnits(Units.forNumber(0)) + * .addAllRequestedReferenceRoutes(new ArrayList ()) + * .build(); + * ComputeRoutesResponse response = routesClient.computeRoutes(request); + * } + * }
Note: close() needs to be called on the RoutesClient 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: + * + *
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 RoutesSettings to create(). + * For example: + * + *
To customize credentials: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * RoutesSettings routesSettings = + * RoutesSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * RoutesClient routesClient = RoutesClient.create(routesSettings); + * }+ * + *
To customize the endpoint: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * RoutesSettings routesSettings = RoutesSettings.newBuilder().setEndpoint(myEndpoint).build(); + * RoutesClient routesClient = RoutesClient.create(routesSettings); + * }+ * + *
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * RoutesSettings routesSettings = RoutesSettings.newHttpJsonBuilder().build(); + * RoutesClient routesClient = RoutesClient.create(routesSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class RoutesClient implements BackgroundResource { + private final RoutesSettings settings; + private final RoutesStub stub; + + /** Constructs an instance of RoutesClient with default settings. */ + public static final RoutesClient create() throws IOException { + return create(RoutesSettings.newBuilder().build()); + } + + /** + * Constructs an instance of RoutesClient, 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 RoutesClient create(RoutesSettings settings) throws IOException { + return new RoutesClient(settings); + } + + /** + * Constructs an instance of RoutesClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(RoutesSettings). + */ + public static final RoutesClient create(RoutesStub stub) { + return new RoutesClient(stub); + } + + /** + * Constructs an instance of RoutesClient, 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 RoutesClient(RoutesSettings settings) throws IOException { + this.settings = settings; + this.stub = ((RoutesStubSettings) settings.getStubSettings()).createStub(); + } + + protected RoutesClient(RoutesStub stub) { + this.settings = null; + this.stub = stub; + } + + public final RoutesSettings getSettings() { + return settings; + } + + public RoutesStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the primary route along with optional alternate routes, given a set of terminal and + * intermediate waypoints. + * + *
**NOTE:** This method requires that you specify a response field mask in the + * input. You can provide the response field mask by using URL parameter `$fields` or `fields`, or + * by using an HTTP/gRPC header `X-Goog-FieldMask` (see the [available URL parameters and + * headers](https://cloud.google.com/apis/docs/system-parameters). The value is a comma separated + * list of field paths. See detailed documentation about [how to construct the field + * paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). + * + *
For example, in this method: + * + *
Google discourage the use of the wildcard (`*`) response field mask, or specifying the + * field mask at the top level (`routes`), because: + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (RoutesClient routesClient = RoutesClient.create()) { + * ComputeRoutesRequest request = + * ComputeRoutesRequest.newBuilder() + * .setOrigin(Waypoint.newBuilder().build()) + * .setDestination(Waypoint.newBuilder().build()) + * .addAllIntermediates(new ArrayList+ * + * @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 ComputeRoutesResponse computeRoutes(ComputeRoutesRequest request) { + return computeRoutesCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the primary route along with optional alternate routes, given a set of terminal and + * intermediate waypoints. + * + *()) + * .setTravelMode(RouteTravelMode.forNumber(0)) + * .setRoutingPreference(RoutingPreference.forNumber(0)) + * .setPolylineQuality(PolylineQuality.forNumber(0)) + * .setPolylineEncoding(PolylineEncoding.forNumber(0)) + * .setDepartureTime(Timestamp.newBuilder().build()) + * .setComputeAlternativeRoutes(true) + * .setRouteModifiers(RouteModifiers.newBuilder().build()) + * .setLanguageCode("languageCode-2092349083") + * .setUnits(Units.forNumber(0)) + * .addAllRequestedReferenceRoutes(new ArrayList ()) + * .build(); + * ComputeRoutesResponse response = routesClient.computeRoutes(request); + * } + * }
**NOTE:** This method requires that you specify a response field mask in the + * input. You can provide the response field mask by using URL parameter `$fields` or `fields`, or + * by using an HTTP/gRPC header `X-Goog-FieldMask` (see the [available URL parameters and + * headers](https://cloud.google.com/apis/docs/system-parameters). The value is a comma separated + * list of field paths. See detailed documentation about [how to construct the field + * paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). + * + *
For example, in this method: + * + *
Google discourage the use of the wildcard (`*`) response field mask, or specifying the + * field mask at the top level (`routes`), because: + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (RoutesClient routesClient = RoutesClient.create()) { + * ComputeRoutesRequest request = + * ComputeRoutesRequest.newBuilder() + * .setOrigin(Waypoint.newBuilder().build()) + * .setDestination(Waypoint.newBuilder().build()) + * .addAllIntermediates(new ArrayList+ */ + public final UnaryCallable()) + * .setTravelMode(RouteTravelMode.forNumber(0)) + * .setRoutingPreference(RoutingPreference.forNumber(0)) + * .setPolylineQuality(PolylineQuality.forNumber(0)) + * .setPolylineEncoding(PolylineEncoding.forNumber(0)) + * .setDepartureTime(Timestamp.newBuilder().build()) + * .setComputeAlternativeRoutes(true) + * .setRouteModifiers(RouteModifiers.newBuilder().build()) + * .setLanguageCode("languageCode-2092349083") + * .setUnits(Units.forNumber(0)) + * .addAllRequestedReferenceRoutes(new ArrayList ()) + * .build(); + * ApiFuture future = + * routesClient.computeRoutesCallable().futureCall(request); + * // Do something. + * ComputeRoutesResponse response = future.get(); + * } + * }
**NOTE:** This method requires that you specify a response field mask in the + * input. You can provide the response field mask by using the URL parameter `$fields` or + * `fields`, or by using the HTTP/gRPC header `X-Goog-FieldMask` (see the [available URL + * parameters and headers](https://cloud.google.com/apis/docs/system-parameters). The value is a + * comma separated list of field paths. See this detailed documentation about [how to construct + * the field + * paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto). + * + *
For example, in this method: + * + *
It is critical that you include `status` in your field mask as otherwise all messages will + * appear to be OK. Google discourages the use of the wildcard (`*`) response field mask, + * because: + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (RoutesClient routesClient = RoutesClient.create()) { + * ComputeRouteMatrixRequest request = + * ComputeRouteMatrixRequest.newBuilder() + * .addAllOrigins(new ArrayList+ */ + public final ServerStreamingCallable()) + * .addAllDestinations(new ArrayList ()) + * .setTravelMode(RouteTravelMode.forNumber(0)) + * .setRoutingPreference(RoutingPreference.forNumber(0)) + * .setDepartureTime(Timestamp.newBuilder().build()) + * .build(); + * ServerStream stream = + * routesClient.computeRouteMatrixCallable().call(request); + * for (RouteMatrixElement response : stream) { + * // Do something when a response is received. + * } + * } + * }
The default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the total timeout of computeRoutes to 30 seconds: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * RoutesSettings.Builder routesSettingsBuilder = RoutesSettings.newBuilder(); + * routesSettingsBuilder + * .computeRoutesSettings() + * .setRetrySettings( + * routesSettingsBuilder.computeRoutesSettings().getRetrySettings().toBuilder() + * .setTotalTimeout(Duration.ofSeconds(30)) + * .build()); + * RoutesSettings routesSettings = routesSettingsBuilder.build(); + * }+ */ +@Generated("by gapic-generator-java") +public class RoutesSettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction The interfaces provided are listed below, along with usage samples.
+ *
+ * ======================= RoutesClient =======================
+ *
+ * Service Description: The Routes API.
+ *
+ * Sample for RoutesClient:
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcRoutesCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcRoutesStub extends RoutesStub {
+ private static final MethodDescriptor This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonRoutesCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonRoutesStub extends RoutesStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class RoutesStub implements BackgroundResource {
+
+ public UnaryCallable The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of computeRoutes to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RoutesClient routesClient = RoutesClient.create()) {
+ * ComputeRoutesRequest request =
+ * ComputeRoutesRequest.newBuilder()
+ * .setOrigin(Waypoint.newBuilder().build())
+ * .setDestination(Waypoint.newBuilder().build())
+ * .addAllIntermediates(new ArrayList
+ */
+@Generated("by gapic-generator-java")
+package com.google.maps.routing.v2;
+
+import javax.annotation.Generated;
diff --git a/java-maps-routing/google-maps-routing/src/main/java/com/google/maps/routing/v2/stub/GrpcRoutesCallableFactory.java b/java-maps-routing/google-maps-routing/src/main/java/com/google/maps/routing/v2/stub/GrpcRoutesCallableFactory.java
new file mode 100644
index 000000000000..099984012490
--- /dev/null
+++ b/java-maps-routing/google-maps-routing/src/main/java/com/google/maps/routing/v2/stub/GrpcRoutesCallableFactory.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2022 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
+ *
+ * https://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.maps.routing.v2.stub;
+
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcCallableFactory;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.BidiStreamingCallable;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientStreamingCallable;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.StreamingCallSettings;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC callable factory implementation for the Routes service API.
+ *
+ *
+ *
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * RoutesStubSettings.Builder routesSettingsBuilder = RoutesStubSettings.newBuilder();
+ * routesSettingsBuilder
+ * .computeRoutesSettings()
+ * .setRetrySettings(
+ * routesSettingsBuilder.computeRoutesSettings().getRetrySettings().toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * RoutesStubSettings routesSettings = routesSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class RoutesStubSettings extends StubSettings