Skip to content

Commit

Permalink
Improved comments as per PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
dinesh-crest committed Aug 16, 2023
1 parent 49db175 commit 6c2ba49
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions dlp/deIdentifyCloudStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ async function main(
};

// Construct the job creation request to be sent by the client.
const request = {
const createDlpJobRequest = {
parent: `projects/${projectId}/locations/global`,
inspectJob: inspectJobConfig,
};
// Send the job creation request and process the response.
const [response] = await dlp.createDlpJob(request);
const [response] = await dlp.createDlpJob(createDlpJobRequest);
const jobName = response.name;

// Waiting for a maximum of 15 minutes for the job to get complete.
Expand Down
29 changes: 13 additions & 16 deletions dlp/kAnonymityWithEntityIds.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,19 @@ async function main(projectId, datasetId, sourceTableId, outputTableId) {
tableId: sourceTableId,
};

// Specify quasi-identifiers to analyze
// Specify the unique identifier in the source table for the k-anonymity analysis.
const uniqueIdField = {name: 'Name'};

// These values represent the column names of quasi-identifiers to analyze
const quasiIds = [{name: 'Age'}, {name: 'Mystery'}];

// Configure the privacy metric to compute for re-identification risk analysis.
const privacyMetric = {
kAnonymityConfig: {
entityId: {
field: {
name: 'Name',
},
field: uniqueIdField,
},
quasiIds: [
{
name: 'Age',
},
{
name: 'Mystery',
},
],
quasiIds: quasiIds,
},
};
// Create action to publish job status notifications to BigQuery table.
Expand All @@ -80,19 +77,19 @@ async function main(projectId, datasetId, sourceTableId, outputTableId) {
];

// Configure the risk analysis job to perform.
const riskJob = {
const riskAnalysisJob = {
sourceTable: sourceTable,
privacyMetric: privacyMetric,
actions: action,
};
// Combine configurations into a request for the service.
const request = {
const createDlpJobRequest = {
parent: `projects/${projectId}/locations/global`,
riskJob: riskJob,
riskJob: riskAnalysisJob,
};

// Send the request and receive response from the service
const [createdDlpJob] = await dlp.createDlpJob(request);
const [createdDlpJob] = await dlp.createDlpJob(createDlpJobRequest);
const jobName = createdDlpJob.name;

// Waiting for a maximum of 15 minutes for the job to get complete.
Expand Down

0 comments on commit 6c2ba49

Please sign in to comment.