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

Function main

dlp/lDiversityAnalysis.js:20–161  ·  view source on GitHub ↗
(
  projectId,
  tableProjectId,
  datasetId,
  tableId,
  topicId,
  subscriptionId,
  sensitiveAttribute,
  quasiIds
)

Source from the content-addressed store, hash-verified

18// usage: node lDiversityAnalysis.js my-project tableProjectId datasetId tableId topicId subscriptionId sensitiveAttribute quasiIds
19
20async function main(
21 projectId,
22 tableProjectId,
23 datasetId,
24 tableId,
25 topicId,
26 subscriptionId,
27 sensitiveAttribute,
28 quasiIds
29) {
30 quasiIds = transformCLI(quasiIds);
31 // [START dlp_l_diversity]
32 // Import the Google Cloud client libraries
33 const DLP = require('@google-cloud/dlp');
34 const {PubSub} = require('@google-cloud/pubsub');
35
36 // Instantiates clients
37 const dlp = new DLP.DlpServiceClient();
38 const pubsub = new PubSub();
39
40 // The project ID to run the API call under
41 // const projectId = 'my-project';
42
43 // The project ID the table is stored under
44 // This may or (for public datasets) may not equal the calling project ID
45 // const tableProjectId = 'my-project';
46
47 // The ID of the dataset to inspect, e.g. 'my_dataset'
48 // const datasetId = 'my_dataset';
49
50 // The ID of the table to inspect, e.g. 'my_table'
51 // const tableId = 'my_table';
52
53 // The name of the Pub/Sub topic to notify once the job completes
54 // TODO(developer): create a Pub/Sub topic to use for this
55 // const topicId = 'MY-PUBSUB-TOPIC'
56
57 // The name of the Pub/Sub subscription to use when listening for job
58 // completion notifications
59 // TODO(developer): create a Pub/Sub subscription to use for this
60 // const subscriptionId = 'MY-PUBSUB-SUBSCRIPTION'
61
62 // The column to measure l-diversity relative to, e.g. 'firstName'
63 // const sensitiveAttribute = 'name';
64
65 // A set of columns that form a composite key ('quasi-identifiers')
66 // const quasiIds = [{ name: 'age' }, { name: 'city' }];
67
68 async function lDiversityAnalysis() {
69 const sourceTable = {
70 projectId: tableProjectId,
71 datasetId: datasetId,
72 tableId: tableId,
73 };
74
75 // Construct request for creating a risk analysis job
76 const request = {
77 parent: `projects/${projectId}/locations/global`,

Callers

nothing calls this directly

Calls 2

lDiversityAnalysisFunction · 0.85
transformCLIFunction · 0.70

Tested by

no test coverage detected