Skip to content

Commit

Permalink
Sync SpannerConfig with Beam
Browse files Browse the repository at this point in the history
  • Loading branch information
Abacn committed Mar 13, 2024
1 parent 0c1d028 commit 447cfaa
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.StatusCode.Code;
import com.google.auth.Credentials;
import com.google.auto.value.AutoValue;
import com.google.cloud.ServiceFactory;
import com.google.cloud.spanner.Options.RpcPriority;
Expand Down Expand Up @@ -86,6 +87,8 @@ public abstract class SpannerConfig implements Serializable {

public abstract @Nullable ValueProvider<Boolean> getDataBoostEnabled();

public abstract @Nullable ValueProvider<Credentials> getCredentials();

abstract Builder toBuilder();

public static SpannerConfig create() {
Expand Down Expand Up @@ -164,6 +167,8 @@ abstract Builder setExecuteStreamingSqlRetrySettings(

abstract Builder setPartitionReadTimeout(ValueProvider<Duration> partitionReadTimeout);

abstract Builder setCredentials(ValueProvider<Credentials> credentials);

public abstract SpannerConfig build();
}

Expand Down Expand Up @@ -305,4 +310,14 @@ public SpannerConfig withPartitionReadTimeout(Duration partitionReadTimeout) {
public SpannerConfig withPartitionReadTimeout(ValueProvider<Duration> partitionReadTimeout) {
return toBuilder().setPartitionReadTimeout(partitionReadTimeout).build();
}

/** Specifies the credentials. */
public SpannerConfig withCredentials(Credentials credentials) {
return withCredentials(ValueProvider.StaticValueProvider.of(credentials));
}

/** Specifies the credentials. */
public SpannerConfig withCredentials(ValueProvider<Credentials> credentials) {
return toBuilder().setCredentials(credentials).build();
}
}

0 comments on commit 447cfaa

Please sign in to comment.