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

Function main

dlp/metadata.js:21–52  ·  view source on GitHub ↗
(projectId, languageCode, filter)

Source from the content-addressed store, hash-verified

19// usage: node metadata.js my-project langaugeCode filter
20
21function main(projectId, languageCode, filter) {
22 // [START dlp_list_info_types]
23 // Imports the Google Cloud Data Loss Prevention library
24 const DLP = require('@google-cloud/dlp');
25
26 // Instantiates a client
27 const dlp = new DLP.DlpServiceClient();
28
29 // The project ID to run the API call under
30 // const projectId = 'my-project';
31
32 // The BCP-47 language code to use, e.g. 'en-US'
33 // const languageCode = 'en-US';
34
35 // The filter to use
36 // const filter = 'supported_by=INSPECT'
37
38 async function listInfoTypes() {
39 const [response] = await dlp.listInfoTypes({
40 languageCode: languageCode,
41 filter: filter,
42 });
43 const infoTypes = response.infoTypes;
44 console.log('Info types:');
45 infoTypes.forEach(infoType => {
46 console.log(`\t${infoType.name} (${infoType.displayName})`);
47 });
48 }
49
50 listInfoTypes();
51 // [END dlp_list_info_types]
52}
53
54module.exports.main = main;
55

Callers 1

metadata.jsFile · 0.70

Calls 1

listInfoTypesFunction · 0.85

Tested by

no test coverage detected