wait method
Waits for the specified Operation resource to return as DONE
or for the request to approach the 2 minute deadline, and retrieves the
specified Operation resource.
This method differs from the
GET method in that it waits for no more than the default
deadline (2 minutes) and then returns the current state of the operation,
which might be DONE or still in progress.
This method is called on a best-effort basis. Specifically:
- In uncommon cases, when the server is overloaded, the request might
return before the default deadline is reached, or might return after zero seconds.
- If the default deadline is reached, there is no guarantee that the
operation is actually done when the method returns. Be prepared to retry
if the operation is not
DONE.
Request parameters:
project - Project ID for this request.
Value must have pattern
(?:(?:\[-a-z0-9\]{1,63}\.)*(?:\[a-z\](?:\[-a-z0-9\]{0,61}\[a-z0-9\])?):)?(?:\[0-9\]{1,19}|(?:\[a-z0-9\](?:\[-a-z0-9\]{0,61}\[a-z0-9\])?)).
operation - Name of the Operations resource to return, or its unique
numeric
identifier.
Value must have pattern
\[a-z\](?:\[-a-z0-9\]{0,61}\[a-z0-9\])?|\[1-9\]\[0-9\]{0,19}.
$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 project,
core.String operation, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'projects/' +
commons.escapeVariable('$project') +
'/global/operations/' +
commons.escapeVariable('$operation') +
'/wait';
final response_ = await _requester.request(
url_,
'POST',
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}