use of com.google.api.gax.longrunning.OperationFutureImpl in project java-spanner by googleapis.
the class InstanceAdminClientImpl method updateInstance.
@Override
public OperationFuture<Instance, UpdateInstanceMetadata> updateInstance(InstanceInfo instance, InstanceInfo.InstanceField... fieldsToUpdate) {
FieldMask fieldMask = fieldsToUpdate.length == 0 ? InstanceInfo.InstanceField.toFieldMask(InstanceInfo.InstanceField.defaultFieldsToUpdate(instance)) : InstanceInfo.InstanceField.toFieldMask(fieldsToUpdate);
OperationFuture<com.google.spanner.admin.instance.v1.Instance, UpdateInstanceMetadata> rawOperationFuture = rpc.updateInstance(instance.toProto(), fieldMask);
return new OperationFutureImpl<>(rawOperationFuture.getPollingFuture(), rawOperationFuture.getInitialFuture(), snapshot -> Instance.fromProto(ProtoOperationTransformers.ResponseTransformer.create(com.google.spanner.admin.instance.v1.Instance.class).apply(snapshot), InstanceAdminClientImpl.this, dbClient), ProtoOperationTransformers.MetadataTransformer.create(UpdateInstanceMetadata.class), e -> {
throw SpannerExceptionFactory.newSpannerException(e);
});
}
Aggregations