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

Function createDisk

compute/test/disks.test.js:33–52  ·  view source on GitHub ↗
(projectId, zone, diskName, sourceImage)

Source from the content-addressed store, hash-verified

31const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
32
33const createDisk = async (projectId, zone, diskName, sourceImage) => {
34 const [response] = await disksClient.insert({
35 project: projectId,
36 zone,
37 diskResource: {
38 sourceImage,
39 name: diskName,
40 },
41 });
42 let operation = response.latestResponse;
43 const operationsClient = new compute.ZoneOperationsClient();
44
45 while (operation.status !== 'DONE') {
46 [operation] = await operationsClient.wait({
47 operation: operation.name,
48 project: projectId,
49 zone: operation.zone.split('/').pop(),
50 });
51 }
52};
53
54const getInstance = async (projectId, zone, instanceName) => {
55 const [instance] = await instancesClient.get({

Callers 1

disks.test.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected