Skip to content

Commit

Permalink
spanner: use method getters (#3299)
Browse files Browse the repository at this point in the history
instead of deprecated fields.

Original PR: googleapis/google-cloud-java#2989
  • Loading branch information
pongad authored May 22, 2018
1 parent e856c4f commit 631db48
Showing 1 changed file with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public Paginated<InstanceConfig> listInstanceConfigs(int pageSize, @Nullable Str
ListInstanceConfigsResponse response =
get(
doUnaryCall(
InstanceAdminGrpc.METHOD_LIST_INSTANCE_CONFIGS,
InstanceAdminGrpc.getListInstanceConfigsMethod(),
request.build(),
projectName(),
null));
Expand All @@ -201,7 +201,7 @@ public InstanceConfig getInstanceConfig(String instanceConfigName) throws Spanne
GetInstanceConfigRequest request =
GetInstanceConfigRequest.newBuilder().setName(instanceConfigName).build();
return get(
doUnaryCall(InstanceAdminGrpc.METHOD_GET_INSTANCE_CONFIG, request, projectName(), null));
doUnaryCall(InstanceAdminGrpc.getGetInstanceConfigMethod(), request, projectName(), null));
}

@Override
Expand All @@ -218,7 +218,7 @@ public Paginated<Instance> listInstances(
ListInstancesResponse response =
get(
doUnaryCall(
InstanceAdminGrpc.METHOD_LIST_INSTANCES, request.build(), projectName(), null));
InstanceAdminGrpc.getListInstancesMethod(), request.build(), projectName(), null));
return new Paginated<>(response.getInstancesList(), response.getNextPageToken());
}

Expand All @@ -231,22 +231,22 @@ public Operation createInstance(String parent, String instanceId, Instance insta
.setInstanceId(instanceId)
.setInstance(instance)
.build();
return get(doUnaryCall(InstanceAdminGrpc.METHOD_CREATE_INSTANCE, request, parent, null));
return get(doUnaryCall(InstanceAdminGrpc.getCreateInstanceMethod(), request, parent, null));
}

@Override
public Operation updateInstance(Instance instance, FieldMask fieldMask) throws SpannerException {
UpdateInstanceRequest request =
UpdateInstanceRequest.newBuilder().setInstance(instance).setFieldMask(fieldMask).build();
return get(
doUnaryCall(InstanceAdminGrpc.METHOD_UPDATE_INSTANCE, request, instance.getName(), null));
doUnaryCall(InstanceAdminGrpc.getUpdateInstanceMethod(), request, instance.getName(), null));
}

@Override
public Instance getInstance(String instanceName) throws SpannerException {
return get(
doUnaryCall(
InstanceAdminGrpc.METHOD_GET_INSTANCE,
InstanceAdminGrpc.getGetInstanceMethod(),
GetInstanceRequest.newBuilder().setName(instanceName).build(),
instanceName,
null));
Expand All @@ -256,7 +256,7 @@ public Instance getInstance(String instanceName) throws SpannerException {
public void deleteInstance(String instanceName) throws SpannerException {
get(
doUnaryCall(
InstanceAdminGrpc.METHOD_DELETE_INSTANCE,
InstanceAdminGrpc.getDeleteInstanceMethod(),
DeleteInstanceRequest.newBuilder().setName(instanceName).build(),
instanceName,
null));
Expand All @@ -273,7 +273,7 @@ public Paginated<Database> listDatabases(
com.google.spanner.admin.database.v1.ListDatabasesResponse response =
get(
doUnaryCall(
DatabaseAdminGrpc.METHOD_LIST_DATABASES, builder.build(), instanceName, null));
DatabaseAdminGrpc.getListDatabasesMethod(), builder.build(), instanceName, null));
return new Paginated<>(response.getDatabasesList(), response.getNextPageToken());
}

Expand All @@ -287,7 +287,7 @@ public Operation createDatabase(
.setCreateStatement(createDatabaseStatement)
.addAllExtraStatements(additionalStatements)
.build();
return get(doUnaryCall(DatabaseAdminGrpc.METHOD_CREATE_DATABASE, request, instanceName, null));
return get(doUnaryCall(DatabaseAdminGrpc.getCreateDatabaseMethod(), request, instanceName, null));
}

@Override
Expand All @@ -301,14 +301,14 @@ public Operation updateDatabaseDdl(
.setOperationId(MoreObjects.firstNonNull(operationId, ""))
.build();
return get(
doUnaryCall(DatabaseAdminGrpc.METHOD_UPDATE_DATABASE_DDL, request, databaseName, null));
doUnaryCall(DatabaseAdminGrpc.getUpdateDatabaseDdlMethod(), request, databaseName, null));
}

