| 56 | }; |
| 57 | |
| 58 | const createDisk = async (projectId, zone, diskName, sourceImage) => { |
| 59 | const [response] = await disksClient.insert({ |
| 60 | project: projectId, |
| 61 | zone, |
| 62 | diskResource: { |
| 63 | sourceImage, |
| 64 | name: diskName, |
| 65 | }, |
| 66 | }); |
| 67 | let operation = response.latestResponse; |
| 68 | const operationsClient = new compute.ZoneOperationsClient(); |
| 69 | |
| 70 | while (operation.status !== 'DONE') { |
| 71 | [operation] = await operationsClient.wait({ |
| 72 | operation: operation.name, |
| 73 | project: projectId, |
| 74 | zone: operation.zone.split('/').pop(), |
| 75 | }); |
| 76 | } |
| 77 | }; |
| 78 | |
| 79 | const deleteDisk = async (projectId, zone, diskName) => { |
| 80 | const [response] = await disksClient.delete({ |