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

Function main

storage-control/quickstart.js:21–57  ·  view source on GitHub ↗
(bucketName)

Source from the content-addressed store, hash-verified

19'use strict';
20
21function main(bucketName) {
22 // [START storage_control_quickstart_sample]
23 /**
24 * This snippet has been automatically generated and should be regarded as a code template only.
25 * It will require modifications to work.
26 * It may require correct/in-range values for request initialization.
27 * TODO(developer): Uncomment these variables before running the sample.
28 */
29 /**
30 * Required. Name of the bucket for which to get the layout
31 */
32 // const bucketName = 'abc123'
33
34 // Imports the Control library
35 const {StorageControlClient} = require('@google-cloud/storage-control').v2;
36
37 // Instantiates a client
38 const controlClient = new StorageControlClient();
39
40 async function callGetStorageLayout() {
41 // Construct request
42 const request = {
43 name: `projects/_/buckets/${bucketName}/storageLayout`,
44 };
45
46 // Run request
47 const [layout] = await controlClient.getStorageLayout(request);
48
49 // Use response
50 console.log(
51 `Bucket ${bucketName} has location type ${layout.locationType}.`
52 );
53 }
54
55 callGetStorageLayout();
56 // [END storage_control_quickstart_sample]
57}
58
59process.on('unhandledRejection', err => {
60 console.error(err.message);

Callers 1

quickstart.jsFile · 0.70

Calls 1

callGetStorageLayoutFunction · 0.85

Tested by

no test coverage detected