()
| 17 | 'use strict'; |
| 18 | |
| 19 | async function main() { |
| 20 | // [START compute_reservation_list] |
| 21 | // Import the Compute library |
| 22 | const computeLib = require('@google-cloud/compute'); |
| 23 | |
| 24 | // Instantiate a reservationsClient |
| 25 | const reservationsClient = new computeLib.ReservationsClient(); |
| 26 | |
| 27 | /** |
| 28 | * TODO(developer): Update these variables before running the sample. |
| 29 | */ |
| 30 | // The ID of the project where your reservations are located. |
| 31 | const projectId = await reservationsClient.getProjectId(); |
| 32 | // The zone where your reservations are located. |
| 33 | const zone = 'us-central1-a'; |
| 34 | |
| 35 | async function callGetReservations() { |
| 36 | const reservations = ( |
| 37 | await reservationsClient.list({ |
| 38 | project: projectId, |
| 39 | zone, |
| 40 | }) |
| 41 | )[0]; |
| 42 | |
| 43 | console.log(JSON.stringify(reservations)); |
| 44 | } |
| 45 | |
| 46 | await callGetReservations(); |
| 47 | // [END compute_reservation_list] |
| 48 | } |
| 49 | |
| 50 | main().catch(err => { |
| 51 | console.error(err); |
no test coverage detected