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:
weiminyu 2018-09-18 14:01:10 -07:00 committed by Ben McIlwain
parent 9bcd5579ef
commit 961e5cc7c7
20 changed files with 184 additions and 226 deletions

View file

@ -24,7 +24,7 @@ import com.google.api.services.bigquery.model.ViewDefinition;
import com.google.appengine.api.taskqueue.TaskOptions;
import com.google.appengine.api.taskqueue.TaskOptions.Method;
import com.google.common.flogger.FluentLogger;
import google.registry.bigquery.BigqueryFactory;
import google.registry.bigquery.CheckedBigquery;
import google.registry.config.RegistryConfig.Config;
import google.registry.request.Action;
import google.registry.request.HttpException.InternalServerErrorException;
@ -69,7 +69,7 @@ public class UpdateSnapshotViewAction implements Runnable {
@Config("projectId")
String projectId;
@Inject BigqueryFactory bigqueryFactory;
@Inject CheckedBigquery checkedBigquery;
@Inject
UpdateSnapshotViewAction() {}
@ -106,7 +106,7 @@ public class UpdateSnapshotViewAction implements Runnable {
SqlTemplate viewQueryTemplate)
throws IOException {
Bigquery bigquery = bigqueryFactory.create(projectId, viewDataset);
Bigquery bigquery = checkedBigquery.ensureDataSetExists(projectId, viewDataset);
updateTable(
bigquery,
new Table()