@Override
public void dropDatabase(String databaseName) throws SpannerException {
get(
doUnaryCall(
DatabaseAdminGrpc.METHOD_DROP_DATABASE,
DatabaseAdminGrpc.getDropDatabaseMethod(),
DropDatabaseRequest.newBuilder().setDatabase(databaseName).build(),
databaseName,
null));
Expand All @@ -318,15 +318,15 @@ public void dropDatabase(String databaseName) throws SpannerException {
public List<String> getDatabaseDdl(String databaseName) throws SpannerException {
GetDatabaseDdlRequest request =
GetDatabaseDdlRequest.newBuilder().setDatabase(databaseName).build();
return get(doUnaryCall(DatabaseAdminGrpc.METHOD_GET_DATABASE_DDL, request, databaseName, null))
return get(doUnaryCall(DatabaseAdminGrpc.getGetDatabaseDdlMethod(), request, databaseName, null))
.getStatementsList();
}

@Override
public Database getDatabase(String databaseName) throws SpannerException {
return get(
doUnaryCall(
DatabaseAdminGrpc.METHOD_GET_DATABASE,
DatabaseAdminGrpc.getGetDatabaseMethod(),
GetDatabaseRequest.newBuilder().setName(databaseName).build(),
databaseName,
null));
Expand All @@ -335,7 +335,7 @@ public Database getDatabase(String databaseName) throws SpannerException {
@Override
public Operation getOperation(String name) throws SpannerException {
GetOperationRequest request = GetOperationRequest.newBuilder().setName(name).build();
return get(doUnaryCall(OperationsGrpc.METHOD_GET_OPERATION, request, name, null));
return get(doUnaryCall(OperationsGrpc.getGetOperationMethod(), request, name, null));
}

@Override
Expand All @@ -349,7 +349,7 @@ public Session createSession(
}
return get(
doUnaryCall(
SpannerGrpc.METHOD_CREATE_SESSION,
SpannerGrpc.getCreateSessionMethod(),
request.build(),
databaseName,
Option.CHANNEL_HINT.getLong(options)));
Expand All @@ -360,7 +360,7 @@ public void deleteSession(String sessionName, @Nullable Map<Option, ?> options)
DeleteSessionRequest request = DeleteSessionRequest.newBuilder().setName(sessionName).build();
get(
doUnaryCall(
SpannerGrpc.METHOD_DELETE_SESSION,
SpannerGrpc.getDeleteSessionMethod(),
request,
sessionName,
Option.CHANNEL_HINT.getLong(options)));
Expand All @@ -370,7 +370,7 @@ public void deleteSession(String sessionName, @Nullable Map<Option, ?> options)
public StreamingCall read(
ReadRequest request, ResultStreamConsumer consumer, @Nullable Map<Option, ?> options) {
return doStreamingCall(
SpannerGrpc.METHOD_STREAMING_READ,
SpannerGrpc.getStreamingReadMethod(),
request,
consumer,
request.getSession(),
Expand All @@ -381,7 +381,7 @@ public StreamingCall read(
public StreamingCall executeQuery(
ExecuteSqlRequest request, ResultStreamConsumer consumer, @Nullable Map<Option, ?> options) {
return doStreamingCall(
SpannerGrpc.METHOD_EXECUTE_STREAMING_SQL,
SpannerGrpc.getExecuteStreamingSqlMethod(),
request,
consumer,
request.getSession(),
Expand All @@ -393,7 +393,7 @@ public Transaction beginTransaction(
BeginTransactionRequest request, @Nullable Map<Option, ?> options) {
return get(
doUnaryCall(
SpannerGrpc.METHOD_BEGIN_TRANSACTION,
SpannerGrpc.getBeginTransactionMethod(),
request,
request.getSession(),
Option.CHANNEL_HINT.getLong(options)));
Expand All @@ -403,7 +403,7 @@ public Transaction beginTransaction(
public CommitResponse commit(CommitRequest commitRequest, @Nullable Map<Option, ?> options) {
return get(
doUnaryCall(
SpannerGrpc.METHOD_COMMIT,
SpannerGrpc.getCommitMethod(),
commitRequest,
commitRequest.getSession(),
Option.CHANNEL_HINT.getLong(options)));
Expand All @@ -413,7 +413,7 @@ public CommitResponse commit(CommitRequest commitRequest, @Nullable Map<Option,
public void rollback(RollbackRequest request, @Nullable Map<Option, ?> options) {
get(
doUnaryCall(
SpannerGrpc.METHOD_ROLLBACK,
SpannerGrpc.getRollbackMethod(),
request,
request.getSession(),
Option.CHANNEL_HINT.getLong(options)));
Expand All @@ -425,7 +425,7 @@ public PartitionResponse partitionQuery(
throws SpannerException {
return get(
doUnaryCall(
SpannerGrpc.METHOD_PARTITION_QUERY,
SpannerGrpc.getPartitionQueryMethod(),
request,
request.getSession(),
Option.CHANNEL_HINT.getLong(options)));
Expand All @@ -437,7 +437,7 @@ public PartitionResponse partitionRead(
throws SpannerException {
return get(
doUnaryCall(
SpannerGrpc.METHOD_PARTITION_READ,
SpannerGrpc.getPartitionReadMethod(),
request,
request.getSession(),
Option.CHANNEL_HINT.getLong(options)));
Expand Down

0 comments on commit 631db48

Please sign in to comment.