(bucketName, folderName)
| 15 | 'use strict'; |
| 16 | |
| 17 | function main(bucketName, folderName) { |
| 18 | // [START storage_control_get_folder] |
| 19 | /** |
| 20 | * TODO(developer): Uncomment these variables before running the sample. |
| 21 | */ |
| 22 | |
| 23 | // The name of your GCS bucket |
| 24 | // const bucketName = 'bucketName'; |
| 25 | |
| 26 | // The name of the folder to get |
| 27 | // const folderName = 'folderName'; |
| 28 | |
| 29 | // Imports the Control library |
| 30 | const {StorageControlClient} = require('@google-cloud/storage-control').v2; |
| 31 | |
| 32 | // Instantiates a client |
| 33 | const controlClient = new StorageControlClient(); |
| 34 | |
| 35 | async function callGetFolder() { |
| 36 | const folderPath = controlClient.folderPath('_', bucketName, folderName); |
| 37 | |
| 38 | // Create the request |
| 39 | const request = { |
| 40 | name: folderPath, |
| 41 | }; |
| 42 | |
| 43 | // Run request |
| 44 | const [response] = await controlClient.getFolder(request); |
| 45 | console.log(`Got folder: ${response.name}.`); |
| 46 | } |
| 47 | |
| 48 | callGetFolder(); |
| 49 | // [END storage_control_get_folder] |
| 50 | } |
| 51 | |
| 52 | process.on('unhandledRejection', err => { |
| 53 | console.error(err.message); |
no test coverage detected