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

Function main

storage-control/listManagedFolders.js:17–49  ·  view source on GitHub ↗
(bucketName)

Source from the content-addressed store, hash-verified

15'use strict';
16
17function main(bucketName) {
18 // [START storage_control_managed_folder_list]
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 // Imports the Control library
27 const {StorageControlClient} = require('@google-cloud/storage-control').v2;
28
29 // Instantiates a client
30 const controlClient = new StorageControlClient();
31
32 async function callListManagedFolders() {
33 const bucketPath = controlClient.bucketPath('_', bucketName);
34
35 // Create the request
36 const request = {
37 parent: bucketPath,
38 };
39
40 // Run request
41 const [folders] = await controlClient.listManagedFolders(request);
42 for (const curManagedFolder of folders) {
43 console.log(curManagedFolder.name);
44 }
45 }
46
47 callListManagedFolders();
48 // [END storage_control_managed_folder_list]
49}
50
51process.on('unhandledRejection', err => {
52 console.error(err.message);

Callers 1

Calls 1

callListManagedFoldersFunction · 0.85

Tested by

no test coverage detected