()
| 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] |