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

Function main

dlp/inspectBigquerySendToScc.js:21–132  ·  view source on GitHub ↗
(projectId, dataProjectId, datasetId, tableId)

Source from the content-addressed store, hash-verified

19// description: Uses the Data Loss Prevention API to Create a Dlp Job with Big Query Data and send its findings to Scc
20// usage: node inspectBigquerySendToScc.js my-project dataProjectId datasetId tableId
21async function main(projectId, dataProjectId, datasetId, tableId) {
22 // [START dlp_inspect_bigquery_send_to_scc]
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 = "your-project-id";
31
32 // The project ID the table is stored under
33 // This may or (for public datasets) may not equal the calling project ID
34 // const dataProjectId = 'my-project';
35
36 // The ID of the dataset to inspect, e.g. 'my_dataset'
37 // const datasetId = 'my_dataset';
38
39 // The ID of the table to inspect, e.g. 'my_table'
40 // const tableId = 'my_table';
41
42 async function inspectBigQuerySendToScc() {
43 // Specify the storage configuration object with big query table.
44 const storageItem = {
45 bigQueryOptions: {
46 tableReference: {
47 projectId: dataProjectId,
48 datasetId: datasetId,
49 tableId: tableId,
50 },
51 },
52 };
53
54 // Specify the type of info the inspection will look for.
55 const infoTypes = [
56 {name: 'EMAIL_ADDRESS'},
57 {name: 'PERSON_NAME'},
58 {name: 'LOCATION'},
59 {name: 'PHONE_NUMBER'},
60 ];
61
62 // Construct inspect configuration.
63 const inspectConfig = {
64 infoTypes: infoTypes,
65 includeQuote: true,
66 minLikelihood: DLP.protos.google.privacy.dlp.v2.Likelihood.UNLIKELY,
67 limits: {
68 maxFindingsPerItem: 100,
69 },
70 };
71
72 // Specify the action that is triggered when the job completes.
73 const action = {
74 publishSummaryToCscc: {
75 enable: true,
76 },
77 };
78

Callers

nothing calls this directly

Calls 1

inspectBigQuerySendToSccFunction · 0.85

Tested by

no test coverage detected