1616
1717'use strict' ;
1818
19- async function main ( ) {
19+ async function main ( diskName , storagePoolName ) {
2020 // [START compute_hyperdisk_create_from_pool]
2121 // Import the Compute library
2222 const computeLib = require ( '@google-cloud/compute' ) ;
@@ -28,16 +28,16 @@ async function main() {
2828 const zoneOperationsClient = new computeLib . ZoneOperationsClient ( ) ;
2929
3030 /**
31- * TODO(developer): Update these variables before running the sample.
31+ * TODO(developer): Update/uncomment these variables before running the sample.
3232 */
3333 // Project ID or project number of the Google Cloud project you want to use.
3434 const projectId = await disksClient . getProjectId ( ) ;
3535 // The zone where your VM and new disk are located.
3636 const zone = 'us-central1-a' ;
3737 // The name of the new disk
38- const diskName = 'disk-from-pool-name' ;
38+ // diskName = 'disk-from-pool-name';
3939 // The name of the storage pool
40- const storagePoolName = 'storage-pool-name' ;
40+ // storagePoolName = 'storage-pool-name';
4141 // Link to the storagePool you want to use. Use format:
4242 // https://www.googleapis.com/compute/v1/projects/{projectId}/zones/{zone}/storagePools/{storagePoolName}
4343 const storagePool = `https://www.googleapis.com/compute/v1/projects/${ projectId } /zones/${ zone } /storagePools/${ storagePoolName } ` ;
@@ -84,22 +84,14 @@ async function main() {
8484 } ) ;
8585 }
8686
87- const hyperdisk = (
88- await disksClient . get ( {
89- project : projectId ,
90- zone,
91- disk : diskName ,
92- } )
93- ) [ 0 ] ;
94-
95- console . log ( JSON . stringify ( hyperdisk ) ) ;
87+ console . log ( `Disk: ${ diskName } created.` ) ;
9688 }
9789
9890 await callCreateComputeHyperdiskFromPool ( ) ;
9991 // [END compute_hyperdisk_create_from_pool]
10092}
10193
102- main ( ) . catch ( err => {
94+ main ( ... process . argv . slice ( 2 ) ) . catch ( err => {
10395 console . error ( err ) ;
10496 process . exitCode = 1 ;
10597} ) ;
0 commit comments