mirror of
https://github.com/google/nomulus
synced 2026-02-13 00:02:04 +00:00
Use @DefaultCredential for Cloud API access in GAE
This change completes the switch to @DefaultCredential for all use cases in GAE. Impacted modules: - IcannReporting - CreateCdnsTld command - LoadSnapshot command. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=213511730
This commit is contained in:
@@ -16,6 +16,8 @@ package google.registry.tools;
|
||||
|
||||
import com.beust.jcommander.ParametersDelegate;
|
||||
import google.registry.bigquery.BigqueryConnection;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
|
||||
/** A {@link Command} that uses the bigquery client API. */
|
||||
abstract class BigqueryCommand implements Command {
|
||||
@@ -28,9 +30,12 @@ abstract class BigqueryCommand implements Command {
|
||||
/** Connection object for interacting with the Bigquery API. */
|
||||
private BigqueryConnection bigquery;
|
||||
|
||||
@Inject Provider<BigqueryConnection.Builder> bigQueryConnectionBuilderProvider;
|
||||
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
try (BigqueryConnection autoClosingBigquery = bigqueryParameters.newConnection()) {
|
||||
try (BigqueryConnection autoClosingBigquery =
|
||||
bigqueryParameters.newConnection(bigQueryConnectionBuilderProvider.get())) {
|
||||
bigquery = autoClosingBigquery;
|
||||
runWithBigquery();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user