MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / waitForOperation

Function waitForOperation

compute/waitForOperation.js:33–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 let operation = JSON.parse(operationString);
32
33 async function waitForOperation() {
34 const operationsClient = new compute.ZoneOperationsClient();
35
36 while (operation.status !== 'DONE') {
37 [operation] = await operationsClient.wait({
38 operation: operation.name,
39 project: projectId,
40 zone: operation.zone.split('/').pop(),
41 });
42 }
43
44 console.log('Operation finished.');
45 }
46
47 waitForOperation();
48 // [END compute_instances_operation_check]

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected