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

Function createDisk

compute/test/snapshots.test.js:58–77  ·  view source on GitHub ↗
(projectId, zone, diskName, sourceImage)

Source from the content-addressed store, hash-verified

56};
57
58const 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
79const deleteDisk = async (projectId, zone, diskName) => {
80 const [response] = await disksClient.delete({

Callers 1

snapshots.test.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected