File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -370,10 +370,7 @@ private ManagedChannel createSingleChannel() throws IOException {
370370
371371 // Check DirectPath traffic.
372372 boolean useDirectPathXds = false ;
373- if (isDirectPathEnabled ()
374- && isCredentialDirectPathCompatible ()
375- && isOnComputeEngine ()
376- && canUseDirectPathWithUniverseDomain ()) {
373+ if (canUseDirectPath ()) {
377374 CallCredentials callCreds = MoreCallCredentials .from (credentials );
378375 ChannelCredentials channelCreds =
379376 GoogleDefaultChannelCredentials .newBuilder ().callCredentials (callCreds ).build ();
@@ -446,6 +443,24 @@ && canUseDirectPathWithUniverseDomain()) {
446443 return managedChannel ;
447444 }
448445
446+ /**
447+ * Marked as Internal Api and intended for internal use. DirectPath must be enabled via the
448+ * settings and a few other configurations/settings must also be valid for the request to go
449+ * through DirectPath.
450+ *
451+ * <p>Checks: 1. Credentials are compatible 2.Running on Compute Engine 3. Universe Domain is
452+ * configured to for the Google Default Universe
453+ *
454+ * @return if DirectPath is enabled for the client AND if the configurations are valid
455+ */
456+ @ InternalApi
457+ public boolean canUseDirectPath () {
458+ return isDirectPathEnabled ()
459+ && isCredentialDirectPathCompatible ()
460+ && isOnComputeEngine ()
461+ && canUseDirectPathWithUniverseDomain ();
462+ }
463+
449464 /** The endpoint to be used for the channel. */
450465 @ Override
451466 public String getEndpoint () {
You can’t perform that action at this time.
0 commit comments