@BetaApi(
      "The surface for long-running operations is not stable yet and may change in the future.")
  public final OperationFuture<Instance, UpdateInstanceMetadata> updateInstanceAsync(
      Instance instance, FieldMask fieldMask) {

    UpdateInstanceRequest request =
        UpdateInstanceRequest.newBuilder().setInstance(instance).setFieldMask(fieldMask).build();
    return updateInstanceAsync(request);
  }
@ BetaApi ( "The surface for long-running operations is not stable yet and may change in the future." ) public final OperationFuture < Instance , UpdateInstanceMetadata > updateInstanceAsync ( Instance instance , FieldMask fieldMask ) { UpdateInstanceRequest request = UpdateInstanceRequest . newBuilder ( ) . setInstance ( instance ) . setFieldMask ( fieldMask ) . build ( ) ; return updateInstanceAsync ( request ) ; }
Updates an instance, and begins allocating or releasing resources as requested. The returned
[long-running operation][google.longrunning.Operation] can be used to track the progress of
updating the instance. If the named instance does not exist, returns `NOT_FOUND`.

<p>Immediately upon completion of this request:

<p>&#42; For resource types for which a decrease in the instance's allocation has been
requested, billing is based on the newly-requested level.

<p>Until completion of the returned operation:

<p>&#42; Cancelling the operation sets its metadata's
[cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], and begins
restoring resources to their pre-request values. The operation is guaranteed to succeed at
undoing all resource changes, after which point it terminates with a `CANCELLED` status. &#42;
All other attempts to modify the instance are rejected. &#42; Reading the instance via the API
continues to give the pre-request resource levels.

<p>Upon completion of the returned operation:

<p>&#42; Billing begins for all successfully-allocated resources (some types may have lower
than the requested levels). &#42; All newly-reserved resources are available for serving the
instance's tables. &#42; The instance's new resource levels are readable via the API.

<p>The returned [long-running operation][google.longrunning.Operation] will have a name of the
format `&lt;instance_name&gt;/operations/&lt;operation_id&gt;` and can be used to track the
instance modification. The [metadata][google.longrunning.Operation.metadata] field type is
[UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. The
[response][google.longrunning.Operation.response] field type is
[Instance][google.spanner.admin.instance.v1.Instance], if successful.

<p>Authorization requires `spanner.instances.update` permission on resource
[name][google.spanner.admin.instance.v1.Instance.name].

<p>Sample code:

<pre><code>
try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
Instance instance = Instance.newBuilder().build();
FieldMask fieldMask = FieldMask.newBuilder().build();
Instance response = instanceAdminClient.updateInstanceAsync(instance, fieldMask).get();
}
</code></pre>

@param instance Required. The instance to update, which must always include the instance name.
Otherwise, only fields mentioned in
[][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] need be included.
@param fieldMask Required. A mask specifying which fields in
[][google.spanner.admin.instance.v1.UpdateInstanceRequest.instance] should be updated. The
field mask must always be specified; this prevents any future fields in
[][google.spanner.admin.instance.v1.Instance] from being erased accidentally by clients
that do not know about them.
@throws com.google.api.gax.rpc.ApiException if the remote call fails