(zone, instanceName)
| 61 | } |
| 62 | |
| 63 | async function deleteInstance(zone, instanceName) { |
| 64 | const projectId = await instancesClient.getProjectId(); |
| 65 | |
| 66 | const [response] = await instancesClient.delete({ |
| 67 | project: projectId, |
| 68 | instance: instanceName, |
| 69 | zone, |
| 70 | }); |
| 71 | let operation = response.latestResponse; |
| 72 | const operationsClient = new compute.ZoneOperationsClient(); |
| 73 | |
| 74 | console.log(`Deleting ${instanceName}`); |
| 75 | |
| 76 | // Wait for the delete operation to complete. |
| 77 | while (operation.status !== 'DONE') { |
| 78 | [operation] = await operationsClient.wait({ |
| 79 | operation: operation.name, |
| 80 | project: projectId, |
| 81 | zone, |
| 82 | }); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | const reservationsClient = new compute.ReservationsClient(); |
| 87 |
no test coverage detected