(reservationName)
| 17 | 'use strict'; |
| 18 | |
| 19 | async function main(reservationName) { |
| 20 | // [START compute_reservation_get] |
| 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/uncomment these variables before running the sample. |
| 29 | */ |
| 30 | // The ID of the project where your reservation is located. |
| 31 | const projectId = await reservationsClient.getProjectId(); |
| 32 | // The zone where your reservation is located. |
| 33 | const zone = 'us-central1-a'; |
| 34 | // The name of the reservation to return. |
| 35 | // reservationName = 'reservation-01'; |
| 36 | |
| 37 | async function callGetReservation() { |
| 38 | const requestedReservation = ( |
| 39 | await reservationsClient.get({ |
| 40 | project: projectId, |
| 41 | zone, |
| 42 | reservation: reservationName, |
| 43 | }) |
| 44 | )[0]; |
| 45 | |
| 46 | console.log(JSON.stringify(requestedReservation)); |
| 47 | } |
| 48 | |
| 49 | await callGetReservation(); |
| 50 | // [END compute_reservation_get] |
| 51 | } |
| 52 | |
| 53 | main(...process.argv.slice(2)).catch(err => { |
| 54 | console.error(err); |
no test coverage detected