GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add mtls feature by arithmetic1728 · Pull Request #672 · googleapis/sdk-platform-java

This repository was archived by the owner on Oct 29, 2026. It is now read-only.

feat: add mtls feature #672

Merged
arithmetic1728 merged 1 commit into master from mtls
Jun 8, 2021

Uh oh!

There was an error while loading. Please reload this page.

Merged

feat: add mtls feature #672

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
e23949c
feat: add mtls support
arithmetic1728 Jun 8, 2021
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

2 changes: 1 addition & 1 deletion 2 WORKSPACE
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions 2 src/main/java/com/google/api/generator/gapic/composer/comment/SettingsCommentComposer.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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.");

Expand Down
32 changes: 32 additions & 0 deletions 32 .../google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -918,6 +919,22 @@ private List<MethodDefinition> 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(
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions 7 ...com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceStubSettings.golden
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public class DeprecatedServiceStubSettings extends StubSettings<DeprecatedServic
return "localhost:7469";
}

/** Returns the default mTLS service endpoint. */
public static String getDefaultMtlsEndpoint() {
return "localhost:7469";
}

/** Returns the default service scopes. */
public static List<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -225,6 +230,8 @@ public class DeprecatedServiceStubSettings extends StubSettings<DeprecatedServic
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

return initDefaults(builder);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoStubSettings.golden
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ public class EchoStubSettings extends StubSettings<EchoStubSettings> {
return "localhost:7469";
}

/** Returns the default mTLS service endpoint. */
public static String getDefaultMtlsEndpoint() {
return "localhost:7469";
}

/** Returns the default service scopes. */
public static List<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -461,6 +466,8 @@ public class EchoStubSettings extends StubSettings<EchoStubSettings> {
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

return initDefaults(builder);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 .../com/google/api/generator/gapic/composer/grpc/goldens/LoggingServiceV2StubSettings.golden
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ public class LoggingServiceV2StubSettings extends StubSettings<LoggingServiceV2S
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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -610,6 +615,8 @@ public class LoggingServiceV2StubSettings extends StubSettings<LoggingServiceV2S
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

return initDefaults(builder);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 ...st/java/com/google/api/generator/gapic/composer/grpc/goldens/PublisherStubSettings.golden
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,11 @@ public class PublisherStubSettings extends StubSettings<PublisherStubSettings> {
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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -651,6 +656,8 @@ public class PublisherStubSettings extends StubSettings<PublisherStubSettings> {
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

return initDefaults(builder);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 ...t/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceStubSettings.golden
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ public class EchoStubSettings extends StubSettings<EchoStubSettings> {
return "localhost:7469";
}

/** Returns the default mTLS service endpoint. */
public static String getDefaultMtlsEndpoint() {
return "localhost:7469";
}

/** Returns the default service scopes. */
public static List<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -462,6 +467,8 @@ public class EchoStubSettings extends StubSettings<EchoStubSettings> {
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);

return initDefaults(builder);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 test/integration/goldens/asset/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 ...dens/credentials/com/google/cloud/iam/credentials/v1/stub/IamCredentialsStubSettings.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 test/integration/goldens/iam/com/google/iam/v1/stub/IAMPolicyStubSettings.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 ...ntegration/goldens/kms/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 .../goldens/library/com/google/cloud/example/library/v1/stub/LibraryServiceStubSettings.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 ...gration/goldens/logging/com/google/cloud/logging/v2/stub/ConfigServiceV2StubSettings.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 ...ration/goldens/logging/com/google/cloud/logging/v2/stub/LoggingServiceV2StubSettings.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 ...ration/goldens/logging/com/google/cloud/logging/v2/stub/MetricsServiceV2StubSettings.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 test/integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/PublisherStubSettings.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions 7 ...integration/goldens/pubsub/com/google/cloud/pubsub/v1/stub/SchemaServiceStubSettings.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
Expand Down Expand Up @@ -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);
}
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.