wait method

Future<Operation> wait(
  1. String name, {
  2. String? timeout,
  3. String? $fields,
})

Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state.

If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns google.rpc.Code.UNIMPLEMENTED. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done.

Request parameters:

name - The name of the operation resource to wait on. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/operations/\[^/\]+$.

timeout - The maximum duration to wait before timing out. If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol. If RPC context deadline is also specified, the shorter one will be used.

$fields - Selector specifying which fields to include in a partial response.

Completes with a Operation.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<Operation> wait(
  core.String name, {
  core.String? timeout,
  core.String? $fields,
}) async {
  final _queryParams = <core.String, core.List<core.String>>{
    if (timeout != null) 'timeout': [timeout],
    if ($fields != null) 'fields': [$fields],
  };

  final _url = 'v1beta1/' + core.Uri.encodeFull('$name') + ':wait';

  final _response = await _requester.request(
    _url,
    'POST',
    queryParams: _queryParams,
  );
  return Operation.fromJson(_response as core.Map<core.String, core.dynamic>);
}