diff --git a/WORKSPACE b/WORKSPACE index f5055bb334..f5101f83fc 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -26,7 +26,7 @@ jvm_maven_import_external( # gapic-generator-java dependencies to match the order in googleapis repository, # which in its turn, prioritizes actual generated clients runtime dependencies # over the generator dependencies. -_gax_java_version = "1.64.0" +_gax_java_version = "1.65.1" http_archive( name = "com_google_api_gax_java", diff --git a/src/main/java/com/google/api/generator/gapic/composer/comment/SettingsCommentComposer.java b/src/main/java/com/google/api/generator/gapic/composer/comment/SettingsCommentComposer.java index 5e10eb9cd5..f1bf7c8860 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/comment/SettingsCommentComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/comment/SettingsCommentComposer.java @@ -61,6 +61,8 @@ public class SettingsCommentComposer { toSimpleComment("Returns a builder for the default ExecutorProvider for this service."); public static final CommentStatement DEFAULT_SERVICE_ENDPOINT_METHOD_COMMENT = toSimpleComment("Returns the default service endpoint."); + public static final CommentStatement DEFAULT_SERVICE_MTLS_ENDPOINT_METHOD_COMMENT = + toSimpleComment("Returns the default mTLS service endpoint."); public static final CommentStatement DEFAULT_SERVICE_SCOPES_METHOD_COMMENT = toSimpleComment("Returns the default service scopes."); diff --git a/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java b/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java index fb2d350011..200d615eb8 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java @@ -61,6 +61,7 @@ import com.google.api.generator.engine.ast.MethodDefinition; import com.google.api.generator.engine.ast.MethodInvocationExpr; import com.google.api.generator.engine.ast.NewObjectExpr; +import com.google.api.generator.engine.ast.PrimitiveValue; import com.google.api.generator.engine.ast.Reference; import com.google.api.generator.engine.ast.ReferenceConstructorExpr; import com.google.api.generator.engine.ast.RelationalOperationExpr; @@ -918,6 +919,22 @@ private List createDefaultHelperAndGetterMethods( .setReturnExpr(ValueExpr.withValue(StringObjectValue.withValue(service.defaultHost()))) .build()); + // Create the getDefaultMtlsEndpoint method. + returnType = TypeNode.STRING; + javaMethods.add( + MethodDefinition.builder() + .setHeaderCommentStatements( + SettingsCommentComposer.DEFAULT_SERVICE_MTLS_ENDPOINT_METHOD_COMMENT) + .setScope(ScopeNode.PUBLIC) + .setIsStatic(true) + .setReturnType(returnType) + .setName("getDefaultMtlsEndpoint") + .setReturnExpr( + ValueExpr.withValue( + StringObjectValue.withValue( + service.defaultHost().replace(".googleapis.com", ".mtls.googleapis.com")))) + .build()); + // Create the getDefaultServiceScopes method. returnType = TypeNode.withReference( @@ -1594,6 +1611,21 @@ private static MethodDefinition createNestedClassCreateDefaultMethod(TypeStore t .setArguments( MethodInvocationExpr.builder().setMethodName("getDefaultEndpoint").build()) .build()); + bodyExprs.add( + MethodInvocationExpr.builder() + .setExprReferenceExpr(builderVarExpr) + .setMethodName("setMtlsEndpoint") + .setArguments( + MethodInvocationExpr.builder().setMethodName("getDefaultMtlsEndpoint").build()) + .build()); + bodyExprs.add( + MethodInvocationExpr.builder() + .setExprReferenceExpr(builderVarExpr) + .setMethodName("setSwitchToMtlsEndpointAllowed") + .setArguments( + ValueExpr.withValue( + PrimitiveValue.builder().setType(TypeNode.BOOLEAN).setValue("true").build())) + .build()); bodyStatements.addAll( bodyExprs.stream().map(e -> ExprStatement.withExpr(e)).collect(Collectors.toList())); bodyStatements.add(EMPTY_LINE_STATEMENT); diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceStubSettings.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceStubSettings.golden index 6e44ff4bd2..ad77c0ed75 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceStubSettings.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceStubSettings.golden @@ -108,6 +108,11 @@ public class DeprecatedServiceStubSettings extends StubSettings getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -225,6 +230,8 @@ public class DeprecatedServiceStubSettings extends StubSettings { return "localhost:7469"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "localhost:7469"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -461,6 +466,8 @@ public class EchoStubSettings extends StubSettings { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/LoggingServiceV2StubSettings.golden b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/LoggingServiceV2StubSettings.golden index 4033943f64..5734b4f511 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/LoggingServiceV2StubSettings.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/LoggingServiceV2StubSettings.golden @@ -428,6 +428,11 @@ public class LoggingServiceV2StubSettings extends StubSettings getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -610,6 +615,8 @@ public class LoggingServiceV2StubSettings extends StubSettings { return "pubsub.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "pubsub.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -651,6 +656,8 @@ public class PublisherStubSettings extends StubSettings { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceStubSettings.golden b/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceStubSettings.golden index f274021dda..7715034885 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceStubSettings.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceStubSettings.golden @@ -284,6 +284,11 @@ public class EchoStubSettings extends StubSettings { return "localhost:7469"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "localhost:7469"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -462,6 +467,8 @@ public class EchoStubSettings extends StubSettings { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/asset/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java b/test/integration/goldens/asset/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java index cceca0029a..52e7b84498 100644 --- a/test/integration/goldens/asset/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java +++ b/test/integration/goldens/asset/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java @@ -375,6 +375,11 @@ public static String getDefaultEndpoint() { return "cloudasset.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "cloudasset.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -623,6 +628,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/stub/IamCredentialsStubSettings.java b/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/stub/IamCredentialsStubSettings.java index 0cec2d9668..7a4cd49735 100644 --- a/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/stub/IamCredentialsStubSettings.java +++ b/test/integration/goldens/credentials/com/google/cloud/iam/credentials/v1/stub/IamCredentialsStubSettings.java @@ -138,6 +138,11 @@ public static String getDefaultEndpoint() { return "iamcredentials.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "iamcredentials.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -277,6 +282,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/iam/com/google/iam/v1/stub/IAMPolicyStubSettings.java b/test/integration/goldens/iam/com/google/iam/v1/stub/IAMPolicyStubSettings.java index 5959e94a06..f69f7ea460 100644 --- a/test/integration/goldens/iam/com/google/iam/v1/stub/IAMPolicyStubSettings.java +++ b/test/integration/goldens/iam/com/google/iam/v1/stub/IAMPolicyStubSettings.java @@ -125,6 +125,11 @@ public static String getDefaultEndpoint() { return "iam-meta-api.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "iam-meta-api.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -250,6 +255,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/kms/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java b/test/integration/goldens/kms/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java index 5ebc43167f..77190adf46 100644 --- a/test/integration/goldens/kms/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java +++ b/test/integration/goldens/kms/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java @@ -645,6 +645,11 @@ public static String getDefaultEndpoint() { return "cloudkms.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "cloudkms.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -962,6 +967,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java b/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java index 0f7a252975..056516530c 100644 --- a/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java +++ b/test/integration/goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java @@ -303,6 +303,11 @@ public static String getDefaultEndpoint() { return "library-example.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "library-example.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -473,6 +478,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java index bfeba9f0a4..7c30359c19 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java @@ -514,6 +514,11 @@ public static String getDefaultEndpoint() { return "logging.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "logging.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -792,6 +797,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java index d1fa3db875..bd2e07a52b 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java @@ -444,6 +444,11 @@ public static String getDefaultEndpoint() { return "logging.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "logging.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -626,6 +631,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java index 3fd951caa0..634af2b28c 100644 --- a/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java +++ b/test/integration/goldens/logging/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java @@ -212,6 +212,11 @@ public static String getDefaultEndpoint() { return "logging.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "logging.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -371,6 +376,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java index 5909b0850c..95307e4d63 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java @@ -478,6 +478,11 @@ public static String getDefaultEndpoint() { return "pubsub.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "pubsub.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -711,6 +716,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java index 6f8f9b182e..9c4e780cd8 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java @@ -242,6 +242,11 @@ public static String getDefaultEndpoint() { return "pubsub.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "pubsub.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -401,6 +406,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java index 55101f5595..c3b932cd11 100644 --- a/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java +++ b/test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SubscriberStubSettings.java @@ -383,6 +383,11 @@ public static String getDefaultEndpoint() { return "pubsub.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "pubsub.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -653,6 +658,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); } diff --git a/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java b/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java index fcb157ea43..1314469600 100644 --- a/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java +++ b/test/integration/goldens/redis/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java @@ -294,6 +294,11 @@ public static String getDefaultEndpoint() { return "redis.googleapis.com:443"; } + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "redis.mtls.googleapis.com:443"; + } + /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; @@ -499,6 +504,8 @@ private static Builder createDefault() { builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); return initDefaults(builder); }