From 1f1ef13d3f1850d910f0f3927933c8353b3fd0a1 Mon Sep 17 00:00:00 2001 From: sagnghos Date: Thu, 2 Jan 2025 12:13:27 +0000 Subject: [PATCH] feat(spanner): added spanner options method usePlainText for abstraction --- .../main/java/com/google/cloud/spanner/SpannerOptions.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java index 47c4692b25e..1bbbbb0939b 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java @@ -1518,6 +1518,12 @@ public Builder useClientCert(String host, String clientCertificate, String clien return this; } + public Builder usePlainText() { + this.setChannelConfigurator(ManagedChannelBuilder::usePlaintext); + this.setCredentials(NoCredentials.getInstance()); + return this; + } + /** * Sets OpenTelemetry object to be used for Spanner Metrics and Traces. GlobalOpenTelemetry will * be used as fallback if this options is not set.