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

Function createRegionDisk

compute/test/snapshots.test.js:33–56  ·  view source on GitHub ↗
(projectId, region, diskName)

Source from the content-addressed store, hash-verified

31const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
32
33const createRegionDisk = async (projectId, region, diskName) => {
34 const [response] = await regionDisksClient.insert({
35 project: projectId,
36 region,
37 diskResource: {
38 sizeGb: 200,
39 name: diskName,
40 replicaZones: [
41 `projects/${projectId}/zones/europe-central2-a`,
42 `projects/${projectId}/zones/europe-central2-b`,
43 ],
44 },
45 });
46 let operation = response.latestResponse;
47 const operationsClient = new compute.RegionOperationsClient();
48
49 while (operation.status !== 'DONE') {
50 [operation] = await operationsClient.wait({
51 operation: operation.name,
52 project: projectId,
53 region: operation.region.split('/').pop(),
54 });
55 }
56};
57
58const createDisk = async (projectId, zone, diskName, sourceImage) => {
59 const [response] = await disksClient.insert({

Callers 1

snapshots.test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected