( projectId, dataProjectId, datasetId, tableId, topicId, subscriptionId, minLikelihood, maxFindings, infoTypes, customInfoTypes )
| 18 | // usage: node inspectBigQuery.js my-project dataProjectId datasetId tableId topicId subscriptionId minLikelihood maxFindings infoTypes customInfoTypes |
| 19 | |
| 20 | async function main( |
| 21 | projectId, |
| 22 | dataProjectId, |
| 23 | datasetId, |
| 24 | tableId, |
| 25 | topicId, |
| 26 | subscriptionId, |
| 27 | minLikelihood, |
| 28 | maxFindings, |
| 29 | infoTypes, |
| 30 | customInfoTypes |
| 31 | ) { |
| 32 | [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); |
| 33 | |
| 34 | // [START dlp_inspect_bigquery] |
| 35 | // Import the Google Cloud client libraries |
| 36 | const DLP = require('@google-cloud/dlp'); |
| 37 | const {PubSub} = require('@google-cloud/pubsub'); |
| 38 | |
| 39 | // Instantiates clients |
| 40 | const dlp = new DLP.DlpServiceClient(); |
| 41 | const pubsub = new PubSub(); |
| 42 | |
| 43 | // The project ID to run the API call under |
| 44 | // const projectId = 'my-project'; |
| 45 | |
| 46 | // The project ID the table is stored under |
| 47 | // This may or (for public datasets) may not equal the calling project ID |
| 48 | // const dataProjectId = 'my-project'; |
| 49 | |
| 50 | // The ID of the dataset to inspect, e.g. 'my_dataset' |
| 51 | // const datasetId = 'my_dataset'; |
| 52 | |
| 53 | // The ID of the table to inspect, e.g. 'my_table' |
| 54 | // const tableId = 'my_table'; |
| 55 | |
| 56 | // The minimum likelihood required before returning a match |
| 57 | // const minLikelihood = 'LIKELIHOOD_UNSPECIFIED'; |
| 58 | |
| 59 | // The maximum number of findings to report per request (0 = server maximum) |
| 60 | // const maxFindings = 0; |
| 61 | |
| 62 | // The infoTypes of information to match |
| 63 | // const infoTypes = [{ name: 'PHONE_NUMBER' }, { name: 'EMAIL_ADDRESS' }, { name: 'CREDIT_CARD_NUMBER' }]; |
| 64 | |
| 65 | // The customInfoTypes of information to match |
| 66 | // const customInfoTypes = [{ infoType: { name: 'DICT_TYPE' }, dictionary: { wordList: { words: ['foo', 'bar', 'baz']}}}, |
| 67 | // { infoType: { name: 'REGEX_TYPE' }, regex: {pattern: '\\(\\d{3}\\) \\d{3}-\\d{4}'}}]; |
| 68 | |
| 69 | // The name of the Pub/Sub topic to notify once the job completes |
| 70 | // TODO(developer): create a Pub/Sub topic to use for this |
| 71 | // const topicId = 'MY-PUBSUB-TOPIC' |
| 72 | |
| 73 | // The name of the Pub/Sub subscription to use when listening for job |
| 74 | // completion notifications |
| 75 | // TODO(developer): create a Pub/Sub subscription to use for this |
| 76 | // const subscriptionId = 'MY-PUBSUB-SUBSCRIPTION' |
| 77 |
nothing calls this directly
no test coverage detected