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

Function main

dlp/kMapEstimationAnalysis.js:20–156  ·  view source on GitHub ↗
(
  projectId,
  tableProjectId,
  datasetId,
  tableId,
  topicId,
  subscriptionId,
  regionCode,
  quasiIds,
  infoTypes
)

Source from the content-addressed store, hash-verified

18// usage: node kMapEstimationAnalysis.js my-project tableProjectId datasetId tableId topicId subscriptionId regionCode quasiIds
19
20async function main(
21 projectId,
22 tableProjectId,
23 datasetId,
24 tableId,
25 topicId,
26 subscriptionId,
27 regionCode,
28 quasiIds,
29 infoTypes
30) {
31 quasiIds = transformCLI(quasiIds, infoTypes);
32
33 // [START dlp_k_map]
34 // Import the Google Cloud client libraries
35 const DLP = require('@google-cloud/dlp');
36 const {PubSub} = require('@google-cloud/pubsub');
37
38 // Instantiates clients
39 const dlp = new DLP.DlpServiceClient();
40 const pubsub = new PubSub();
41
42 // The project ID to run the API call under
43 // const projectId = 'my-project';
44
45 // The project ID the table is stored under
46 // This may or (for public datasets) may not equal the calling project ID
47 // const tableProjectId = 'my-project';
48
49 // The ID of the dataset to inspect, e.g. 'my_dataset'
50 // const datasetId = 'my_dataset';
51
52 // The ID of the table to inspect, e.g. 'my_table'
53 // const tableId = 'my_table';
54
55 // The name of the Pub/Sub topic to notify once the job completes
56 // TODO(developer): create a Pub/Sub topic to use for this
57 // const topicId = 'MY-PUBSUB-TOPIC'
58
59 // The name of the Pub/Sub subscription to use when listening for job
60 // completion notifications
61 // TODO(developer): create a Pub/Sub subscription to use for this
62 // const subscriptionId = 'MY-PUBSUB-SUBSCRIPTION'
63
64 // The ISO 3166-1 region code that the data is representative of
65 // Can be omitted if using a region-specific infoType (such as US_ZIP_5)
66 // const regionCode = 'USA';
67
68 // A set of columns that form a composite key ('quasi-identifiers'), and
69 // optionally their reidentification distributions
70 // const quasiIds = [{ field: { name: 'age' }, infoType: { name: 'AGE' }}];
71 async function kMapEstimationAnalysis() {
72 const sourceTable = {
73 projectId: tableProjectId,
74 datasetId: datasetId,
75 tableId: tableId,
76 };
77

Callers

nothing calls this directly

Calls 2

kMapEstimationAnalysisFunction · 0.85
transformCLIFunction · 0.70

Tested by

no test coverage detected