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

Function main

storage-control/getManagedFolder.js:17–54  ·  view source on GitHub ↗
(bucketName, managedFolderName)

Source from the content-addressed store, hash-verified

15'use strict';
16
17function main(bucketName, managedFolderName) {
18 // [START storage_control_managed_folder_get]
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 managed folder to get
27 // const managedFolderName = 'managedFolderName';
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 callGetManagedFolder() {
36 const managedFolderPath = controlClient.managedFolderPath(
37 '_',
38 bucketName,
39 managedFolderName
40 );
41
42 // Create the request
43 const request = {
44 name: managedFolderPath,
45 };
46
47 // Run request
48 const [response] = await controlClient.getManagedFolder(request);
49 console.log(`Got managed folder: ${response.name}.`);
50 }
51
52 callGetManagedFolder();
53 // [END storage_control_managed_folder_get]
54}
55
56process.on('unhandledRejection', err => {
57 console.error(err.message);

Callers 1

Calls 1

callGetManagedFolderFunction · 0.85

Tested by

no test coverage detected