( projectId, tableProjectId, datasetId, tableId, topicId, subscriptionId, quasiIds )
| 18 | // usage: node kAnonymityAnalysis.js my-project tableProjectId datasetId tableId topicId subscriptionId quasiIds |
| 19 | |
| 20 | async function main( |
| 21 | projectId, |
| 22 | tableProjectId, |
| 23 | datasetId, |
| 24 | tableId, |
| 25 | topicId, |
| 26 | subscriptionId, |
| 27 | quasiIds |
| 28 | ) { |
| 29 | quasiIds = transformCLI(quasiIds); |
| 30 | |
| 31 | // [START dlp_k_anonymity] |
| 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 | // A set of columns that form a composite key ('quasi-identifiers') |
| 63 | // const quasiIds = [{ name: 'age' }, { name: 'city' }]; |
| 64 | async function kAnonymityAnalysis() { |
| 65 | const sourceTable = { |
| 66 | projectId: tableProjectId, |
| 67 | datasetId: datasetId, |
| 68 | tableId: tableId, |
| 69 | }; |
| 70 | // Construct request for creating a risk analysis job |
| 71 | |
| 72 | const request = { |
| 73 | parent: `projects/${projectId}/locations/global`, |
| 74 | riskJob: { |
| 75 | privacyMetric: { |
| 76 | kAnonymityConfig: { |
| 77 | quasiIds: quasiIds, |
nothing calls this directly
no test coverage detected