Search in sources :

Example 1 with OperationFutureImpl

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);
    });
}
Also used : UpdateInstanceMetadata(com.google.spanner.admin.instance.v1.UpdateInstanceMetadata) OperationFutureImpl(com.google.api.gax.longrunning.OperationFutureImpl) FieldMask(com.google.protobuf.FieldMask)

Aggregations

OperationFutureImpl (com.google.api.gax.longrunning.OperationFutureImpl)1 FieldMask (com.google.protobuf.FieldMask)1 UpdateInstanceMetadata (com.google.spanner.admin.instance.v1.UpdateInstanceMetadata)1