From 397da165a1ae2cc8d214bb0799f42246290186f6 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 10:09:37 +1100 Subject: [PATCH 01/22] fix(dlp): onboard to testing-isolation --- .github/config/nodejs-prod.jsonc | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/config/nodejs-prod.jsonc b/.github/config/nodejs-prod.jsonc index 5f908446a0..4ee4713c8b 100644 --- a/.github/config/nodejs-prod.jsonc +++ b/.github/config/nodejs-prod.jsonc @@ -81,7 +81,6 @@ "dataproc", // GoogleError: Error submitting create cluster request: Multiple validation errors "datastore/functions", // [ERR_REQUIRE_ESM]: require() of ES Module "dialogflow-cx", // NOT_FOUND: com.google.apps.framework.request.NotFoundException: Agent 'undefined' does not exist - "dlp", // [ERR_REQUIRE_ESM]: require() of ES Module "document-ai", // [ERR_REQUIRE_ESM]: require() of ES Module "eventarc/audit-storage", // (untested) Environment Variable 'SERVICE_NAME' not found "eventarc/pubsub", // (untested) Environment Variable 'SERVICE_NAME' not found From 50a1df6b218c2bc385384b3f005858b4a48b28ce Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 10:35:26 +1100 Subject: [PATCH 02/22] noop: make a change to force the tests to run --- dlp/resources/harmless.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlp/resources/harmless.txt b/dlp/resources/harmless.txt index 5666de37ab..aa8f96e391 100644 --- a/dlp/resources/harmless.txt +++ b/dlp/resources/harmless.txt @@ -1 +1 @@ -This file is mostly harmless. +This file is mostly harmless... From c4609ea2ecfc34c2ea706e838dfa5430341374c7 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 10:54:31 +1100 Subject: [PATCH 03/22] set Node version in CI --- dlp/ci-setup.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 dlp/ci-setup.json diff --git a/dlp/ci-setup.json b/dlp/ci-setup.json new file mode 100644 index 0000000000..c983c5f3d1 --- /dev/null +++ b/dlp/ci-setup.json @@ -0,0 +1,3 @@ +{ + "node-version": 16 +} From a6d5e3e355b7c9c66b32788a8dcb33eb608c610c Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 11:15:37 +1100 Subject: [PATCH 04/22] change node version to 18 --- dlp/ci-setup.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlp/ci-setup.json b/dlp/ci-setup.json index c983c5f3d1..eb661b9b7f 100644 --- a/dlp/ci-setup.json +++ b/dlp/ci-setup.json @@ -1,3 +1,3 @@ { - "node-version": 16 + "node-version": 18 } From 31d8d6f07b4aada4853a1a604f088793a0d2e24f Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 11:36:57 +1100 Subject: [PATCH 05/22] debug: bulk update exports --- dlp/categoricalRiskAnalysis.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deidentifyWithDeterministic.js | 2 +- dlp/inspectBigQuery.js | 2 +- dlp/inspectBigQueryTableWithSampling.js | 2 +- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 2 +- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectGCSFile.js | 2 +- dlp/inspectGcsFileWithSampling.js | 2 +- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 2 +- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 2 +- dlp/lDiversityAnalysis.js | 2 +- dlp/numericalRiskAnalysis.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/updateStoredInfoType.js | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index 7a7406272c..16e915a265 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -162,4 +162,4 @@ process.on('unhandledRejection', err => { process.exitCode = 1; }); -module.exports = main; +export default main; diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index 672f99464c..4ee077d3c5 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -111,4 +111,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index a876ce18c8..bb3cc4ae84 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -172,4 +172,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index fd71f7e766..c46c859bcf 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -129,4 +129,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index 0793fff4d6..09ab7d8f9c 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -125,4 +125,4 @@ function transformCLI(infoTypes) { : undefined; } -module.exports = main; +export default main; diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index e4dafda269..8737dfd037 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -196,4 +196,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -module.exports = main; +export default main; diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index f03cdb8168..f7f68237f9 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -166,4 +166,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index c2259fd634..f321fade71 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -139,4 +139,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index cbcf4091e4..c1b7fd7526 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -134,4 +134,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 1dfe29b954..61836027c2 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -199,4 +199,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -module.exports = main; +export default main; diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 5d5084e704..1237200aa9 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -135,4 +135,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index 6cce718136..3fd8da73ce 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -188,4 +188,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -module.exports = main; +export default main; diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index 5df7fdad70..170b3649c6 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -164,4 +164,4 @@ function transformCLI(infoTypes) { : undefined; } -module.exports = main; +export default main; diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 57297b03bc..0625886665 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -126,4 +126,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index 3295fc5267..f4879651e3 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -88,4 +88,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index c5ecdcb81c..0afca9024a 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -167,4 +167,4 @@ function transformCLI(quasiIds) { return quasiIds; } -module.exports = main; +export default main; diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index fa42e563d4..fb19595f0b 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -147,4 +147,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index 19eb01fa04..bb2b804b76 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -181,4 +181,4 @@ function transformCLI(quasiIds, infoTypes) { return quasiIds; } -module.exports = main; +export default main; diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index 4c585e7488..84fe1449bf 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -182,4 +182,4 @@ function transformCLI(quasiIds) { return quasiIds; } -module.exports = main; +export default main; diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index 03cab40db5..6ea2f66a35 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -163,4 +163,4 @@ process.on('unhandledRejection', err => { process.exitCode = 1; }); -module.exports = main; +export default main; diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index 61d04f3272..111193e588 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -107,4 +107,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index b8bfee6547..50e606fd06 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -120,4 +120,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index f4291dd092..5c9f36e92e 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -111,4 +111,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 6c6756f122..36a539cab8 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -80,4 +80,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; From a7466ccdad23b886cb853f2f314535eedf39c7c0 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 11:40:05 +1100 Subject: [PATCH 06/22] debug: bulk update const --- dlp/categoricalRiskAnalysis.js | 4 ++-- dlp/createInspectTemplate.js | 2 +- dlp/createJob.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/createTrigger.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableBucketing.js | 2 +- dlp/deIdentifyTableConditionInfoTypes.js | 2 +- dlp/deIdentifyTableConditionMasking.js | 2 +- dlp/deIdentifyTableInfoTypes.js | 2 +- dlp/deIdentifyTableRowSuppress.js | 2 +- dlp/deIdentifyTableWithBucketingConfig.js | 2 +- dlp/deIdentifyTableWithCryptoHash.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deIdentifyTableWithMultipleCryptoHash.js | 2 +- dlp/deIdentifyWithExceptionList.js | 2 +- dlp/deIdentifyWithRedaction.js | 2 +- dlp/deIdentifyWithReplaceInfoType.js | 2 +- dlp/deIdentifyWithSimpleWordList.js | 2 +- dlp/deidentifyWithDateShift.js | 4 ++-- dlp/deidentifyWithDeterministic.js | 2 +- dlp/deidentifyWithDictionaryReplacement.js | 2 +- dlp/deidentifyWithFpe.js | 2 +- dlp/deidentifyWithFpeSurrogate.js | 2 +- dlp/deidentifyWithMask.js | 2 +- dlp/deidentifyWithReplacement.js | 2 +- dlp/deidentifyWithTimeExtraction.js | 2 +- dlp/deleteInspectTemplate.js | 2 +- dlp/deleteJob.js | 2 +- dlp/deleteTrigger.js | 2 +- dlp/getJob.js | 2 +- dlp/inspectBigQuery.js | 4 ++-- dlp/inspectBigQueryTableWithSampling.js | 4 ++-- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 4 ++-- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectFile.js | 6 +++--- dlp/inspectGCSFile.js | 4 ++-- dlp/inspectGcsFileWithSampling.js | 4 ++-- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectImageFile.js | 6 +++--- dlp/inspectImageFileAllInfoTypes.js | 6 +++--- dlp/inspectImageFileListedInfoTypes.js | 6 +++--- dlp/inspectPhoneNumber.js | 2 +- dlp/inspectString.js | 2 +- dlp/inspectStringAugmentInfoType.js | 2 +- dlp/inspectStringCustomExcludingSubstring.js | 2 +- dlp/inspectStringCustomHotword.js | 2 +- dlp/inspectStringCustomOmitOverlap.js | 2 +- dlp/inspectStringMultipleRules.js | 2 +- dlp/inspectStringOmitOverlap.js | 2 +- dlp/inspectStringRep.js | 2 +- dlp/inspectStringWithExclusionDict.js | 2 +- ...inspectStringWithExclusionDictSubstring.js | 2 +- dlp/inspectStringWithExclusionRegex.js | 2 +- dlp/inspectStringWithoutOverlap.js | 2 +- dlp/inspectTable.js | 2 +- dlp/inspectWithCustomHotwords.js | 2 +- dlp/inspectWithCustomRegex.js | 2 +- dlp/inspectWithHotwordRules.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 4 ++-- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 4 ++-- dlp/lDiversityAnalysis.js | 4 ++-- dlp/listInspectTemplates.js | 2 +- dlp/listJobs.js | 2 +- dlp/listTriggers.js | 2 +- dlp/metadata.js | 2 +- dlp/numericalRiskAnalysis.js | 4 ++-- dlp/quickstart.js | 2 +- dlp/redactImage.js | 6 +++--- dlp/redactImageFileAllInfoTypes.js | 6 +++--- dlp/redactImageFileAllText.js | 6 +++--- dlp/redactImageFileColoredInfoTypes.js | 6 +++--- dlp/redactImageFileListedInfoTypes.js | 6 +++--- dlp/redactText.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/reidentifyWithFpe.js | 2 +- dlp/reidentifyWithFpeSurrogate.js | 2 +- dlp/system-test/deid.test.js | 18 ++++++++--------- dlp/system-test/inspect.test.js | 18 ++++++++--------- dlp/system-test/jobs.test.js | 8 ++++---- dlp/system-test/metadata.test.js | 20 +++++++++---------- dlp/system-test/mockdata.js | 4 ++-- dlp/system-test/quickstart.test.js | 8 ++++---- dlp/system-test/redact.test.js | 14 ++++++------- dlp/system-test/risk.test.js | 18 ++++++++--------- dlp/system-test/templates.test.js | 10 +++++----- dlp/system-test/triggers.test.js | 10 +++++----- dlp/updateStoredInfoType.js | 2 +- dlp/updateTrigger.js | 2 +- 95 files changed, 178 insertions(+), 178 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index 16e915a265..ee9ad1eedf 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -30,8 +30,8 @@ async function main( ) { // [START dlp_categorical_stats] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createInspectTemplate.js b/dlp/createInspectTemplate.js index 5e13e694c3..19d93471b7 100644 --- a/dlp/createInspectTemplate.js +++ b/dlp/createInspectTemplate.js @@ -31,7 +31,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_inspect_template] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createJob.js b/dlp/createJob.js index f311c26bb3..dc421b52d4 100644 --- a/dlp/createJob.js +++ b/dlp/createJob.js @@ -21,7 +21,7 @@ function main(projectId, cloudFileUrl) { // [START dlp_create_job] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index 4ee077d3c5..5233ffe192 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -29,7 +29,7 @@ async function main( ) { // [START dlp_create_stored_infotype] // Import the required libraries - const dlp = require('@google-cloud/dlp'); + import dlp from '@google-cloud/dlp'; // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/createTrigger.js b/dlp/createTrigger.js index f4f338d4f4..1fdcb78266 100644 --- a/dlp/createTrigger.js +++ b/dlp/createTrigger.js @@ -34,7 +34,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index bb3cc4ae84..c71ad1ed7a 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_deidentify_cloud_storage] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableBucketing.js b/dlp/deIdentifyTableBucketing.js index 4c8cc2ae69..7f41c398be 100644 --- a/dlp/deIdentifyTableBucketing.js +++ b/dlp/deIdentifyTableBucketing.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_bucketing] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionInfoTypes.js b/dlp/deIdentifyTableConditionInfoTypes.js index 7058a7b373..c05590b01e 100644 --- a/dlp/deIdentifyTableConditionInfoTypes.js +++ b/dlp/deIdentifyTableConditionInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionMasking.js b/dlp/deIdentifyTableConditionMasking.js index 94cfd42b4b..e2e6218ada 100644 --- a/dlp/deIdentifyTableConditionMasking.js +++ b/dlp/deIdentifyTableConditionMasking.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_masking] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableInfoTypes.js b/dlp/deIdentifyTableInfoTypes.js index 4767cb690b..5e00a1871e 100644 --- a/dlp/deIdentifyTableInfoTypes.js +++ b/dlp/deIdentifyTableInfoTypes.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableRowSuppress.js b/dlp/deIdentifyTableRowSuppress.js index e62685b93a..50397613cf 100644 --- a/dlp/deIdentifyTableRowSuppress.js +++ b/dlp/deIdentifyTableRowSuppress.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_row_suppress] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithBucketingConfig.js b/dlp/deIdentifyTableWithBucketingConfig.js index 335a3e6ce9..dc577917a6 100644 --- a/dlp/deIdentifyTableWithBucketingConfig.js +++ b/dlp/deIdentifyTableWithBucketingConfig.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_primitive_bucketing] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithCryptoHash.js b/dlp/deIdentifyTableWithCryptoHash.js index f63c58974e..a84fb6536c 100644 --- a/dlp/deIdentifyTableWithCryptoHash.js +++ b/dlp/deIdentifyTableWithCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKeyName) { // [START dlp_deidentify_table_with_crypto_hash] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index c46c859bcf..0e7afed316 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_deidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithMultipleCryptoHash.js b/dlp/deIdentifyTableWithMultipleCryptoHash.js index d953382b22..853685d2fb 100644 --- a/dlp/deIdentifyTableWithMultipleCryptoHash.js +++ b/dlp/deIdentifyTableWithMultipleCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKey1, transientKey2) { // [START dlp_deidentify_table_with_multiple_crypto_hash] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithExceptionList.js b/dlp/deIdentifyWithExceptionList.js index 717a12be0d..44e7790d17 100644 --- a/dlp/deIdentifyWithExceptionList.js +++ b/dlp/deIdentifyWithExceptionList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_exception_list] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call diff --git a/dlp/deIdentifyWithRedaction.js b/dlp/deIdentifyWithRedaction.js index 8f2d3f20c6..47bde6e99b 100644 --- a/dlp/deIdentifyWithRedaction.js +++ b/dlp/deIdentifyWithRedaction.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_redact] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithReplaceInfoType.js b/dlp/deIdentifyWithReplaceInfoType.js index 08d8301abc..4bf56eeed3 100644 --- a/dlp/deIdentifyWithReplaceInfoType.js +++ b/dlp/deIdentifyWithReplaceInfoType.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = parseInfotypes(infoTypes); // [START dlp_deidentify_replace_infotype] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithSimpleWordList.js b/dlp/deIdentifyWithSimpleWordList.js index dcdb388b84..aa80596a62 100644 --- a/dlp/deIdentifyWithSimpleWordList.js +++ b/dlp/deIdentifyWithSimpleWordList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, customInfoTypeName) { words = words.split(','); // [START dlp_deidentify_simple_word_list] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // TODO(developer): Replace these variables before running the sample. // const projectId = "your-project-id"; diff --git a/dlp/deidentifyWithDateShift.js b/dlp/deidentifyWithDateShift.js index e13d96425d..9fa3c06499 100644 --- a/dlp/deidentifyWithDateShift.js +++ b/dlp/deidentifyWithDateShift.js @@ -33,13 +33,13 @@ function main( dateFields = transformCLI(dateFields); // [START dlp_deidentify_date_shift] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); // Import other required libraries - const fs = require('fs'); + import fs from 'fs'; // The project ID to run the API call under // const projectId = 'my-project'; diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index 09ab7d8f9c..fd4c7513fc 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -29,7 +29,7 @@ async function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDictionaryReplacement.js b/dlp/deidentifyWithDictionaryReplacement.js index 32576dfb96..4bb63c59dc 100644 --- a/dlp/deidentifyWithDictionaryReplacement.js +++ b/dlp/deidentifyWithDictionaryReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, infoTypes, words) { [infoTypes, words] = transformCLI(infoTypes, words); // [START dlp_deidentify_dictionary_replacement] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpe.js b/dlp/deidentifyWithFpe.js index 015b24d7ad..0a8e38c63c 100644 --- a/dlp/deidentifyWithFpe.js +++ b/dlp/deidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, keyName, wrappedKey, surrogateType) { // [START dlp_deidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpeSurrogate.js b/dlp/deidentifyWithFpeSurrogate.js index d2968e60a5..719fe3689a 100644 --- a/dlp/deidentifyWithFpeSurrogate.js +++ b/dlp/deidentifyWithFpeSurrogate.js @@ -29,7 +29,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithMask.js b/dlp/deidentifyWithMask.js index 6e6df7e7ef..9a9acc0f2d 100644 --- a/dlp/deidentifyWithMask.js +++ b/dlp/deidentifyWithMask.js @@ -22,7 +22,7 @@ function main(projectId, string, maskingCharacter, numberToMask) { // [START dlp_deidentify_masking] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithReplacement.js b/dlp/deidentifyWithReplacement.js index 84ead95f20..a42adf7570 100644 --- a/dlp/deidentifyWithReplacement.js +++ b/dlp/deidentifyWithReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, replacement) { // [START dlp_deidentify_replace] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithTimeExtraction.js b/dlp/deidentifyWithTimeExtraction.js index 03c0e5de14..703840b9db 100644 --- a/dlp/deidentifyWithTimeExtraction.js +++ b/dlp/deidentifyWithTimeExtraction.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_time_extract] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteInspectTemplate.js b/dlp/deleteInspectTemplate.js index 61a8021151..52f928708f 100644 --- a/dlp/deleteInspectTemplate.js +++ b/dlp/deleteInspectTemplate.js @@ -22,7 +22,7 @@ function main(projectId, templateName) { // [START dlp_delete_inspect_template] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteJob.js b/dlp/deleteJob.js index 78202468e2..9b0a63ad72 100644 --- a/dlp/deleteJob.js +++ b/dlp/deleteJob.js @@ -20,7 +20,7 @@ function main(projectId, jobName) { // [START dlp_delete_job] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteTrigger.js b/dlp/deleteTrigger.js index 9fca52f798..5d7d5c776e 100644 --- a/dlp/deleteTrigger.js +++ b/dlp/deleteTrigger.js @@ -20,7 +20,7 @@ function main(projectId, triggerId) { // [START dlp_delete_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/getJob.js b/dlp/getJob.js index 19bf9c290b..f8b752a143 100644 --- a/dlp/getJob.js +++ b/dlp/getJob.js @@ -21,7 +21,7 @@ function main(jobName) { // [START dlp_get_job] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index 8737dfd037..b8b75882db 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -33,8 +33,8 @@ async function main( // [START dlp_inspect_bigquery] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index f7f68237f9..213a540609 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -26,8 +26,8 @@ async function main( ) { // [START dlp_inspect_bigquery_with_sampling] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index f321fade71..fad4f424b5 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, dataProjectId, datasetId, tableId) { // [START dlp_inspect_bigquery_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index c1b7fd7526..861d4f6ecb 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -22,7 +22,7 @@ async function main(projectId, string, jobTriggerId) { // [START dlp_inspect_send_data_to_hybrid_job_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 61836027c2..401a598052 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -35,8 +35,8 @@ async function main( // [START dlp_inspect_datastore] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 1237200aa9..1e7fd97464 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, datastoreNamespace, datastoreKind) { // [START dlp_inspect_datastore_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectFile.js b/dlp/inspectFile.js index 26da96e5a7..5090fc00c9 100644 --- a/dlp/inspectFile.js +++ b/dlp/inspectFile.js @@ -30,11 +30,11 @@ function main( // [START dlp_inspect_file] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Import other required libraries - const fs = require('fs'); - const mime = require('mime'); + import fs from 'fs'; + import mime from 'mime'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index 3fd8da73ce..85372afdc6 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -32,8 +32,8 @@ async function main( // [START dlp_inspect_gcs] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index 170b3649c6..42e93aa1f3 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -21,8 +21,8 @@ async function main(projectId, gcsUri, topicId, subscriptionId, infoTypes) { // [START dlp_inspect_gcs_with_sampling] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 0625886665..235a9889b6 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, gcsPath) { // [START dlp_inspect_gcs_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFile.js b/dlp/inspectImageFile.js index 8e6c03c0cd..76c79170c2 100644 --- a/dlp/inspectImageFile.js +++ b/dlp/inspectImageFile.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_file] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); - const mime = require('mime'); - const fs = require('fs'); + import DLP from '@google-cloud/dlp'; + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileAllInfoTypes.js b/dlp/inspectImageFileAllInfoTypes.js index b7e7ad7fc3..0328177664 100644 --- a/dlp/inspectImageFileAllInfoTypes.js +++ b/dlp/inspectImageFileAllInfoTypes.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); - const mime = require('mime'); - const fs = require('fs'); + import DLP from '@google-cloud/dlp'; + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileListedInfoTypes.js b/dlp/inspectImageFileListedInfoTypes.js index 4789ee0e3b..34fb7504d3 100644 --- a/dlp/inspectImageFileListedInfoTypes.js +++ b/dlp/inspectImageFileListedInfoTypes.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); - const mime = require('mime'); - const fs = require('fs'); + import DLP from '@google-cloud/dlp'; + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectPhoneNumber.js b/dlp/inspectPhoneNumber.js index d0db144258..99502338d5 100644 --- a/dlp/inspectPhoneNumber.js +++ b/dlp/inspectPhoneNumber.js @@ -31,7 +31,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_phone_number] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectString.js b/dlp/inspectString.js index cfeda45c5c..b4912e6aa6 100644 --- a/dlp/inspectString.js +++ b/dlp/inspectString.js @@ -32,7 +32,7 @@ function main( // [START dlp_inspect_string] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringAugmentInfoType.js b/dlp/inspectStringAugmentInfoType.js index 95aee9303a..d554aca917 100644 --- a/dlp/inspectStringAugmentInfoType.js +++ b/dlp/inspectStringAugmentInfoType.js @@ -22,7 +22,7 @@ function main(projectId, string, words) { words = words ? words.split(',') : []; // [START dlp_inspect_augment_infotypes] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomExcludingSubstring.js b/dlp/inspectStringCustomExcludingSubstring.js index 12ff24ec78..c96f7f1de1 100644 --- a/dlp/inspectStringCustomExcludingSubstring.js +++ b/dlp/inspectStringCustomExcludingSubstring.js @@ -22,7 +22,7 @@ function main(projectId, string, excludedWords) { excludedWords = excludedWords ? excludedWords.split(',') : []; // [START dlp_inspect_string_custom_excluding_substring] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomHotword.js b/dlp/inspectStringCustomHotword.js index 2dc9edf12b..244efc41d1 100644 --- a/dlp/inspectStringCustomHotword.js +++ b/dlp/inspectStringCustomHotword.js @@ -21,7 +21,7 @@ function main(projectId, string, customHotword) { // [START dlp_inspect_string_custom_hotword] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomOmitOverlap.js b/dlp/inspectStringCustomOmitOverlap.js index 19b8edba29..6461c1075a 100644 --- a/dlp/inspectStringCustomOmitOverlap.js +++ b/dlp/inspectStringCustomOmitOverlap.js @@ -20,7 +20,7 @@ function main(projectId, string) { // [START dlp_inspect_string_custom_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringMultipleRules.js b/dlp/inspectStringMultipleRules.js index de48a6d9a9..157c543f44 100644 --- a/dlp/inspectStringMultipleRules.js +++ b/dlp/inspectStringMultipleRules.js @@ -21,7 +21,7 @@ function main(projectId, string) { // [START dlp_inspect_string_multiple_rules] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringOmitOverlap.js b/dlp/inspectStringOmitOverlap.js index 4a1144d87b..66136e39b8 100644 --- a/dlp/inspectStringOmitOverlap.js +++ b/dlp/inspectStringOmitOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringRep.js b/dlp/inspectStringRep.js index 20a9437650..b5877cd636 100644 --- a/dlp/inspectStringRep.js +++ b/dlp/inspectStringRep.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_string_rep] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Assemble the regional endpoint url using provided rep location const opts = { diff --git a/dlp/inspectStringWithExclusionDict.js b/dlp/inspectStringWithExclusionDict.js index e0e1f15926..f4a4fcb32b 100644 --- a/dlp/inspectStringWithExclusionDict.js +++ b/dlp/inspectStringWithExclusionDict.js @@ -23,7 +23,7 @@ function main(projectId, string, infoTypes, excludedWords) { [infoTypes, excludedWords] = transformCLI(infoTypes, excludedWords); // [START dlp_inspect_string_with_exclusion_dict] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionDictSubstring.js b/dlp/inspectStringWithExclusionDictSubstring.js index 621275f234..37496dfcd5 100644 --- a/dlp/inspectStringWithExclusionDictSubstring.js +++ b/dlp/inspectStringWithExclusionDictSubstring.js @@ -25,7 +25,7 @@ function main(projectId, string, excludedSubstringList) { : []; // [START dlp_inspect_string_with_exclusion_dict_substring] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionRegex.js b/dlp/inspectStringWithExclusionRegex.js index 501b652f10..60bef9ffa6 100644 --- a/dlp/inspectStringWithExclusionRegex.js +++ b/dlp/inspectStringWithExclusionRegex.js @@ -21,7 +21,7 @@ function main(projectId, string, exclusionRegex) { // [START dlp_inspect_string_with_exclusion_regex] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithoutOverlap.js b/dlp/inspectStringWithoutOverlap.js index f8d58f6bf1..14d85132f1 100644 --- a/dlp/inspectStringWithoutOverlap.js +++ b/dlp/inspectStringWithoutOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_without_overlap] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectTable.js b/dlp/inspectTable.js index db86a7c534..b29acd36f7 100644 --- a/dlp/inspectTable.js +++ b/dlp/inspectTable.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_table] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomHotwords.js b/dlp/inspectWithCustomHotwords.js index ea4c0fe6b4..7898a9ace8 100644 --- a/dlp/inspectWithCustomHotwords.js +++ b/dlp/inspectWithCustomHotwords.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_column_values_w_custom_hotwords] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomRegex.js b/dlp/inspectWithCustomRegex.js index 216e883432..183726ddbe 100644 --- a/dlp/inspectWithCustomRegex.js +++ b/dlp/inspectWithCustomRegex.js @@ -22,7 +22,7 @@ function main(projectId, string, customRegex) { // [START dlp_inspect_custom_regex] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithHotwordRules.js b/dlp/inspectWithHotwordRules.js index 2fff8e9428..5d694f6f67 100644 --- a/dlp/inspectWithHotwordRules.js +++ b/dlp/inspectWithHotwordRules.js @@ -32,7 +32,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_hotword_rule] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index f4879651e3..c5afa6a3ac 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, string) { // [START dlp_inspect_with_stored_infotype] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index 0afca9024a..6c415822bf 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -30,8 +30,8 @@ async function main( // [START dlp_k_anonymity] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index fb19595f0b..5e6c103df5 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -21,7 +21,7 @@ async function main(projectId, datasetId, sourceTableId, outputTableId) { // [START dlp_k_anonymity_with_entity_id] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index bb2b804b76..379cf21957 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -32,8 +32,8 @@ async function main( // [START dlp_k_map] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index 84fe1449bf..a5ac40cc4d 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -30,8 +30,8 @@ async function main( quasiIds = transformCLI(quasiIds); // [START dlp_l_diversity] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listInspectTemplates.js b/dlp/listInspectTemplates.js index 73e41aaebc..015e7e05d9 100644 --- a/dlp/listInspectTemplates.js +++ b/dlp/listInspectTemplates.js @@ -20,7 +20,7 @@ function main(projectId) { // [START dlp_list_inspect_templates] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listJobs.js b/dlp/listJobs.js index 41469ed254..87ccee08ac 100644 --- a/dlp/listJobs.js +++ b/dlp/listJobs.js @@ -22,7 +22,7 @@ function main(projectId, filter, jobType) { // [START dlp_list_jobs] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listTriggers.js b/dlp/listTriggers.js index c7fd234a7f..ff04b95ecc 100644 --- a/dlp/listTriggers.js +++ b/dlp/listTriggers.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_list_triggers] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/metadata.js b/dlp/metadata.js index 02cf404666..39a6a0639b 100644 --- a/dlp/metadata.js +++ b/dlp/metadata.js @@ -21,7 +21,7 @@ function main(projectId, languageCode, filter) { // [START dlp_list_info_types] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index 6ea2f66a35..efce7784d1 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -30,8 +30,8 @@ async function main( ) { // [START dlp_numerical_stats] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/quickstart.js b/dlp/quickstart.js index 0d60c0e433..c76f55dcb5 100644 --- a/dlp/quickstart.js +++ b/dlp/quickstart.js @@ -21,7 +21,7 @@ function main(projectId) { // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // [START dlp_quickstart] diff --git a/dlp/redactImage.js b/dlp/redactImage.js index da893c2e85..42c9473e43 100644 --- a/dlp/redactImage.js +++ b/dlp/redactImage.js @@ -21,11 +21,11 @@ function main(projectId, filepath, minLikelihood, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllInfoTypes.js b/dlp/redactImageFileAllInfoTypes.js index 1890732349..221fb15b31 100644 --- a/dlp/redactImageFileAllInfoTypes.js +++ b/dlp/redactImageFileAllInfoTypes.js @@ -20,11 +20,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllText.js b/dlp/redactImageFileAllText.js index f3ef7a38ee..5a38851a15 100644 --- a/dlp/redactImageFileAllText.js +++ b/dlp/redactImageFileAllText.js @@ -19,11 +19,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_text] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileColoredInfoTypes.js b/dlp/redactImageFileColoredInfoTypes.js index b12625660d..2b15c8fcab 100644 --- a/dlp/redactImageFileColoredInfoTypes.js +++ b/dlp/redactImageFileColoredInfoTypes.js @@ -19,11 +19,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_colored_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileListedInfoTypes.js b/dlp/redactImageFileListedInfoTypes.js index 6945216c9f..2ba7fb7cd7 100644 --- a/dlp/redactImageFileListedInfoTypes.js +++ b/dlp/redactImageFileListedInfoTypes.js @@ -20,11 +20,11 @@ function main(projectId, filepath, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactText.js b/dlp/redactText.js index 305dcd44b6..4c75476a08 100644 --- a/dlp/redactText.js +++ b/dlp/redactText.js @@ -21,7 +21,7 @@ function main(projectId, string, minLikelihood, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_text] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index 111193e588..c6f17ef2e5 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_reidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index 50e606fd06..7dfa4ddf72 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -28,7 +28,7 @@ async function main( ) { // [START dlp_reidentify_text_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index 5c9f36e92e..37d0039c16 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -21,7 +21,7 @@ async function main(projectId, string, keyName, wrappedKey, surrogateType) { // [START dlp_reidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpe.js b/dlp/reidentifyWithFpe.js index 0fe8e14133..b1f3277500 100644 --- a/dlp/reidentifyWithFpe.js +++ b/dlp/reidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, surrogateType, keyName, wrappedKey) { // [START dlp_reidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpeSurrogate.js b/dlp/reidentifyWithFpeSurrogate.js index 89a28e3975..c242b993f8 100644 --- a/dlp/reidentifyWithFpeSurrogate.js +++ b/dlp/reidentifyWithFpeSurrogate.js @@ -21,7 +21,7 @@ function main(projectId, string, alphabet, surrogateType, unwrappedKey) { // [START dlp_reidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/deid.test.js b/dlp/system-test/deid.test.js index 3cc3a774d0..8597c268c8 100644 --- a/dlp/system-test/deid.test.js +++ b/dlp/system-test/deid.test.js @@ -14,15 +14,15 @@ 'use strict'; -const path = require('path'); -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const fs = require('fs'); -const cp = require('child_process'); -const DLP = require('@google-cloud/dlp'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); -const {MOCK_DATA} = require('./mockdata'); +import path from 'path'; +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import fs from 'fs'; +import cp from 'child_process'; +import DLP from '@google-cloud/dlp'; +import proxyquire from 'proxyquire'; +import sinon from 'sinon'; +import {MOCK_DATA} from './mockdata'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/inspect.test.js b/dlp/system-test/inspect.test.js index 3d51f65817..ee84d4905c 100644 --- a/dlp/system-test/inspect.test.js +++ b/dlp/system-test/inspect.test.js @@ -14,17 +14,17 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before, after, afterEach} = require('mocha'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); -const cp = require('child_process'); -const {PubSub} = require('@google-cloud/pubsub'); +import {assert} from 'chai'; +import {describe, it, before, after, afterEach} from 'mocha'; +import proxyquire from 'proxyquire'; +import sinon from 'sinon'; +import cp from 'child_process'; +import {PubSub} from '@google-cloud/pubsub'; const pubsub = new PubSub(); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); +import uuid from 'uuid'; +import DLP from '@google-cloud/dlp'; -const {MOCK_DATA} = require('./mockdata'); +import {MOCK_DATA} from './mockdata'; const bucket = 'nodejs-dlp-test-bucket'; const dataProject = 'bigquery-public-data'; const datasetId = 'samples'; diff --git a/dlp/system-test/jobs.test.js b/dlp/system-test/jobs.test.js index 8294904ca7..1b55c0d79d 100644 --- a/dlp/system-test/jobs.test.js +++ b/dlp/system-test/jobs.test.js @@ -14,10 +14,10 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const DLP = require('@google-cloud/dlp'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import cp from 'child_process'; +import DLP from '@google-cloud/dlp'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/metadata.test.js b/dlp/system-test/metadata.test.js index 89c02323e9..92183b71f8 100644 --- a/dlp/system-test/metadata.test.js +++ b/dlp/system-test/metadata.test.js @@ -14,16 +14,16 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); -const {Storage} = require('@google-cloud/storage'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); - -const {MOCK_DATA} = require('./mockdata'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import cp from 'child_process'; +import uuid from 'uuid'; +import DLP from '@google-cloud/dlp'; +import {Storage} from '@google-cloud/storage'; +import proxyquire from 'proxyquire'; +import sinon from 'sinon'; + +import {MOCK_DATA} from './mockdata'; const dataProject = 'bigquery-public-data'; const dataSetId = 'samples'; diff --git a/dlp/system-test/mockdata.js b/dlp/system-test/mockdata.js index 5f79ee5752..2df5f79fda 100644 --- a/dlp/system-test/mockdata.js +++ b/dlp/system-test/mockdata.js @@ -14,8 +14,8 @@ 'use strict'; -const DLP = require('@google-cloud/dlp'); -const sinon = require('sinon'); +import DLP from '@google-cloud/dlp'; +import sinon from 'sinon'; /** Mock data for unit test cases. diff --git a/dlp/system-test/quickstart.test.js b/dlp/system-test/quickstart.test.js index 2e000674b7..e670b1584e 100644 --- a/dlp/system-test/quickstart.test.js +++ b/dlp/system-test/quickstart.test.js @@ -14,10 +14,10 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const DLP = require('@google-cloud/dlp'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import cp from 'child_process'; +import DLP from '@google-cloud/dlp'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/redact.test.js b/dlp/system-test/redact.test.js index 2dee0e4028..15884942dd 100644 --- a/dlp/system-test/redact.test.js +++ b/dlp/system-test/redact.test.js @@ -14,13 +14,13 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const fs = require('fs'); -const cp = require('child_process'); -const {PNG} = require('pngjs'); -const pixelmatch = require('pixelmatch'); -const DLP = require('@google-cloud/dlp'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import fs from 'fs'; +import cp from 'child_process'; +import {PNG} from 'pngjs'; +import pixelmatch from 'pixelmatch'; +import DLP from '@google-cloud/dlp'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/risk.test.js b/dlp/system-test/risk.test.js index b3ed576131..8a1fa09cd1 100644 --- a/dlp/system-test/risk.test.js +++ b/dlp/system-test/risk.test.js @@ -14,15 +14,15 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before, after, afterEach} = require('mocha'); -const uuid = require('uuid'); -const {PubSub} = require('@google-cloud/pubsub'); -const DLP = require('@google-cloud/dlp'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); - -const {MOCK_DATA} = require('./mockdata'); +import {assert} from 'chai'; +import {describe, it, before, after, afterEach} from 'mocha'; +import uuid from 'uuid'; +import {PubSub} from '@google-cloud/pubsub'; +import DLP from '@google-cloud/dlp'; +import proxyquire from 'proxyquire'; +import sinon from 'sinon'; + +import {MOCK_DATA} from './mockdata'; const pubsub = new PubSub(); const client = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/templates.test.js b/dlp/system-test/templates.test.js index 16b330d9d6..7e23fe58a0 100644 --- a/dlp/system-test/templates.test.js +++ b/dlp/system-test/templates.test.js @@ -14,11 +14,11 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import cp from 'child_process'; +import uuid from 'uuid'; +import DLP from '@google-cloud/dlp'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/triggers.test.js b/dlp/system-test/triggers.test.js index 3092aa47de..f829c3b859 100644 --- a/dlp/system-test/triggers.test.js +++ b/dlp/system-test/triggers.test.js @@ -14,11 +14,11 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import cp from 'child_process'; +import uuid from 'uuid'; +import DLP from '@google-cloud/dlp'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 36a539cab8..81118e006c 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, outputPath, fileSetUrl) { // [START dlp_update_stored_infotype] // Import the required libraries - const dlp = require('@google-cloud/dlp'); + import dlp from '@google-cloud/dlp'; // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/updateTrigger.js b/dlp/updateTrigger.js index 2d2a9b0c5d..5d934605b9 100644 --- a/dlp/updateTrigger.js +++ b/dlp/updateTrigger.js @@ -21,7 +21,7 @@ function main(projectId, jobTriggerName) { // [START dlp_update_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); From 0aff6bb1202f9a83b5aad7b0ae414f58fa286237 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 12:27:59 +1100 Subject: [PATCH 07/22] Revert "debug: bulk update exports" This reverts commit 31d8d6f07b4aada4853a1a604f088793a0d2e24f. --- dlp/categoricalRiskAnalysis.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deidentifyWithDeterministic.js | 2 +- dlp/inspectBigQuery.js | 2 +- dlp/inspectBigQueryTableWithSampling.js | 2 +- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 2 +- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectGCSFile.js | 2 +- dlp/inspectGcsFileWithSampling.js | 2 +- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 2 +- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 2 +- dlp/lDiversityAnalysis.js | 2 +- dlp/numericalRiskAnalysis.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/updateStoredInfoType.js | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index ee9ad1eedf..2b109ec785 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -162,4 +162,4 @@ process.on('unhandledRejection', err => { process.exitCode = 1; }); -export default main; +module.exports = main; diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index 5233ffe192..0a860884b0 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -111,4 +111,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index c71ad1ed7a..a16922c438 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -172,4 +172,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index 0e7afed316..30e855987d 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -129,4 +129,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index fd4c7513fc..b150728296 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -125,4 +125,4 @@ function transformCLI(infoTypes) { : undefined; } -export default main; +module.exports = main; diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index b8b75882db..ff977a6ca9 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -196,4 +196,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -export default main; +module.exports = main; diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index 213a540609..d6b509a458 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -166,4 +166,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index fad4f424b5..71ee94c2d6 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -139,4 +139,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index 861d4f6ecb..ff7b7a395a 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -134,4 +134,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 401a598052..4653c7314a 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -199,4 +199,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -export default main; +module.exports = main; diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 1e7fd97464..1b1a41b89d 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -135,4 +135,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index 85372afdc6..34b1c9bbc9 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -188,4 +188,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -export default main; +module.exports = main; diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index 42e93aa1f3..e2df499170 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -164,4 +164,4 @@ function transformCLI(infoTypes) { : undefined; } -export default main; +module.exports = main; diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 235a9889b6..7b6bcf9bb7 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -126,4 +126,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index c5afa6a3ac..83b6ae2c24 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -88,4 +88,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index 6c415822bf..12578d80d1 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -167,4 +167,4 @@ function transformCLI(quasiIds) { return quasiIds; } -export default main; +module.exports = main; diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index 5e6c103df5..7f7ed09c5a 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -147,4 +147,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index 379cf21957..8e4b5d7008 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -181,4 +181,4 @@ function transformCLI(quasiIds, infoTypes) { return quasiIds; } -export default main; +module.exports = main; diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index a5ac40cc4d..ae9d6932a4 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -182,4 +182,4 @@ function transformCLI(quasiIds) { return quasiIds; } -export default main; +module.exports = main; diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index efce7784d1..5344fa94cc 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -163,4 +163,4 @@ process.on('unhandledRejection', err => { process.exitCode = 1; }); -export default main; +module.exports = main; diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index c6f17ef2e5..41afa77ba8 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -107,4 +107,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index 7dfa4ddf72..288c8b7665 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -120,4 +120,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index 37d0039c16..9a45577c65 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -111,4 +111,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 81118e006c..2c970d6fdc 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -80,4 +80,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; From 40354982cbea67132698e02c300d2305a39cd7e5 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 12:28:06 +1100 Subject: [PATCH 08/22] Revert "debug: bulk update const" This reverts commit a7466ccdad23b886cb853f2f314535eedf39c7c0. --- dlp/categoricalRiskAnalysis.js | 4 ++-- dlp/createInspectTemplate.js | 2 +- dlp/createJob.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/createTrigger.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableBucketing.js | 2 +- dlp/deIdentifyTableConditionInfoTypes.js | 2 +- dlp/deIdentifyTableConditionMasking.js | 2 +- dlp/deIdentifyTableInfoTypes.js | 2 +- dlp/deIdentifyTableRowSuppress.js | 2 +- dlp/deIdentifyTableWithBucketingConfig.js | 2 +- dlp/deIdentifyTableWithCryptoHash.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deIdentifyTableWithMultipleCryptoHash.js | 2 +- dlp/deIdentifyWithExceptionList.js | 2 +- dlp/deIdentifyWithRedaction.js | 2 +- dlp/deIdentifyWithReplaceInfoType.js | 2 +- dlp/deIdentifyWithSimpleWordList.js | 2 +- dlp/deidentifyWithDateShift.js | 4 ++-- dlp/deidentifyWithDeterministic.js | 2 +- dlp/deidentifyWithDictionaryReplacement.js | 2 +- dlp/deidentifyWithFpe.js | 2 +- dlp/deidentifyWithFpeSurrogate.js | 2 +- dlp/deidentifyWithMask.js | 2 +- dlp/deidentifyWithReplacement.js | 2 +- dlp/deidentifyWithTimeExtraction.js | 2 +- dlp/deleteInspectTemplate.js | 2 +- dlp/deleteJob.js | 2 +- dlp/deleteTrigger.js | 2 +- dlp/getJob.js | 2 +- dlp/inspectBigQuery.js | 4 ++-- dlp/inspectBigQueryTableWithSampling.js | 4 ++-- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 4 ++-- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectFile.js | 6 +++--- dlp/inspectGCSFile.js | 4 ++-- dlp/inspectGcsFileWithSampling.js | 4 ++-- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectImageFile.js | 6 +++--- dlp/inspectImageFileAllInfoTypes.js | 6 +++--- dlp/inspectImageFileListedInfoTypes.js | 6 +++--- dlp/inspectPhoneNumber.js | 2 +- dlp/inspectString.js | 2 +- dlp/inspectStringAugmentInfoType.js | 2 +- dlp/inspectStringCustomExcludingSubstring.js | 2 +- dlp/inspectStringCustomHotword.js | 2 +- dlp/inspectStringCustomOmitOverlap.js | 2 +- dlp/inspectStringMultipleRules.js | 2 +- dlp/inspectStringOmitOverlap.js | 2 +- dlp/inspectStringRep.js | 2 +- dlp/inspectStringWithExclusionDict.js | 2 +- ...inspectStringWithExclusionDictSubstring.js | 2 +- dlp/inspectStringWithExclusionRegex.js | 2 +- dlp/inspectStringWithoutOverlap.js | 2 +- dlp/inspectTable.js | 2 +- dlp/inspectWithCustomHotwords.js | 2 +- dlp/inspectWithCustomRegex.js | 2 +- dlp/inspectWithHotwordRules.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 4 ++-- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 4 ++-- dlp/lDiversityAnalysis.js | 4 ++-- dlp/listInspectTemplates.js | 2 +- dlp/listJobs.js | 2 +- dlp/listTriggers.js | 2 +- dlp/metadata.js | 2 +- dlp/numericalRiskAnalysis.js | 4 ++-- dlp/quickstart.js | 2 +- dlp/redactImage.js | 6 +++--- dlp/redactImageFileAllInfoTypes.js | 6 +++--- dlp/redactImageFileAllText.js | 6 +++--- dlp/redactImageFileColoredInfoTypes.js | 6 +++--- dlp/redactImageFileListedInfoTypes.js | 6 +++--- dlp/redactText.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/reidentifyWithFpe.js | 2 +- dlp/reidentifyWithFpeSurrogate.js | 2 +- dlp/system-test/deid.test.js | 18 ++++++++--------- dlp/system-test/inspect.test.js | 18 ++++++++--------- dlp/system-test/jobs.test.js | 8 ++++---- dlp/system-test/metadata.test.js | 20 +++++++++---------- dlp/system-test/mockdata.js | 4 ++-- dlp/system-test/quickstart.test.js | 8 ++++---- dlp/system-test/redact.test.js | 14 ++++++------- dlp/system-test/risk.test.js | 18 ++++++++--------- dlp/system-test/templates.test.js | 10 +++++----- dlp/system-test/triggers.test.js | 10 +++++----- dlp/updateStoredInfoType.js | 2 +- dlp/updateTrigger.js | 2 +- 95 files changed, 178 insertions(+), 178 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index 2b109ec785..7a7406272c 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -30,8 +30,8 @@ async function main( ) { // [START dlp_categorical_stats] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createInspectTemplate.js b/dlp/createInspectTemplate.js index 19d93471b7..5e13e694c3 100644 --- a/dlp/createInspectTemplate.js +++ b/dlp/createInspectTemplate.js @@ -31,7 +31,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_inspect_template] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createJob.js b/dlp/createJob.js index dc421b52d4..f311c26bb3 100644 --- a/dlp/createJob.js +++ b/dlp/createJob.js @@ -21,7 +21,7 @@ function main(projectId, cloudFileUrl) { // [START dlp_create_job] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index 0a860884b0..672f99464c 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -29,7 +29,7 @@ async function main( ) { // [START dlp_create_stored_infotype] // Import the required libraries - import dlp from '@google-cloud/dlp'; + const dlp = require('@google-cloud/dlp'); // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/createTrigger.js b/dlp/createTrigger.js index 1fdcb78266..f4f338d4f4 100644 --- a/dlp/createTrigger.js +++ b/dlp/createTrigger.js @@ -34,7 +34,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index a16922c438..a876ce18c8 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_deidentify_cloud_storage] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableBucketing.js b/dlp/deIdentifyTableBucketing.js index 7f41c398be..4c8cc2ae69 100644 --- a/dlp/deIdentifyTableBucketing.js +++ b/dlp/deIdentifyTableBucketing.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_bucketing] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionInfoTypes.js b/dlp/deIdentifyTableConditionInfoTypes.js index c05590b01e..7058a7b373 100644 --- a/dlp/deIdentifyTableConditionInfoTypes.js +++ b/dlp/deIdentifyTableConditionInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionMasking.js b/dlp/deIdentifyTableConditionMasking.js index e2e6218ada..94cfd42b4b 100644 --- a/dlp/deIdentifyTableConditionMasking.js +++ b/dlp/deIdentifyTableConditionMasking.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_masking] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableInfoTypes.js b/dlp/deIdentifyTableInfoTypes.js index 5e00a1871e..4767cb690b 100644 --- a/dlp/deIdentifyTableInfoTypes.js +++ b/dlp/deIdentifyTableInfoTypes.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableRowSuppress.js b/dlp/deIdentifyTableRowSuppress.js index 50397613cf..e62685b93a 100644 --- a/dlp/deIdentifyTableRowSuppress.js +++ b/dlp/deIdentifyTableRowSuppress.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_row_suppress] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithBucketingConfig.js b/dlp/deIdentifyTableWithBucketingConfig.js index dc577917a6..335a3e6ce9 100644 --- a/dlp/deIdentifyTableWithBucketingConfig.js +++ b/dlp/deIdentifyTableWithBucketingConfig.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_primitive_bucketing] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithCryptoHash.js b/dlp/deIdentifyTableWithCryptoHash.js index a84fb6536c..f63c58974e 100644 --- a/dlp/deIdentifyTableWithCryptoHash.js +++ b/dlp/deIdentifyTableWithCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKeyName) { // [START dlp_deidentify_table_with_crypto_hash] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index 30e855987d..fd71f7e766 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_deidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithMultipleCryptoHash.js b/dlp/deIdentifyTableWithMultipleCryptoHash.js index 853685d2fb..d953382b22 100644 --- a/dlp/deIdentifyTableWithMultipleCryptoHash.js +++ b/dlp/deIdentifyTableWithMultipleCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKey1, transientKey2) { // [START dlp_deidentify_table_with_multiple_crypto_hash] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithExceptionList.js b/dlp/deIdentifyWithExceptionList.js index 44e7790d17..717a12be0d 100644 --- a/dlp/deIdentifyWithExceptionList.js +++ b/dlp/deIdentifyWithExceptionList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_exception_list] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call diff --git a/dlp/deIdentifyWithRedaction.js b/dlp/deIdentifyWithRedaction.js index 47bde6e99b..8f2d3f20c6 100644 --- a/dlp/deIdentifyWithRedaction.js +++ b/dlp/deIdentifyWithRedaction.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_redact] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithReplaceInfoType.js b/dlp/deIdentifyWithReplaceInfoType.js index 4bf56eeed3..08d8301abc 100644 --- a/dlp/deIdentifyWithReplaceInfoType.js +++ b/dlp/deIdentifyWithReplaceInfoType.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = parseInfotypes(infoTypes); // [START dlp_deidentify_replace_infotype] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithSimpleWordList.js b/dlp/deIdentifyWithSimpleWordList.js index aa80596a62..dcdb388b84 100644 --- a/dlp/deIdentifyWithSimpleWordList.js +++ b/dlp/deIdentifyWithSimpleWordList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, customInfoTypeName) { words = words.split(','); // [START dlp_deidentify_simple_word_list] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // TODO(developer): Replace these variables before running the sample. // const projectId = "your-project-id"; diff --git a/dlp/deidentifyWithDateShift.js b/dlp/deidentifyWithDateShift.js index 9fa3c06499..e13d96425d 100644 --- a/dlp/deidentifyWithDateShift.js +++ b/dlp/deidentifyWithDateShift.js @@ -33,13 +33,13 @@ function main( dateFields = transformCLI(dateFields); // [START dlp_deidentify_date_shift] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); // Import other required libraries - import fs from 'fs'; + const fs = require('fs'); // The project ID to run the API call under // const projectId = 'my-project'; diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index b150728296..0793fff4d6 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -29,7 +29,7 @@ async function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDictionaryReplacement.js b/dlp/deidentifyWithDictionaryReplacement.js index 4bb63c59dc..32576dfb96 100644 --- a/dlp/deidentifyWithDictionaryReplacement.js +++ b/dlp/deidentifyWithDictionaryReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, infoTypes, words) { [infoTypes, words] = transformCLI(infoTypes, words); // [START dlp_deidentify_dictionary_replacement] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpe.js b/dlp/deidentifyWithFpe.js index 0a8e38c63c..015b24d7ad 100644 --- a/dlp/deidentifyWithFpe.js +++ b/dlp/deidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, keyName, wrappedKey, surrogateType) { // [START dlp_deidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpeSurrogate.js b/dlp/deidentifyWithFpeSurrogate.js index 719fe3689a..d2968e60a5 100644 --- a/dlp/deidentifyWithFpeSurrogate.js +++ b/dlp/deidentifyWithFpeSurrogate.js @@ -29,7 +29,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithMask.js b/dlp/deidentifyWithMask.js index 9a9acc0f2d..6e6df7e7ef 100644 --- a/dlp/deidentifyWithMask.js +++ b/dlp/deidentifyWithMask.js @@ -22,7 +22,7 @@ function main(projectId, string, maskingCharacter, numberToMask) { // [START dlp_deidentify_masking] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithReplacement.js b/dlp/deidentifyWithReplacement.js index a42adf7570..84ead95f20 100644 --- a/dlp/deidentifyWithReplacement.js +++ b/dlp/deidentifyWithReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, replacement) { // [START dlp_deidentify_replace] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithTimeExtraction.js b/dlp/deidentifyWithTimeExtraction.js index 703840b9db..03c0e5de14 100644 --- a/dlp/deidentifyWithTimeExtraction.js +++ b/dlp/deidentifyWithTimeExtraction.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_time_extract] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteInspectTemplate.js b/dlp/deleteInspectTemplate.js index 52f928708f..61a8021151 100644 --- a/dlp/deleteInspectTemplate.js +++ b/dlp/deleteInspectTemplate.js @@ -22,7 +22,7 @@ function main(projectId, templateName) { // [START dlp_delete_inspect_template] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteJob.js b/dlp/deleteJob.js index 9b0a63ad72..78202468e2 100644 --- a/dlp/deleteJob.js +++ b/dlp/deleteJob.js @@ -20,7 +20,7 @@ function main(projectId, jobName) { // [START dlp_delete_job] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteTrigger.js b/dlp/deleteTrigger.js index 5d7d5c776e..9fca52f798 100644 --- a/dlp/deleteTrigger.js +++ b/dlp/deleteTrigger.js @@ -20,7 +20,7 @@ function main(projectId, triggerId) { // [START dlp_delete_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/getJob.js b/dlp/getJob.js index f8b752a143..19bf9c290b 100644 --- a/dlp/getJob.js +++ b/dlp/getJob.js @@ -21,7 +21,7 @@ function main(jobName) { // [START dlp_get_job] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index ff977a6ca9..e4dafda269 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -33,8 +33,8 @@ async function main( // [START dlp_inspect_bigquery] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index d6b509a458..f03cdb8168 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -26,8 +26,8 @@ async function main( ) { // [START dlp_inspect_bigquery_with_sampling] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index 71ee94c2d6..c2259fd634 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, dataProjectId, datasetId, tableId) { // [START dlp_inspect_bigquery_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index ff7b7a395a..cbcf4091e4 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -22,7 +22,7 @@ async function main(projectId, string, jobTriggerId) { // [START dlp_inspect_send_data_to_hybrid_job_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 4653c7314a..1dfe29b954 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -35,8 +35,8 @@ async function main( // [START dlp_inspect_datastore] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 1b1a41b89d..5d5084e704 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, datastoreNamespace, datastoreKind) { // [START dlp_inspect_datastore_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectFile.js b/dlp/inspectFile.js index 5090fc00c9..26da96e5a7 100644 --- a/dlp/inspectFile.js +++ b/dlp/inspectFile.js @@ -30,11 +30,11 @@ function main( // [START dlp_inspect_file] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Import other required libraries - import fs from 'fs'; - import mime from 'mime'; + const fs = require('fs'); + const mime = require('mime'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index 34b1c9bbc9..6cce718136 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -32,8 +32,8 @@ async function main( // [START dlp_inspect_gcs] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index e2df499170..5df7fdad70 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -21,8 +21,8 @@ async function main(projectId, gcsUri, topicId, subscriptionId, infoTypes) { // [START dlp_inspect_gcs_with_sampling] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 7b6bcf9bb7..57297b03bc 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, gcsPath) { // [START dlp_inspect_gcs_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFile.js b/dlp/inspectImageFile.js index 76c79170c2..8e6c03c0cd 100644 --- a/dlp/inspectImageFile.js +++ b/dlp/inspectImageFile.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_file] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; - import mime from 'mime'; - import fs from 'fs'; + const DLP = require('@google-cloud/dlp'); + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileAllInfoTypes.js b/dlp/inspectImageFileAllInfoTypes.js index 0328177664..b7e7ad7fc3 100644 --- a/dlp/inspectImageFileAllInfoTypes.js +++ b/dlp/inspectImageFileAllInfoTypes.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; - import mime from 'mime'; - import fs from 'fs'; + const DLP = require('@google-cloud/dlp'); + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileListedInfoTypes.js b/dlp/inspectImageFileListedInfoTypes.js index 34fb7504d3..4789ee0e3b 100644 --- a/dlp/inspectImageFileListedInfoTypes.js +++ b/dlp/inspectImageFileListedInfoTypes.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; - import mime from 'mime'; - import fs from 'fs'; + const DLP = require('@google-cloud/dlp'); + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectPhoneNumber.js b/dlp/inspectPhoneNumber.js index 99502338d5..d0db144258 100644 --- a/dlp/inspectPhoneNumber.js +++ b/dlp/inspectPhoneNumber.js @@ -31,7 +31,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_phone_number] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectString.js b/dlp/inspectString.js index b4912e6aa6..cfeda45c5c 100644 --- a/dlp/inspectString.js +++ b/dlp/inspectString.js @@ -32,7 +32,7 @@ function main( // [START dlp_inspect_string] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringAugmentInfoType.js b/dlp/inspectStringAugmentInfoType.js index d554aca917..95aee9303a 100644 --- a/dlp/inspectStringAugmentInfoType.js +++ b/dlp/inspectStringAugmentInfoType.js @@ -22,7 +22,7 @@ function main(projectId, string, words) { words = words ? words.split(',') : []; // [START dlp_inspect_augment_infotypes] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomExcludingSubstring.js b/dlp/inspectStringCustomExcludingSubstring.js index c96f7f1de1..12ff24ec78 100644 --- a/dlp/inspectStringCustomExcludingSubstring.js +++ b/dlp/inspectStringCustomExcludingSubstring.js @@ -22,7 +22,7 @@ function main(projectId, string, excludedWords) { excludedWords = excludedWords ? excludedWords.split(',') : []; // [START dlp_inspect_string_custom_excluding_substring] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomHotword.js b/dlp/inspectStringCustomHotword.js index 244efc41d1..2dc9edf12b 100644 --- a/dlp/inspectStringCustomHotword.js +++ b/dlp/inspectStringCustomHotword.js @@ -21,7 +21,7 @@ function main(projectId, string, customHotword) { // [START dlp_inspect_string_custom_hotword] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomOmitOverlap.js b/dlp/inspectStringCustomOmitOverlap.js index 6461c1075a..19b8edba29 100644 --- a/dlp/inspectStringCustomOmitOverlap.js +++ b/dlp/inspectStringCustomOmitOverlap.js @@ -20,7 +20,7 @@ function main(projectId, string) { // [START dlp_inspect_string_custom_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringMultipleRules.js b/dlp/inspectStringMultipleRules.js index 157c543f44..de48a6d9a9 100644 --- a/dlp/inspectStringMultipleRules.js +++ b/dlp/inspectStringMultipleRules.js @@ -21,7 +21,7 @@ function main(projectId, string) { // [START dlp_inspect_string_multiple_rules] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringOmitOverlap.js b/dlp/inspectStringOmitOverlap.js index 66136e39b8..4a1144d87b 100644 --- a/dlp/inspectStringOmitOverlap.js +++ b/dlp/inspectStringOmitOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringRep.js b/dlp/inspectStringRep.js index b5877cd636..20a9437650 100644 --- a/dlp/inspectStringRep.js +++ b/dlp/inspectStringRep.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_string_rep] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Assemble the regional endpoint url using provided rep location const opts = { diff --git a/dlp/inspectStringWithExclusionDict.js b/dlp/inspectStringWithExclusionDict.js index f4a4fcb32b..e0e1f15926 100644 --- a/dlp/inspectStringWithExclusionDict.js +++ b/dlp/inspectStringWithExclusionDict.js @@ -23,7 +23,7 @@ function main(projectId, string, infoTypes, excludedWords) { [infoTypes, excludedWords] = transformCLI(infoTypes, excludedWords); // [START dlp_inspect_string_with_exclusion_dict] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionDictSubstring.js b/dlp/inspectStringWithExclusionDictSubstring.js index 37496dfcd5..621275f234 100644 --- a/dlp/inspectStringWithExclusionDictSubstring.js +++ b/dlp/inspectStringWithExclusionDictSubstring.js @@ -25,7 +25,7 @@ function main(projectId, string, excludedSubstringList) { : []; // [START dlp_inspect_string_with_exclusion_dict_substring] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionRegex.js b/dlp/inspectStringWithExclusionRegex.js index 60bef9ffa6..501b652f10 100644 --- a/dlp/inspectStringWithExclusionRegex.js +++ b/dlp/inspectStringWithExclusionRegex.js @@ -21,7 +21,7 @@ function main(projectId, string, exclusionRegex) { // [START dlp_inspect_string_with_exclusion_regex] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithoutOverlap.js b/dlp/inspectStringWithoutOverlap.js index 14d85132f1..f8d58f6bf1 100644 --- a/dlp/inspectStringWithoutOverlap.js +++ b/dlp/inspectStringWithoutOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_without_overlap] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectTable.js b/dlp/inspectTable.js index b29acd36f7..db86a7c534 100644 --- a/dlp/inspectTable.js +++ b/dlp/inspectTable.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_table] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomHotwords.js b/dlp/inspectWithCustomHotwords.js index 7898a9ace8..ea4c0fe6b4 100644 --- a/dlp/inspectWithCustomHotwords.js +++ b/dlp/inspectWithCustomHotwords.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_column_values_w_custom_hotwords] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomRegex.js b/dlp/inspectWithCustomRegex.js index 183726ddbe..216e883432 100644 --- a/dlp/inspectWithCustomRegex.js +++ b/dlp/inspectWithCustomRegex.js @@ -22,7 +22,7 @@ function main(projectId, string, customRegex) { // [START dlp_inspect_custom_regex] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithHotwordRules.js b/dlp/inspectWithHotwordRules.js index 5d694f6f67..2fff8e9428 100644 --- a/dlp/inspectWithHotwordRules.js +++ b/dlp/inspectWithHotwordRules.js @@ -32,7 +32,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_hotword_rule] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index 83b6ae2c24..3295fc5267 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, string) { // [START dlp_inspect_with_stored_infotype] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index 12578d80d1..c5ecdcb81c 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -30,8 +30,8 @@ async function main( // [START dlp_k_anonymity] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index 7f7ed09c5a..fa42e563d4 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -21,7 +21,7 @@ async function main(projectId, datasetId, sourceTableId, outputTableId) { // [START dlp_k_anonymity_with_entity_id] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index 8e4b5d7008..19eb01fa04 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -32,8 +32,8 @@ async function main( // [START dlp_k_map] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index ae9d6932a4..4c585e7488 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -30,8 +30,8 @@ async function main( quasiIds = transformCLI(quasiIds); // [START dlp_l_diversity] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listInspectTemplates.js b/dlp/listInspectTemplates.js index 015e7e05d9..73e41aaebc 100644 --- a/dlp/listInspectTemplates.js +++ b/dlp/listInspectTemplates.js @@ -20,7 +20,7 @@ function main(projectId) { // [START dlp_list_inspect_templates] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listJobs.js b/dlp/listJobs.js index 87ccee08ac..41469ed254 100644 --- a/dlp/listJobs.js +++ b/dlp/listJobs.js @@ -22,7 +22,7 @@ function main(projectId, filter, jobType) { // [START dlp_list_jobs] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listTriggers.js b/dlp/listTriggers.js index ff04b95ecc..c7fd234a7f 100644 --- a/dlp/listTriggers.js +++ b/dlp/listTriggers.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_list_triggers] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/metadata.js b/dlp/metadata.js index 39a6a0639b..02cf404666 100644 --- a/dlp/metadata.js +++ b/dlp/metadata.js @@ -21,7 +21,7 @@ function main(projectId, languageCode, filter) { // [START dlp_list_info_types] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index 5344fa94cc..03cab40db5 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -30,8 +30,8 @@ async function main( ) { // [START dlp_numerical_stats] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/quickstart.js b/dlp/quickstart.js index c76f55dcb5..0d60c0e433 100644 --- a/dlp/quickstart.js +++ b/dlp/quickstart.js @@ -21,7 +21,7 @@ function main(projectId) { // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // [START dlp_quickstart] diff --git a/dlp/redactImage.js b/dlp/redactImage.js index 42c9473e43..da893c2e85 100644 --- a/dlp/redactImage.js +++ b/dlp/redactImage.js @@ -21,11 +21,11 @@ function main(projectId, filepath, minLikelihood, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries - import mime from 'mime'; - import fs from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllInfoTypes.js b/dlp/redactImageFileAllInfoTypes.js index 221fb15b31..1890732349 100644 --- a/dlp/redactImageFileAllInfoTypes.js +++ b/dlp/redactImageFileAllInfoTypes.js @@ -20,11 +20,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries - import mime from 'mime'; - import fs from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllText.js b/dlp/redactImageFileAllText.js index 5a38851a15..f3ef7a38ee 100644 --- a/dlp/redactImageFileAllText.js +++ b/dlp/redactImageFileAllText.js @@ -19,11 +19,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_text] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries - import mime from 'mime'; - import fs from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileColoredInfoTypes.js b/dlp/redactImageFileColoredInfoTypes.js index 2b15c8fcab..b12625660d 100644 --- a/dlp/redactImageFileColoredInfoTypes.js +++ b/dlp/redactImageFileColoredInfoTypes.js @@ -19,11 +19,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_colored_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries - import mime from 'mime'; - import fs from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileListedInfoTypes.js b/dlp/redactImageFileListedInfoTypes.js index 2ba7fb7cd7..6945216c9f 100644 --- a/dlp/redactImageFileListedInfoTypes.js +++ b/dlp/redactImageFileListedInfoTypes.js @@ -20,11 +20,11 @@ function main(projectId, filepath, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries - import mime from 'mime'; - import fs from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactText.js b/dlp/redactText.js index 4c75476a08..305dcd44b6 100644 --- a/dlp/redactText.js +++ b/dlp/redactText.js @@ -21,7 +21,7 @@ function main(projectId, string, minLikelihood, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_text] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index 41afa77ba8..61d04f3272 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_reidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index 288c8b7665..b8bfee6547 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -28,7 +28,7 @@ async function main( ) { // [START dlp_reidentify_text_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index 9a45577c65..f4291dd092 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -21,7 +21,7 @@ async function main(projectId, string, keyName, wrappedKey, surrogateType) { // [START dlp_reidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpe.js b/dlp/reidentifyWithFpe.js index b1f3277500..0fe8e14133 100644 --- a/dlp/reidentifyWithFpe.js +++ b/dlp/reidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, surrogateType, keyName, wrappedKey) { // [START dlp_reidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpeSurrogate.js b/dlp/reidentifyWithFpeSurrogate.js index c242b993f8..89a28e3975 100644 --- a/dlp/reidentifyWithFpeSurrogate.js +++ b/dlp/reidentifyWithFpeSurrogate.js @@ -21,7 +21,7 @@ function main(projectId, string, alphabet, surrogateType, unwrappedKey) { // [START dlp_reidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/deid.test.js b/dlp/system-test/deid.test.js index 8597c268c8..3cc3a774d0 100644 --- a/dlp/system-test/deid.test.js +++ b/dlp/system-test/deid.test.js @@ -14,15 +14,15 @@ 'use strict'; -import path from 'path'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import fs from 'fs'; -import cp from 'child_process'; -import DLP from '@google-cloud/dlp'; -import proxyquire from 'proxyquire'; -import sinon from 'sinon'; -import {MOCK_DATA} from './mockdata'; +const path = require('path'); +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const fs = require('fs'); +const cp = require('child_process'); +const DLP = require('@google-cloud/dlp'); +const proxyquire = require('proxyquire'); +const sinon = require('sinon'); +const {MOCK_DATA} = require('./mockdata'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/inspect.test.js b/dlp/system-test/inspect.test.js index ee84d4905c..3d51f65817 100644 --- a/dlp/system-test/inspect.test.js +++ b/dlp/system-test/inspect.test.js @@ -14,17 +14,17 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before, after, afterEach} from 'mocha'; -import proxyquire from 'proxyquire'; -import sinon from 'sinon'; -import cp from 'child_process'; -import {PubSub} from '@google-cloud/pubsub'; +const {assert} = require('chai'); +const {describe, it, before, after, afterEach} = require('mocha'); +const proxyquire = require('proxyquire'); +const sinon = require('sinon'); +const cp = require('child_process'); +const {PubSub} = require('@google-cloud/pubsub'); const pubsub = new PubSub(); -import uuid from 'uuid'; -import DLP from '@google-cloud/dlp'; +const uuid = require('uuid'); +const DLP = require('@google-cloud/dlp'); -import {MOCK_DATA} from './mockdata'; +const {MOCK_DATA} = require('./mockdata'); const bucket = 'nodejs-dlp-test-bucket'; const dataProject = 'bigquery-public-data'; const datasetId = 'samples'; diff --git a/dlp/system-test/jobs.test.js b/dlp/system-test/jobs.test.js index 1b55c0d79d..8294904ca7 100644 --- a/dlp/system-test/jobs.test.js +++ b/dlp/system-test/jobs.test.js @@ -14,10 +14,10 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import cp from 'child_process'; -import DLP from '@google-cloud/dlp'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const cp = require('child_process'); +const DLP = require('@google-cloud/dlp'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/metadata.test.js b/dlp/system-test/metadata.test.js index 92183b71f8..89c02323e9 100644 --- a/dlp/system-test/metadata.test.js +++ b/dlp/system-test/metadata.test.js @@ -14,16 +14,16 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import cp from 'child_process'; -import uuid from 'uuid'; -import DLP from '@google-cloud/dlp'; -import {Storage} from '@google-cloud/storage'; -import proxyquire from 'proxyquire'; -import sinon from 'sinon'; - -import {MOCK_DATA} from './mockdata'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const cp = require('child_process'); +const uuid = require('uuid'); +const DLP = require('@google-cloud/dlp'); +const {Storage} = require('@google-cloud/storage'); +const proxyquire = require('proxyquire'); +const sinon = require('sinon'); + +const {MOCK_DATA} = require('./mockdata'); const dataProject = 'bigquery-public-data'; const dataSetId = 'samples'; diff --git a/dlp/system-test/mockdata.js b/dlp/system-test/mockdata.js index 2df5f79fda..5f79ee5752 100644 --- a/dlp/system-test/mockdata.js +++ b/dlp/system-test/mockdata.js @@ -14,8 +14,8 @@ 'use strict'; -import DLP from '@google-cloud/dlp'; -import sinon from 'sinon'; +const DLP = require('@google-cloud/dlp'); +const sinon = require('sinon'); /** Mock data for unit test cases. diff --git a/dlp/system-test/quickstart.test.js b/dlp/system-test/quickstart.test.js index e670b1584e..2e000674b7 100644 --- a/dlp/system-test/quickstart.test.js +++ b/dlp/system-test/quickstart.test.js @@ -14,10 +14,10 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import cp from 'child_process'; -import DLP from '@google-cloud/dlp'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const cp = require('child_process'); +const DLP = require('@google-cloud/dlp'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/redact.test.js b/dlp/system-test/redact.test.js index 15884942dd..2dee0e4028 100644 --- a/dlp/system-test/redact.test.js +++ b/dlp/system-test/redact.test.js @@ -14,13 +14,13 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import fs from 'fs'; -import cp from 'child_process'; -import {PNG} from 'pngjs'; -import pixelmatch from 'pixelmatch'; -import DLP from '@google-cloud/dlp'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const fs = require('fs'); +const cp = require('child_process'); +const {PNG} = require('pngjs'); +const pixelmatch = require('pixelmatch'); +const DLP = require('@google-cloud/dlp'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/risk.test.js b/dlp/system-test/risk.test.js index 8a1fa09cd1..b3ed576131 100644 --- a/dlp/system-test/risk.test.js +++ b/dlp/system-test/risk.test.js @@ -14,15 +14,15 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before, after, afterEach} from 'mocha'; -import uuid from 'uuid'; -import {PubSub} from '@google-cloud/pubsub'; -import DLP from '@google-cloud/dlp'; -import proxyquire from 'proxyquire'; -import sinon from 'sinon'; - -import {MOCK_DATA} from './mockdata'; +const {assert} = require('chai'); +const {describe, it, before, after, afterEach} = require('mocha'); +const uuid = require('uuid'); +const {PubSub} = require('@google-cloud/pubsub'); +const DLP = require('@google-cloud/dlp'); +const proxyquire = require('proxyquire'); +const sinon = require('sinon'); + +const {MOCK_DATA} = require('./mockdata'); const pubsub = new PubSub(); const client = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/templates.test.js b/dlp/system-test/templates.test.js index 7e23fe58a0..16b330d9d6 100644 --- a/dlp/system-test/templates.test.js +++ b/dlp/system-test/templates.test.js @@ -14,11 +14,11 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import cp from 'child_process'; -import uuid from 'uuid'; -import DLP from '@google-cloud/dlp'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const cp = require('child_process'); +const uuid = require('uuid'); +const DLP = require('@google-cloud/dlp'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/triggers.test.js b/dlp/system-test/triggers.test.js index f829c3b859..3092aa47de 100644 --- a/dlp/system-test/triggers.test.js +++ b/dlp/system-test/triggers.test.js @@ -14,11 +14,11 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import cp from 'child_process'; -import uuid from 'uuid'; -import DLP from '@google-cloud/dlp'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const cp = require('child_process'); +const uuid = require('uuid'); +const DLP = require('@google-cloud/dlp'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 2c970d6fdc..6c6756f122 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, outputPath, fileSetUrl) { // [START dlp_update_stored_infotype] // Import the required libraries - import dlp from '@google-cloud/dlp'; + const dlp = require('@google-cloud/dlp'); // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/updateTrigger.js b/dlp/updateTrigger.js index 5d934605b9..2d2a9b0c5d 100644 --- a/dlp/updateTrigger.js +++ b/dlp/updateTrigger.js @@ -21,7 +21,7 @@ function main(projectId, jobTriggerName) { // [START dlp_update_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); From b98e04d252ac48c2b0c819adc5468e2dbb7eb58b Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 12:28:56 +1100 Subject: [PATCH 09/22] Reapply "debug: bulk update exports" This reverts commit 0aff6bb1202f9a83b5aad7b0ae414f58fa286237. --- dlp/categoricalRiskAnalysis.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deidentifyWithDeterministic.js | 2 +- dlp/inspectBigQuery.js | 2 +- dlp/inspectBigQueryTableWithSampling.js | 2 +- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 2 +- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectGCSFile.js | 2 +- dlp/inspectGcsFileWithSampling.js | 2 +- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 2 +- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 2 +- dlp/lDiversityAnalysis.js | 2 +- dlp/numericalRiskAnalysis.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/updateStoredInfoType.js | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index 7a7406272c..16e915a265 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -162,4 +162,4 @@ process.on('unhandledRejection', err => { process.exitCode = 1; }); -module.exports = main; +export default main; diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index 672f99464c..4ee077d3c5 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -111,4 +111,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index a876ce18c8..bb3cc4ae84 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -172,4 +172,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index fd71f7e766..c46c859bcf 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -129,4 +129,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index 0793fff4d6..09ab7d8f9c 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -125,4 +125,4 @@ function transformCLI(infoTypes) { : undefined; } -module.exports = main; +export default main; diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index e4dafda269..8737dfd037 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -196,4 +196,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -module.exports = main; +export default main; diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index f03cdb8168..f7f68237f9 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -166,4 +166,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index c2259fd634..f321fade71 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -139,4 +139,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index cbcf4091e4..c1b7fd7526 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -134,4 +134,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 1dfe29b954..61836027c2 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -199,4 +199,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -module.exports = main; +export default main; diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 5d5084e704..1237200aa9 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -135,4 +135,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index 6cce718136..3fd8da73ce 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -188,4 +188,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -module.exports = main; +export default main; diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index 5df7fdad70..170b3649c6 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -164,4 +164,4 @@ function transformCLI(infoTypes) { : undefined; } -module.exports = main; +export default main; diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 57297b03bc..0625886665 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -126,4 +126,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index 3295fc5267..f4879651e3 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -88,4 +88,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index c5ecdcb81c..0afca9024a 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -167,4 +167,4 @@ function transformCLI(quasiIds) { return quasiIds; } -module.exports = main; +export default main; diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index fa42e563d4..fb19595f0b 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -147,4 +147,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index 19eb01fa04..bb2b804b76 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -181,4 +181,4 @@ function transformCLI(quasiIds, infoTypes) { return quasiIds; } -module.exports = main; +export default main; diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index 4c585e7488..84fe1449bf 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -182,4 +182,4 @@ function transformCLI(quasiIds) { return quasiIds; } -module.exports = main; +export default main; diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index 03cab40db5..6ea2f66a35 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -163,4 +163,4 @@ process.on('unhandledRejection', err => { process.exitCode = 1; }); -module.exports = main; +export default main; diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index 61d04f3272..111193e588 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -107,4 +107,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index b8bfee6547..50e606fd06 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -120,4 +120,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index f4291dd092..5c9f36e92e 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -111,4 +111,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 6c6756f122..36a539cab8 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -80,4 +80,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -module.exports = main; +export default main; From 74654166fbd1e219051e4ec4adf6a9b71aacba6c Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 12:29:06 +1100 Subject: [PATCH 10/22] Reapply "debug: bulk update const" This reverts commit 40354982cbea67132698e02c300d2305a39cd7e5. --- dlp/categoricalRiskAnalysis.js | 4 ++-- dlp/createInspectTemplate.js | 2 +- dlp/createJob.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/createTrigger.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableBucketing.js | 2 +- dlp/deIdentifyTableConditionInfoTypes.js | 2 +- dlp/deIdentifyTableConditionMasking.js | 2 +- dlp/deIdentifyTableInfoTypes.js | 2 +- dlp/deIdentifyTableRowSuppress.js | 2 +- dlp/deIdentifyTableWithBucketingConfig.js | 2 +- dlp/deIdentifyTableWithCryptoHash.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deIdentifyTableWithMultipleCryptoHash.js | 2 +- dlp/deIdentifyWithExceptionList.js | 2 +- dlp/deIdentifyWithRedaction.js | 2 +- dlp/deIdentifyWithReplaceInfoType.js | 2 +- dlp/deIdentifyWithSimpleWordList.js | 2 +- dlp/deidentifyWithDateShift.js | 4 ++-- dlp/deidentifyWithDeterministic.js | 2 +- dlp/deidentifyWithDictionaryReplacement.js | 2 +- dlp/deidentifyWithFpe.js | 2 +- dlp/deidentifyWithFpeSurrogate.js | 2 +- dlp/deidentifyWithMask.js | 2 +- dlp/deidentifyWithReplacement.js | 2 +- dlp/deidentifyWithTimeExtraction.js | 2 +- dlp/deleteInspectTemplate.js | 2 +- dlp/deleteJob.js | 2 +- dlp/deleteTrigger.js | 2 +- dlp/getJob.js | 2 +- dlp/inspectBigQuery.js | 4 ++-- dlp/inspectBigQueryTableWithSampling.js | 4 ++-- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 4 ++-- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectFile.js | 6 +++--- dlp/inspectGCSFile.js | 4 ++-- dlp/inspectGcsFileWithSampling.js | 4 ++-- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectImageFile.js | 6 +++--- dlp/inspectImageFileAllInfoTypes.js | 6 +++--- dlp/inspectImageFileListedInfoTypes.js | 6 +++--- dlp/inspectPhoneNumber.js | 2 +- dlp/inspectString.js | 2 +- dlp/inspectStringAugmentInfoType.js | 2 +- dlp/inspectStringCustomExcludingSubstring.js | 2 +- dlp/inspectStringCustomHotword.js | 2 +- dlp/inspectStringCustomOmitOverlap.js | 2 +- dlp/inspectStringMultipleRules.js | 2 +- dlp/inspectStringOmitOverlap.js | 2 +- dlp/inspectStringRep.js | 2 +- dlp/inspectStringWithExclusionDict.js | 2 +- ...inspectStringWithExclusionDictSubstring.js | 2 +- dlp/inspectStringWithExclusionRegex.js | 2 +- dlp/inspectStringWithoutOverlap.js | 2 +- dlp/inspectTable.js | 2 +- dlp/inspectWithCustomHotwords.js | 2 +- dlp/inspectWithCustomRegex.js | 2 +- dlp/inspectWithHotwordRules.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 4 ++-- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 4 ++-- dlp/lDiversityAnalysis.js | 4 ++-- dlp/listInspectTemplates.js | 2 +- dlp/listJobs.js | 2 +- dlp/listTriggers.js | 2 +- dlp/metadata.js | 2 +- dlp/numericalRiskAnalysis.js | 4 ++-- dlp/quickstart.js | 2 +- dlp/redactImage.js | 6 +++--- dlp/redactImageFileAllInfoTypes.js | 6 +++--- dlp/redactImageFileAllText.js | 6 +++--- dlp/redactImageFileColoredInfoTypes.js | 6 +++--- dlp/redactImageFileListedInfoTypes.js | 6 +++--- dlp/redactText.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/reidentifyWithFpe.js | 2 +- dlp/reidentifyWithFpeSurrogate.js | 2 +- dlp/system-test/deid.test.js | 18 ++++++++--------- dlp/system-test/inspect.test.js | 18 ++++++++--------- dlp/system-test/jobs.test.js | 8 ++++---- dlp/system-test/metadata.test.js | 20 +++++++++---------- dlp/system-test/mockdata.js | 4 ++-- dlp/system-test/quickstart.test.js | 8 ++++---- dlp/system-test/redact.test.js | 14 ++++++------- dlp/system-test/risk.test.js | 18 ++++++++--------- dlp/system-test/templates.test.js | 10 +++++----- dlp/system-test/triggers.test.js | 10 +++++----- dlp/updateStoredInfoType.js | 2 +- dlp/updateTrigger.js | 2 +- 95 files changed, 178 insertions(+), 178 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index 16e915a265..ee9ad1eedf 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -30,8 +30,8 @@ async function main( ) { // [START dlp_categorical_stats] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createInspectTemplate.js b/dlp/createInspectTemplate.js index 5e13e694c3..19d93471b7 100644 --- a/dlp/createInspectTemplate.js +++ b/dlp/createInspectTemplate.js @@ -31,7 +31,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_inspect_template] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createJob.js b/dlp/createJob.js index f311c26bb3..dc421b52d4 100644 --- a/dlp/createJob.js +++ b/dlp/createJob.js @@ -21,7 +21,7 @@ function main(projectId, cloudFileUrl) { // [START dlp_create_job] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index 4ee077d3c5..5233ffe192 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -29,7 +29,7 @@ async function main( ) { // [START dlp_create_stored_infotype] // Import the required libraries - const dlp = require('@google-cloud/dlp'); + import dlp from '@google-cloud/dlp'; // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/createTrigger.js b/dlp/createTrigger.js index f4f338d4f4..1fdcb78266 100644 --- a/dlp/createTrigger.js +++ b/dlp/createTrigger.js @@ -34,7 +34,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index bb3cc4ae84..c71ad1ed7a 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_deidentify_cloud_storage] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableBucketing.js b/dlp/deIdentifyTableBucketing.js index 4c8cc2ae69..7f41c398be 100644 --- a/dlp/deIdentifyTableBucketing.js +++ b/dlp/deIdentifyTableBucketing.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_bucketing] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionInfoTypes.js b/dlp/deIdentifyTableConditionInfoTypes.js index 7058a7b373..c05590b01e 100644 --- a/dlp/deIdentifyTableConditionInfoTypes.js +++ b/dlp/deIdentifyTableConditionInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionMasking.js b/dlp/deIdentifyTableConditionMasking.js index 94cfd42b4b..e2e6218ada 100644 --- a/dlp/deIdentifyTableConditionMasking.js +++ b/dlp/deIdentifyTableConditionMasking.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_masking] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableInfoTypes.js b/dlp/deIdentifyTableInfoTypes.js index 4767cb690b..5e00a1871e 100644 --- a/dlp/deIdentifyTableInfoTypes.js +++ b/dlp/deIdentifyTableInfoTypes.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableRowSuppress.js b/dlp/deIdentifyTableRowSuppress.js index e62685b93a..50397613cf 100644 --- a/dlp/deIdentifyTableRowSuppress.js +++ b/dlp/deIdentifyTableRowSuppress.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_row_suppress] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithBucketingConfig.js b/dlp/deIdentifyTableWithBucketingConfig.js index 335a3e6ce9..dc577917a6 100644 --- a/dlp/deIdentifyTableWithBucketingConfig.js +++ b/dlp/deIdentifyTableWithBucketingConfig.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_primitive_bucketing] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithCryptoHash.js b/dlp/deIdentifyTableWithCryptoHash.js index f63c58974e..a84fb6536c 100644 --- a/dlp/deIdentifyTableWithCryptoHash.js +++ b/dlp/deIdentifyTableWithCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKeyName) { // [START dlp_deidentify_table_with_crypto_hash] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index c46c859bcf..0e7afed316 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_deidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithMultipleCryptoHash.js b/dlp/deIdentifyTableWithMultipleCryptoHash.js index d953382b22..853685d2fb 100644 --- a/dlp/deIdentifyTableWithMultipleCryptoHash.js +++ b/dlp/deIdentifyTableWithMultipleCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKey1, transientKey2) { // [START dlp_deidentify_table_with_multiple_crypto_hash] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithExceptionList.js b/dlp/deIdentifyWithExceptionList.js index 717a12be0d..44e7790d17 100644 --- a/dlp/deIdentifyWithExceptionList.js +++ b/dlp/deIdentifyWithExceptionList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_exception_list] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call diff --git a/dlp/deIdentifyWithRedaction.js b/dlp/deIdentifyWithRedaction.js index 8f2d3f20c6..47bde6e99b 100644 --- a/dlp/deIdentifyWithRedaction.js +++ b/dlp/deIdentifyWithRedaction.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_redact] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithReplaceInfoType.js b/dlp/deIdentifyWithReplaceInfoType.js index 08d8301abc..4bf56eeed3 100644 --- a/dlp/deIdentifyWithReplaceInfoType.js +++ b/dlp/deIdentifyWithReplaceInfoType.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = parseInfotypes(infoTypes); // [START dlp_deidentify_replace_infotype] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithSimpleWordList.js b/dlp/deIdentifyWithSimpleWordList.js index dcdb388b84..aa80596a62 100644 --- a/dlp/deIdentifyWithSimpleWordList.js +++ b/dlp/deIdentifyWithSimpleWordList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, customInfoTypeName) { words = words.split(','); // [START dlp_deidentify_simple_word_list] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // TODO(developer): Replace these variables before running the sample. // const projectId = "your-project-id"; diff --git a/dlp/deidentifyWithDateShift.js b/dlp/deidentifyWithDateShift.js index e13d96425d..9fa3c06499 100644 --- a/dlp/deidentifyWithDateShift.js +++ b/dlp/deidentifyWithDateShift.js @@ -33,13 +33,13 @@ function main( dateFields = transformCLI(dateFields); // [START dlp_deidentify_date_shift] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); // Import other required libraries - const fs = require('fs'); + import fs from 'fs'; // The project ID to run the API call under // const projectId = 'my-project'; diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index 09ab7d8f9c..fd4c7513fc 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -29,7 +29,7 @@ async function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDictionaryReplacement.js b/dlp/deidentifyWithDictionaryReplacement.js index 32576dfb96..4bb63c59dc 100644 --- a/dlp/deidentifyWithDictionaryReplacement.js +++ b/dlp/deidentifyWithDictionaryReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, infoTypes, words) { [infoTypes, words] = transformCLI(infoTypes, words); // [START dlp_deidentify_dictionary_replacement] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpe.js b/dlp/deidentifyWithFpe.js index 015b24d7ad..0a8e38c63c 100644 --- a/dlp/deidentifyWithFpe.js +++ b/dlp/deidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, keyName, wrappedKey, surrogateType) { // [START dlp_deidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpeSurrogate.js b/dlp/deidentifyWithFpeSurrogate.js index d2968e60a5..719fe3689a 100644 --- a/dlp/deidentifyWithFpeSurrogate.js +++ b/dlp/deidentifyWithFpeSurrogate.js @@ -29,7 +29,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithMask.js b/dlp/deidentifyWithMask.js index 6e6df7e7ef..9a9acc0f2d 100644 --- a/dlp/deidentifyWithMask.js +++ b/dlp/deidentifyWithMask.js @@ -22,7 +22,7 @@ function main(projectId, string, maskingCharacter, numberToMask) { // [START dlp_deidentify_masking] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithReplacement.js b/dlp/deidentifyWithReplacement.js index 84ead95f20..a42adf7570 100644 --- a/dlp/deidentifyWithReplacement.js +++ b/dlp/deidentifyWithReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, replacement) { // [START dlp_deidentify_replace] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithTimeExtraction.js b/dlp/deidentifyWithTimeExtraction.js index 03c0e5de14..703840b9db 100644 --- a/dlp/deidentifyWithTimeExtraction.js +++ b/dlp/deidentifyWithTimeExtraction.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_time_extract] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteInspectTemplate.js b/dlp/deleteInspectTemplate.js index 61a8021151..52f928708f 100644 --- a/dlp/deleteInspectTemplate.js +++ b/dlp/deleteInspectTemplate.js @@ -22,7 +22,7 @@ function main(projectId, templateName) { // [START dlp_delete_inspect_template] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteJob.js b/dlp/deleteJob.js index 78202468e2..9b0a63ad72 100644 --- a/dlp/deleteJob.js +++ b/dlp/deleteJob.js @@ -20,7 +20,7 @@ function main(projectId, jobName) { // [START dlp_delete_job] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteTrigger.js b/dlp/deleteTrigger.js index 9fca52f798..5d7d5c776e 100644 --- a/dlp/deleteTrigger.js +++ b/dlp/deleteTrigger.js @@ -20,7 +20,7 @@ function main(projectId, triggerId) { // [START dlp_delete_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/getJob.js b/dlp/getJob.js index 19bf9c290b..f8b752a143 100644 --- a/dlp/getJob.js +++ b/dlp/getJob.js @@ -21,7 +21,7 @@ function main(jobName) { // [START dlp_get_job] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index 8737dfd037..b8b75882db 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -33,8 +33,8 @@ async function main( // [START dlp_inspect_bigquery] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index f7f68237f9..213a540609 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -26,8 +26,8 @@ async function main( ) { // [START dlp_inspect_bigquery_with_sampling] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index f321fade71..fad4f424b5 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, dataProjectId, datasetId, tableId) { // [START dlp_inspect_bigquery_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index c1b7fd7526..861d4f6ecb 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -22,7 +22,7 @@ async function main(projectId, string, jobTriggerId) { // [START dlp_inspect_send_data_to_hybrid_job_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 61836027c2..401a598052 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -35,8 +35,8 @@ async function main( // [START dlp_inspect_datastore] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 1237200aa9..1e7fd97464 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, datastoreNamespace, datastoreKind) { // [START dlp_inspect_datastore_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectFile.js b/dlp/inspectFile.js index 26da96e5a7..5090fc00c9 100644 --- a/dlp/inspectFile.js +++ b/dlp/inspectFile.js @@ -30,11 +30,11 @@ function main( // [START dlp_inspect_file] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Import other required libraries - const fs = require('fs'); - const mime = require('mime'); + import fs from 'fs'; + import mime from 'mime'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index 3fd8da73ce..85372afdc6 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -32,8 +32,8 @@ async function main( // [START dlp_inspect_gcs] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index 170b3649c6..42e93aa1f3 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -21,8 +21,8 @@ async function main(projectId, gcsUri, topicId, subscriptionId, infoTypes) { // [START dlp_inspect_gcs_with_sampling] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 0625886665..235a9889b6 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, gcsPath) { // [START dlp_inspect_gcs_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFile.js b/dlp/inspectImageFile.js index 8e6c03c0cd..76c79170c2 100644 --- a/dlp/inspectImageFile.js +++ b/dlp/inspectImageFile.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_file] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); - const mime = require('mime'); - const fs = require('fs'); + import DLP from '@google-cloud/dlp'; + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileAllInfoTypes.js b/dlp/inspectImageFileAllInfoTypes.js index b7e7ad7fc3..0328177664 100644 --- a/dlp/inspectImageFileAllInfoTypes.js +++ b/dlp/inspectImageFileAllInfoTypes.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); - const mime = require('mime'); - const fs = require('fs'); + import DLP from '@google-cloud/dlp'; + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileListedInfoTypes.js b/dlp/inspectImageFileListedInfoTypes.js index 4789ee0e3b..34fb7504d3 100644 --- a/dlp/inspectImageFileListedInfoTypes.js +++ b/dlp/inspectImageFileListedInfoTypes.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); - const mime = require('mime'); - const fs = require('fs'); + import DLP from '@google-cloud/dlp'; + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectPhoneNumber.js b/dlp/inspectPhoneNumber.js index d0db144258..99502338d5 100644 --- a/dlp/inspectPhoneNumber.js +++ b/dlp/inspectPhoneNumber.js @@ -31,7 +31,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_phone_number] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectString.js b/dlp/inspectString.js index cfeda45c5c..b4912e6aa6 100644 --- a/dlp/inspectString.js +++ b/dlp/inspectString.js @@ -32,7 +32,7 @@ function main( // [START dlp_inspect_string] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringAugmentInfoType.js b/dlp/inspectStringAugmentInfoType.js index 95aee9303a..d554aca917 100644 --- a/dlp/inspectStringAugmentInfoType.js +++ b/dlp/inspectStringAugmentInfoType.js @@ -22,7 +22,7 @@ function main(projectId, string, words) { words = words ? words.split(',') : []; // [START dlp_inspect_augment_infotypes] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomExcludingSubstring.js b/dlp/inspectStringCustomExcludingSubstring.js index 12ff24ec78..c96f7f1de1 100644 --- a/dlp/inspectStringCustomExcludingSubstring.js +++ b/dlp/inspectStringCustomExcludingSubstring.js @@ -22,7 +22,7 @@ function main(projectId, string, excludedWords) { excludedWords = excludedWords ? excludedWords.split(',') : []; // [START dlp_inspect_string_custom_excluding_substring] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomHotword.js b/dlp/inspectStringCustomHotword.js index 2dc9edf12b..244efc41d1 100644 --- a/dlp/inspectStringCustomHotword.js +++ b/dlp/inspectStringCustomHotword.js @@ -21,7 +21,7 @@ function main(projectId, string, customHotword) { // [START dlp_inspect_string_custom_hotword] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomOmitOverlap.js b/dlp/inspectStringCustomOmitOverlap.js index 19b8edba29..6461c1075a 100644 --- a/dlp/inspectStringCustomOmitOverlap.js +++ b/dlp/inspectStringCustomOmitOverlap.js @@ -20,7 +20,7 @@ function main(projectId, string) { // [START dlp_inspect_string_custom_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringMultipleRules.js b/dlp/inspectStringMultipleRules.js index de48a6d9a9..157c543f44 100644 --- a/dlp/inspectStringMultipleRules.js +++ b/dlp/inspectStringMultipleRules.js @@ -21,7 +21,7 @@ function main(projectId, string) { // [START dlp_inspect_string_multiple_rules] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringOmitOverlap.js b/dlp/inspectStringOmitOverlap.js index 4a1144d87b..66136e39b8 100644 --- a/dlp/inspectStringOmitOverlap.js +++ b/dlp/inspectStringOmitOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringRep.js b/dlp/inspectStringRep.js index 20a9437650..b5877cd636 100644 --- a/dlp/inspectStringRep.js +++ b/dlp/inspectStringRep.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_string_rep] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Assemble the regional endpoint url using provided rep location const opts = { diff --git a/dlp/inspectStringWithExclusionDict.js b/dlp/inspectStringWithExclusionDict.js index e0e1f15926..f4a4fcb32b 100644 --- a/dlp/inspectStringWithExclusionDict.js +++ b/dlp/inspectStringWithExclusionDict.js @@ -23,7 +23,7 @@ function main(projectId, string, infoTypes, excludedWords) { [infoTypes, excludedWords] = transformCLI(infoTypes, excludedWords); // [START dlp_inspect_string_with_exclusion_dict] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionDictSubstring.js b/dlp/inspectStringWithExclusionDictSubstring.js index 621275f234..37496dfcd5 100644 --- a/dlp/inspectStringWithExclusionDictSubstring.js +++ b/dlp/inspectStringWithExclusionDictSubstring.js @@ -25,7 +25,7 @@ function main(projectId, string, excludedSubstringList) { : []; // [START dlp_inspect_string_with_exclusion_dict_substring] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionRegex.js b/dlp/inspectStringWithExclusionRegex.js index 501b652f10..60bef9ffa6 100644 --- a/dlp/inspectStringWithExclusionRegex.js +++ b/dlp/inspectStringWithExclusionRegex.js @@ -21,7 +21,7 @@ function main(projectId, string, exclusionRegex) { // [START dlp_inspect_string_with_exclusion_regex] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithoutOverlap.js b/dlp/inspectStringWithoutOverlap.js index f8d58f6bf1..14d85132f1 100644 --- a/dlp/inspectStringWithoutOverlap.js +++ b/dlp/inspectStringWithoutOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_without_overlap] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectTable.js b/dlp/inspectTable.js index db86a7c534..b29acd36f7 100644 --- a/dlp/inspectTable.js +++ b/dlp/inspectTable.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_table] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomHotwords.js b/dlp/inspectWithCustomHotwords.js index ea4c0fe6b4..7898a9ace8 100644 --- a/dlp/inspectWithCustomHotwords.js +++ b/dlp/inspectWithCustomHotwords.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_column_values_w_custom_hotwords] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomRegex.js b/dlp/inspectWithCustomRegex.js index 216e883432..183726ddbe 100644 --- a/dlp/inspectWithCustomRegex.js +++ b/dlp/inspectWithCustomRegex.js @@ -22,7 +22,7 @@ function main(projectId, string, customRegex) { // [START dlp_inspect_custom_regex] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithHotwordRules.js b/dlp/inspectWithHotwordRules.js index 2fff8e9428..5d694f6f67 100644 --- a/dlp/inspectWithHotwordRules.js +++ b/dlp/inspectWithHotwordRules.js @@ -32,7 +32,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_hotword_rule] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index f4879651e3..c5afa6a3ac 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, string) { // [START dlp_inspect_with_stored_infotype] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index 0afca9024a..6c415822bf 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -30,8 +30,8 @@ async function main( // [START dlp_k_anonymity] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index fb19595f0b..5e6c103df5 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -21,7 +21,7 @@ async function main(projectId, datasetId, sourceTableId, outputTableId) { // [START dlp_k_anonymity_with_entity_id] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index bb2b804b76..379cf21957 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -32,8 +32,8 @@ async function main( // [START dlp_k_map] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index 84fe1449bf..a5ac40cc4d 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -30,8 +30,8 @@ async function main( quasiIds = transformCLI(quasiIds); // [START dlp_l_diversity] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listInspectTemplates.js b/dlp/listInspectTemplates.js index 73e41aaebc..015e7e05d9 100644 --- a/dlp/listInspectTemplates.js +++ b/dlp/listInspectTemplates.js @@ -20,7 +20,7 @@ function main(projectId) { // [START dlp_list_inspect_templates] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listJobs.js b/dlp/listJobs.js index 41469ed254..87ccee08ac 100644 --- a/dlp/listJobs.js +++ b/dlp/listJobs.js @@ -22,7 +22,7 @@ function main(projectId, filter, jobType) { // [START dlp_list_jobs] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listTriggers.js b/dlp/listTriggers.js index c7fd234a7f..ff04b95ecc 100644 --- a/dlp/listTriggers.js +++ b/dlp/listTriggers.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_list_triggers] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/metadata.js b/dlp/metadata.js index 02cf404666..39a6a0639b 100644 --- a/dlp/metadata.js +++ b/dlp/metadata.js @@ -21,7 +21,7 @@ function main(projectId, languageCode, filter) { // [START dlp_list_info_types] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index 6ea2f66a35..efce7784d1 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -30,8 +30,8 @@ async function main( ) { // [START dlp_numerical_stats] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); - const {PubSub} = require('@google-cloud/pubsub'); + import DLP from '@google-cloud/dlp'; + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/quickstart.js b/dlp/quickstart.js index 0d60c0e433..c76f55dcb5 100644 --- a/dlp/quickstart.js +++ b/dlp/quickstart.js @@ -21,7 +21,7 @@ function main(projectId) { // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // [START dlp_quickstart] diff --git a/dlp/redactImage.js b/dlp/redactImage.js index da893c2e85..42c9473e43 100644 --- a/dlp/redactImage.js +++ b/dlp/redactImage.js @@ -21,11 +21,11 @@ function main(projectId, filepath, minLikelihood, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllInfoTypes.js b/dlp/redactImageFileAllInfoTypes.js index 1890732349..221fb15b31 100644 --- a/dlp/redactImageFileAllInfoTypes.js +++ b/dlp/redactImageFileAllInfoTypes.js @@ -20,11 +20,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllText.js b/dlp/redactImageFileAllText.js index f3ef7a38ee..5a38851a15 100644 --- a/dlp/redactImageFileAllText.js +++ b/dlp/redactImageFileAllText.js @@ -19,11 +19,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_text] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileColoredInfoTypes.js b/dlp/redactImageFileColoredInfoTypes.js index b12625660d..2b15c8fcab 100644 --- a/dlp/redactImageFileColoredInfoTypes.js +++ b/dlp/redactImageFileColoredInfoTypes.js @@ -19,11 +19,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_colored_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileListedInfoTypes.js b/dlp/redactImageFileListedInfoTypes.js index 6945216c9f..2ba7fb7cd7 100644 --- a/dlp/redactImageFileListedInfoTypes.js +++ b/dlp/redactImageFileListedInfoTypes.js @@ -20,11 +20,11 @@ function main(projectId, filepath, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import mime from 'mime'; + import fs from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactText.js b/dlp/redactText.js index 305dcd44b6..4c75476a08 100644 --- a/dlp/redactText.js +++ b/dlp/redactText.js @@ -21,7 +21,7 @@ function main(projectId, string, minLikelihood, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_text] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index 111193e588..c6f17ef2e5 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_reidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index 50e606fd06..7dfa4ddf72 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -28,7 +28,7 @@ async function main( ) { // [START dlp_reidentify_text_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index 5c9f36e92e..37d0039c16 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -21,7 +21,7 @@ async function main(projectId, string, keyName, wrappedKey, surrogateType) { // [START dlp_reidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpe.js b/dlp/reidentifyWithFpe.js index 0fe8e14133..b1f3277500 100644 --- a/dlp/reidentifyWithFpe.js +++ b/dlp/reidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, surrogateType, keyName, wrappedKey) { // [START dlp_reidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpeSurrogate.js b/dlp/reidentifyWithFpeSurrogate.js index 89a28e3975..c242b993f8 100644 --- a/dlp/reidentifyWithFpeSurrogate.js +++ b/dlp/reidentifyWithFpeSurrogate.js @@ -21,7 +21,7 @@ function main(projectId, string, alphabet, surrogateType, unwrappedKey) { // [START dlp_reidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/deid.test.js b/dlp/system-test/deid.test.js index 3cc3a774d0..8597c268c8 100644 --- a/dlp/system-test/deid.test.js +++ b/dlp/system-test/deid.test.js @@ -14,15 +14,15 @@ 'use strict'; -const path = require('path'); -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const fs = require('fs'); -const cp = require('child_process'); -const DLP = require('@google-cloud/dlp'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); -const {MOCK_DATA} = require('./mockdata'); +import path from 'path'; +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import fs from 'fs'; +import cp from 'child_process'; +import DLP from '@google-cloud/dlp'; +import proxyquire from 'proxyquire'; +import sinon from 'sinon'; +import {MOCK_DATA} from './mockdata'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/inspect.test.js b/dlp/system-test/inspect.test.js index 3d51f65817..ee84d4905c 100644 --- a/dlp/system-test/inspect.test.js +++ b/dlp/system-test/inspect.test.js @@ -14,17 +14,17 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before, after, afterEach} = require('mocha'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); -const cp = require('child_process'); -const {PubSub} = require('@google-cloud/pubsub'); +import {assert} from 'chai'; +import {describe, it, before, after, afterEach} from 'mocha'; +import proxyquire from 'proxyquire'; +import sinon from 'sinon'; +import cp from 'child_process'; +import {PubSub} from '@google-cloud/pubsub'; const pubsub = new PubSub(); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); +import uuid from 'uuid'; +import DLP from '@google-cloud/dlp'; -const {MOCK_DATA} = require('./mockdata'); +import {MOCK_DATA} from './mockdata'; const bucket = 'nodejs-dlp-test-bucket'; const dataProject = 'bigquery-public-data'; const datasetId = 'samples'; diff --git a/dlp/system-test/jobs.test.js b/dlp/system-test/jobs.test.js index 8294904ca7..1b55c0d79d 100644 --- a/dlp/system-test/jobs.test.js +++ b/dlp/system-test/jobs.test.js @@ -14,10 +14,10 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const DLP = require('@google-cloud/dlp'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import cp from 'child_process'; +import DLP from '@google-cloud/dlp'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/metadata.test.js b/dlp/system-test/metadata.test.js index 89c02323e9..92183b71f8 100644 --- a/dlp/system-test/metadata.test.js +++ b/dlp/system-test/metadata.test.js @@ -14,16 +14,16 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); -const {Storage} = require('@google-cloud/storage'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); - -const {MOCK_DATA} = require('./mockdata'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import cp from 'child_process'; +import uuid from 'uuid'; +import DLP from '@google-cloud/dlp'; +import {Storage} from '@google-cloud/storage'; +import proxyquire from 'proxyquire'; +import sinon from 'sinon'; + +import {MOCK_DATA} from './mockdata'; const dataProject = 'bigquery-public-data'; const dataSetId = 'samples'; diff --git a/dlp/system-test/mockdata.js b/dlp/system-test/mockdata.js index 5f79ee5752..2df5f79fda 100644 --- a/dlp/system-test/mockdata.js +++ b/dlp/system-test/mockdata.js @@ -14,8 +14,8 @@ 'use strict'; -const DLP = require('@google-cloud/dlp'); -const sinon = require('sinon'); +import DLP from '@google-cloud/dlp'; +import sinon from 'sinon'; /** Mock data for unit test cases. diff --git a/dlp/system-test/quickstart.test.js b/dlp/system-test/quickstart.test.js index 2e000674b7..e670b1584e 100644 --- a/dlp/system-test/quickstart.test.js +++ b/dlp/system-test/quickstart.test.js @@ -14,10 +14,10 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const DLP = require('@google-cloud/dlp'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import cp from 'child_process'; +import DLP from '@google-cloud/dlp'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/redact.test.js b/dlp/system-test/redact.test.js index 2dee0e4028..15884942dd 100644 --- a/dlp/system-test/redact.test.js +++ b/dlp/system-test/redact.test.js @@ -14,13 +14,13 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const fs = require('fs'); -const cp = require('child_process'); -const {PNG} = require('pngjs'); -const pixelmatch = require('pixelmatch'); -const DLP = require('@google-cloud/dlp'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import fs from 'fs'; +import cp from 'child_process'; +import {PNG} from 'pngjs'; +import pixelmatch from 'pixelmatch'; +import DLP from '@google-cloud/dlp'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/risk.test.js b/dlp/system-test/risk.test.js index b3ed576131..8a1fa09cd1 100644 --- a/dlp/system-test/risk.test.js +++ b/dlp/system-test/risk.test.js @@ -14,15 +14,15 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before, after, afterEach} = require('mocha'); -const uuid = require('uuid'); -const {PubSub} = require('@google-cloud/pubsub'); -const DLP = require('@google-cloud/dlp'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); - -const {MOCK_DATA} = require('./mockdata'); +import {assert} from 'chai'; +import {describe, it, before, after, afterEach} from 'mocha'; +import uuid from 'uuid'; +import {PubSub} from '@google-cloud/pubsub'; +import DLP from '@google-cloud/dlp'; +import proxyquire from 'proxyquire'; +import sinon from 'sinon'; + +import {MOCK_DATA} from './mockdata'; const pubsub = new PubSub(); const client = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/templates.test.js b/dlp/system-test/templates.test.js index 16b330d9d6..7e23fe58a0 100644 --- a/dlp/system-test/templates.test.js +++ b/dlp/system-test/templates.test.js @@ -14,11 +14,11 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import cp from 'child_process'; +import uuid from 'uuid'; +import DLP from '@google-cloud/dlp'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/triggers.test.js b/dlp/system-test/triggers.test.js index 3092aa47de..f829c3b859 100644 --- a/dlp/system-test/triggers.test.js +++ b/dlp/system-test/triggers.test.js @@ -14,11 +14,11 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); +import {assert} from 'chai'; +import {describe, it, before} from 'mocha'; +import cp from 'child_process'; +import uuid from 'uuid'; +import DLP from '@google-cloud/dlp'; const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 36a539cab8..81118e006c 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, outputPath, fileSetUrl) { // [START dlp_update_stored_infotype] // Import the required libraries - const dlp = require('@google-cloud/dlp'); + import dlp from '@google-cloud/dlp'; // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/updateTrigger.js b/dlp/updateTrigger.js index 2d2a9b0c5d..5d934605b9 100644 --- a/dlp/updateTrigger.js +++ b/dlp/updateTrigger.js @@ -21,7 +21,7 @@ function main(projectId, jobTriggerName) { // [START dlp_update_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); From 8f8a97b719fc3d0161edfdd98ffc2f7ba0a59b69 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 12:29:33 +1100 Subject: [PATCH 11/22] update type in package.json --- dlp/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/dlp/package.json b/dlp/package.json index 2ba79f42e8..cc0df0a4bb 100644 --- a/dlp/package.json +++ b/dlp/package.json @@ -8,6 +8,7 @@ "files": [ "*.js" ], + "type": "module", "engines": { "node": ">=16.0.0" }, From 51d56037c1acbcd5a39549d2fcab06725d82b346 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 12:48:37 +1100 Subject: [PATCH 12/22] Revert "update type in package.json" This reverts commit 8f8a97b719fc3d0161edfdd98ffc2f7ba0a59b69. --- dlp/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/dlp/package.json b/dlp/package.json index cc0df0a4bb..2ba79f42e8 100644 --- a/dlp/package.json +++ b/dlp/package.json @@ -8,7 +8,6 @@ "files": [ "*.js" ], - "type": "module", "engines": { "node": ">=16.0.0" }, From 5ccdb2bc64a5d83a11357c93b1381d05205901d5 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 12:48:47 +1100 Subject: [PATCH 13/22] Revert "Reapply "debug: bulk update const"" This reverts commit 74654166fbd1e219051e4ec4adf6a9b71aacba6c. --- dlp/categoricalRiskAnalysis.js | 4 ++-- dlp/createInspectTemplate.js | 2 +- dlp/createJob.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/createTrigger.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableBucketing.js | 2 +- dlp/deIdentifyTableConditionInfoTypes.js | 2 +- dlp/deIdentifyTableConditionMasking.js | 2 +- dlp/deIdentifyTableInfoTypes.js | 2 +- dlp/deIdentifyTableRowSuppress.js | 2 +- dlp/deIdentifyTableWithBucketingConfig.js | 2 +- dlp/deIdentifyTableWithCryptoHash.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deIdentifyTableWithMultipleCryptoHash.js | 2 +- dlp/deIdentifyWithExceptionList.js | 2 +- dlp/deIdentifyWithRedaction.js | 2 +- dlp/deIdentifyWithReplaceInfoType.js | 2 +- dlp/deIdentifyWithSimpleWordList.js | 2 +- dlp/deidentifyWithDateShift.js | 4 ++-- dlp/deidentifyWithDeterministic.js | 2 +- dlp/deidentifyWithDictionaryReplacement.js | 2 +- dlp/deidentifyWithFpe.js | 2 +- dlp/deidentifyWithFpeSurrogate.js | 2 +- dlp/deidentifyWithMask.js | 2 +- dlp/deidentifyWithReplacement.js | 2 +- dlp/deidentifyWithTimeExtraction.js | 2 +- dlp/deleteInspectTemplate.js | 2 +- dlp/deleteJob.js | 2 +- dlp/deleteTrigger.js | 2 +- dlp/getJob.js | 2 +- dlp/inspectBigQuery.js | 4 ++-- dlp/inspectBigQueryTableWithSampling.js | 4 ++-- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 4 ++-- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectFile.js | 6 +++--- dlp/inspectGCSFile.js | 4 ++-- dlp/inspectGcsFileWithSampling.js | 4 ++-- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectImageFile.js | 6 +++--- dlp/inspectImageFileAllInfoTypes.js | 6 +++--- dlp/inspectImageFileListedInfoTypes.js | 6 +++--- dlp/inspectPhoneNumber.js | 2 +- dlp/inspectString.js | 2 +- dlp/inspectStringAugmentInfoType.js | 2 +- dlp/inspectStringCustomExcludingSubstring.js | 2 +- dlp/inspectStringCustomHotword.js | 2 +- dlp/inspectStringCustomOmitOverlap.js | 2 +- dlp/inspectStringMultipleRules.js | 2 +- dlp/inspectStringOmitOverlap.js | 2 +- dlp/inspectStringRep.js | 2 +- dlp/inspectStringWithExclusionDict.js | 2 +- ...inspectStringWithExclusionDictSubstring.js | 2 +- dlp/inspectStringWithExclusionRegex.js | 2 +- dlp/inspectStringWithoutOverlap.js | 2 +- dlp/inspectTable.js | 2 +- dlp/inspectWithCustomHotwords.js | 2 +- dlp/inspectWithCustomRegex.js | 2 +- dlp/inspectWithHotwordRules.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 4 ++-- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 4 ++-- dlp/lDiversityAnalysis.js | 4 ++-- dlp/listInspectTemplates.js | 2 +- dlp/listJobs.js | 2 +- dlp/listTriggers.js | 2 +- dlp/metadata.js | 2 +- dlp/numericalRiskAnalysis.js | 4 ++-- dlp/quickstart.js | 2 +- dlp/redactImage.js | 6 +++--- dlp/redactImageFileAllInfoTypes.js | 6 +++--- dlp/redactImageFileAllText.js | 6 +++--- dlp/redactImageFileColoredInfoTypes.js | 6 +++--- dlp/redactImageFileListedInfoTypes.js | 6 +++--- dlp/redactText.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/reidentifyWithFpe.js | 2 +- dlp/reidentifyWithFpeSurrogate.js | 2 +- dlp/system-test/deid.test.js | 18 ++++++++--------- dlp/system-test/inspect.test.js | 18 ++++++++--------- dlp/system-test/jobs.test.js | 8 ++++---- dlp/system-test/metadata.test.js | 20 +++++++++---------- dlp/system-test/mockdata.js | 4 ++-- dlp/system-test/quickstart.test.js | 8 ++++---- dlp/system-test/redact.test.js | 14 ++++++------- dlp/system-test/risk.test.js | 18 ++++++++--------- dlp/system-test/templates.test.js | 10 +++++----- dlp/system-test/triggers.test.js | 10 +++++----- dlp/updateStoredInfoType.js | 2 +- dlp/updateTrigger.js | 2 +- 95 files changed, 178 insertions(+), 178 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index ee9ad1eedf..16e915a265 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -30,8 +30,8 @@ async function main( ) { // [START dlp_categorical_stats] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createInspectTemplate.js b/dlp/createInspectTemplate.js index 19d93471b7..5e13e694c3 100644 --- a/dlp/createInspectTemplate.js +++ b/dlp/createInspectTemplate.js @@ -31,7 +31,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_inspect_template] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createJob.js b/dlp/createJob.js index dc421b52d4..f311c26bb3 100644 --- a/dlp/createJob.js +++ b/dlp/createJob.js @@ -21,7 +21,7 @@ function main(projectId, cloudFileUrl) { // [START dlp_create_job] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index 5233ffe192..4ee077d3c5 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -29,7 +29,7 @@ async function main( ) { // [START dlp_create_stored_infotype] // Import the required libraries - import dlp from '@google-cloud/dlp'; + const dlp = require('@google-cloud/dlp'); // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/createTrigger.js b/dlp/createTrigger.js index 1fdcb78266..f4f338d4f4 100644 --- a/dlp/createTrigger.js +++ b/dlp/createTrigger.js @@ -34,7 +34,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index c71ad1ed7a..bb3cc4ae84 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_deidentify_cloud_storage] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableBucketing.js b/dlp/deIdentifyTableBucketing.js index 7f41c398be..4c8cc2ae69 100644 --- a/dlp/deIdentifyTableBucketing.js +++ b/dlp/deIdentifyTableBucketing.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_bucketing] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionInfoTypes.js b/dlp/deIdentifyTableConditionInfoTypes.js index c05590b01e..7058a7b373 100644 --- a/dlp/deIdentifyTableConditionInfoTypes.js +++ b/dlp/deIdentifyTableConditionInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionMasking.js b/dlp/deIdentifyTableConditionMasking.js index e2e6218ada..94cfd42b4b 100644 --- a/dlp/deIdentifyTableConditionMasking.js +++ b/dlp/deIdentifyTableConditionMasking.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_masking] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableInfoTypes.js b/dlp/deIdentifyTableInfoTypes.js index 5e00a1871e..4767cb690b 100644 --- a/dlp/deIdentifyTableInfoTypes.js +++ b/dlp/deIdentifyTableInfoTypes.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableRowSuppress.js b/dlp/deIdentifyTableRowSuppress.js index 50397613cf..e62685b93a 100644 --- a/dlp/deIdentifyTableRowSuppress.js +++ b/dlp/deIdentifyTableRowSuppress.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_row_suppress] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithBucketingConfig.js b/dlp/deIdentifyTableWithBucketingConfig.js index dc577917a6..335a3e6ce9 100644 --- a/dlp/deIdentifyTableWithBucketingConfig.js +++ b/dlp/deIdentifyTableWithBucketingConfig.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_primitive_bucketing] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithCryptoHash.js b/dlp/deIdentifyTableWithCryptoHash.js index a84fb6536c..f63c58974e 100644 --- a/dlp/deIdentifyTableWithCryptoHash.js +++ b/dlp/deIdentifyTableWithCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKeyName) { // [START dlp_deidentify_table_with_crypto_hash] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index 0e7afed316..c46c859bcf 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_deidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithMultipleCryptoHash.js b/dlp/deIdentifyTableWithMultipleCryptoHash.js index 853685d2fb..d953382b22 100644 --- a/dlp/deIdentifyTableWithMultipleCryptoHash.js +++ b/dlp/deIdentifyTableWithMultipleCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKey1, transientKey2) { // [START dlp_deidentify_table_with_multiple_crypto_hash] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithExceptionList.js b/dlp/deIdentifyWithExceptionList.js index 44e7790d17..717a12be0d 100644 --- a/dlp/deIdentifyWithExceptionList.js +++ b/dlp/deIdentifyWithExceptionList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_exception_list] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call diff --git a/dlp/deIdentifyWithRedaction.js b/dlp/deIdentifyWithRedaction.js index 47bde6e99b..8f2d3f20c6 100644 --- a/dlp/deIdentifyWithRedaction.js +++ b/dlp/deIdentifyWithRedaction.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_redact] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithReplaceInfoType.js b/dlp/deIdentifyWithReplaceInfoType.js index 4bf56eeed3..08d8301abc 100644 --- a/dlp/deIdentifyWithReplaceInfoType.js +++ b/dlp/deIdentifyWithReplaceInfoType.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = parseInfotypes(infoTypes); // [START dlp_deidentify_replace_infotype] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithSimpleWordList.js b/dlp/deIdentifyWithSimpleWordList.js index aa80596a62..dcdb388b84 100644 --- a/dlp/deIdentifyWithSimpleWordList.js +++ b/dlp/deIdentifyWithSimpleWordList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, customInfoTypeName) { words = words.split(','); // [START dlp_deidentify_simple_word_list] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // TODO(developer): Replace these variables before running the sample. // const projectId = "your-project-id"; diff --git a/dlp/deidentifyWithDateShift.js b/dlp/deidentifyWithDateShift.js index 9fa3c06499..e13d96425d 100644 --- a/dlp/deidentifyWithDateShift.js +++ b/dlp/deidentifyWithDateShift.js @@ -33,13 +33,13 @@ function main( dateFields = transformCLI(dateFields); // [START dlp_deidentify_date_shift] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); // Import other required libraries - import fs from 'fs'; + const fs = require('fs'); // The project ID to run the API call under // const projectId = 'my-project'; diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index fd4c7513fc..09ab7d8f9c 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -29,7 +29,7 @@ async function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDictionaryReplacement.js b/dlp/deidentifyWithDictionaryReplacement.js index 4bb63c59dc..32576dfb96 100644 --- a/dlp/deidentifyWithDictionaryReplacement.js +++ b/dlp/deidentifyWithDictionaryReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, infoTypes, words) { [infoTypes, words] = transformCLI(infoTypes, words); // [START dlp_deidentify_dictionary_replacement] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpe.js b/dlp/deidentifyWithFpe.js index 0a8e38c63c..015b24d7ad 100644 --- a/dlp/deidentifyWithFpe.js +++ b/dlp/deidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, keyName, wrappedKey, surrogateType) { // [START dlp_deidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpeSurrogate.js b/dlp/deidentifyWithFpeSurrogate.js index 719fe3689a..d2968e60a5 100644 --- a/dlp/deidentifyWithFpeSurrogate.js +++ b/dlp/deidentifyWithFpeSurrogate.js @@ -29,7 +29,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithMask.js b/dlp/deidentifyWithMask.js index 9a9acc0f2d..6e6df7e7ef 100644 --- a/dlp/deidentifyWithMask.js +++ b/dlp/deidentifyWithMask.js @@ -22,7 +22,7 @@ function main(projectId, string, maskingCharacter, numberToMask) { // [START dlp_deidentify_masking] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithReplacement.js b/dlp/deidentifyWithReplacement.js index a42adf7570..84ead95f20 100644 --- a/dlp/deidentifyWithReplacement.js +++ b/dlp/deidentifyWithReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, replacement) { // [START dlp_deidentify_replace] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithTimeExtraction.js b/dlp/deidentifyWithTimeExtraction.js index 703840b9db..03c0e5de14 100644 --- a/dlp/deidentifyWithTimeExtraction.js +++ b/dlp/deidentifyWithTimeExtraction.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_time_extract] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteInspectTemplate.js b/dlp/deleteInspectTemplate.js index 52f928708f..61a8021151 100644 --- a/dlp/deleteInspectTemplate.js +++ b/dlp/deleteInspectTemplate.js @@ -22,7 +22,7 @@ function main(projectId, templateName) { // [START dlp_delete_inspect_template] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteJob.js b/dlp/deleteJob.js index 9b0a63ad72..78202468e2 100644 --- a/dlp/deleteJob.js +++ b/dlp/deleteJob.js @@ -20,7 +20,7 @@ function main(projectId, jobName) { // [START dlp_delete_job] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteTrigger.js b/dlp/deleteTrigger.js index 5d7d5c776e..9fca52f798 100644 --- a/dlp/deleteTrigger.js +++ b/dlp/deleteTrigger.js @@ -20,7 +20,7 @@ function main(projectId, triggerId) { // [START dlp_delete_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/getJob.js b/dlp/getJob.js index f8b752a143..19bf9c290b 100644 --- a/dlp/getJob.js +++ b/dlp/getJob.js @@ -21,7 +21,7 @@ function main(jobName) { // [START dlp_get_job] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index b8b75882db..8737dfd037 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -33,8 +33,8 @@ async function main( // [START dlp_inspect_bigquery] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index 213a540609..f7f68237f9 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -26,8 +26,8 @@ async function main( ) { // [START dlp_inspect_bigquery_with_sampling] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index fad4f424b5..f321fade71 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, dataProjectId, datasetId, tableId) { // [START dlp_inspect_bigquery_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index 861d4f6ecb..c1b7fd7526 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -22,7 +22,7 @@ async function main(projectId, string, jobTriggerId) { // [START dlp_inspect_send_data_to_hybrid_job_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 401a598052..61836027c2 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -35,8 +35,8 @@ async function main( // [START dlp_inspect_datastore] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 1e7fd97464..1237200aa9 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, datastoreNamespace, datastoreKind) { // [START dlp_inspect_datastore_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectFile.js b/dlp/inspectFile.js index 5090fc00c9..26da96e5a7 100644 --- a/dlp/inspectFile.js +++ b/dlp/inspectFile.js @@ -30,11 +30,11 @@ function main( // [START dlp_inspect_file] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Import other required libraries - import fs from 'fs'; - import mime from 'mime'; + const fs = require('fs'); + const mime = require('mime'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index 85372afdc6..3fd8da73ce 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -32,8 +32,8 @@ async function main( // [START dlp_inspect_gcs] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index 42e93aa1f3..170b3649c6 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -21,8 +21,8 @@ async function main(projectId, gcsUri, topicId, subscriptionId, infoTypes) { // [START dlp_inspect_gcs_with_sampling] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 235a9889b6..0625886665 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, gcsPath) { // [START dlp_inspect_gcs_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFile.js b/dlp/inspectImageFile.js index 76c79170c2..8e6c03c0cd 100644 --- a/dlp/inspectImageFile.js +++ b/dlp/inspectImageFile.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_file] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; - import mime from 'mime'; - import fs from 'fs'; + const DLP = require('@google-cloud/dlp'); + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileAllInfoTypes.js b/dlp/inspectImageFileAllInfoTypes.js index 0328177664..b7e7ad7fc3 100644 --- a/dlp/inspectImageFileAllInfoTypes.js +++ b/dlp/inspectImageFileAllInfoTypes.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; - import mime from 'mime'; - import fs from 'fs'; + const DLP = require('@google-cloud/dlp'); + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileListedInfoTypes.js b/dlp/inspectImageFileListedInfoTypes.js index 34fb7504d3..4789ee0e3b 100644 --- a/dlp/inspectImageFileListedInfoTypes.js +++ b/dlp/inspectImageFileListedInfoTypes.js @@ -21,9 +21,9 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; - import mime from 'mime'; - import fs from 'fs'; + const DLP = require('@google-cloud/dlp'); + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectPhoneNumber.js b/dlp/inspectPhoneNumber.js index 99502338d5..d0db144258 100644 --- a/dlp/inspectPhoneNumber.js +++ b/dlp/inspectPhoneNumber.js @@ -31,7 +31,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_phone_number] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectString.js b/dlp/inspectString.js index b4912e6aa6..cfeda45c5c 100644 --- a/dlp/inspectString.js +++ b/dlp/inspectString.js @@ -32,7 +32,7 @@ function main( // [START dlp_inspect_string] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringAugmentInfoType.js b/dlp/inspectStringAugmentInfoType.js index d554aca917..95aee9303a 100644 --- a/dlp/inspectStringAugmentInfoType.js +++ b/dlp/inspectStringAugmentInfoType.js @@ -22,7 +22,7 @@ function main(projectId, string, words) { words = words ? words.split(',') : []; // [START dlp_inspect_augment_infotypes] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomExcludingSubstring.js b/dlp/inspectStringCustomExcludingSubstring.js index c96f7f1de1..12ff24ec78 100644 --- a/dlp/inspectStringCustomExcludingSubstring.js +++ b/dlp/inspectStringCustomExcludingSubstring.js @@ -22,7 +22,7 @@ function main(projectId, string, excludedWords) { excludedWords = excludedWords ? excludedWords.split(',') : []; // [START dlp_inspect_string_custom_excluding_substring] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomHotword.js b/dlp/inspectStringCustomHotword.js index 244efc41d1..2dc9edf12b 100644 --- a/dlp/inspectStringCustomHotword.js +++ b/dlp/inspectStringCustomHotword.js @@ -21,7 +21,7 @@ function main(projectId, string, customHotword) { // [START dlp_inspect_string_custom_hotword] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomOmitOverlap.js b/dlp/inspectStringCustomOmitOverlap.js index 6461c1075a..19b8edba29 100644 --- a/dlp/inspectStringCustomOmitOverlap.js +++ b/dlp/inspectStringCustomOmitOverlap.js @@ -20,7 +20,7 @@ function main(projectId, string) { // [START dlp_inspect_string_custom_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringMultipleRules.js b/dlp/inspectStringMultipleRules.js index 157c543f44..de48a6d9a9 100644 --- a/dlp/inspectStringMultipleRules.js +++ b/dlp/inspectStringMultipleRules.js @@ -21,7 +21,7 @@ function main(projectId, string) { // [START dlp_inspect_string_multiple_rules] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringOmitOverlap.js b/dlp/inspectStringOmitOverlap.js index 66136e39b8..4a1144d87b 100644 --- a/dlp/inspectStringOmitOverlap.js +++ b/dlp/inspectStringOmitOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringRep.js b/dlp/inspectStringRep.js index b5877cd636..20a9437650 100644 --- a/dlp/inspectStringRep.js +++ b/dlp/inspectStringRep.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_string_rep] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Assemble the regional endpoint url using provided rep location const opts = { diff --git a/dlp/inspectStringWithExclusionDict.js b/dlp/inspectStringWithExclusionDict.js index f4a4fcb32b..e0e1f15926 100644 --- a/dlp/inspectStringWithExclusionDict.js +++ b/dlp/inspectStringWithExclusionDict.js @@ -23,7 +23,7 @@ function main(projectId, string, infoTypes, excludedWords) { [infoTypes, excludedWords] = transformCLI(infoTypes, excludedWords); // [START dlp_inspect_string_with_exclusion_dict] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionDictSubstring.js b/dlp/inspectStringWithExclusionDictSubstring.js index 37496dfcd5..621275f234 100644 --- a/dlp/inspectStringWithExclusionDictSubstring.js +++ b/dlp/inspectStringWithExclusionDictSubstring.js @@ -25,7 +25,7 @@ function main(projectId, string, excludedSubstringList) { : []; // [START dlp_inspect_string_with_exclusion_dict_substring] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionRegex.js b/dlp/inspectStringWithExclusionRegex.js index 60bef9ffa6..501b652f10 100644 --- a/dlp/inspectStringWithExclusionRegex.js +++ b/dlp/inspectStringWithExclusionRegex.js @@ -21,7 +21,7 @@ function main(projectId, string, exclusionRegex) { // [START dlp_inspect_string_with_exclusion_regex] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithoutOverlap.js b/dlp/inspectStringWithoutOverlap.js index 14d85132f1..f8d58f6bf1 100644 --- a/dlp/inspectStringWithoutOverlap.js +++ b/dlp/inspectStringWithoutOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_without_overlap] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectTable.js b/dlp/inspectTable.js index b29acd36f7..db86a7c534 100644 --- a/dlp/inspectTable.js +++ b/dlp/inspectTable.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_table] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomHotwords.js b/dlp/inspectWithCustomHotwords.js index 7898a9ace8..ea4c0fe6b4 100644 --- a/dlp/inspectWithCustomHotwords.js +++ b/dlp/inspectWithCustomHotwords.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_column_values_w_custom_hotwords] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomRegex.js b/dlp/inspectWithCustomRegex.js index 183726ddbe..216e883432 100644 --- a/dlp/inspectWithCustomRegex.js +++ b/dlp/inspectWithCustomRegex.js @@ -22,7 +22,7 @@ function main(projectId, string, customRegex) { // [START dlp_inspect_custom_regex] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithHotwordRules.js b/dlp/inspectWithHotwordRules.js index 5d694f6f67..2fff8e9428 100644 --- a/dlp/inspectWithHotwordRules.js +++ b/dlp/inspectWithHotwordRules.js @@ -32,7 +32,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_hotword_rule] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index c5afa6a3ac..f4879651e3 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, string) { // [START dlp_inspect_with_stored_infotype] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index 6c415822bf..0afca9024a 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -30,8 +30,8 @@ async function main( // [START dlp_k_anonymity] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index 5e6c103df5..fb19595f0b 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -21,7 +21,7 @@ async function main(projectId, datasetId, sourceTableId, outputTableId) { // [START dlp_k_anonymity_with_entity_id] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index 379cf21957..bb2b804b76 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -32,8 +32,8 @@ async function main( // [START dlp_k_map] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index a5ac40cc4d..84fe1449bf 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -30,8 +30,8 @@ async function main( quasiIds = transformCLI(quasiIds); // [START dlp_l_diversity] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listInspectTemplates.js b/dlp/listInspectTemplates.js index 015e7e05d9..73e41aaebc 100644 --- a/dlp/listInspectTemplates.js +++ b/dlp/listInspectTemplates.js @@ -20,7 +20,7 @@ function main(projectId) { // [START dlp_list_inspect_templates] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listJobs.js b/dlp/listJobs.js index 87ccee08ac..41469ed254 100644 --- a/dlp/listJobs.js +++ b/dlp/listJobs.js @@ -22,7 +22,7 @@ function main(projectId, filter, jobType) { // [START dlp_list_jobs] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listTriggers.js b/dlp/listTriggers.js index ff04b95ecc..c7fd234a7f 100644 --- a/dlp/listTriggers.js +++ b/dlp/listTriggers.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_list_triggers] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/metadata.js b/dlp/metadata.js index 39a6a0639b..02cf404666 100644 --- a/dlp/metadata.js +++ b/dlp/metadata.js @@ -21,7 +21,7 @@ function main(projectId, languageCode, filter) { // [START dlp_list_info_types] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index efce7784d1..6ea2f66a35 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -30,8 +30,8 @@ async function main( ) { // [START dlp_numerical_stats] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const DLP = require('@google-cloud/dlp'); + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/quickstart.js b/dlp/quickstart.js index c76f55dcb5..0d60c0e433 100644 --- a/dlp/quickstart.js +++ b/dlp/quickstart.js @@ -21,7 +21,7 @@ function main(projectId) { // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // [START dlp_quickstart] diff --git a/dlp/redactImage.js b/dlp/redactImage.js index 42c9473e43..da893c2e85 100644 --- a/dlp/redactImage.js +++ b/dlp/redactImage.js @@ -21,11 +21,11 @@ function main(projectId, filepath, minLikelihood, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries - import mime from 'mime'; - import fs from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllInfoTypes.js b/dlp/redactImageFileAllInfoTypes.js index 221fb15b31..1890732349 100644 --- a/dlp/redactImageFileAllInfoTypes.js +++ b/dlp/redactImageFileAllInfoTypes.js @@ -20,11 +20,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries - import mime from 'mime'; - import fs from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllText.js b/dlp/redactImageFileAllText.js index 5a38851a15..f3ef7a38ee 100644 --- a/dlp/redactImageFileAllText.js +++ b/dlp/redactImageFileAllText.js @@ -19,11 +19,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_text] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries - import mime from 'mime'; - import fs from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileColoredInfoTypes.js b/dlp/redactImageFileColoredInfoTypes.js index 2b15c8fcab..b12625660d 100644 --- a/dlp/redactImageFileColoredInfoTypes.js +++ b/dlp/redactImageFileColoredInfoTypes.js @@ -19,11 +19,11 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_colored_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries - import mime from 'mime'; - import fs from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileListedInfoTypes.js b/dlp/redactImageFileListedInfoTypes.js index 2ba7fb7cd7..6945216c9f 100644 --- a/dlp/redactImageFileListedInfoTypes.js +++ b/dlp/redactImageFileListedInfoTypes.js @@ -20,11 +20,11 @@ function main(projectId, filepath, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries - import mime from 'mime'; - import fs from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactText.js b/dlp/redactText.js index 4c75476a08..305dcd44b6 100644 --- a/dlp/redactText.js +++ b/dlp/redactText.js @@ -21,7 +21,7 @@ function main(projectId, string, minLikelihood, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_text] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index c6f17ef2e5..111193e588 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_reidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index 7dfa4ddf72..50e606fd06 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -28,7 +28,7 @@ async function main( ) { // [START dlp_reidentify_text_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index 37d0039c16..5c9f36e92e 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -21,7 +21,7 @@ async function main(projectId, string, keyName, wrappedKey, surrogateType) { // [START dlp_reidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpe.js b/dlp/reidentifyWithFpe.js index b1f3277500..0fe8e14133 100644 --- a/dlp/reidentifyWithFpe.js +++ b/dlp/reidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, surrogateType, keyName, wrappedKey) { // [START dlp_reidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpeSurrogate.js b/dlp/reidentifyWithFpeSurrogate.js index c242b993f8..89a28e3975 100644 --- a/dlp/reidentifyWithFpeSurrogate.js +++ b/dlp/reidentifyWithFpeSurrogate.js @@ -21,7 +21,7 @@ function main(projectId, string, alphabet, surrogateType, unwrappedKey) { // [START dlp_reidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/deid.test.js b/dlp/system-test/deid.test.js index 8597c268c8..3cc3a774d0 100644 --- a/dlp/system-test/deid.test.js +++ b/dlp/system-test/deid.test.js @@ -14,15 +14,15 @@ 'use strict'; -import path from 'path'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import fs from 'fs'; -import cp from 'child_process'; -import DLP from '@google-cloud/dlp'; -import proxyquire from 'proxyquire'; -import sinon from 'sinon'; -import {MOCK_DATA} from './mockdata'; +const path = require('path'); +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const fs = require('fs'); +const cp = require('child_process'); +const DLP = require('@google-cloud/dlp'); +const proxyquire = require('proxyquire'); +const sinon = require('sinon'); +const {MOCK_DATA} = require('./mockdata'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/inspect.test.js b/dlp/system-test/inspect.test.js index ee84d4905c..3d51f65817 100644 --- a/dlp/system-test/inspect.test.js +++ b/dlp/system-test/inspect.test.js @@ -14,17 +14,17 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before, after, afterEach} from 'mocha'; -import proxyquire from 'proxyquire'; -import sinon from 'sinon'; -import cp from 'child_process'; -import {PubSub} from '@google-cloud/pubsub'; +const {assert} = require('chai'); +const {describe, it, before, after, afterEach} = require('mocha'); +const proxyquire = require('proxyquire'); +const sinon = require('sinon'); +const cp = require('child_process'); +const {PubSub} = require('@google-cloud/pubsub'); const pubsub = new PubSub(); -import uuid from 'uuid'; -import DLP from '@google-cloud/dlp'; +const uuid = require('uuid'); +const DLP = require('@google-cloud/dlp'); -import {MOCK_DATA} from './mockdata'; +const {MOCK_DATA} = require('./mockdata'); const bucket = 'nodejs-dlp-test-bucket'; const dataProject = 'bigquery-public-data'; const datasetId = 'samples'; diff --git a/dlp/system-test/jobs.test.js b/dlp/system-test/jobs.test.js index 1b55c0d79d..8294904ca7 100644 --- a/dlp/system-test/jobs.test.js +++ b/dlp/system-test/jobs.test.js @@ -14,10 +14,10 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import cp from 'child_process'; -import DLP from '@google-cloud/dlp'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const cp = require('child_process'); +const DLP = require('@google-cloud/dlp'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/metadata.test.js b/dlp/system-test/metadata.test.js index 92183b71f8..89c02323e9 100644 --- a/dlp/system-test/metadata.test.js +++ b/dlp/system-test/metadata.test.js @@ -14,16 +14,16 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import cp from 'child_process'; -import uuid from 'uuid'; -import DLP from '@google-cloud/dlp'; -import {Storage} from '@google-cloud/storage'; -import proxyquire from 'proxyquire'; -import sinon from 'sinon'; - -import {MOCK_DATA} from './mockdata'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const cp = require('child_process'); +const uuid = require('uuid'); +const DLP = require('@google-cloud/dlp'); +const {Storage} = require('@google-cloud/storage'); +const proxyquire = require('proxyquire'); +const sinon = require('sinon'); + +const {MOCK_DATA} = require('./mockdata'); const dataProject = 'bigquery-public-data'; const dataSetId = 'samples'; diff --git a/dlp/system-test/mockdata.js b/dlp/system-test/mockdata.js index 2df5f79fda..5f79ee5752 100644 --- a/dlp/system-test/mockdata.js +++ b/dlp/system-test/mockdata.js @@ -14,8 +14,8 @@ 'use strict'; -import DLP from '@google-cloud/dlp'; -import sinon from 'sinon'; +const DLP = require('@google-cloud/dlp'); +const sinon = require('sinon'); /** Mock data for unit test cases. diff --git a/dlp/system-test/quickstart.test.js b/dlp/system-test/quickstart.test.js index e670b1584e..2e000674b7 100644 --- a/dlp/system-test/quickstart.test.js +++ b/dlp/system-test/quickstart.test.js @@ -14,10 +14,10 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import cp from 'child_process'; -import DLP from '@google-cloud/dlp'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const cp = require('child_process'); +const DLP = require('@google-cloud/dlp'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/redact.test.js b/dlp/system-test/redact.test.js index 15884942dd..2dee0e4028 100644 --- a/dlp/system-test/redact.test.js +++ b/dlp/system-test/redact.test.js @@ -14,13 +14,13 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import fs from 'fs'; -import cp from 'child_process'; -import {PNG} from 'pngjs'; -import pixelmatch from 'pixelmatch'; -import DLP from '@google-cloud/dlp'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const fs = require('fs'); +const cp = require('child_process'); +const {PNG} = require('pngjs'); +const pixelmatch = require('pixelmatch'); +const DLP = require('@google-cloud/dlp'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/risk.test.js b/dlp/system-test/risk.test.js index 8a1fa09cd1..b3ed576131 100644 --- a/dlp/system-test/risk.test.js +++ b/dlp/system-test/risk.test.js @@ -14,15 +14,15 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before, after, afterEach} from 'mocha'; -import uuid from 'uuid'; -import {PubSub} from '@google-cloud/pubsub'; -import DLP from '@google-cloud/dlp'; -import proxyquire from 'proxyquire'; -import sinon from 'sinon'; - -import {MOCK_DATA} from './mockdata'; +const {assert} = require('chai'); +const {describe, it, before, after, afterEach} = require('mocha'); +const uuid = require('uuid'); +const {PubSub} = require('@google-cloud/pubsub'); +const DLP = require('@google-cloud/dlp'); +const proxyquire = require('proxyquire'); +const sinon = require('sinon'); + +const {MOCK_DATA} = require('./mockdata'); const pubsub = new PubSub(); const client = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/templates.test.js b/dlp/system-test/templates.test.js index 7e23fe58a0..16b330d9d6 100644 --- a/dlp/system-test/templates.test.js +++ b/dlp/system-test/templates.test.js @@ -14,11 +14,11 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import cp from 'child_process'; -import uuid from 'uuid'; -import DLP from '@google-cloud/dlp'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const cp = require('child_process'); +const uuid = require('uuid'); +const DLP = require('@google-cloud/dlp'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/system-test/triggers.test.js b/dlp/system-test/triggers.test.js index f829c3b859..3092aa47de 100644 --- a/dlp/system-test/triggers.test.js +++ b/dlp/system-test/triggers.test.js @@ -14,11 +14,11 @@ 'use strict'; -import {assert} from 'chai'; -import {describe, it, before} from 'mocha'; -import cp from 'child_process'; -import uuid from 'uuid'; -import DLP from '@google-cloud/dlp'; +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const cp = require('child_process'); +const uuid = require('uuid'); +const DLP = require('@google-cloud/dlp'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 81118e006c..36a539cab8 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, outputPath, fileSetUrl) { // [START dlp_update_stored_infotype] // Import the required libraries - import dlp from '@google-cloud/dlp'; + const dlp = require('@google-cloud/dlp'); // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/updateTrigger.js b/dlp/updateTrigger.js index 5d934605b9..2d2a9b0c5d 100644 --- a/dlp/updateTrigger.js +++ b/dlp/updateTrigger.js @@ -21,7 +21,7 @@ function main(projectId, jobTriggerName) { // [START dlp_update_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); From 74a6ba119acc21d254fc4e758908824e8c10305f Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Feb 2025 12:49:06 +1100 Subject: [PATCH 14/22] Revert "Reapply "debug: bulk update exports"" This reverts commit b98e04d252ac48c2b0c819adc5468e2dbb7eb58b. --- dlp/categoricalRiskAnalysis.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deidentifyWithDeterministic.js | 2 +- dlp/inspectBigQuery.js | 2 +- dlp/inspectBigQueryTableWithSampling.js | 2 +- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 2 +- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectGCSFile.js | 2 +- dlp/inspectGcsFileWithSampling.js | 2 +- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 2 +- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 2 +- dlp/lDiversityAnalysis.js | 2 +- dlp/numericalRiskAnalysis.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/updateStoredInfoType.js | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index 16e915a265..7a7406272c 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -162,4 +162,4 @@ process.on('unhandledRejection', err => { process.exitCode = 1; }); -export default main; +module.exports = main; diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index 4ee077d3c5..672f99464c 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -111,4 +111,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index bb3cc4ae84..a876ce18c8 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -172,4 +172,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index c46c859bcf..fd71f7e766 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -129,4 +129,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index 09ab7d8f9c..0793fff4d6 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -125,4 +125,4 @@ function transformCLI(infoTypes) { : undefined; } -export default main; +module.exports = main; diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index 8737dfd037..e4dafda269 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -196,4 +196,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -export default main; +module.exports = main; diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index f7f68237f9..f03cdb8168 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -166,4 +166,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index f321fade71..c2259fd634 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -139,4 +139,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index c1b7fd7526..cbcf4091e4 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -134,4 +134,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 61836027c2..1dfe29b954 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -199,4 +199,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -export default main; +module.exports = main; diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 1237200aa9..5d5084e704 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -135,4 +135,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index 3fd8da73ce..6cce718136 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -188,4 +188,4 @@ function transformCLI(infoTypes, customInfoTypes) { return [infoTypes, customInfoTypes]; } -export default main; +module.exports = main; diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index 170b3649c6..5df7fdad70 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -164,4 +164,4 @@ function transformCLI(infoTypes) { : undefined; } -export default main; +module.exports = main; diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 0625886665..57297b03bc 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -126,4 +126,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index f4879651e3..3295fc5267 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -88,4 +88,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index 0afca9024a..c5ecdcb81c 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -167,4 +167,4 @@ function transformCLI(quasiIds) { return quasiIds; } -export default main; +module.exports = main; diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index fb19595f0b..fa42e563d4 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -147,4 +147,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index bb2b804b76..19eb01fa04 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -181,4 +181,4 @@ function transformCLI(quasiIds, infoTypes) { return quasiIds; } -export default main; +module.exports = main; diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index 84fe1449bf..4c585e7488 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -182,4 +182,4 @@ function transformCLI(quasiIds) { return quasiIds; } -export default main; +module.exports = main; diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index 6ea2f66a35..03cab40db5 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -163,4 +163,4 @@ process.on('unhandledRejection', err => { process.exitCode = 1; }); -export default main; +module.exports = main; diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index 111193e588..61d04f3272 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -107,4 +107,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index 50e606fd06..b8bfee6547 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -120,4 +120,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index 5c9f36e92e..f4291dd092 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -111,4 +111,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 36a539cab8..6c6756f122 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -80,4 +80,4 @@ process.on('unhandledRejection', err => { // TODO(developer): Please uncomment below line before running sample // main(...process.argv.slice(2)); -export default main; +module.exports = main; From a43a5760f913687a03f8170bc26505c189d885fc Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 4 Mar 2025 10:58:50 +1100 Subject: [PATCH 15/22] add test to dev --- .github/config/nodejs-dev.jsonc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/config/nodejs-dev.jsonc b/.github/config/nodejs-dev.jsonc index b730c11468..164f9c9a71 100644 --- a/.github/config/nodejs-dev.jsonc +++ b/.github/config/nodejs-dev.jsonc @@ -42,7 +42,7 @@ ".kokoro/", ".prettierignore", ".prettierrc.js", - "cloud-samples-tools", // checked out by GH action in ci-*.yml + "cloud-samples-tools", // checked out by GH action in ci-*.yml "CODEOWNERS", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", @@ -103,6 +103,7 @@ "datalabeling", "dialogflow", "discoveryengine", + "dlp", "document-warehouse", "endpoints/getting-started", "endpoints/getting-started-grpc", From 3d3e63c8ab0fbbcbff75294917db151c7df5c8e7 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Thu, 6 Mar 2025 13:34:40 +1100 Subject: [PATCH 16/22] migrate to esmodules --- dlp/package.json | 1 + dlp/system-test/deid.test.js | 163 ++++---- dlp/system-test/inspect.test.js | 598 ++++++++++++++--------------- dlp/system-test/jobs.test.js | 14 +- dlp/system-test/metadata.test.js | 76 ++-- dlp/system-test/mockdata.js | 60 +-- dlp/system-test/quickstart.test.js | 12 +- dlp/system-test/redact.test.js | 20 +- dlp/system-test/risk.test.js | 350 ++++++++--------- dlp/system-test/templates.test.js | 18 +- dlp/system-test/triggers.test.js | 22 +- 11 files changed, 651 insertions(+), 683 deletions(-) diff --git a/dlp/package.json b/dlp/package.json index 2ba79f42e8..cc0df0a4bb 100644 --- a/dlp/package.json +++ b/dlp/package.json @@ -8,6 +8,7 @@ "files": [ "*.js" ], + "type": "module", "engines": { "node": ">=16.0.0" }, diff --git a/dlp/system-test/deid.test.js b/dlp/system-test/deid.test.js index 3cc3a774d0..98891285f5 100644 --- a/dlp/system-test/deid.test.js +++ b/dlp/system-test/deid.test.js @@ -14,23 +14,23 @@ 'use strict'; -const path = require('path'); -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const fs = require('fs'); -const cp = require('child_process'); -const DLP = require('@google-cloud/dlp'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); -const {MOCK_DATA} = require('./mockdata'); - -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +import { join } from 'path'; +import { assert } from 'chai'; +import { describe, it, before } from 'mocha'; +import { readFileSync } from 'fs'; +import { execSync as _execSync } from 'child_process'; +import DLP, { DlpServiceClient } from '@google-cloud/dlp'; +import proxyquire from 'proxyquire'; +import { restore, stub, replace, assert as _assert, fake } from 'sinon'; +import { MOCK_DATA } from './mockdata'; + +const execSync = cmd => _execSync(cmd, {encoding: 'utf-8'}); const harmfulString = 'My SSN is 372819127'; const harmlessString = 'My favorite color is blue'; const surrogateType = 'SSN_TOKEN'; const csvFile = 'resources/dates.csv'; -const tempOutputFile = path.join(__dirname, 'temp.result.csv'); +const tempOutputFile = join(__dirname, 'temp.result.csv'); const dateShiftAmount = 30; const dateFields = 'birth_date,register_date'; const keyName = 'KEY_NAME'; @@ -46,7 +46,7 @@ const deidentifyTemplateId = 'MOCK_DEIDENTIFY_TEMPLATE'; const structuredDeidentifyTemplateId = 'MOCK_STRUCTURED_ DEIDENTIFY_TEMPLATE'; const imageRedactTemplateId = 'MOCK_IMAGE_REDACT_TEMPLATE'; -const client = new DLP.DlpServiceClient(); +const client = new DlpServiceClient(); describe('deid', () => { let projectId; @@ -55,7 +55,7 @@ describe('deid', () => { }); afterEach(async () => { - sinon.restore(); + restore(); }); // deidentify_masking @@ -110,8 +110,8 @@ describe('deid', () => { `Successfully saved date-shift output to ${outputCsvFile}` ); assert.notInclude( - fs.readFileSync(outputCsvFile).toString(), - fs.readFileSync(csvFile).toString() + readFileSync(outputCsvFile).toString(), + readFileSync(csvFile).toString() ); }); @@ -387,16 +387,15 @@ describe('deid', () => { wrappedKey ); - const mockDeidentifyContent = sinon - .stub() + const mockDeidentifyContent = stub() .resolves(CONSTANT_DATA.RESPONSE_DEIDENTIFY_CONTENT); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'deidentifyContent', mockDeidentifyContent ); - sinon.replace(console, 'log', () => sinon.stub()); + replace(console, 'log', () => stub()); const deIdentifyTableWithFpe = proxyquire('../deIdentifyTableWithFpe', { '@google-cloud/dlp': {DLP: DLP}, @@ -404,20 +403,20 @@ describe('deid', () => { await deIdentifyTableWithFpe(projectId, 'NUMERIC', keyName, wrappedKey); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockDeidentifyContent, CONSTANT_DATA.REQUEST_DEIDENTIFY_CONTENT ); }); it('should handle de-identification errors', async () => { - const mockDeidentifyContent = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockDeidentifyContent = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'deidentifyContent', mockDeidentifyContent ); - sinon.replace(console, 'log', () => sinon.stub()); + replace(console, 'log', () => stub()); const deIdentifyTableWithFpe = proxyquire('../deIdentifyTableWithFpe', { '@google-cloud/dlp': {DLP: DLP}, @@ -494,16 +493,15 @@ describe('deid', () => { 'EMAIL_ADDRESS_TOKEN' ); - const mockDeidentifyContent = sinon - .stub() + const mockDeidentifyContent = stub() .resolves(CONSTANT_DATA.RESPONSE_DEIDENTIFY_CONTENT); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'deidentifyContent', mockDeidentifyContent ); - sinon.replace(console, 'log', () => sinon.stub()); + replace(console, 'log', () => stub()); const deIdentifyWithDeterministic = proxyquire( '../deidentifyWithDeterministic.js', @@ -521,7 +519,7 @@ describe('deid', () => { 'EMAIL_ADDRESS_TOKEN' ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockDeidentifyContent, CONSTANT_DATA.REQUEST_DEIDENTIFY_CONTENT ); @@ -531,14 +529,14 @@ describe('deid', () => { const string = 'My name is Alicia Abernathy, and my email address is aabernathy@example.com.'; - const mockDeidentifyContent = sinon.stub().rejects(new Error('Failed')); + const mockDeidentifyContent = stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'deidentifyContent', mockDeidentifyContent ); - sinon.replace(console, 'log', () => sinon.stub()); + replace(console, 'log', () => stub()); const deIdentifyWithDeterministic = proxyquire( '../deidentifyWithDeterministic.js', @@ -573,16 +571,15 @@ describe('deid', () => { 'EMAIL_ADDRESS_TOKEN' ); - const mockReidentifyContent = sinon - .stub() + const mockReidentifyContent = stub() .resolves(CONSTANT_DATA.RESPONSE_REIDENTIFY_CONTENT); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'reidentifyContent', mockReidentifyContent ); - sinon.replace(console, 'log', () => sinon.stub()); + replace(console, 'log', () => stub()); const reIdentifyWithDeterministic = proxyquire( '../reidentifyWithDeterministic.js', @@ -599,7 +596,7 @@ describe('deid', () => { 'EMAIL_ADDRESS_TOKEN' ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockReidentifyContent, CONSTANT_DATA.REQUEST_REIDENTIFY_CONTENT ); @@ -609,14 +606,14 @@ describe('deid', () => { const string = 'My name is Alicia Abernathy, and my email address is EMAIL_ADDRESS_TOKEN'; - const mockReidentifyContent = sinon.stub().rejects(new Error('Failed')); + const mockReidentifyContent = stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'reidentifyContent', mockReidentifyContent ); - sinon.replace(console, 'log', () => sinon.stub()); + replace(console, 'log', () => stub()); const reIdentifyWithDeterministic = proxyquire( '../reidentifyWithDeterministic.js', @@ -701,16 +698,15 @@ describe('deid', () => { wrappedKey ); - const mockReidentifyContent = sinon - .stub() + const mockReidentifyContent = stub() .resolves(CONSTANT_DATA.RESPONSE_REIDENTIFY_CONTENT); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'reidentifyContent', mockReidentifyContent ); - sinon.replace(console, 'log', () => sinon.stub()); + replace(console, 'log', () => stub()); const reIdentifyTableWithFpe = proxyquire('../reidentifyTableWithFpe', { '@google-cloud/dlp': {DLP: DLP}, @@ -718,20 +714,20 @@ describe('deid', () => { await reIdentifyTableWithFpe(projectId, 'NUMERIC', keyName, wrappedKey); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockReidentifyContent, CONSTANT_DATA.REQUEST_REIDENTIFY_CONTENT ); }); it('should handle re-identification errors', async () => { - const mockReidentifyContent = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockReidentifyContent = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'reidentifyContent', mockReidentifyContent ); - sinon.replace(console, 'log', () => sinon.stub()); + replace(console, 'log', () => stub()); const reIdentifyTableWithFpe = proxyquire('../reidentifyTableWithFpe', { '@google-cloud/dlp': {DLP: DLP}, @@ -756,16 +752,15 @@ describe('deid', () => { 'PHONE_TOKEN' ); - const mockReidentifyContent = sinon - .stub() + const mockReidentifyContent = stub() .resolves(CONSTANT_DATA.RESPONSE_REIDENTIFY_CONTENT); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'reidentifyContent', mockReidentifyContent ); - sinon.replace(console, 'log', () => sinon.stub()); + replace(console, 'log', () => stub()); const reIdentifyTextWithFpe = proxyquire('../reidentifyTextWithFpe', { '@google-cloud/dlp': {DLP: DLP}, @@ -780,21 +775,21 @@ describe('deid', () => { 'PHONE_TOKEN' ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockReidentifyContent, CONSTANT_DATA.REQUEST_REIDENTIFY_CONTENT ); }); it('should handle re-identification errors', async () => { - const mockReidentifyContent = sinon.stub().rejects(new Error('Failed')); + const mockReidentifyContent = stub().rejects(new Error('Failed')); const text = 'My phone number is PHONE_TOKEN(10):9617256398'; - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'reidentifyContent', mockReidentifyContent ); - sinon.replace(console, 'log', () => sinon.stub()); + replace(console, 'log', () => stub()); const reIdentifyTextWithFpe = proxyquire('../reidentifyTextWithFpe', { '@google-cloud/dlp': {DLP: DLP}, @@ -927,19 +922,19 @@ describe('deid', () => { imageRedactTemplateId, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const deIdentifyCloudStorage = proxyquire('../deIdentifyCloudStorage', { '@google-cloud/dlp': {DLP: DLP}, @@ -955,11 +950,11 @@ describe('deid', () => { structuredDeidentifyTemplateId, imageRedactTemplateId ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle error if inspect cloud storage job fails', async () => { @@ -975,19 +970,19 @@ describe('deid', () => { imageRedactTemplateId, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_FAILED ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const deIdentifyCloudStorage = proxyquire('../deIdentifyCloudStorage', { '@google-cloud/dlp': {DLP: DLP}, @@ -1003,8 +998,8 @@ describe('deid', () => { structuredDeidentifyTemplateId, imageRedactTemplateId ); - sinon.assert.calledOnce(mockGetDlpJob); - sinon.assert.calledWithMatch( + _assert.calledOnce(mockGetDlpJob); + _assert.calledWithMatch( mockConsoleLog, 'Job Failed, Please check the configuration.' ); diff --git a/dlp/system-test/inspect.test.js b/dlp/system-test/inspect.test.js index 3d51f65817..c29a997e55 100644 --- a/dlp/system-test/inspect.test.js +++ b/dlp/system-test/inspect.test.js @@ -14,25 +14,25 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before, after, afterEach} = require('mocha'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); -const cp = require('child_process'); -const {PubSub} = require('@google-cloud/pubsub'); +import { assert } from 'chai'; +import { describe, it, before, after, afterEach } from 'mocha'; +import proxyquire from 'proxyquire'; +import { restore, stub, replace, fake, assert as _assert } from 'sinon'; +import { execSync as _execSync } from 'child_process'; +import { PubSub } from '@google-cloud/pubsub'; const pubsub = new PubSub(); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); +import { v4 } from 'uuid'; +import DLP, { DlpServiceClient, protos } from '@google-cloud/dlp'; -const {MOCK_DATA} = require('./mockdata'); +import { MOCK_DATA } from './mockdata'; const bucket = 'nodejs-dlp-test-bucket'; const dataProject = 'bigquery-public-data'; const datasetId = 'samples'; const tableId = 'github_nested'; -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = cmd => _execSync(cmd, {encoding: 'utf-8'}); -const client = new DLP.DlpServiceClient(); +const client = new DlpServiceClient(); describe('inspect', () => { let projectId; @@ -40,8 +40,8 @@ describe('inspect', () => { projectId = await client.getProjectId(); }); let topic, subscription, jobName; - const topicName = `dlp-inspect-topic-${uuid.v4()}`; - const subscriptionName = `dlp-inspect-subscription-${uuid.v4()}`; + const topicName = `dlp-inspect-topic-${v4()}`; + const subscriptionName = `dlp-inspect-subscription-${v4()}`; before(async () => { [topic] = await pubsub.createTopic(topicName); [subscription] = await topic.createSubscription(subscriptionName); @@ -55,7 +55,7 @@ describe('inspect', () => { // Delete DLP job created in the snippets. afterEach(async () => { - sinon.restore(); + restore(); if (!jobName) return; const request = { name: jobName, @@ -465,19 +465,18 @@ describe('inspect', () => { topicName, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -486,13 +485,13 @@ describe('inspect', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', () => sinon.stub()); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', () => stub()); const inspectBigqueryWithSampling = proxyquire( '../inspectBigQueryTableWithSampling', { @@ -512,11 +511,11 @@ describe('inspect', () => { topicName, subscriptionName ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle errors while creating inspection job', async () => { @@ -529,22 +528,20 @@ describe('inspect', () => { topicName, jobName ); - const mockCreateDlpJob = sinon - .stub() + const mockCreateDlpJob = stub() .rejects(new Error('Error while creating job')); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -553,15 +550,15 @@ describe('inspect', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockErrorHandler = sinon.stub(); - sinon.replace(process, 'on', mockErrorHandler); - sinon.replace(console, 'log', () => sinon.stub()); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockErrorHandler = stub(); + replace(process, 'on', mockErrorHandler); + replace(console, 'log', () => stub()); const inspectBigqueryWithSampling = proxyquire( '../inspectBigQueryTableWithSampling', { @@ -585,8 +582,8 @@ describe('inspect', () => { } catch (error) { console.log(error); } - sinon.assert.calledOnce(mockErrorHandler); - sinon.assert.notCalled(mockGetDlpJob); + _assert.calledOnce(mockErrorHandler); + _assert.notCalled(mockGetDlpJob); }); // dlp_inspect_string_multiple_rules @@ -643,19 +640,18 @@ describe('inspect', () => { infoTypes, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -664,13 +660,13 @@ describe('inspect', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', () => sinon.stub()); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', () => stub()); const inspectGcsWithSampling = proxyquire('../inspectGcsFileWithSampling', { '@google-cloud/dlp': {DLP: DLP}, @@ -684,11 +680,11 @@ describe('inspect', () => { subscriptionName, 'PERSON_NAME' ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle error while inspecting GCS file', async () => { @@ -702,19 +698,18 @@ describe('inspect', () => { infoTypes, jobName ); - const mockCreateDlpJob = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -723,13 +718,13 @@ describe('inspect', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', () => sinon.stub()); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', () => stub()); const inspectGcsWithSampling = proxyquire('../inspectGcsFileWithSampling', { '@google-cloud/dlp': {DLP: DLP}, @@ -884,30 +879,30 @@ describe('inspect', () => { gcsUri, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const inspectGcsSendToScc = proxyquire('../inspectGcsSendToScc', { '@google-cloud/dlp': {DLP: DLP}, }); await inspectGcsSendToScc(projectId, gcsUri); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle error if inspect job results into failure', async () => { @@ -918,27 +913,27 @@ describe('inspect', () => { gcsUri, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_FAILED ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const inspectGcsSendToScc = proxyquire('../inspectGcsSendToScc', { '@google-cloud/dlp': {DLP: DLP}, }); await inspectGcsSendToScc(projectId, gcsUri); - sinon.assert.calledOnce(mockGetDlpJob); - sinon.assert.calledWithMatch( + _assert.calledOnce(mockGetDlpJob); + _assert.calledWithMatch( mockConsoleLog, 'Job Failed, Please check the configuration.' ); @@ -954,30 +949,30 @@ describe('inspect', () => { tableId, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const inspectBigquerySendToScc = proxyquire('../inspectBigquerySendToScc', { '@google-cloud/dlp': {DLP: DLP}, }); await inspectBigquerySendToScc(projectId, dataProject, datasetId, tableId); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle error if inspect job results into failure', async () => { @@ -989,27 +984,27 @@ describe('inspect', () => { tableId, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_FAILED ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const inspectBigQuerySendToScc = proxyquire('../inspectBigquerySendToScc', { '@google-cloud/dlp': {DLP: DLP}, }); await inspectBigQuerySendToScc(projectId, dataProject, datasetId, tableId); - sinon.assert.calledOnce(mockGetDlpJob); - sinon.assert.calledWithMatch( + _assert.calledOnce(mockGetDlpJob); + _assert.calledWithMatch( mockConsoleLog, 'Job Failed, Please check the configuration.' ); @@ -1026,19 +1021,19 @@ describe('inspect', () => { datastoreKind, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const inspectDatastoreSendToScc = proxyquire( '../inspectDatastoreSendToScc', @@ -1052,11 +1047,11 @@ describe('inspect', () => { datastoreNamespace, datastoreKind ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle error if inspect job results into failure', async () => { @@ -1069,19 +1064,19 @@ describe('inspect', () => { datastoreKind, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_FAILED ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const inspectDatastoreSendToScc = proxyquire( '../inspectDatastoreSendToScc', @@ -1095,8 +1090,8 @@ describe('inspect', () => { datastoreNamespace, datastoreKind ); - sinon.assert.calledOnce(mockGetDlpJob); - sinon.assert.calledWithMatch( + _assert.calledOnce(mockGetDlpJob); + _assert.calledWithMatch( mockConsoleLog, 'Job Failed, Please check the configuration.' ); @@ -1169,16 +1164,15 @@ describe('inspect', () => { string, infoTypeId ); - const mockInspectContent = sinon - .stub() + const mockInspectContent = stub() .resolves(DATA_CONSTANTS.RESPONSE_INSPECT_CONTENT); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'inspectContent', mockInspectContent ); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const inspectWithStoredInfotype = proxyquire( '../inspectWithStoredInfotype', @@ -1188,7 +1182,7 @@ describe('inspect', () => { ); await inspectWithStoredInfotype(projectId, infoTypeId, string); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockInspectContent, DATA_CONSTANTS.REQUEST_INSPECT_CONTENT ); @@ -1198,14 +1192,14 @@ describe('inspect', () => { const string = 'My phone number is (223) 456-7890 and my email address is gary@example.com.'; const infoTypeId = 'MOCK_INFOTYPE'; - const mockInspectContent = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockInspectContent = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'inspectContent', mockInspectContent ); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const inspectWithStoredInfotype = proxyquire( '../inspectWithStoredInfotype', @@ -1233,33 +1227,32 @@ describe('inspect', () => { jobName ); - const mockHybridInspectJobTrigger = sinon - .stub() + const mockHybridInspectJobTrigger = stub() .resolves([{name: jobName}]); - const mockActivateJobTrigger = sinon.stub().resolves([{name: jobName}]); - const mockFinishDlpJob = sinon.stub().resolves(); - const mockGetDlpJob = sinon.fake.resolves( + const mockActivateJobTrigger = stub().resolves([{name: jobName}]); + const mockFinishDlpJob = stub().resolves(); + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - const mockConsoleLog = sinon.stub(); + const mockConsoleLog = stub(); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'hybridInspectJobTrigger', mockHybridInspectJobTrigger ); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'activateJobTrigger', mockActivateJobTrigger ); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'finishDlpJob', mockFinishDlpJob ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', mockConsoleLog); const inspectDataToHybridJobTrigger = proxyquire( '../inspectDataToHybridJobTrigger.js', @@ -1268,11 +1261,11 @@ describe('inspect', () => { } ); await inspectDataToHybridJobTrigger(projectId, string, jobTriggerId); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockHybridInspectJobTrigger, DATA_CONSTANTS.REQUEST_HYBRID_INSPECT_JOB_TRIGGER ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should inspect data using hybrid job trigger that is active', async () => { @@ -1286,38 +1279,37 @@ describe('inspect', () => { jobName ); - const mockHybridInspectJobTrigger = sinon - .stub() + const mockHybridInspectJobTrigger = stub() .resolves([{name: jobName}]); - const mockActivateJobTrigger = sinon.stub().rejects({code: 3}); - const mockFinishDlpJob = sinon.stub().resolves(); - const mockGetDlpJob = sinon.fake.resolves( + const mockActivateJobTrigger = stub().rejects({code: 3}); + const mockFinishDlpJob = stub().resolves(); + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - const mockConsoleLog = sinon.stub(); - const mockListDlpJobs = sinon.stub().resolves([[{name: jobName}]]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockConsoleLog = stub(); + const mockListDlpJobs = stub().resolves([[{name: jobName}]]); + replace( + DlpServiceClient.prototype, 'hybridInspectJobTrigger', mockHybridInspectJobTrigger ); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'activateJobTrigger', mockActivateJobTrigger ); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'finishDlpJob', mockFinishDlpJob ); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'listDlpJobs', mockListDlpJobs ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', mockConsoleLog); const inspectDataToHybridJobTrigger = proxyquire( '../inspectDataToHybridJobTrigger.js', @@ -1326,11 +1318,11 @@ describe('inspect', () => { } ); await inspectDataToHybridJobTrigger(projectId, string, jobTriggerId); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockHybridInspectJobTrigger, DATA_CONSTANTS.REQUEST_HYBRID_INSPECT_JOB_TRIGGER ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockListDlpJobs, DATA_CONSTANTS.REQUEST_LIST_DLP_JOBS ); @@ -1347,34 +1339,32 @@ describe('inspect', () => { jobName ); - const mockHybridInspectJobTrigger = sinon - .stub() + const mockHybridInspectJobTrigger = stub() .resolves([{name: jobName}]); - const mockActivateJobTrigger = sinon - .stub() + const mockActivateJobTrigger = stub() .resolves([{name: jobTriggerId}]); - const mockFinishDlpJob = sinon.stub().resolves(); - const mockGetDlpJob = sinon.fake.resolves( + const mockFinishDlpJob = stub().resolves(); + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_FAILED ); - const mockConsoleLog = sinon.stub(); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockConsoleLog = stub(); + replace( + DlpServiceClient.prototype, 'hybridInspectJobTrigger', mockHybridInspectJobTrigger ); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'activateJobTrigger', mockActivateJobTrigger ); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'finishDlpJob', mockFinishDlpJob ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', mockConsoleLog); const inspectDataToHybridJobTrigger = proxyquire( '../inspectDataToHybridJobTrigger.js', @@ -1383,8 +1373,8 @@ describe('inspect', () => { } ); await inspectDataToHybridJobTrigger(projectId, string, jobTriggerId); - sinon.assert.calledOnce(mockGetDlpJob); - sinon.assert.calledWithMatch( + _assert.calledOnce(mockGetDlpJob); + _assert.calledWithMatch( mockConsoleLog, 'Job Failed, Please check the configuration.' ); @@ -1399,25 +1389,24 @@ describe('inspect', () => { bucket, fileName, topicName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, infoTypes, undefined, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -1426,13 +1415,13 @@ describe('inspect', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', () => sinon.stub()); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', () => stub()); const inspectGCSFile = proxyquire('../inspectGCSFile', { '@google-cloud/dlp': {DLP: DLP}, @@ -1445,17 +1434,17 @@ describe('inspect', () => { fileName, topicName, subscriptionName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, 'PERSON_NAME', undefined, jobName ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle error while inspecting GCS file', async () => { @@ -1467,25 +1456,24 @@ describe('inspect', () => { bucket, fileName, topicName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, infoTypes, undefined, jobName ); - const mockCreateDlpJob = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -1494,13 +1482,13 @@ describe('inspect', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', () => sinon.stub()); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', () => stub()); const inspectGCSFile = proxyquire('../inspectGCSFile', { '@google-cloud/dlp': {DLP: DLP}, @@ -1514,7 +1502,7 @@ describe('inspect', () => { fileName, topicName, subscriptionName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, 'PERSON_NAME', undefined, @@ -1535,25 +1523,24 @@ describe('inspect', () => { datasetId, tableId, topicName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, infoTypes, undefined, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -1562,13 +1549,13 @@ describe('inspect', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', () => sinon.stub()); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', () => stub()); const inspectBigQuery = proxyquire('../inspectBigQuery', { '@google-cloud/dlp': {DLP: DLP}, @@ -1582,16 +1569,16 @@ describe('inspect', () => { tableId, topicName, subscriptionName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, 'PERSON_NAME', undefined ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle error while inspecting big query table', async () => { @@ -1603,25 +1590,24 @@ describe('inspect', () => { datasetId, tableId, topicName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, infoTypes, undefined, jobName ); - const mockCreateDlpJob = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -1630,13 +1616,13 @@ describe('inspect', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', () => sinon.stub()); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', () => stub()); const inspectBigQuery = proxyquire('../inspectBigQuery', { '@google-cloud/dlp': {DLP: DLP}, @@ -1651,7 +1637,7 @@ describe('inspect', () => { tableId, topicName, subscriptionName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, 'PERSON_NAME', undefined @@ -1673,25 +1659,24 @@ describe('inspect', () => { nameSpaceId, kind, topicName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, infoTypes, undefined, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -1700,13 +1685,13 @@ describe('inspect', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', () => sinon.stub()); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', () => stub()); const inspectDatastore = proxyquire('../inspectDatastore', { '@google-cloud/dlp': {DLP: DLP}, @@ -1720,16 +1705,16 @@ describe('inspect', () => { kind, topicName, subscriptionName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, 'PERSON_NAME', undefined ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle error while inspecting datastore instance', async () => { @@ -1743,25 +1728,24 @@ describe('inspect', () => { nameSpaceId, kind, topicName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, infoTypes, undefined, jobName ); - const mockCreateDlpJob = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -1770,13 +1754,13 @@ describe('inspect', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - sinon.replace(console, 'log', () => sinon.stub()); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + replace(console, 'log', () => stub()); const inspectDatastore = proxyquire('../inspectDatastore', { '@google-cloud/dlp': {DLP: DLP}, @@ -1791,7 +1775,7 @@ describe('inspect', () => { kind, topicName, subscriptionName, - DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, 0, 'PERSON_NAME', undefined @@ -1811,30 +1795,30 @@ describe('inspect', () => { tableId, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const inspectBigquerySendToScc = proxyquire('../inspectBigquerySendToScc', { '@google-cloud/dlp': {DLP: DLP}, }); await inspectBigquerySendToScc(projectId, dataProject, datasetId, tableId); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle error if inspect job results into failure', async () => { @@ -1846,27 +1830,27 @@ describe('inspect', () => { tableId, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_FAILED ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const inspectBigQuerySendToScc = proxyquire('../inspectBigquerySendToScc', { '@google-cloud/dlp': {DLP: DLP}, }); await inspectBigQuerySendToScc(projectId, dataProject, datasetId, tableId); - sinon.assert.calledOnce(mockGetDlpJob); - sinon.assert.calledWithMatch( + _assert.calledOnce(mockGetDlpJob); + _assert.calledWithMatch( mockConsoleLog, 'Job Failed, Please check the configuration.' ); diff --git a/dlp/system-test/jobs.test.js b/dlp/system-test/jobs.test.js index 8294904ca7..98711f28e8 100644 --- a/dlp/system-test/jobs.test.js +++ b/dlp/system-test/jobs.test.js @@ -14,12 +14,12 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const DLP = require('@google-cloud/dlp'); +import { assert } from 'chai'; +import { describe, it, before } from 'mocha'; +import { execSync as _execSync } from 'child_process'; +import { DlpServiceClient } from '@google-cloud/dlp'; -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = cmd => _execSync(cmd, {encoding: 'utf-8'}); const badJobName = 'projects/not-a-project/dlpJobs/i-123456789'; @@ -29,7 +29,7 @@ const testTableId = 'bikeshare_trips'; const testColumnName = 'zip_code'; const bucketName = 'nodejs-dlp-test-bucket'; -const client = new DLP.DlpServiceClient(); +const client = new DlpServiceClient(); // createTestJob needs time to finish creating a DLP job, before listing // tests will succeed. @@ -88,7 +88,7 @@ describe('test', () => { }); async function deleteStaleJobs() { - const dlp = new DLP.DlpServiceClient(); + const dlp = new DlpServiceClient(); const request = { parent: `projects/${projectId}/locations/global`, filter: 'state=DONE', diff --git a/dlp/system-test/metadata.test.js b/dlp/system-test/metadata.test.js index 89c02323e9..360cee7688 100644 --- a/dlp/system-test/metadata.test.js +++ b/dlp/system-test/metadata.test.js @@ -14,16 +14,16 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); -const {Storage} = require('@google-cloud/storage'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); +import { assert } from 'chai'; +import { describe, it, before } from 'mocha'; +import { execSync as _execSync } from 'child_process'; +import { v4 } from 'uuid'; +import DLP, { DlpServiceClient } from '@google-cloud/dlp'; +import { Storage } from '@google-cloud/storage'; +import proxyquire from 'proxyquire'; +import { restore, stub, replace, assert as _assert } from 'sinon'; -const {MOCK_DATA} = require('./mockdata'); +import { MOCK_DATA } from './mockdata'; const dataProject = 'bigquery-public-data'; const dataSetId = 'samples'; @@ -31,11 +31,11 @@ const tableId = 'github_nested'; const storage = new Storage(); const testFile = 'resources/test.txt'; -const bucketName = `test-dlp-metadata-bucket-${uuid.v4()}`; +const bucketName = `test-dlp-metadata-bucket-${v4()}`; -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = cmd => _execSync(cmd, {encoding: 'utf-8'}); -const client = new DLP.DlpServiceClient(); +const client = new DlpServiceClient(); describe('metadata', () => { let projectId, storedInfoTypeId; @@ -60,7 +60,7 @@ describe('metadata', () => { // Delete stored infotypes created in the snippets. afterEach(async () => { - sinon.restore(); + restore(); if (!storedInfoTypeId) { return; } @@ -103,17 +103,16 @@ describe('metadata', () => { fieldName, storedInfoTypeName ); - const mockCreateStoredInfoType = sinon - .stub() + const mockCreateStoredInfoType = stub() .resolves([{name: storedInfoTypeName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'createStoredInfoType', mockCreateStoredInfoType ); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const createStoredInfoType = proxyquire('../createStoredInfoType', { '@google-cloud/dlp': {DLP: DLP}, @@ -127,11 +126,11 @@ describe('metadata', () => { tableId, fieldName ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateStoredInfoType, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledWithExactly( + _assert.calledWithExactly( mockConsoleLog, `InfoType stored successfully: ${storedInfoTypeName}` ); @@ -141,15 +140,15 @@ describe('metadata', () => { const infoTypeId = 'MOCK_INFOTYPE_ID'; const outputPath = 'MOCK_OUTPUT_PATH'; const fieldName = 'MOCK_FIELD'; - const mockCreateStoredInfoType = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateStoredInfoType = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'createStoredInfoType', mockCreateStoredInfoType ); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const createStoredInfoType = proxyquire('../createStoredInfoType', { '@google-cloud/dlp': {DLP: DLP}, @@ -181,28 +180,27 @@ describe('metadata', () => { outputPath, fileSetUrl ); - const mockUpdateStoredInfoType = sinon - .stub() + const mockUpdateStoredInfoType = stub() .resolves([{name: storedInfoTypeName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + replace( + DlpServiceClient.prototype, 'updateStoredInfoType', mockUpdateStoredInfoType ); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const updateStoredInfoType = proxyquire('../updateStoredInfoType', { '@google-cloud/dlp': {DLP: DLP}, }); await updateStoredInfoType(projectId, infoTypeId, outputPath, fileSetUrl); - sinon.assert.calledWith( + _assert.calledWith( mockUpdateStoredInfoType, DATA_CONSTANTS.REQUEST_UPDATE_STORED_INFOTYPE ); - sinon.assert.calledWithMatch( + _assert.calledWithMatch( mockConsoleLog, 'InfoType updated successfully:' ); @@ -212,15 +210,15 @@ describe('metadata', () => { const infoTypeId = 'MOCK_INFOTYPE_ID'; const outputPath = 'MOCK_OUTPUT_PATH'; const fileSetUrl = 'MOCK_FILE_SET_URL'; - const mockUpdateStoredInfoType = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockUpdateStoredInfoType = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'updateStoredInfoType', mockUpdateStoredInfoType ); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const updateStoredInfoType = proxyquire('../updateStoredInfoType', { '@google-cloud/dlp': {DLP: DLP}, diff --git a/dlp/system-test/mockdata.js b/dlp/system-test/mockdata.js index 5f79ee5752..a9bdff3083 100644 --- a/dlp/system-test/mockdata.js +++ b/dlp/system-test/mockdata.js @@ -14,8 +14,8 @@ 'use strict'; -const DLP = require('@google-cloud/dlp'); -const sinon = require('sinon'); +import { protos } from '@google-cloud/dlp'; +import { stub } from 'sinon'; /** Mock data for unit test cases. @@ -46,7 +46,7 @@ const MOCK_DATA = { }, rowsLimit: 1000, sampleMethod: - DLP.protos.google.privacy.dlp.v2.BigQueryOptions.SampleMethod + protos.google.privacy.dlp.v2.BigQueryOptions.SampleMethod .RANDOM_START, includedFields: [{name: 'name'}], }, @@ -81,8 +81,8 @@ const MOCK_DATA = { attributes: { DlpJobName: jobName, }, - ack: sinon.stub(), - nack: sinon.stub(), + ack: stub(), + nack: stub(), }, }), DEIDENTIFY_TABLE_WITH_FPE: (projectId, alphabet, keyName, wrappedKey) => ({ @@ -155,7 +155,7 @@ const MOCK_DATA = { inspectJob: { inspectConfig: { infoTypes: infoTypes, - minLikelihood: DLP.protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, + minLikelihood: protos.google.privacy.dlp.v2.Likelihood.POSSIBLE, includeQuote: true, excludeInfoTypes: true, }, @@ -164,9 +164,9 @@ const MOCK_DATA = { fileSet: {url: gcsUri}, bytesLimitPerFile: 200, filesLimitPercent: 90, - fileTypes: [DLP.protos.google.privacy.dlp.v2.FileType.TEXT_FILE], + fileTypes: [protos.google.privacy.dlp.v2.FileType.TEXT_FILE], sampleMethod: - DLP.protos.google.privacy.dlp.v2.CloudStorageOptions.SampleMethod + protos.google.privacy.dlp.v2.CloudStorageOptions.SampleMethod .RANDOM_START, }, }, @@ -200,8 +200,8 @@ const MOCK_DATA = { attributes: { DlpJobName: jobName, }, - ack: sinon.stub(), - nack: sinon.stub(), + ack: stub(), + nack: stub(), }, }), DEIDENTIFY_WITH_DETEMINISTIC: ( @@ -375,7 +375,7 @@ const MOCK_DATA = { {name: 'LOCATION'}, {name: 'PHONE_NUMBER'}, ], - minLikelihood: DLP.protos.google.privacy.dlp.v2.Likelihood.UNLIKELY, + minLikelihood: protos.google.privacy.dlp.v2.Likelihood.UNLIKELY, limits: { maxFindingsPerItem: 100, }, @@ -435,7 +435,7 @@ const MOCK_DATA = { {name: 'LOCATION'}, {name: 'PHONE_NUMBER'}, ], - minLikelihood: DLP.protos.google.privacy.dlp.v2.Likelihood.UNLIKELY, + minLikelihood: protos.google.privacy.dlp.v2.Likelihood.UNLIKELY, limits: { maxFindingsPerItem: 100, }, @@ -499,7 +499,7 @@ const MOCK_DATA = { {name: 'LOCATION'}, {name: 'PHONE_NUMBER'}, ], - minLikelihood: DLP.protos.google.privacy.dlp.v2.Likelihood.UNLIKELY, + minLikelihood: protos.google.privacy.dlp.v2.Likelihood.UNLIKELY, limits: { maxFindingsPerItem: 100, }, @@ -868,8 +868,8 @@ const MOCK_DATA = { attributes: { DlpJobName: jobName, }, - ack: sinon.stub(), - nack: sinon.stub(), + ack: stub(), + nack: stub(), }, }), NUMERICAL_STATS: ( @@ -941,8 +941,8 @@ const MOCK_DATA = { attributes: { DlpJobName: jobName, }, - ack: sinon.stub(), - nack: sinon.stub(), + ack: stub(), + nack: stub(), }, }), K_MAP_ESTIMATION_ANALYSIS: ( @@ -1028,8 +1028,8 @@ const MOCK_DATA = { attributes: { DlpJobName: jobName, }, - ack: sinon.stub(), - nack: sinon.stub(), + ack: stub(), + nack: stub(), }, }), L_DIVERSITY_ANALYSIS: ( @@ -1110,8 +1110,8 @@ const MOCK_DATA = { attributes: { DlpJobName: jobName, }, - ack: sinon.stub(), - nack: sinon.stub(), + ack: stub(), + nack: stub(), }, }), CATEGORICAL_STATS: ( @@ -1193,8 +1193,8 @@ const MOCK_DATA = { attributes: { DlpJobName: jobName, }, - ack: sinon.stub(), - nack: sinon.stub(), + ack: stub(), + nack: stub(), }, }), CREATE_STORED_INFOTYPE: ( @@ -1305,8 +1305,8 @@ const MOCK_DATA = { attributes: { DlpJobName: jobName, }, - ack: sinon.stub(), - nack: sinon.stub(), + ack: stub(), + nack: stub(), }, }), INSPECT_BIG_QUERY: ( @@ -1371,8 +1371,8 @@ const MOCK_DATA = { attributes: { DlpJobName: jobName, }, - ack: sinon.stub(), - nack: sinon.stub(), + ack: stub(), + nack: stub(), }, }), INSPECT_DATASTORE: ( @@ -1439,10 +1439,10 @@ const MOCK_DATA = { attributes: { DlpJobName: jobName, }, - ack: sinon.stub(), - nack: sinon.stub(), + ack: stub(), + nack: stub(), }, }), }; -module.exports = {MOCK_DATA}; +export default {MOCK_DATA}; diff --git a/dlp/system-test/quickstart.test.js b/dlp/system-test/quickstart.test.js index 2e000674b7..2a6bff652e 100644 --- a/dlp/system-test/quickstart.test.js +++ b/dlp/system-test/quickstart.test.js @@ -14,14 +14,14 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const DLP = require('@google-cloud/dlp'); +import { assert } from 'chai'; +import { describe, it, before } from 'mocha'; +import { execSync as _execSync } from 'child_process'; +import { DlpServiceClient } from '@google-cloud/dlp'; -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = cmd => _execSync(cmd, {encoding: 'utf-8'}); -const client = new DLP.DlpServiceClient(); +const client = new DlpServiceClient(); describe('quickstart', () => { let projectId; diff --git a/dlp/system-test/redact.test.js b/dlp/system-test/redact.test.js index 2dee0e4028..0c9974c48b 100644 --- a/dlp/system-test/redact.test.js +++ b/dlp/system-test/redact.test.js @@ -14,24 +14,24 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const fs = require('fs'); -const cp = require('child_process'); -const {PNG} = require('pngjs'); -const pixelmatch = require('pixelmatch'); -const DLP = require('@google-cloud/dlp'); +import { assert } from 'chai'; +import { describe, it, before } from 'mocha'; +import { createReadStream } from 'fs'; +import { execSync as _execSync } from 'child_process'; +import { PNG } from 'pngjs'; +import pixelmatch from 'pixelmatch'; +import { DlpServiceClient } from '@google-cloud/dlp'; -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = cmd => _execSync(cmd, {encoding: 'utf-8'}); const testImage = 'resources/test.png'; const testResourcePath = 'system-test/resources'; -const client = new DLP.DlpServiceClient(); +const client = new DlpServiceClient(); async function readImage(filePath) { return new Promise((resolve, reject) => { - fs.createReadStream(filePath) + createReadStream(filePath) .pipe(new PNG()) .on('error', reject) .on('parsed', function () { diff --git a/dlp/system-test/risk.test.js b/dlp/system-test/risk.test.js index b3ed576131..0cc0869891 100644 --- a/dlp/system-test/risk.test.js +++ b/dlp/system-test/risk.test.js @@ -14,18 +14,18 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before, after, afterEach} = require('mocha'); -const uuid = require('uuid'); -const {PubSub} = require('@google-cloud/pubsub'); -const DLP = require('@google-cloud/dlp'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); +import { assert } from 'chai'; +import { describe, it, before, after, afterEach } from 'mocha'; +import { v4 } from 'uuid'; +import { PubSub } from '@google-cloud/pubsub'; +import DLP, { DlpServiceClient } from '@google-cloud/dlp'; +import proxyquire from 'proxyquire'; +import { restore, stub, replace, fake, assert as _assert } from 'sinon'; -const {MOCK_DATA} = require('./mockdata'); +import { MOCK_DATA } from './mockdata'; const pubsub = new PubSub(); -const client = new DLP.DlpServiceClient(); +const client = new DlpServiceClient(); // Dummy resource names used in test cases mocking API Calls. const datasetId = 'MOCK_DATASET_ID'; @@ -47,8 +47,8 @@ describe('risk', () => { let topic, subscription, topicName, subscriptionName, jobName; before(async () => { - topicName = `dlp-risk-topic-${uuid.v4()}-${Date.now()}`; - subscriptionName = `dlp-risk-subscription-${uuid.v4()}-${Date.now()}`; + topicName = `dlp-risk-topic-${v4()}-${Date.now()}`; + subscriptionName = `dlp-risk-subscription-${v4()}-${Date.now()}`; projectId = await client.getProjectId(); [topic] = await pubsub.createTopic(topicName); [subscription] = await topic.createSubscription(subscriptionName); @@ -84,7 +84,7 @@ describe('risk', () => { // Delete risk analysis job created in the snippets. afterEach(async () => { - sinon.restore(); + restore(); const request = { name: jobName, }; @@ -115,20 +115,19 @@ describe('risk', () => { quasiIds, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -137,14 +136,14 @@ describe('risk', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const kAnonymityAnalysis = proxyquire('../kAnonymityAnalysis', { '@google-cloud/dlp': {DLP: DLP}, @@ -159,11 +158,11 @@ describe('risk', () => { subscriptionName, 'AGE,MYSTERY' ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle k-anonymity analysis errors', async () => { @@ -181,20 +180,19 @@ describe('risk', () => { quasiIds, jobName ); - const mockCreateDlpJob = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -203,14 +201,14 @@ describe('risk', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const kAnonymityAnalysis = proxyquire('../kAnonymityAnalysis', { '@google-cloud/dlp': {DLP: DLP}, @@ -244,20 +242,19 @@ describe('risk', () => { topicName, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -266,14 +263,14 @@ describe('risk', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const numericalRiskAnalysis = proxyquire('../numericalRiskAnalysis', { '@google-cloud/dlp': {DLP: DLP}, @@ -288,11 +285,11 @@ describe('risk', () => { topicName, subscriptionName ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle numerical risk analysis errors', async () => { @@ -307,20 +304,19 @@ describe('risk', () => { topicName, jobName ); - const mockCreateDlpJob = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -329,14 +325,14 @@ describe('risk', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const numericalRiskAnalysis = proxyquire('../numericalRiskAnalysis', { '@google-cloud/dlp': {DLP: DLP}, @@ -372,20 +368,19 @@ describe('risk', () => { quasiIds, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -394,14 +389,14 @@ describe('risk', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const kMapEstimationAnalysis = proxyquire('../kMapEstimationAnalysis', { '@google-cloud/dlp': {DLP: DLP}, @@ -418,11 +413,11 @@ describe('risk', () => { quasiIds[0].field.name, quasiIds[0].infoType.name ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle k-map analysis errors', async () => { @@ -439,20 +434,19 @@ describe('risk', () => { quasiIds, jobName ); - const mockCreateDlpJob = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -461,14 +455,14 @@ describe('risk', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const kMapEstimationAnalysis = proxyquire('../kMapEstimationAnalysis', { '@google-cloud/dlp': {DLP: DLP}, @@ -509,20 +503,19 @@ describe('risk', () => { quasiIds, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -531,14 +524,14 @@ describe('risk', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const lDiversityAnalysis = proxyquire('../lDiversityAnalysis', { '@google-cloud/dlp': {DLP: DLP}, @@ -554,11 +547,11 @@ describe('risk', () => { sensitiveAttribute, 'AGE,MYSTERY' ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle l-diversity analysis errors', async () => { @@ -578,20 +571,19 @@ describe('risk', () => { quasiIds, jobName ); - const mockCreateDlpJob = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -600,14 +592,14 @@ describe('risk', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const lDiversityAnalysis = proxyquire('../lDiversityAnalysis', { '@google-cloud/dlp': {DLP: DLP}, @@ -642,20 +634,19 @@ describe('risk', () => { topicName, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -664,14 +655,14 @@ describe('risk', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const categoricalRiskAnalysis = proxyquire( '../categoricalRiskAnalysis.js', @@ -689,11 +680,11 @@ describe('risk', () => { topicName, subscriptionName ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle error if categorical risk analysis job fails', async () => { @@ -708,20 +699,19 @@ describe('risk', () => { topicName, jobName ); - const mockCreateDlpJob = sinon.stub().rejects(new Error('Failed')); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().rejects(new Error('Failed')); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const topicHandlerStub = sinon.stub().returns({ - get: sinon.stub().resolves([ + const topicHandlerStub = stub().returns({ + get: stub().resolves([ { - subscription: sinon.stub().resolves({ - removeListener: sinon.stub(), - on: sinon - .stub() + subscription: stub().resolves({ + removeListener: stub(), + on: stub() .withArgs('message') .callsFake((eventName, handler) => { handler(DATA_CONSTANTS.MOCK_MESSAGE); @@ -730,14 +720,14 @@ describe('risk', () => { }, ]), }); - sinon.replace(PubSub.prototype, 'topic', topicHandlerStub); + replace(PubSub.prototype, 'topic', topicHandlerStub); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const categoricalRiskAnalysis = proxyquire('../categoricalRiskAnalysis', { '@google-cloud/dlp': {DLP: DLP}, @@ -768,19 +758,19 @@ describe('risk', () => { outputTableId, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_SUCCESS ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const kAnonymityWithEntityIds = proxyquire('../kAnonymityWithEntityIds', { '@google-cloud/dlp': {DLP: DLP}, @@ -791,11 +781,11 @@ describe('risk', () => { sourceTableId, outputTableId ); - sinon.assert.calledOnceWithExactly( + _assert.calledOnceWithExactly( mockCreateDlpJob, DATA_CONSTANTS.REQUEST_CREATE_DLP_JOB ); - sinon.assert.calledOnce(mockGetDlpJob); + _assert.calledOnce(mockGetDlpJob); }); it('should handle error if risk job fails', async () => { @@ -807,19 +797,19 @@ describe('risk', () => { outputTableId, jobName ); - const mockCreateDlpJob = sinon.stub().resolves([{name: jobName}]); - sinon.replace( - DLP.DlpServiceClient.prototype, + const mockCreateDlpJob = stub().resolves([{name: jobName}]); + replace( + DlpServiceClient.prototype, 'createDlpJob', mockCreateDlpJob ); - const mockGetDlpJob = sinon.fake.resolves( + const mockGetDlpJob = fake.resolves( DATA_CONSTANTS.RESPONSE_GET_DLP_JOB_FAILED ); - sinon.replace(DLP.DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); - const mockConsoleLog = sinon.stub(); - sinon.replace(console, 'log', mockConsoleLog); + replace(DlpServiceClient.prototype, 'getDlpJob', mockGetDlpJob); + const mockConsoleLog = stub(); + replace(console, 'log', mockConsoleLog); const kAnonymityWithEntityIds = proxyquire('../kAnonymityWithEntityIds', { '@google-cloud/dlp': {DLP: DLP}, @@ -830,8 +820,8 @@ describe('risk', () => { sourceTableId, outputTableId ); - sinon.assert.calledOnce(mockGetDlpJob); - sinon.assert.calledWithMatch( + _assert.calledOnce(mockGetDlpJob); + _assert.calledWithMatch( mockConsoleLog, 'Job Failed, Please check the configuration.' ); diff --git a/dlp/system-test/templates.test.js b/dlp/system-test/templates.test.js index 16b330d9d6..b7497a58fe 100644 --- a/dlp/system-test/templates.test.js +++ b/dlp/system-test/templates.test.js @@ -14,16 +14,16 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); +import { assert } from 'chai'; +import { describe, it, before } from 'mocha'; +import { execSync as _execSync } from 'child_process'; +import { v4 } from 'uuid'; +import { DlpServiceClient } from '@google-cloud/dlp'; -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = cmd => _execSync(cmd, {encoding: 'utf-8'}); const templateName = ''; -const client = new DLP.DlpServiceClient(); +const client = new DlpServiceClient(); describe('templates', () => { let projectId; @@ -32,8 +32,8 @@ describe('templates', () => { const MIN_LIKELIHOOD = 'VERY_LIKELY'; const MAX_FINDINGS = 5; const INCLUDE_QUOTE = false; - const DISPLAY_NAME = `My Template ${uuid.v4()}`; - const TEMPLATE_NAME = `my-template-${uuid.v4()}`; + const DISPLAY_NAME = `My Template ${v4()}`; + const TEMPLATE_NAME = `my-template-${v4()}`; before(async () => { projectId = await client.getProjectId(); diff --git a/dlp/system-test/triggers.test.js b/dlp/system-test/triggers.test.js index 3092aa47de..1f6031828e 100644 --- a/dlp/system-test/triggers.test.js +++ b/dlp/system-test/triggers.test.js @@ -14,22 +14,22 @@ 'use strict'; -const {assert} = require('chai'); -const {describe, it, before} = require('mocha'); -const cp = require('child_process'); -const uuid = require('uuid'); -const DLP = require('@google-cloud/dlp'); +import { assert } from 'chai'; +import { describe, it, before } from 'mocha'; +import { execSync as _execSync } from 'child_process'; +import { v4 } from 'uuid'; +import { DlpServiceClient } from '@google-cloud/dlp'; -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +const execSync = cmd => _execSync(cmd, {encoding: 'utf-8'}); -const client = new DLP.DlpServiceClient(); +const client = new DlpServiceClient(); describe('triggers', () => { let projectId; let fullTriggerName; - const triggerName = `my-trigger-${uuid.v4()}`; - const triggerDisplayName = `My Trigger Display Name: ${uuid.v4()}`; - const triggerDescription = `My Trigger Description: ${uuid.v4()}`; + const triggerName = `my-trigger-${v4()}`; + const triggerDisplayName = `My Trigger Display Name: ${v4()}`; + const triggerDescription = `My Trigger Description: ${v4()}`; const infoType = 'PERSON_NAME'; const minLikelihood = 'VERY_LIKELY'; const maxFindings = 5; @@ -37,7 +37,7 @@ describe('triggers', () => { let tempTriggerName = ''; async function createTempTrigger() { - const triggerId = `trigger-test-${uuid.v4()}`; + const triggerId = `trigger-test-${v4()}`; await client.createJobTrigger({ parent: `projects/${projectId}/locations/global`, jobTrigger: { From a65f43c21735d369b686f25fdf754cc37832571f Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Thu, 6 Mar 2025 13:43:36 +1100 Subject: [PATCH 17/22] bulk import fix --- dlp/categoricalRiskAnalysis.js | 2 +- dlp/createInspectTemplate.js | 2 +- dlp/createJob.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/createTrigger.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableBucketing.js | 2 +- dlp/deIdentifyTableConditionInfoTypes.js | 2 +- dlp/deIdentifyTableConditionMasking.js | 2 +- dlp/deIdentifyTableInfoTypes.js | 2 +- dlp/deIdentifyTableRowSuppress.js | 2 +- dlp/deIdentifyTableWithBucketingConfig.js | 2 +- dlp/deIdentifyTableWithCryptoHash.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deIdentifyTableWithMultipleCryptoHash.js | 2 +- dlp/deIdentifyWithExceptionList.js | 2 +- dlp/deIdentifyWithRedaction.js | 2 +- dlp/deIdentifyWithReplaceInfoType.js | 2 +- dlp/deIdentifyWithSimpleWordList.js | 2 +- dlp/deidentifyWithDateShift.js | 2 +- dlp/deidentifyWithDeterministic.js | 2 +- dlp/deidentifyWithDictionaryReplacement.js | 2 +- dlp/deidentifyWithFpe.js | 2 +- dlp/deidentifyWithFpeSurrogate.js | 2 +- dlp/deidentifyWithMask.js | 2 +- dlp/deidentifyWithReplacement.js | 2 +- dlp/deidentifyWithTimeExtraction.js | 2 +- dlp/deleteInspectTemplate.js | 2 +- dlp/deleteJob.js | 2 +- dlp/deleteTrigger.js | 2 +- dlp/getJob.js | 2 +- dlp/inspectBigQuery.js | 2 +- dlp/inspectBigQueryTableWithSampling.js | 2 +- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 2 +- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectFile.js | 2 +- dlp/inspectGCSFile.js | 2 +- dlp/inspectGcsFileWithSampling.js | 2 +- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectImageFile.js | 2 +- dlp/inspectImageFileAllInfoTypes.js | 2 +- dlp/inspectImageFileListedInfoTypes.js | 2 +- dlp/inspectPhoneNumber.js | 2 +- dlp/inspectString.js | 2 +- dlp/inspectStringAugmentInfoType.js | 2 +- dlp/inspectStringCustomExcludingSubstring.js | 2 +- dlp/inspectStringCustomHotword.js | 2 +- dlp/inspectStringCustomOmitOverlap.js | 2 +- dlp/inspectStringMultipleRules.js | 2 +- dlp/inspectStringOmitOverlap.js | 2 +- dlp/inspectStringRep.js | 2 +- dlp/inspectStringWithExclusionDict.js | 2 +- dlp/inspectStringWithExclusionDictSubstring.js | 2 +- dlp/inspectStringWithExclusionRegex.js | 2 +- dlp/inspectStringWithoutOverlap.js | 2 +- dlp/inspectTable.js | 2 +- dlp/inspectWithCustomHotwords.js | 2 +- dlp/inspectWithCustomRegex.js | 2 +- dlp/inspectWithHotwordRules.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 2 +- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 2 +- dlp/lDiversityAnalysis.js | 2 +- dlp/listInspectTemplates.js | 2 +- dlp/listJobs.js | 2 +- dlp/listTriggers.js | 2 +- dlp/metadata.js | 2 +- dlp/numericalRiskAnalysis.js | 2 +- dlp/quickstart.js | 2 +- dlp/redactImage.js | 2 +- dlp/redactImageFileAllInfoTypes.js | 2 +- dlp/redactImageFileAllText.js | 2 +- dlp/redactImageFileColoredInfoTypes.js | 2 +- dlp/redactImageFileListedInfoTypes.js | 2 +- dlp/redactText.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/reidentifyWithFpe.js | 2 +- dlp/reidentifyWithFpeSurrogate.js | 2 +- dlp/updateStoredInfoType.js | 2 +- dlp/updateTrigger.js | 2 +- 85 files changed, 85 insertions(+), 85 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index 7a7406272c..da9ca5a836 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_categorical_stats] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/createInspectTemplate.js b/dlp/createInspectTemplate.js index 5e13e694c3..2720ca4ec4 100644 --- a/dlp/createInspectTemplate.js +++ b/dlp/createInspectTemplate.js @@ -31,7 +31,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_inspect_template] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createJob.js b/dlp/createJob.js index f311c26bb3..63c2645776 100644 --- a/dlp/createJob.js +++ b/dlp/createJob.js @@ -21,7 +21,7 @@ function main(projectId, cloudFileUrl) { // [START dlp_create_job] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index 672f99464c..2028774202 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -29,7 +29,7 @@ async function main( ) { // [START dlp_create_stored_infotype] // Import the required libraries - const dlp = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/createTrigger.js b/dlp/createTrigger.js index f4f338d4f4..fe0af291ff 100644 --- a/dlp/createTrigger.js +++ b/dlp/createTrigger.js @@ -34,7 +34,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index a876ce18c8..346289de84 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_deidentify_cloud_storage] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableBucketing.js b/dlp/deIdentifyTableBucketing.js index 4c8cc2ae69..4ef40460e4 100644 --- a/dlp/deIdentifyTableBucketing.js +++ b/dlp/deIdentifyTableBucketing.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_bucketing] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionInfoTypes.js b/dlp/deIdentifyTableConditionInfoTypes.js index 7058a7b373..555a1d8a18 100644 --- a/dlp/deIdentifyTableConditionInfoTypes.js +++ b/dlp/deIdentifyTableConditionInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionMasking.js b/dlp/deIdentifyTableConditionMasking.js index 94cfd42b4b..b52eb7bc08 100644 --- a/dlp/deIdentifyTableConditionMasking.js +++ b/dlp/deIdentifyTableConditionMasking.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_masking] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableInfoTypes.js b/dlp/deIdentifyTableInfoTypes.js index 4767cb690b..dfc87f9b46 100644 --- a/dlp/deIdentifyTableInfoTypes.js +++ b/dlp/deIdentifyTableInfoTypes.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableRowSuppress.js b/dlp/deIdentifyTableRowSuppress.js index e62685b93a..78e94bf3c2 100644 --- a/dlp/deIdentifyTableRowSuppress.js +++ b/dlp/deIdentifyTableRowSuppress.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_row_suppress] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithBucketingConfig.js b/dlp/deIdentifyTableWithBucketingConfig.js index 335a3e6ce9..057c32d9b0 100644 --- a/dlp/deIdentifyTableWithBucketingConfig.js +++ b/dlp/deIdentifyTableWithBucketingConfig.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_primitive_bucketing] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithCryptoHash.js b/dlp/deIdentifyTableWithCryptoHash.js index f63c58974e..a837fe5b99 100644 --- a/dlp/deIdentifyTableWithCryptoHash.js +++ b/dlp/deIdentifyTableWithCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKeyName) { // [START dlp_deidentify_table_with_crypto_hash] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index fd71f7e766..1698397c49 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_deidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithMultipleCryptoHash.js b/dlp/deIdentifyTableWithMultipleCryptoHash.js index d953382b22..fbe493b36b 100644 --- a/dlp/deIdentifyTableWithMultipleCryptoHash.js +++ b/dlp/deIdentifyTableWithMultipleCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKey1, transientKey2) { // [START dlp_deidentify_table_with_multiple_crypto_hash] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithExceptionList.js b/dlp/deIdentifyWithExceptionList.js index 717a12be0d..7fa51ad242 100644 --- a/dlp/deIdentifyWithExceptionList.js +++ b/dlp/deIdentifyWithExceptionList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_exception_list] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call diff --git a/dlp/deIdentifyWithRedaction.js b/dlp/deIdentifyWithRedaction.js index 8f2d3f20c6..08746e9cc3 100644 --- a/dlp/deIdentifyWithRedaction.js +++ b/dlp/deIdentifyWithRedaction.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_redact] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithReplaceInfoType.js b/dlp/deIdentifyWithReplaceInfoType.js index 08d8301abc..911b85110d 100644 --- a/dlp/deIdentifyWithReplaceInfoType.js +++ b/dlp/deIdentifyWithReplaceInfoType.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = parseInfotypes(infoTypes); // [START dlp_deidentify_replace_infotype] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithSimpleWordList.js b/dlp/deIdentifyWithSimpleWordList.js index dcdb388b84..3ef2eaca52 100644 --- a/dlp/deIdentifyWithSimpleWordList.js +++ b/dlp/deIdentifyWithSimpleWordList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, customInfoTypeName) { words = words.split(','); // [START dlp_deidentify_simple_word_list] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // TODO(developer): Replace these variables before running the sample. // const projectId = "your-project-id"; diff --git a/dlp/deidentifyWithDateShift.js b/dlp/deidentifyWithDateShift.js index e13d96425d..5bb4b6c303 100644 --- a/dlp/deidentifyWithDateShift.js +++ b/dlp/deidentifyWithDateShift.js @@ -33,7 +33,7 @@ function main( dateFields = transformCLI(dateFields); // [START dlp_deidentify_date_shift] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index 0793fff4d6..73f8805d3c 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -29,7 +29,7 @@ async function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDictionaryReplacement.js b/dlp/deidentifyWithDictionaryReplacement.js index 32576dfb96..d56308f0b5 100644 --- a/dlp/deidentifyWithDictionaryReplacement.js +++ b/dlp/deidentifyWithDictionaryReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, infoTypes, words) { [infoTypes, words] = transformCLI(infoTypes, words); // [START dlp_deidentify_dictionary_replacement] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpe.js b/dlp/deidentifyWithFpe.js index 015b24d7ad..a26917937c 100644 --- a/dlp/deidentifyWithFpe.js +++ b/dlp/deidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, keyName, wrappedKey, surrogateType) { // [START dlp_deidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpeSurrogate.js b/dlp/deidentifyWithFpeSurrogate.js index d2968e60a5..2eb9cdc601 100644 --- a/dlp/deidentifyWithFpeSurrogate.js +++ b/dlp/deidentifyWithFpeSurrogate.js @@ -29,7 +29,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithMask.js b/dlp/deidentifyWithMask.js index 6e6df7e7ef..3749a49e4e 100644 --- a/dlp/deidentifyWithMask.js +++ b/dlp/deidentifyWithMask.js @@ -22,7 +22,7 @@ function main(projectId, string, maskingCharacter, numberToMask) { // [START dlp_deidentify_masking] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithReplacement.js b/dlp/deidentifyWithReplacement.js index 84ead95f20..6ce33b4a34 100644 --- a/dlp/deidentifyWithReplacement.js +++ b/dlp/deidentifyWithReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, replacement) { // [START dlp_deidentify_replace] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithTimeExtraction.js b/dlp/deidentifyWithTimeExtraction.js index 03c0e5de14..7a32c22c61 100644 --- a/dlp/deidentifyWithTimeExtraction.js +++ b/dlp/deidentifyWithTimeExtraction.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_time_extract] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteInspectTemplate.js b/dlp/deleteInspectTemplate.js index 61a8021151..f4edfbe968 100644 --- a/dlp/deleteInspectTemplate.js +++ b/dlp/deleteInspectTemplate.js @@ -22,7 +22,7 @@ function main(projectId, templateName) { // [START dlp_delete_inspect_template] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteJob.js b/dlp/deleteJob.js index 78202468e2..9716df46fe 100644 --- a/dlp/deleteJob.js +++ b/dlp/deleteJob.js @@ -20,7 +20,7 @@ function main(projectId, jobName) { // [START dlp_delete_job] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteTrigger.js b/dlp/deleteTrigger.js index 9fca52f798..c004d62acf 100644 --- a/dlp/deleteTrigger.js +++ b/dlp/deleteTrigger.js @@ -20,7 +20,7 @@ function main(projectId, triggerId) { // [START dlp_delete_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/getJob.js b/dlp/getJob.js index 19bf9c290b..117abf1541 100644 --- a/dlp/getJob.js +++ b/dlp/getJob.js @@ -21,7 +21,7 @@ function main(jobName) { // [START dlp_get_job] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index e4dafda269..c8cedad4d0 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_bigquery] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index f03cdb8168..6d9cd5c244 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -26,7 +26,7 @@ async function main( ) { // [START dlp_inspect_bigquery_with_sampling] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index c2259fd634..9d63499d88 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, dataProjectId, datasetId, tableId) { // [START dlp_inspect_bigquery_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index cbcf4091e4..5d300ad8d0 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -22,7 +22,7 @@ async function main(projectId, string, jobTriggerId) { // [START dlp_inspect_send_data_to_hybrid_job_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 1dfe29b954..71a15075f9 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -35,7 +35,7 @@ async function main( // [START dlp_inspect_datastore] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 5d5084e704..9d25d36538 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, datastoreNamespace, datastoreKind) { // [START dlp_inspect_datastore_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectFile.js b/dlp/inspectFile.js index 26da96e5a7..3ed64f9537 100644 --- a/dlp/inspectFile.js +++ b/dlp/inspectFile.js @@ -30,7 +30,7 @@ function main( // [START dlp_inspect_file] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Import other required libraries const fs = require('fs'); diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index 6cce718136..ff363376cc 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -32,7 +32,7 @@ async function main( // [START dlp_inspect_gcs] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index 5df7fdad70..2e67a21998 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -21,7 +21,7 @@ async function main(projectId, gcsUri, topicId, subscriptionId, infoTypes) { // [START dlp_inspect_gcs_with_sampling] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 57297b03bc..5b0a42bb30 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, gcsPath) { // [START dlp_inspect_gcs_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFile.js b/dlp/inspectImageFile.js index 8e6c03c0cd..1b24733d8e 100644 --- a/dlp/inspectImageFile.js +++ b/dlp/inspectImageFile.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_file] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const mime = require('mime'); const fs = require('fs'); diff --git a/dlp/inspectImageFileAllInfoTypes.js b/dlp/inspectImageFileAllInfoTypes.js index b7e7ad7fc3..4486f0a858 100644 --- a/dlp/inspectImageFileAllInfoTypes.js +++ b/dlp/inspectImageFileAllInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const mime = require('mime'); const fs = require('fs'); diff --git a/dlp/inspectImageFileListedInfoTypes.js b/dlp/inspectImageFileListedInfoTypes.js index 4789ee0e3b..f4533348d0 100644 --- a/dlp/inspectImageFileListedInfoTypes.js +++ b/dlp/inspectImageFileListedInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const mime = require('mime'); const fs = require('fs'); diff --git a/dlp/inspectPhoneNumber.js b/dlp/inspectPhoneNumber.js index d0db144258..c4b91bda97 100644 --- a/dlp/inspectPhoneNumber.js +++ b/dlp/inspectPhoneNumber.js @@ -31,7 +31,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_phone_number] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectString.js b/dlp/inspectString.js index cfeda45c5c..57d3a32072 100644 --- a/dlp/inspectString.js +++ b/dlp/inspectString.js @@ -32,7 +32,7 @@ function main( // [START dlp_inspect_string] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringAugmentInfoType.js b/dlp/inspectStringAugmentInfoType.js index 95aee9303a..6beaa6a0fb 100644 --- a/dlp/inspectStringAugmentInfoType.js +++ b/dlp/inspectStringAugmentInfoType.js @@ -22,7 +22,7 @@ function main(projectId, string, words) { words = words ? words.split(',') : []; // [START dlp_inspect_augment_infotypes] // Imports the Google Cloud client library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomExcludingSubstring.js b/dlp/inspectStringCustomExcludingSubstring.js index 12ff24ec78..f8df43101a 100644 --- a/dlp/inspectStringCustomExcludingSubstring.js +++ b/dlp/inspectStringCustomExcludingSubstring.js @@ -22,7 +22,7 @@ function main(projectId, string, excludedWords) { excludedWords = excludedWords ? excludedWords.split(',') : []; // [START dlp_inspect_string_custom_excluding_substring] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomHotword.js b/dlp/inspectStringCustomHotword.js index 2dc9edf12b..07bdef7719 100644 --- a/dlp/inspectStringCustomHotword.js +++ b/dlp/inspectStringCustomHotword.js @@ -21,7 +21,7 @@ function main(projectId, string, customHotword) { // [START dlp_inspect_string_custom_hotword] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomOmitOverlap.js b/dlp/inspectStringCustomOmitOverlap.js index 19b8edba29..3e61c9fe21 100644 --- a/dlp/inspectStringCustomOmitOverlap.js +++ b/dlp/inspectStringCustomOmitOverlap.js @@ -20,7 +20,7 @@ function main(projectId, string) { // [START dlp_inspect_string_custom_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringMultipleRules.js b/dlp/inspectStringMultipleRules.js index de48a6d9a9..6f76723e2a 100644 --- a/dlp/inspectStringMultipleRules.js +++ b/dlp/inspectStringMultipleRules.js @@ -21,7 +21,7 @@ function main(projectId, string) { // [START dlp_inspect_string_multiple_rules] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringOmitOverlap.js b/dlp/inspectStringOmitOverlap.js index 4a1144d87b..92084f1546 100644 --- a/dlp/inspectStringOmitOverlap.js +++ b/dlp/inspectStringOmitOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringRep.js b/dlp/inspectStringRep.js index 20a9437650..28097a6c65 100644 --- a/dlp/inspectStringRep.js +++ b/dlp/inspectStringRep.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_string_rep] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Assemble the regional endpoint url using provided rep location const opts = { diff --git a/dlp/inspectStringWithExclusionDict.js b/dlp/inspectStringWithExclusionDict.js index e0e1f15926..f0f3fc64d7 100644 --- a/dlp/inspectStringWithExclusionDict.js +++ b/dlp/inspectStringWithExclusionDict.js @@ -23,7 +23,7 @@ function main(projectId, string, infoTypes, excludedWords) { [infoTypes, excludedWords] = transformCLI(infoTypes, excludedWords); // [START dlp_inspect_string_with_exclusion_dict] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionDictSubstring.js b/dlp/inspectStringWithExclusionDictSubstring.js index 621275f234..2d6b6de14d 100644 --- a/dlp/inspectStringWithExclusionDictSubstring.js +++ b/dlp/inspectStringWithExclusionDictSubstring.js @@ -25,7 +25,7 @@ function main(projectId, string, excludedSubstringList) { : []; // [START dlp_inspect_string_with_exclusion_dict_substring] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionRegex.js b/dlp/inspectStringWithExclusionRegex.js index 501b652f10..77335382da 100644 --- a/dlp/inspectStringWithExclusionRegex.js +++ b/dlp/inspectStringWithExclusionRegex.js @@ -21,7 +21,7 @@ function main(projectId, string, exclusionRegex) { // [START dlp_inspect_string_with_exclusion_regex] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithoutOverlap.js b/dlp/inspectStringWithoutOverlap.js index f8d58f6bf1..c015ba1179 100644 --- a/dlp/inspectStringWithoutOverlap.js +++ b/dlp/inspectStringWithoutOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_without_overlap] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectTable.js b/dlp/inspectTable.js index db86a7c534..8567712632 100644 --- a/dlp/inspectTable.js +++ b/dlp/inspectTable.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_table] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomHotwords.js b/dlp/inspectWithCustomHotwords.js index ea4c0fe6b4..e234778cb3 100644 --- a/dlp/inspectWithCustomHotwords.js +++ b/dlp/inspectWithCustomHotwords.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_column_values_w_custom_hotwords] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomRegex.js b/dlp/inspectWithCustomRegex.js index 216e883432..c654e4b56b 100644 --- a/dlp/inspectWithCustomRegex.js +++ b/dlp/inspectWithCustomRegex.js @@ -22,7 +22,7 @@ function main(projectId, string, customRegex) { // [START dlp_inspect_custom_regex] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithHotwordRules.js b/dlp/inspectWithHotwordRules.js index 2fff8e9428..50e4e54b2d 100644 --- a/dlp/inspectWithHotwordRules.js +++ b/dlp/inspectWithHotwordRules.js @@ -32,7 +32,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_hotword_rule] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index 3295fc5267..fa76aacfb7 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, string) { // [START dlp_inspect_with_stored_infotype] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index c5ecdcb81c..303ee90508 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -30,7 +30,7 @@ async function main( // [START dlp_k_anonymity] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index fa42e563d4..379bd47fee 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -21,7 +21,7 @@ async function main(projectId, datasetId, sourceTableId, outputTableId) { // [START dlp_k_anonymity_with_entity_id] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index 19eb01fa04..8f6b0ae8b4 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -32,7 +32,7 @@ async function main( // [START dlp_k_map] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index 4c585e7488..3ea088b5c9 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -30,7 +30,7 @@ async function main( quasiIds = transformCLI(quasiIds); // [START dlp_l_diversity] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/listInspectTemplates.js b/dlp/listInspectTemplates.js index 73e41aaebc..e9b92fa8d6 100644 --- a/dlp/listInspectTemplates.js +++ b/dlp/listInspectTemplates.js @@ -20,7 +20,7 @@ function main(projectId) { // [START dlp_list_inspect_templates] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listJobs.js b/dlp/listJobs.js index 41469ed254..d3236f75e6 100644 --- a/dlp/listJobs.js +++ b/dlp/listJobs.js @@ -22,7 +22,7 @@ function main(projectId, filter, jobType) { // [START dlp_list_jobs] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listTriggers.js b/dlp/listTriggers.js index c7fd234a7f..c38382b9a9 100644 --- a/dlp/listTriggers.js +++ b/dlp/listTriggers.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_list_triggers] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/metadata.js b/dlp/metadata.js index 02cf404666..d2f56a0da2 100644 --- a/dlp/metadata.js +++ b/dlp/metadata.js @@ -21,7 +21,7 @@ function main(projectId, languageCode, filter) { // [START dlp_list_info_types] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index 03cab40db5..0e153646b0 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_numerical_stats] // Import the Google Cloud client libraries - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/quickstart.js b/dlp/quickstart.js index 0d60c0e433..805efeaeec 100644 --- a/dlp/quickstart.js +++ b/dlp/quickstart.js @@ -21,7 +21,7 @@ function main(projectId) { // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // [START dlp_quickstart] diff --git a/dlp/redactImage.js b/dlp/redactImage.js index da893c2e85..0a11a6b0af 100644 --- a/dlp/redactImage.js +++ b/dlp/redactImage.js @@ -21,7 +21,7 @@ function main(projectId, filepath, minLikelihood, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries const mime = require('mime'); diff --git a/dlp/redactImageFileAllInfoTypes.js b/dlp/redactImageFileAllInfoTypes.js index 1890732349..c0958e8e56 100644 --- a/dlp/redactImageFileAllInfoTypes.js +++ b/dlp/redactImageFileAllInfoTypes.js @@ -20,7 +20,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries const mime = require('mime'); diff --git a/dlp/redactImageFileAllText.js b/dlp/redactImageFileAllText.js index f3ef7a38ee..36f2f02a54 100644 --- a/dlp/redactImageFileAllText.js +++ b/dlp/redactImageFileAllText.js @@ -19,7 +19,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_text] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries const mime = require('mime'); diff --git a/dlp/redactImageFileColoredInfoTypes.js b/dlp/redactImageFileColoredInfoTypes.js index b12625660d..e112dfbb71 100644 --- a/dlp/redactImageFileColoredInfoTypes.js +++ b/dlp/redactImageFileColoredInfoTypes.js @@ -19,7 +19,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_colored_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries const mime = require('mime'); diff --git a/dlp/redactImageFileListedInfoTypes.js b/dlp/redactImageFileListedInfoTypes.js index 6945216c9f..9ebec44c9a 100644 --- a/dlp/redactImageFileListedInfoTypes.js +++ b/dlp/redactImageFileListedInfoTypes.js @@ -20,7 +20,7 @@ function main(projectId, filepath, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries const mime = require('mime'); diff --git a/dlp/redactText.js b/dlp/redactText.js index 305dcd44b6..e18c3e6d9e 100644 --- a/dlp/redactText.js +++ b/dlp/redactText.js @@ -21,7 +21,7 @@ function main(projectId, string, minLikelihood, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_text] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index 61d04f3272..a1d3a53c8b 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_reidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index b8bfee6547..ffb4ed54c6 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -28,7 +28,7 @@ async function main( ) { // [START dlp_reidentify_text_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index f4291dd092..8c27162ec6 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -21,7 +21,7 @@ async function main(projectId, string, keyName, wrappedKey, surrogateType) { // [START dlp_reidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpe.js b/dlp/reidentifyWithFpe.js index 0fe8e14133..ab71595819 100644 --- a/dlp/reidentifyWithFpe.js +++ b/dlp/reidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, surrogateType, keyName, wrappedKey) { // [START dlp_reidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpeSurrogate.js b/dlp/reidentifyWithFpeSurrogate.js index 89a28e3975..da4b052d30 100644 --- a/dlp/reidentifyWithFpeSurrogate.js +++ b/dlp/reidentifyWithFpeSurrogate.js @@ -21,7 +21,7 @@ function main(projectId, string, alphabet, surrogateType, unwrappedKey) { // [START dlp_reidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 6c6756f122..9bbcb8d915 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, outputPath, fileSetUrl) { // [START dlp_update_stored_infotype] // Import the required libraries - const dlp = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/updateTrigger.js b/dlp/updateTrigger.js index 2d2a9b0c5d..dcbc6621d0 100644 --- a/dlp/updateTrigger.js +++ b/dlp/updateTrigger.js @@ -21,7 +21,7 @@ function main(projectId, jobTriggerName) { // [START dlp_update_trigger] // Imports the Google Cloud Data Loss Prevention library - const DLP = require('@google-cloud/dlp'); + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); From 6cd98c5eb21922649dea3c7f1ab460a8341732aa Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Thu, 6 Mar 2025 13:46:14 +1100 Subject: [PATCH 18/22] bulk fix --- dlp/categoricalRiskAnalysis.js | 2 +- dlp/deidentifyWithDateShift.js | 2 +- dlp/inspectBigQuery.js | 2 +- dlp/inspectBigQueryTableWithSampling.js | 2 +- dlp/inspectDatastore.js | 2 +- dlp/inspectFile.js | 4 ++-- dlp/inspectGCSFile.js | 2 +- dlp/inspectGcsFileWithSampling.js | 2 +- dlp/inspectImageFile.js | 4 ++-- dlp/inspectImageFileAllInfoTypes.js | 4 ++-- dlp/inspectImageFileListedInfoTypes.js | 4 ++-- dlp/kAnonymityAnalysis.js | 2 +- dlp/kMapEstimationAnalysis.js | 2 +- dlp/lDiversityAnalysis.js | 2 +- dlp/numericalRiskAnalysis.js | 2 +- dlp/redactImage.js | 4 ++-- dlp/redactImageFileAllInfoTypes.js | 4 ++-- dlp/redactImageFileAllText.js | 4 ++-- dlp/redactImageFileColoredInfoTypes.js | 4 ++-- dlp/redactImageFileListedInfoTypes.js | 4 ++-- dlp/system-test/jobs.test.js | 2 +- 21 files changed, 30 insertions(+), 30 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index da9ca5a836..3b83e92c24 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -31,7 +31,7 @@ async function main( // [START dlp_categorical_stats] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - const {PubSub} = require('@google-cloud/pubsub'); + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDateShift.js b/dlp/deidentifyWithDateShift.js index 5bb4b6c303..85bab4ab3e 100644 --- a/dlp/deidentifyWithDateShift.js +++ b/dlp/deidentifyWithDateShift.js @@ -39,7 +39,7 @@ function main( const dlp = new DLP.DlpServiceClient(); // Import other required libraries - const fs = require('fs'); + import {fs} from 'fs'; // The project ID to run the API call under // const projectId = 'my-project'; diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index c8cedad4d0..a4ac9d8c79 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -34,7 +34,7 @@ async function main( // [START dlp_inspect_bigquery] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - const {PubSub} = require('@google-cloud/pubsub'); + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index 6d9cd5c244..be623d1c9d 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -27,7 +27,7 @@ async function main( // [START dlp_inspect_bigquery_with_sampling] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - const {PubSub} = require('@google-cloud/pubsub'); + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 71a15075f9..34c5da8ad0 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -36,7 +36,7 @@ async function main( // [START dlp_inspect_datastore] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - const {PubSub} = require('@google-cloud/pubsub'); + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectFile.js b/dlp/inspectFile.js index 3ed64f9537..fe887956f0 100644 --- a/dlp/inspectFile.js +++ b/dlp/inspectFile.js @@ -33,8 +33,8 @@ function main( import {DLP} from '@google-cloud/dlp'; // Import other required libraries - const fs = require('fs'); - const mime = require('mime'); + import {fs} from 'fs'; + import {mine} from 'mime'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index ff363376cc..d37f5c12ac 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_gcs] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - const {PubSub} = require('@google-cloud/pubsub'); + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index 2e67a21998..e6ab5b870d 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -22,7 +22,7 @@ async function main(projectId, gcsUri, topicId, subscriptionId, infoTypes) { // [START dlp_inspect_gcs_with_sampling] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - const {PubSub} = require('@google-cloud/pubsub'); + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFile.js b/dlp/inspectImageFile.js index 1b24733d8e..39eff5cb41 100644 --- a/dlp/inspectImageFile.js +++ b/dlp/inspectImageFile.js @@ -22,8 +22,8 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_file] // Imports the Google Cloud Data Loss Prevention library import {DLP} from '@google-cloud/dlp'; - const mime = require('mime'); - const fs = require('fs'); + import {mine} from 'mime'; + import {fs} from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileAllInfoTypes.js b/dlp/inspectImageFileAllInfoTypes.js index 4486f0a858..7c07cbe902 100644 --- a/dlp/inspectImageFileAllInfoTypes.js +++ b/dlp/inspectImageFileAllInfoTypes.js @@ -22,8 +22,8 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library import {DLP} from '@google-cloud/dlp'; - const mime = require('mime'); - const fs = require('fs'); + import {mine} from 'mime'; + import {fs} from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileListedInfoTypes.js b/dlp/inspectImageFileListedInfoTypes.js index f4533348d0..ec70148670 100644 --- a/dlp/inspectImageFileListedInfoTypes.js +++ b/dlp/inspectImageFileListedInfoTypes.js @@ -22,8 +22,8 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library import {DLP} from '@google-cloud/dlp'; - const mime = require('mime'); - const fs = require('fs'); + import {mine} from 'mime'; + import {fs} from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index 303ee90508..704c9cbe77 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -31,7 +31,7 @@ async function main( // [START dlp_k_anonymity] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - const {PubSub} = require('@google-cloud/pubsub'); + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index 8f6b0ae8b4..78ecd9cc21 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -33,7 +33,7 @@ async function main( // [START dlp_k_map] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - const {PubSub} = require('@google-cloud/pubsub'); + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index 3ea088b5c9..a421b8d174 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -31,7 +31,7 @@ async function main( // [START dlp_l_diversity] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - const {PubSub} = require('@google-cloud/pubsub'); + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index 0e153646b0..e3c6607689 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -31,7 +31,7 @@ async function main( // [START dlp_numerical_stats] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - const {PubSub} = require('@google-cloud/pubsub'); + import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImage.js b/dlp/redactImage.js index 0a11a6b0af..1cfe8ca28b 100644 --- a/dlp/redactImage.js +++ b/dlp/redactImage.js @@ -24,8 +24,8 @@ function main(projectId, filepath, minLikelihood, infoTypes, outputPath) { import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import {mine} from 'mime'; + import {fs} from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllInfoTypes.js b/dlp/redactImageFileAllInfoTypes.js index c0958e8e56..f8733ae62f 100644 --- a/dlp/redactImageFileAllInfoTypes.js +++ b/dlp/redactImageFileAllInfoTypes.js @@ -23,8 +23,8 @@ function main(projectId, filepath, outputPath) { import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import {mine} from 'mime'; + import {fs} from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllText.js b/dlp/redactImageFileAllText.js index 36f2f02a54..f5d9829b9c 100644 --- a/dlp/redactImageFileAllText.js +++ b/dlp/redactImageFileAllText.js @@ -22,8 +22,8 @@ function main(projectId, filepath, outputPath) { import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import {mine} from 'mime'; + import {fs} from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileColoredInfoTypes.js b/dlp/redactImageFileColoredInfoTypes.js index e112dfbb71..09f78f3824 100644 --- a/dlp/redactImageFileColoredInfoTypes.js +++ b/dlp/redactImageFileColoredInfoTypes.js @@ -22,8 +22,8 @@ function main(projectId, filepath, outputPath) { import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import {mine} from 'mime'; + import {fs} from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileListedInfoTypes.js b/dlp/redactImageFileListedInfoTypes.js index 9ebec44c9a..64f54049fd 100644 --- a/dlp/redactImageFileListedInfoTypes.js +++ b/dlp/redactImageFileListedInfoTypes.js @@ -23,8 +23,8 @@ function main(projectId, filepath, infoTypes, outputPath) { import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries - const mime = require('mime'); - const fs = require('fs'); + import {mine} from 'mime'; + import {fs} from 'fs'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/jobs.test.js b/dlp/system-test/jobs.test.js index 98711f28e8..65bd014480 100644 --- a/dlp/system-test/jobs.test.js +++ b/dlp/system-test/jobs.test.js @@ -53,7 +53,7 @@ describe('test', () => { // Helper function for creating test jobs const createTestJob = async () => { // Initialize client library - const DLP = require('@google-cloud/dlp').v2; + import {DLP} from '@google-cloud/dlp'; //.v2; const dlp = new DLP.DlpServiceClient(); // Construct job request From fb5b5b243ba62345e9aabef04f6e3d1559b79543 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Thu, 6 Mar 2025 13:54:04 +1100 Subject: [PATCH 19/22] import update --- dlp/categoricalRiskAnalysis.js | 2 +- dlp/createInspectTemplate.js | 2 +- dlp/createJob.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/createTrigger.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableBucketing.js | 2 +- dlp/deIdentifyTableConditionInfoTypes.js | 2 +- dlp/deIdentifyTableConditionMasking.js | 2 +- dlp/deIdentifyTableInfoTypes.js | 2 +- dlp/deIdentifyTableRowSuppress.js | 2 +- dlp/deIdentifyTableWithBucketingConfig.js | 2 +- dlp/deIdentifyTableWithCryptoHash.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deIdentifyTableWithMultipleCryptoHash.js | 2 +- dlp/deIdentifyWithExceptionList.js | 2 +- dlp/deIdentifyWithRedaction.js | 2 +- dlp/deIdentifyWithReplaceInfoType.js | 2 +- dlp/deIdentifyWithSimpleWordList.js | 2 +- dlp/deidentifyWithDateShift.js | 2 +- dlp/deidentifyWithDeterministic.js | 2 +- dlp/deidentifyWithDictionaryReplacement.js | 2 +- dlp/deidentifyWithFpe.js | 2 +- dlp/deidentifyWithFpeSurrogate.js | 2 +- dlp/deidentifyWithMask.js | 2 +- dlp/deidentifyWithReplacement.js | 2 +- dlp/deidentifyWithTimeExtraction.js | 2 +- dlp/deleteInspectTemplate.js | 2 +- dlp/deleteJob.js | 2 +- dlp/deleteTrigger.js | 2 +- dlp/getJob.js | 2 +- dlp/inspectBigQuery.js | 2 +- dlp/inspectBigQueryTableWithSampling.js | 2 +- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 2 +- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectFile.js | 2 +- dlp/inspectGCSFile.js | 2 +- dlp/inspectGcsFileWithSampling.js | 2 +- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectImageFile.js | 2 +- dlp/inspectImageFileAllInfoTypes.js | 2 +- dlp/inspectImageFileListedInfoTypes.js | 2 +- dlp/inspectPhoneNumber.js | 2 +- dlp/inspectString.js | 2 +- dlp/inspectStringAugmentInfoType.js | 2 +- dlp/inspectStringCustomExcludingSubstring.js | 2 +- dlp/inspectStringCustomHotword.js | 2 +- dlp/inspectStringCustomOmitOverlap.js | 2 +- dlp/inspectStringMultipleRules.js | 2 +- dlp/inspectStringOmitOverlap.js | 2 +- dlp/inspectStringRep.js | 2 +- dlp/inspectStringWithExclusionDict.js | 2 +- dlp/inspectStringWithExclusionDictSubstring.js | 2 +- dlp/inspectStringWithExclusionRegex.js | 2 +- dlp/inspectStringWithoutOverlap.js | 2 +- dlp/inspectTable.js | 2 +- dlp/inspectWithCustomHotwords.js | 2 +- dlp/inspectWithCustomRegex.js | 2 +- dlp/inspectWithHotwordRules.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 2 +- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 2 +- dlp/lDiversityAnalysis.js | 2 +- dlp/listInspectTemplates.js | 2 +- dlp/listJobs.js | 2 +- dlp/listTriggers.js | 2 +- dlp/metadata.js | 2 +- dlp/numericalRiskAnalysis.js | 2 +- dlp/quickstart.js | 2 +- dlp/redactImage.js | 2 +- dlp/redactImageFileAllInfoTypes.js | 2 +- dlp/redactImageFileAllText.js | 2 +- dlp/redactImageFileColoredInfoTypes.js | 2 +- dlp/redactImageFileListedInfoTypes.js | 2 +- dlp/redactText.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/reidentifyWithFpe.js | 2 +- dlp/reidentifyWithFpeSurrogate.js | 2 +- dlp/system-test/jobs.test.js | 2 +- dlp/updateStoredInfoType.js | 2 +- dlp/updateTrigger.js | 2 +- 86 files changed, 86 insertions(+), 86 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index 3b83e92c24..2b109ec785 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_categorical_stats] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/createInspectTemplate.js b/dlp/createInspectTemplate.js index 2720ca4ec4..19d93471b7 100644 --- a/dlp/createInspectTemplate.js +++ b/dlp/createInspectTemplate.js @@ -31,7 +31,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_inspect_template] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createJob.js b/dlp/createJob.js index 63c2645776..dc421b52d4 100644 --- a/dlp/createJob.js +++ b/dlp/createJob.js @@ -21,7 +21,7 @@ function main(projectId, cloudFileUrl) { // [START dlp_create_job] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index 2028774202..d8d52b1183 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -29,7 +29,7 @@ async function main( ) { // [START dlp_create_stored_infotype] // Import the required libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/createTrigger.js b/dlp/createTrigger.js index fe0af291ff..1fdcb78266 100644 --- a/dlp/createTrigger.js +++ b/dlp/createTrigger.js @@ -34,7 +34,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_trigger] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index 346289de84..a16922c438 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_deidentify_cloud_storage] // Imports the Google Cloud client library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableBucketing.js b/dlp/deIdentifyTableBucketing.js index 4ef40460e4..7f41c398be 100644 --- a/dlp/deIdentifyTableBucketing.js +++ b/dlp/deIdentifyTableBucketing.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_bucketing] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionInfoTypes.js b/dlp/deIdentifyTableConditionInfoTypes.js index 555a1d8a18..c05590b01e 100644 --- a/dlp/deIdentifyTableConditionInfoTypes.js +++ b/dlp/deIdentifyTableConditionInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionMasking.js b/dlp/deIdentifyTableConditionMasking.js index b52eb7bc08..e2e6218ada 100644 --- a/dlp/deIdentifyTableConditionMasking.js +++ b/dlp/deIdentifyTableConditionMasking.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_masking] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableInfoTypes.js b/dlp/deIdentifyTableInfoTypes.js index dfc87f9b46..5e00a1871e 100644 --- a/dlp/deIdentifyTableInfoTypes.js +++ b/dlp/deIdentifyTableInfoTypes.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableRowSuppress.js b/dlp/deIdentifyTableRowSuppress.js index 78e94bf3c2..50397613cf 100644 --- a/dlp/deIdentifyTableRowSuppress.js +++ b/dlp/deIdentifyTableRowSuppress.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_row_suppress] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithBucketingConfig.js b/dlp/deIdentifyTableWithBucketingConfig.js index 057c32d9b0..dc577917a6 100644 --- a/dlp/deIdentifyTableWithBucketingConfig.js +++ b/dlp/deIdentifyTableWithBucketingConfig.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_primitive_bucketing] // Imports the Google Cloud client library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithCryptoHash.js b/dlp/deIdentifyTableWithCryptoHash.js index a837fe5b99..a84fb6536c 100644 --- a/dlp/deIdentifyTableWithCryptoHash.js +++ b/dlp/deIdentifyTableWithCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKeyName) { // [START dlp_deidentify_table_with_crypto_hash] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index 1698397c49..30e855987d 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_deidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithMultipleCryptoHash.js b/dlp/deIdentifyTableWithMultipleCryptoHash.js index fbe493b36b..853685d2fb 100644 --- a/dlp/deIdentifyTableWithMultipleCryptoHash.js +++ b/dlp/deIdentifyTableWithMultipleCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKey1, transientKey2) { // [START dlp_deidentify_table_with_multiple_crypto_hash] // Imports the Google Cloud client library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithExceptionList.js b/dlp/deIdentifyWithExceptionList.js index 7fa51ad242..44e7790d17 100644 --- a/dlp/deIdentifyWithExceptionList.js +++ b/dlp/deIdentifyWithExceptionList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_exception_list] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call diff --git a/dlp/deIdentifyWithRedaction.js b/dlp/deIdentifyWithRedaction.js index 08746e9cc3..47bde6e99b 100644 --- a/dlp/deIdentifyWithRedaction.js +++ b/dlp/deIdentifyWithRedaction.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_redact] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithReplaceInfoType.js b/dlp/deIdentifyWithReplaceInfoType.js index 911b85110d..4bf56eeed3 100644 --- a/dlp/deIdentifyWithReplaceInfoType.js +++ b/dlp/deIdentifyWithReplaceInfoType.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = parseInfotypes(infoTypes); // [START dlp_deidentify_replace_infotype] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithSimpleWordList.js b/dlp/deIdentifyWithSimpleWordList.js index 3ef2eaca52..aa80596a62 100644 --- a/dlp/deIdentifyWithSimpleWordList.js +++ b/dlp/deIdentifyWithSimpleWordList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, customInfoTypeName) { words = words.split(','); // [START dlp_deidentify_simple_word_list] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // TODO(developer): Replace these variables before running the sample. // const projectId = "your-project-id"; diff --git a/dlp/deidentifyWithDateShift.js b/dlp/deidentifyWithDateShift.js index 85bab4ab3e..8d10c3a571 100644 --- a/dlp/deidentifyWithDateShift.js +++ b/dlp/deidentifyWithDateShift.js @@ -33,7 +33,7 @@ function main( dateFields = transformCLI(dateFields); // [START dlp_deidentify_date_shift] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index 73f8805d3c..b150728296 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -29,7 +29,7 @@ async function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDictionaryReplacement.js b/dlp/deidentifyWithDictionaryReplacement.js index d56308f0b5..4bb63c59dc 100644 --- a/dlp/deidentifyWithDictionaryReplacement.js +++ b/dlp/deidentifyWithDictionaryReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, infoTypes, words) { [infoTypes, words] = transformCLI(infoTypes, words); // [START dlp_deidentify_dictionary_replacement] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpe.js b/dlp/deidentifyWithFpe.js index a26917937c..0a8e38c63c 100644 --- a/dlp/deidentifyWithFpe.js +++ b/dlp/deidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, keyName, wrappedKey, surrogateType) { // [START dlp_deidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpeSurrogate.js b/dlp/deidentifyWithFpeSurrogate.js index 2eb9cdc601..719fe3689a 100644 --- a/dlp/deidentifyWithFpeSurrogate.js +++ b/dlp/deidentifyWithFpeSurrogate.js @@ -29,7 +29,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithMask.js b/dlp/deidentifyWithMask.js index 3749a49e4e..9a9acc0f2d 100644 --- a/dlp/deidentifyWithMask.js +++ b/dlp/deidentifyWithMask.js @@ -22,7 +22,7 @@ function main(projectId, string, maskingCharacter, numberToMask) { // [START dlp_deidentify_masking] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithReplacement.js b/dlp/deidentifyWithReplacement.js index 6ce33b4a34..a42adf7570 100644 --- a/dlp/deidentifyWithReplacement.js +++ b/dlp/deidentifyWithReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, replacement) { // [START dlp_deidentify_replace] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithTimeExtraction.js b/dlp/deidentifyWithTimeExtraction.js index 7a32c22c61..703840b9db 100644 --- a/dlp/deidentifyWithTimeExtraction.js +++ b/dlp/deidentifyWithTimeExtraction.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_time_extract] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteInspectTemplate.js b/dlp/deleteInspectTemplate.js index f4edfbe968..52f928708f 100644 --- a/dlp/deleteInspectTemplate.js +++ b/dlp/deleteInspectTemplate.js @@ -22,7 +22,7 @@ function main(projectId, templateName) { // [START dlp_delete_inspect_template] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteJob.js b/dlp/deleteJob.js index 9716df46fe..9b0a63ad72 100644 --- a/dlp/deleteJob.js +++ b/dlp/deleteJob.js @@ -20,7 +20,7 @@ function main(projectId, jobName) { // [START dlp_delete_job] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteTrigger.js b/dlp/deleteTrigger.js index c004d62acf..5d7d5c776e 100644 --- a/dlp/deleteTrigger.js +++ b/dlp/deleteTrigger.js @@ -20,7 +20,7 @@ function main(projectId, triggerId) { // [START dlp_delete_trigger] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/getJob.js b/dlp/getJob.js index 117abf1541..f8b752a143 100644 --- a/dlp/getJob.js +++ b/dlp/getJob.js @@ -21,7 +21,7 @@ function main(jobName) { // [START dlp_get_job] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index a4ac9d8c79..ff977a6ca9 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_bigquery] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index be623d1c9d..d6b509a458 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -26,7 +26,7 @@ async function main( ) { // [START dlp_inspect_bigquery_with_sampling] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index 9d63499d88..71ee94c2d6 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, dataProjectId, datasetId, tableId) { // [START dlp_inspect_bigquery_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index 5d300ad8d0..ff7b7a395a 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -22,7 +22,7 @@ async function main(projectId, string, jobTriggerId) { // [START dlp_inspect_send_data_to_hybrid_job_trigger] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 34c5da8ad0..4653c7314a 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -35,7 +35,7 @@ async function main( // [START dlp_inspect_datastore] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 9d25d36538..1b1a41b89d 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, datastoreNamespace, datastoreKind) { // [START dlp_inspect_datastore_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectFile.js b/dlp/inspectFile.js index fe887956f0..907caf2042 100644 --- a/dlp/inspectFile.js +++ b/dlp/inspectFile.js @@ -30,7 +30,7 @@ function main( // [START dlp_inspect_file] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Import other required libraries import {fs} from 'fs'; diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index d37f5c12ac..34b1c9bbc9 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -32,7 +32,7 @@ async function main( // [START dlp_inspect_gcs] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index e6ab5b870d..e2df499170 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -21,7 +21,7 @@ async function main(projectId, gcsUri, topicId, subscriptionId, infoTypes) { // [START dlp_inspect_gcs_with_sampling] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 5b0a42bb30..7b6bcf9bb7 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, gcsPath) { // [START dlp_inspect_gcs_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFile.js b/dlp/inspectImageFile.js index 39eff5cb41..daf2b2c231 100644 --- a/dlp/inspectImageFile.js +++ b/dlp/inspectImageFile.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_file] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {mine} from 'mime'; import {fs} from 'fs'; diff --git a/dlp/inspectImageFileAllInfoTypes.js b/dlp/inspectImageFileAllInfoTypes.js index 7c07cbe902..f02208cf34 100644 --- a/dlp/inspectImageFileAllInfoTypes.js +++ b/dlp/inspectImageFileAllInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {mine} from 'mime'; import {fs} from 'fs'; diff --git a/dlp/inspectImageFileListedInfoTypes.js b/dlp/inspectImageFileListedInfoTypes.js index ec70148670..9abc820d83 100644 --- a/dlp/inspectImageFileListedInfoTypes.js +++ b/dlp/inspectImageFileListedInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {mine} from 'mime'; import {fs} from 'fs'; diff --git a/dlp/inspectPhoneNumber.js b/dlp/inspectPhoneNumber.js index c4b91bda97..99502338d5 100644 --- a/dlp/inspectPhoneNumber.js +++ b/dlp/inspectPhoneNumber.js @@ -31,7 +31,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_phone_number] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectString.js b/dlp/inspectString.js index 57d3a32072..b4912e6aa6 100644 --- a/dlp/inspectString.js +++ b/dlp/inspectString.js @@ -32,7 +32,7 @@ function main( // [START dlp_inspect_string] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringAugmentInfoType.js b/dlp/inspectStringAugmentInfoType.js index 6beaa6a0fb..d554aca917 100644 --- a/dlp/inspectStringAugmentInfoType.js +++ b/dlp/inspectStringAugmentInfoType.js @@ -22,7 +22,7 @@ function main(projectId, string, words) { words = words ? words.split(',') : []; // [START dlp_inspect_augment_infotypes] // Imports the Google Cloud client library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomExcludingSubstring.js b/dlp/inspectStringCustomExcludingSubstring.js index f8df43101a..c96f7f1de1 100644 --- a/dlp/inspectStringCustomExcludingSubstring.js +++ b/dlp/inspectStringCustomExcludingSubstring.js @@ -22,7 +22,7 @@ function main(projectId, string, excludedWords) { excludedWords = excludedWords ? excludedWords.split(',') : []; // [START dlp_inspect_string_custom_excluding_substring] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomHotword.js b/dlp/inspectStringCustomHotword.js index 07bdef7719..244efc41d1 100644 --- a/dlp/inspectStringCustomHotword.js +++ b/dlp/inspectStringCustomHotword.js @@ -21,7 +21,7 @@ function main(projectId, string, customHotword) { // [START dlp_inspect_string_custom_hotword] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomOmitOverlap.js b/dlp/inspectStringCustomOmitOverlap.js index 3e61c9fe21..6461c1075a 100644 --- a/dlp/inspectStringCustomOmitOverlap.js +++ b/dlp/inspectStringCustomOmitOverlap.js @@ -20,7 +20,7 @@ function main(projectId, string) { // [START dlp_inspect_string_custom_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringMultipleRules.js b/dlp/inspectStringMultipleRules.js index 6f76723e2a..157c543f44 100644 --- a/dlp/inspectStringMultipleRules.js +++ b/dlp/inspectStringMultipleRules.js @@ -21,7 +21,7 @@ function main(projectId, string) { // [START dlp_inspect_string_multiple_rules] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringOmitOverlap.js b/dlp/inspectStringOmitOverlap.js index 92084f1546..66136e39b8 100644 --- a/dlp/inspectStringOmitOverlap.js +++ b/dlp/inspectStringOmitOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringRep.js b/dlp/inspectStringRep.js index 28097a6c65..b5877cd636 100644 --- a/dlp/inspectStringRep.js +++ b/dlp/inspectStringRep.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_string_rep] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Assemble the regional endpoint url using provided rep location const opts = { diff --git a/dlp/inspectStringWithExclusionDict.js b/dlp/inspectStringWithExclusionDict.js index f0f3fc64d7..f4a4fcb32b 100644 --- a/dlp/inspectStringWithExclusionDict.js +++ b/dlp/inspectStringWithExclusionDict.js @@ -23,7 +23,7 @@ function main(projectId, string, infoTypes, excludedWords) { [infoTypes, excludedWords] = transformCLI(infoTypes, excludedWords); // [START dlp_inspect_string_with_exclusion_dict] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionDictSubstring.js b/dlp/inspectStringWithExclusionDictSubstring.js index 2d6b6de14d..37496dfcd5 100644 --- a/dlp/inspectStringWithExclusionDictSubstring.js +++ b/dlp/inspectStringWithExclusionDictSubstring.js @@ -25,7 +25,7 @@ function main(projectId, string, excludedSubstringList) { : []; // [START dlp_inspect_string_with_exclusion_dict_substring] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionRegex.js b/dlp/inspectStringWithExclusionRegex.js index 77335382da..60bef9ffa6 100644 --- a/dlp/inspectStringWithExclusionRegex.js +++ b/dlp/inspectStringWithExclusionRegex.js @@ -21,7 +21,7 @@ function main(projectId, string, exclusionRegex) { // [START dlp_inspect_string_with_exclusion_regex] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithoutOverlap.js b/dlp/inspectStringWithoutOverlap.js index c015ba1179..14d85132f1 100644 --- a/dlp/inspectStringWithoutOverlap.js +++ b/dlp/inspectStringWithoutOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_without_overlap] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectTable.js b/dlp/inspectTable.js index 8567712632..b29acd36f7 100644 --- a/dlp/inspectTable.js +++ b/dlp/inspectTable.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_table] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomHotwords.js b/dlp/inspectWithCustomHotwords.js index e234778cb3..7898a9ace8 100644 --- a/dlp/inspectWithCustomHotwords.js +++ b/dlp/inspectWithCustomHotwords.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_column_values_w_custom_hotwords] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomRegex.js b/dlp/inspectWithCustomRegex.js index c654e4b56b..183726ddbe 100644 --- a/dlp/inspectWithCustomRegex.js +++ b/dlp/inspectWithCustomRegex.js @@ -22,7 +22,7 @@ function main(projectId, string, customRegex) { // [START dlp_inspect_custom_regex] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithHotwordRules.js b/dlp/inspectWithHotwordRules.js index 50e4e54b2d..5d694f6f67 100644 --- a/dlp/inspectWithHotwordRules.js +++ b/dlp/inspectWithHotwordRules.js @@ -32,7 +32,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_hotword_rule] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index fa76aacfb7..83b6ae2c24 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, string) { // [START dlp_inspect_with_stored_infotype] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index 704c9cbe77..12578d80d1 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -30,7 +30,7 @@ async function main( // [START dlp_k_anonymity] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index 379bd47fee..7f7ed09c5a 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -21,7 +21,7 @@ async function main(projectId, datasetId, sourceTableId, outputTableId) { // [START dlp_k_anonymity_with_entity_id] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index 78ecd9cc21..8e4b5d7008 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -32,7 +32,7 @@ async function main( // [START dlp_k_map] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index a421b8d174..ae9d6932a4 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -30,7 +30,7 @@ async function main( quasiIds = transformCLI(quasiIds); // [START dlp_l_diversity] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/listInspectTemplates.js b/dlp/listInspectTemplates.js index e9b92fa8d6..015e7e05d9 100644 --- a/dlp/listInspectTemplates.js +++ b/dlp/listInspectTemplates.js @@ -20,7 +20,7 @@ function main(projectId) { // [START dlp_list_inspect_templates] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listJobs.js b/dlp/listJobs.js index d3236f75e6..87ccee08ac 100644 --- a/dlp/listJobs.js +++ b/dlp/listJobs.js @@ -22,7 +22,7 @@ function main(projectId, filter, jobType) { // [START dlp_list_jobs] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listTriggers.js b/dlp/listTriggers.js index c38382b9a9..ff04b95ecc 100644 --- a/dlp/listTriggers.js +++ b/dlp/listTriggers.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_list_triggers] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/metadata.js b/dlp/metadata.js index d2f56a0da2..39a6a0639b 100644 --- a/dlp/metadata.js +++ b/dlp/metadata.js @@ -21,7 +21,7 @@ function main(projectId, languageCode, filter) { // [START dlp_list_info_types] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index e3c6607689..5344fa94cc 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_numerical_stats] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/quickstart.js b/dlp/quickstart.js index 805efeaeec..c76f55dcb5 100644 --- a/dlp/quickstart.js +++ b/dlp/quickstart.js @@ -21,7 +21,7 @@ function main(projectId) { // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // [START dlp_quickstart] diff --git a/dlp/redactImage.js b/dlp/redactImage.js index 1cfe8ca28b..8e0d943951 100644 --- a/dlp/redactImage.js +++ b/dlp/redactImage.js @@ -21,7 +21,7 @@ function main(projectId, filepath, minLikelihood, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries import {mine} from 'mime'; diff --git a/dlp/redactImageFileAllInfoTypes.js b/dlp/redactImageFileAllInfoTypes.js index f8733ae62f..38154d7cc9 100644 --- a/dlp/redactImageFileAllInfoTypes.js +++ b/dlp/redactImageFileAllInfoTypes.js @@ -20,7 +20,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries import {mine} from 'mime'; diff --git a/dlp/redactImageFileAllText.js b/dlp/redactImageFileAllText.js index f5d9829b9c..1e88ea613a 100644 --- a/dlp/redactImageFileAllText.js +++ b/dlp/redactImageFileAllText.js @@ -19,7 +19,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_text] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries import {mine} from 'mime'; diff --git a/dlp/redactImageFileColoredInfoTypes.js b/dlp/redactImageFileColoredInfoTypes.js index 09f78f3824..11f00fb48e 100644 --- a/dlp/redactImageFileColoredInfoTypes.js +++ b/dlp/redactImageFileColoredInfoTypes.js @@ -19,7 +19,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_colored_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries import {mine} from 'mime'; diff --git a/dlp/redactImageFileListedInfoTypes.js b/dlp/redactImageFileListedInfoTypes.js index 64f54049fd..2fb50a7f60 100644 --- a/dlp/redactImageFileListedInfoTypes.js +++ b/dlp/redactImageFileListedInfoTypes.js @@ -20,7 +20,7 @@ function main(projectId, filepath, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Imports required Node.js libraries import {mine} from 'mime'; diff --git a/dlp/redactText.js b/dlp/redactText.js index e18c3e6d9e..4c75476a08 100644 --- a/dlp/redactText.js +++ b/dlp/redactText.js @@ -21,7 +21,7 @@ function main(projectId, string, minLikelihood, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_text] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index a1d3a53c8b..41afa77ba8 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_reidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index ffb4ed54c6..288c8b7665 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -28,7 +28,7 @@ async function main( ) { // [START dlp_reidentify_text_fpe] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index 8c27162ec6..9a45577c65 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -21,7 +21,7 @@ async function main(projectId, string, keyName, wrappedKey, surrogateType) { // [START dlp_reidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpe.js b/dlp/reidentifyWithFpe.js index ab71595819..b1f3277500 100644 --- a/dlp/reidentifyWithFpe.js +++ b/dlp/reidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, surrogateType, keyName, wrappedKey) { // [START dlp_reidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpeSurrogate.js b/dlp/reidentifyWithFpeSurrogate.js index da4b052d30..c242b993f8 100644 --- a/dlp/reidentifyWithFpeSurrogate.js +++ b/dlp/reidentifyWithFpeSurrogate.js @@ -21,7 +21,7 @@ function main(projectId, string, alphabet, surrogateType, unwrappedKey) { // [START dlp_reidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/jobs.test.js b/dlp/system-test/jobs.test.js index 65bd014480..ed4919751e 100644 --- a/dlp/system-test/jobs.test.js +++ b/dlp/system-test/jobs.test.js @@ -53,7 +53,7 @@ describe('test', () => { // Helper function for creating test jobs const createTestJob = async () => { // Initialize client library - import {DLP} from '@google-cloud/dlp'; //.v2; + import DLP from '@google-cloud/dlp'; //.v2; const dlp = new DLP.DlpServiceClient(); // Construct job request diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 9bbcb8d915..35cb26463b 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, outputPath, fileSetUrl) { // [START dlp_update_stored_infotype] // Import the required libraries - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/updateTrigger.js b/dlp/updateTrigger.js index dcbc6621d0..5d934605b9 100644 --- a/dlp/updateTrigger.js +++ b/dlp/updateTrigger.js @@ -21,7 +21,7 @@ function main(projectId, jobTriggerName) { // [START dlp_update_trigger] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + import DLP from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); From f84eba4d95d1c15aec550260b749d751b6e697b4 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Thu, 6 Mar 2025 13:58:59 +1100 Subject: [PATCH 20/22] Revert "import update" This reverts commit fb5b5b243ba62345e9aabef04f6e3d1559b79543. --- dlp/categoricalRiskAnalysis.js | 2 +- dlp/createInspectTemplate.js | 2 +- dlp/createJob.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/createTrigger.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableBucketing.js | 2 +- dlp/deIdentifyTableConditionInfoTypes.js | 2 +- dlp/deIdentifyTableConditionMasking.js | 2 +- dlp/deIdentifyTableInfoTypes.js | 2 +- dlp/deIdentifyTableRowSuppress.js | 2 +- dlp/deIdentifyTableWithBucketingConfig.js | 2 +- dlp/deIdentifyTableWithCryptoHash.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deIdentifyTableWithMultipleCryptoHash.js | 2 +- dlp/deIdentifyWithExceptionList.js | 2 +- dlp/deIdentifyWithRedaction.js | 2 +- dlp/deIdentifyWithReplaceInfoType.js | 2 +- dlp/deIdentifyWithSimpleWordList.js | 2 +- dlp/deidentifyWithDateShift.js | 2 +- dlp/deidentifyWithDeterministic.js | 2 +- dlp/deidentifyWithDictionaryReplacement.js | 2 +- dlp/deidentifyWithFpe.js | 2 +- dlp/deidentifyWithFpeSurrogate.js | 2 +- dlp/deidentifyWithMask.js | 2 +- dlp/deidentifyWithReplacement.js | 2 +- dlp/deidentifyWithTimeExtraction.js | 2 +- dlp/deleteInspectTemplate.js | 2 +- dlp/deleteJob.js | 2 +- dlp/deleteTrigger.js | 2 +- dlp/getJob.js | 2 +- dlp/inspectBigQuery.js | 2 +- dlp/inspectBigQueryTableWithSampling.js | 2 +- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 2 +- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectFile.js | 2 +- dlp/inspectGCSFile.js | 2 +- dlp/inspectGcsFileWithSampling.js | 2 +- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectImageFile.js | 2 +- dlp/inspectImageFileAllInfoTypes.js | 2 +- dlp/inspectImageFileListedInfoTypes.js | 2 +- dlp/inspectPhoneNumber.js | 2 +- dlp/inspectString.js | 2 +- dlp/inspectStringAugmentInfoType.js | 2 +- dlp/inspectStringCustomExcludingSubstring.js | 2 +- dlp/inspectStringCustomHotword.js | 2 +- dlp/inspectStringCustomOmitOverlap.js | 2 +- dlp/inspectStringMultipleRules.js | 2 +- dlp/inspectStringOmitOverlap.js | 2 +- dlp/inspectStringRep.js | 2 +- dlp/inspectStringWithExclusionDict.js | 2 +- dlp/inspectStringWithExclusionDictSubstring.js | 2 +- dlp/inspectStringWithExclusionRegex.js | 2 +- dlp/inspectStringWithoutOverlap.js | 2 +- dlp/inspectTable.js | 2 +- dlp/inspectWithCustomHotwords.js | 2 +- dlp/inspectWithCustomRegex.js | 2 +- dlp/inspectWithHotwordRules.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 2 +- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 2 +- dlp/lDiversityAnalysis.js | 2 +- dlp/listInspectTemplates.js | 2 +- dlp/listJobs.js | 2 +- dlp/listTriggers.js | 2 +- dlp/metadata.js | 2 +- dlp/numericalRiskAnalysis.js | 2 +- dlp/quickstart.js | 2 +- dlp/redactImage.js | 2 +- dlp/redactImageFileAllInfoTypes.js | 2 +- dlp/redactImageFileAllText.js | 2 +- dlp/redactImageFileColoredInfoTypes.js | 2 +- dlp/redactImageFileListedInfoTypes.js | 2 +- dlp/redactText.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/reidentifyWithFpe.js | 2 +- dlp/reidentifyWithFpeSurrogate.js | 2 +- dlp/system-test/jobs.test.js | 2 +- dlp/updateStoredInfoType.js | 2 +- dlp/updateTrigger.js | 2 +- 86 files changed, 86 insertions(+), 86 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index 2b109ec785..3b83e92c24 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_categorical_stats] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/createInspectTemplate.js b/dlp/createInspectTemplate.js index 19d93471b7..2720ca4ec4 100644 --- a/dlp/createInspectTemplate.js +++ b/dlp/createInspectTemplate.js @@ -31,7 +31,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_inspect_template] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createJob.js b/dlp/createJob.js index dc421b52d4..63c2645776 100644 --- a/dlp/createJob.js +++ b/dlp/createJob.js @@ -21,7 +21,7 @@ function main(projectId, cloudFileUrl) { // [START dlp_create_job] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index d8d52b1183..2028774202 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -29,7 +29,7 @@ async function main( ) { // [START dlp_create_stored_infotype] // Import the required libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/createTrigger.js b/dlp/createTrigger.js index 1fdcb78266..fe0af291ff 100644 --- a/dlp/createTrigger.js +++ b/dlp/createTrigger.js @@ -34,7 +34,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index a16922c438..346289de84 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_deidentify_cloud_storage] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableBucketing.js b/dlp/deIdentifyTableBucketing.js index 7f41c398be..4ef40460e4 100644 --- a/dlp/deIdentifyTableBucketing.js +++ b/dlp/deIdentifyTableBucketing.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_bucketing] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionInfoTypes.js b/dlp/deIdentifyTableConditionInfoTypes.js index c05590b01e..555a1d8a18 100644 --- a/dlp/deIdentifyTableConditionInfoTypes.js +++ b/dlp/deIdentifyTableConditionInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionMasking.js b/dlp/deIdentifyTableConditionMasking.js index e2e6218ada..b52eb7bc08 100644 --- a/dlp/deIdentifyTableConditionMasking.js +++ b/dlp/deIdentifyTableConditionMasking.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_masking] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableInfoTypes.js b/dlp/deIdentifyTableInfoTypes.js index 5e00a1871e..dfc87f9b46 100644 --- a/dlp/deIdentifyTableInfoTypes.js +++ b/dlp/deIdentifyTableInfoTypes.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableRowSuppress.js b/dlp/deIdentifyTableRowSuppress.js index 50397613cf..78e94bf3c2 100644 --- a/dlp/deIdentifyTableRowSuppress.js +++ b/dlp/deIdentifyTableRowSuppress.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_row_suppress] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithBucketingConfig.js b/dlp/deIdentifyTableWithBucketingConfig.js index dc577917a6..057c32d9b0 100644 --- a/dlp/deIdentifyTableWithBucketingConfig.js +++ b/dlp/deIdentifyTableWithBucketingConfig.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_primitive_bucketing] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithCryptoHash.js b/dlp/deIdentifyTableWithCryptoHash.js index a84fb6536c..a837fe5b99 100644 --- a/dlp/deIdentifyTableWithCryptoHash.js +++ b/dlp/deIdentifyTableWithCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKeyName) { // [START dlp_deidentify_table_with_crypto_hash] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index 30e855987d..1698397c49 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_deidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithMultipleCryptoHash.js b/dlp/deIdentifyTableWithMultipleCryptoHash.js index 853685d2fb..fbe493b36b 100644 --- a/dlp/deIdentifyTableWithMultipleCryptoHash.js +++ b/dlp/deIdentifyTableWithMultipleCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKey1, transientKey2) { // [START dlp_deidentify_table_with_multiple_crypto_hash] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithExceptionList.js b/dlp/deIdentifyWithExceptionList.js index 44e7790d17..7fa51ad242 100644 --- a/dlp/deIdentifyWithExceptionList.js +++ b/dlp/deIdentifyWithExceptionList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_exception_list] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call diff --git a/dlp/deIdentifyWithRedaction.js b/dlp/deIdentifyWithRedaction.js index 47bde6e99b..08746e9cc3 100644 --- a/dlp/deIdentifyWithRedaction.js +++ b/dlp/deIdentifyWithRedaction.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_redact] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithReplaceInfoType.js b/dlp/deIdentifyWithReplaceInfoType.js index 4bf56eeed3..911b85110d 100644 --- a/dlp/deIdentifyWithReplaceInfoType.js +++ b/dlp/deIdentifyWithReplaceInfoType.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = parseInfotypes(infoTypes); // [START dlp_deidentify_replace_infotype] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithSimpleWordList.js b/dlp/deIdentifyWithSimpleWordList.js index aa80596a62..3ef2eaca52 100644 --- a/dlp/deIdentifyWithSimpleWordList.js +++ b/dlp/deIdentifyWithSimpleWordList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, customInfoTypeName) { words = words.split(','); // [START dlp_deidentify_simple_word_list] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // TODO(developer): Replace these variables before running the sample. // const projectId = "your-project-id"; diff --git a/dlp/deidentifyWithDateShift.js b/dlp/deidentifyWithDateShift.js index 8d10c3a571..85bab4ab3e 100644 --- a/dlp/deidentifyWithDateShift.js +++ b/dlp/deidentifyWithDateShift.js @@ -33,7 +33,7 @@ function main( dateFields = transformCLI(dateFields); // [START dlp_deidentify_date_shift] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index b150728296..73f8805d3c 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -29,7 +29,7 @@ async function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDictionaryReplacement.js b/dlp/deidentifyWithDictionaryReplacement.js index 4bb63c59dc..d56308f0b5 100644 --- a/dlp/deidentifyWithDictionaryReplacement.js +++ b/dlp/deidentifyWithDictionaryReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, infoTypes, words) { [infoTypes, words] = transformCLI(infoTypes, words); // [START dlp_deidentify_dictionary_replacement] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpe.js b/dlp/deidentifyWithFpe.js index 0a8e38c63c..a26917937c 100644 --- a/dlp/deidentifyWithFpe.js +++ b/dlp/deidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, keyName, wrappedKey, surrogateType) { // [START dlp_deidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpeSurrogate.js b/dlp/deidentifyWithFpeSurrogate.js index 719fe3689a..2eb9cdc601 100644 --- a/dlp/deidentifyWithFpeSurrogate.js +++ b/dlp/deidentifyWithFpeSurrogate.js @@ -29,7 +29,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithMask.js b/dlp/deidentifyWithMask.js index 9a9acc0f2d..3749a49e4e 100644 --- a/dlp/deidentifyWithMask.js +++ b/dlp/deidentifyWithMask.js @@ -22,7 +22,7 @@ function main(projectId, string, maskingCharacter, numberToMask) { // [START dlp_deidentify_masking] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithReplacement.js b/dlp/deidentifyWithReplacement.js index a42adf7570..6ce33b4a34 100644 --- a/dlp/deidentifyWithReplacement.js +++ b/dlp/deidentifyWithReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, replacement) { // [START dlp_deidentify_replace] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithTimeExtraction.js b/dlp/deidentifyWithTimeExtraction.js index 703840b9db..7a32c22c61 100644 --- a/dlp/deidentifyWithTimeExtraction.js +++ b/dlp/deidentifyWithTimeExtraction.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_time_extract] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteInspectTemplate.js b/dlp/deleteInspectTemplate.js index 52f928708f..f4edfbe968 100644 --- a/dlp/deleteInspectTemplate.js +++ b/dlp/deleteInspectTemplate.js @@ -22,7 +22,7 @@ function main(projectId, templateName) { // [START dlp_delete_inspect_template] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteJob.js b/dlp/deleteJob.js index 9b0a63ad72..9716df46fe 100644 --- a/dlp/deleteJob.js +++ b/dlp/deleteJob.js @@ -20,7 +20,7 @@ function main(projectId, jobName) { // [START dlp_delete_job] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteTrigger.js b/dlp/deleteTrigger.js index 5d7d5c776e..c004d62acf 100644 --- a/dlp/deleteTrigger.js +++ b/dlp/deleteTrigger.js @@ -20,7 +20,7 @@ function main(projectId, triggerId) { // [START dlp_delete_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/getJob.js b/dlp/getJob.js index f8b752a143..117abf1541 100644 --- a/dlp/getJob.js +++ b/dlp/getJob.js @@ -21,7 +21,7 @@ function main(jobName) { // [START dlp_get_job] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index ff977a6ca9..a4ac9d8c79 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_bigquery] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index d6b509a458..be623d1c9d 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -26,7 +26,7 @@ async function main( ) { // [START dlp_inspect_bigquery_with_sampling] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index 71ee94c2d6..9d63499d88 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, dataProjectId, datasetId, tableId) { // [START dlp_inspect_bigquery_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index ff7b7a395a..5d300ad8d0 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -22,7 +22,7 @@ async function main(projectId, string, jobTriggerId) { // [START dlp_inspect_send_data_to_hybrid_job_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 4653c7314a..34c5da8ad0 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -35,7 +35,7 @@ async function main( // [START dlp_inspect_datastore] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 1b1a41b89d..9d25d36538 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, datastoreNamespace, datastoreKind) { // [START dlp_inspect_datastore_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectFile.js b/dlp/inspectFile.js index 907caf2042..fe887956f0 100644 --- a/dlp/inspectFile.js +++ b/dlp/inspectFile.js @@ -30,7 +30,7 @@ function main( // [START dlp_inspect_file] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Import other required libraries import {fs} from 'fs'; diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index 34b1c9bbc9..d37f5c12ac 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -32,7 +32,7 @@ async function main( // [START dlp_inspect_gcs] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index e2df499170..e6ab5b870d 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -21,7 +21,7 @@ async function main(projectId, gcsUri, topicId, subscriptionId, infoTypes) { // [START dlp_inspect_gcs_with_sampling] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 7b6bcf9bb7..5b0a42bb30 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, gcsPath) { // [START dlp_inspect_gcs_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFile.js b/dlp/inspectImageFile.js index daf2b2c231..39eff5cb41 100644 --- a/dlp/inspectImageFile.js +++ b/dlp/inspectImageFile.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_file] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {mine} from 'mime'; import {fs} from 'fs'; diff --git a/dlp/inspectImageFileAllInfoTypes.js b/dlp/inspectImageFileAllInfoTypes.js index f02208cf34..7c07cbe902 100644 --- a/dlp/inspectImageFileAllInfoTypes.js +++ b/dlp/inspectImageFileAllInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {mine} from 'mime'; import {fs} from 'fs'; diff --git a/dlp/inspectImageFileListedInfoTypes.js b/dlp/inspectImageFileListedInfoTypes.js index 9abc820d83..ec70148670 100644 --- a/dlp/inspectImageFileListedInfoTypes.js +++ b/dlp/inspectImageFileListedInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {mine} from 'mime'; import {fs} from 'fs'; diff --git a/dlp/inspectPhoneNumber.js b/dlp/inspectPhoneNumber.js index 99502338d5..c4b91bda97 100644 --- a/dlp/inspectPhoneNumber.js +++ b/dlp/inspectPhoneNumber.js @@ -31,7 +31,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_phone_number] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectString.js b/dlp/inspectString.js index b4912e6aa6..57d3a32072 100644 --- a/dlp/inspectString.js +++ b/dlp/inspectString.js @@ -32,7 +32,7 @@ function main( // [START dlp_inspect_string] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringAugmentInfoType.js b/dlp/inspectStringAugmentInfoType.js index d554aca917..6beaa6a0fb 100644 --- a/dlp/inspectStringAugmentInfoType.js +++ b/dlp/inspectStringAugmentInfoType.js @@ -22,7 +22,7 @@ function main(projectId, string, words) { words = words ? words.split(',') : []; // [START dlp_inspect_augment_infotypes] // Imports the Google Cloud client library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomExcludingSubstring.js b/dlp/inspectStringCustomExcludingSubstring.js index c96f7f1de1..f8df43101a 100644 --- a/dlp/inspectStringCustomExcludingSubstring.js +++ b/dlp/inspectStringCustomExcludingSubstring.js @@ -22,7 +22,7 @@ function main(projectId, string, excludedWords) { excludedWords = excludedWords ? excludedWords.split(',') : []; // [START dlp_inspect_string_custom_excluding_substring] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomHotword.js b/dlp/inspectStringCustomHotword.js index 244efc41d1..07bdef7719 100644 --- a/dlp/inspectStringCustomHotword.js +++ b/dlp/inspectStringCustomHotword.js @@ -21,7 +21,7 @@ function main(projectId, string, customHotword) { // [START dlp_inspect_string_custom_hotword] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomOmitOverlap.js b/dlp/inspectStringCustomOmitOverlap.js index 6461c1075a..3e61c9fe21 100644 --- a/dlp/inspectStringCustomOmitOverlap.js +++ b/dlp/inspectStringCustomOmitOverlap.js @@ -20,7 +20,7 @@ function main(projectId, string) { // [START dlp_inspect_string_custom_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringMultipleRules.js b/dlp/inspectStringMultipleRules.js index 157c543f44..6f76723e2a 100644 --- a/dlp/inspectStringMultipleRules.js +++ b/dlp/inspectStringMultipleRules.js @@ -21,7 +21,7 @@ function main(projectId, string) { // [START dlp_inspect_string_multiple_rules] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringOmitOverlap.js b/dlp/inspectStringOmitOverlap.js index 66136e39b8..92084f1546 100644 --- a/dlp/inspectStringOmitOverlap.js +++ b/dlp/inspectStringOmitOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringRep.js b/dlp/inspectStringRep.js index b5877cd636..28097a6c65 100644 --- a/dlp/inspectStringRep.js +++ b/dlp/inspectStringRep.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_string_rep] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Assemble the regional endpoint url using provided rep location const opts = { diff --git a/dlp/inspectStringWithExclusionDict.js b/dlp/inspectStringWithExclusionDict.js index f4a4fcb32b..f0f3fc64d7 100644 --- a/dlp/inspectStringWithExclusionDict.js +++ b/dlp/inspectStringWithExclusionDict.js @@ -23,7 +23,7 @@ function main(projectId, string, infoTypes, excludedWords) { [infoTypes, excludedWords] = transformCLI(infoTypes, excludedWords); // [START dlp_inspect_string_with_exclusion_dict] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionDictSubstring.js b/dlp/inspectStringWithExclusionDictSubstring.js index 37496dfcd5..2d6b6de14d 100644 --- a/dlp/inspectStringWithExclusionDictSubstring.js +++ b/dlp/inspectStringWithExclusionDictSubstring.js @@ -25,7 +25,7 @@ function main(projectId, string, excludedSubstringList) { : []; // [START dlp_inspect_string_with_exclusion_dict_substring] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionRegex.js b/dlp/inspectStringWithExclusionRegex.js index 60bef9ffa6..77335382da 100644 --- a/dlp/inspectStringWithExclusionRegex.js +++ b/dlp/inspectStringWithExclusionRegex.js @@ -21,7 +21,7 @@ function main(projectId, string, exclusionRegex) { // [START dlp_inspect_string_with_exclusion_regex] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithoutOverlap.js b/dlp/inspectStringWithoutOverlap.js index 14d85132f1..c015ba1179 100644 --- a/dlp/inspectStringWithoutOverlap.js +++ b/dlp/inspectStringWithoutOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_without_overlap] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectTable.js b/dlp/inspectTable.js index b29acd36f7..8567712632 100644 --- a/dlp/inspectTable.js +++ b/dlp/inspectTable.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_table] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomHotwords.js b/dlp/inspectWithCustomHotwords.js index 7898a9ace8..e234778cb3 100644 --- a/dlp/inspectWithCustomHotwords.js +++ b/dlp/inspectWithCustomHotwords.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_column_values_w_custom_hotwords] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomRegex.js b/dlp/inspectWithCustomRegex.js index 183726ddbe..c654e4b56b 100644 --- a/dlp/inspectWithCustomRegex.js +++ b/dlp/inspectWithCustomRegex.js @@ -22,7 +22,7 @@ function main(projectId, string, customRegex) { // [START dlp_inspect_custom_regex] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithHotwordRules.js b/dlp/inspectWithHotwordRules.js index 5d694f6f67..50e4e54b2d 100644 --- a/dlp/inspectWithHotwordRules.js +++ b/dlp/inspectWithHotwordRules.js @@ -32,7 +32,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_hotword_rule] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index 83b6ae2c24..fa76aacfb7 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, string) { // [START dlp_inspect_with_stored_infotype] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index 12578d80d1..704c9cbe77 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -30,7 +30,7 @@ async function main( // [START dlp_k_anonymity] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index 7f7ed09c5a..379bd47fee 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -21,7 +21,7 @@ async function main(projectId, datasetId, sourceTableId, outputTableId) { // [START dlp_k_anonymity_with_entity_id] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index 8e4b5d7008..78ecd9cc21 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -32,7 +32,7 @@ async function main( // [START dlp_k_map] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index ae9d6932a4..a421b8d174 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -30,7 +30,7 @@ async function main( quasiIds = transformCLI(quasiIds); // [START dlp_l_diversity] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/listInspectTemplates.js b/dlp/listInspectTemplates.js index 015e7e05d9..e9b92fa8d6 100644 --- a/dlp/listInspectTemplates.js +++ b/dlp/listInspectTemplates.js @@ -20,7 +20,7 @@ function main(projectId) { // [START dlp_list_inspect_templates] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listJobs.js b/dlp/listJobs.js index 87ccee08ac..d3236f75e6 100644 --- a/dlp/listJobs.js +++ b/dlp/listJobs.js @@ -22,7 +22,7 @@ function main(projectId, filter, jobType) { // [START dlp_list_jobs] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listTriggers.js b/dlp/listTriggers.js index ff04b95ecc..c38382b9a9 100644 --- a/dlp/listTriggers.js +++ b/dlp/listTriggers.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_list_triggers] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/metadata.js b/dlp/metadata.js index 39a6a0639b..d2f56a0da2 100644 --- a/dlp/metadata.js +++ b/dlp/metadata.js @@ -21,7 +21,7 @@ function main(projectId, languageCode, filter) { // [START dlp_list_info_types] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index 5344fa94cc..e3c6607689 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_numerical_stats] // Import the Google Cloud client libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; import {PubSub} from '@google-cloud/pubsub'; // Instantiates clients diff --git a/dlp/quickstart.js b/dlp/quickstart.js index c76f55dcb5..805efeaeec 100644 --- a/dlp/quickstart.js +++ b/dlp/quickstart.js @@ -21,7 +21,7 @@ function main(projectId) { // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // [START dlp_quickstart] diff --git a/dlp/redactImage.js b/dlp/redactImage.js index 8e0d943951..1cfe8ca28b 100644 --- a/dlp/redactImage.js +++ b/dlp/redactImage.js @@ -21,7 +21,7 @@ function main(projectId, filepath, minLikelihood, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries import {mine} from 'mime'; diff --git a/dlp/redactImageFileAllInfoTypes.js b/dlp/redactImageFileAllInfoTypes.js index 38154d7cc9..f8733ae62f 100644 --- a/dlp/redactImageFileAllInfoTypes.js +++ b/dlp/redactImageFileAllInfoTypes.js @@ -20,7 +20,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries import {mine} from 'mime'; diff --git a/dlp/redactImageFileAllText.js b/dlp/redactImageFileAllText.js index 1e88ea613a..f5d9829b9c 100644 --- a/dlp/redactImageFileAllText.js +++ b/dlp/redactImageFileAllText.js @@ -19,7 +19,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_text] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries import {mine} from 'mime'; diff --git a/dlp/redactImageFileColoredInfoTypes.js b/dlp/redactImageFileColoredInfoTypes.js index 11f00fb48e..09f78f3824 100644 --- a/dlp/redactImageFileColoredInfoTypes.js +++ b/dlp/redactImageFileColoredInfoTypes.js @@ -19,7 +19,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_colored_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries import {mine} from 'mime'; diff --git a/dlp/redactImageFileListedInfoTypes.js b/dlp/redactImageFileListedInfoTypes.js index 2fb50a7f60..64f54049fd 100644 --- a/dlp/redactImageFileListedInfoTypes.js +++ b/dlp/redactImageFileListedInfoTypes.js @@ -20,7 +20,7 @@ function main(projectId, filepath, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries import {mine} from 'mime'; diff --git a/dlp/redactText.js b/dlp/redactText.js index 4c75476a08..e18c3e6d9e 100644 --- a/dlp/redactText.js +++ b/dlp/redactText.js @@ -21,7 +21,7 @@ function main(projectId, string, minLikelihood, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_text] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index 41afa77ba8..a1d3a53c8b 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_reidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index 288c8b7665..ffb4ed54c6 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -28,7 +28,7 @@ async function main( ) { // [START dlp_reidentify_text_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index 9a45577c65..8c27162ec6 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -21,7 +21,7 @@ async function main(projectId, string, keyName, wrappedKey, surrogateType) { // [START dlp_reidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpe.js b/dlp/reidentifyWithFpe.js index b1f3277500..ab71595819 100644 --- a/dlp/reidentifyWithFpe.js +++ b/dlp/reidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, surrogateType, keyName, wrappedKey) { // [START dlp_reidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpeSurrogate.js b/dlp/reidentifyWithFpeSurrogate.js index c242b993f8..da4b052d30 100644 --- a/dlp/reidentifyWithFpeSurrogate.js +++ b/dlp/reidentifyWithFpeSurrogate.js @@ -21,7 +21,7 @@ function main(projectId, string, alphabet, surrogateType, unwrappedKey) { // [START dlp_reidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/jobs.test.js b/dlp/system-test/jobs.test.js index ed4919751e..65bd014480 100644 --- a/dlp/system-test/jobs.test.js +++ b/dlp/system-test/jobs.test.js @@ -53,7 +53,7 @@ describe('test', () => { // Helper function for creating test jobs const createTestJob = async () => { // Initialize client library - import DLP from '@google-cloud/dlp'; //.v2; + import {DLP} from '@google-cloud/dlp'; //.v2; const dlp = new DLP.DlpServiceClient(); // Construct job request diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 35cb26463b..9bbcb8d915 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, outputPath, fileSetUrl) { // [START dlp_update_stored_infotype] // Import the required libraries - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/updateTrigger.js b/dlp/updateTrigger.js index 5d934605b9..dcbc6621d0 100644 --- a/dlp/updateTrigger.js +++ b/dlp/updateTrigger.js @@ -21,7 +21,7 @@ function main(projectId, jobTriggerName) { // [START dlp_update_trigger] // Imports the Google Cloud Data Loss Prevention library - import DLP from '@google-cloud/dlp'; + import {DLP} from '@google-cloud/dlp'; // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); From 70351ed830fc8041e3323ffcb6c838b081c1d445 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Thu, 6 Mar 2025 13:59:06 +1100 Subject: [PATCH 21/22] Revert "bulk fix" This reverts commit 6cd98c5eb21922649dea3c7f1ab460a8341732aa. --- dlp/categoricalRiskAnalysis.js | 2 +- dlp/deidentifyWithDateShift.js | 2 +- dlp/inspectBigQuery.js | 2 +- dlp/inspectBigQueryTableWithSampling.js | 2 +- dlp/inspectDatastore.js | 2 +- dlp/inspectFile.js | 4 ++-- dlp/inspectGCSFile.js | 2 +- dlp/inspectGcsFileWithSampling.js | 2 +- dlp/inspectImageFile.js | 4 ++-- dlp/inspectImageFileAllInfoTypes.js | 4 ++-- dlp/inspectImageFileListedInfoTypes.js | 4 ++-- dlp/kAnonymityAnalysis.js | 2 +- dlp/kMapEstimationAnalysis.js | 2 +- dlp/lDiversityAnalysis.js | 2 +- dlp/numericalRiskAnalysis.js | 2 +- dlp/redactImage.js | 4 ++-- dlp/redactImageFileAllInfoTypes.js | 4 ++-- dlp/redactImageFileAllText.js | 4 ++-- dlp/redactImageFileColoredInfoTypes.js | 4 ++-- dlp/redactImageFileListedInfoTypes.js | 4 ++-- dlp/system-test/jobs.test.js | 2 +- 21 files changed, 30 insertions(+), 30 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index 3b83e92c24..da9ca5a836 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -31,7 +31,7 @@ async function main( // [START dlp_categorical_stats] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDateShift.js b/dlp/deidentifyWithDateShift.js index 85bab4ab3e..5bb4b6c303 100644 --- a/dlp/deidentifyWithDateShift.js +++ b/dlp/deidentifyWithDateShift.js @@ -39,7 +39,7 @@ function main( const dlp = new DLP.DlpServiceClient(); // Import other required libraries - import {fs} from 'fs'; + const fs = require('fs'); // The project ID to run the API call under // const projectId = 'my-project'; diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index a4ac9d8c79..c8cedad4d0 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -34,7 +34,7 @@ async function main( // [START dlp_inspect_bigquery] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index be623d1c9d..6d9cd5c244 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -27,7 +27,7 @@ async function main( // [START dlp_inspect_bigquery_with_sampling] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 34c5da8ad0..71a15075f9 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -36,7 +36,7 @@ async function main( // [START dlp_inspect_datastore] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectFile.js b/dlp/inspectFile.js index fe887956f0..3ed64f9537 100644 --- a/dlp/inspectFile.js +++ b/dlp/inspectFile.js @@ -33,8 +33,8 @@ function main( import {DLP} from '@google-cloud/dlp'; // Import other required libraries - import {fs} from 'fs'; - import {mine} from 'mime'; + const fs = require('fs'); + const mime = require('mime'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index d37f5c12ac..ff363376cc 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_gcs] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index e6ab5b870d..2e67a21998 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -22,7 +22,7 @@ async function main(projectId, gcsUri, topicId, subscriptionId, infoTypes) { // [START dlp_inspect_gcs_with_sampling] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFile.js b/dlp/inspectImageFile.js index 39eff5cb41..1b24733d8e 100644 --- a/dlp/inspectImageFile.js +++ b/dlp/inspectImageFile.js @@ -22,8 +22,8 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_file] // Imports the Google Cloud Data Loss Prevention library import {DLP} from '@google-cloud/dlp'; - import {mine} from 'mime'; - import {fs} from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileAllInfoTypes.js b/dlp/inspectImageFileAllInfoTypes.js index 7c07cbe902..4486f0a858 100644 --- a/dlp/inspectImageFileAllInfoTypes.js +++ b/dlp/inspectImageFileAllInfoTypes.js @@ -22,8 +22,8 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library import {DLP} from '@google-cloud/dlp'; - import {mine} from 'mime'; - import {fs} from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFileListedInfoTypes.js b/dlp/inspectImageFileListedInfoTypes.js index ec70148670..f4533348d0 100644 --- a/dlp/inspectImageFileListedInfoTypes.js +++ b/dlp/inspectImageFileListedInfoTypes.js @@ -22,8 +22,8 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library import {DLP} from '@google-cloud/dlp'; - import {mine} from 'mime'; - import {fs} from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index 704c9cbe77..303ee90508 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -31,7 +31,7 @@ async function main( // [START dlp_k_anonymity] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index 78ecd9cc21..8f6b0ae8b4 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -33,7 +33,7 @@ async function main( // [START dlp_k_map] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index a421b8d174..3ea088b5c9 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -31,7 +31,7 @@ async function main( // [START dlp_l_diversity] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index e3c6607689..0e153646b0 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -31,7 +31,7 @@ async function main( // [START dlp_numerical_stats] // Import the Google Cloud client libraries import {DLP} from '@google-cloud/dlp'; - import {PubSub} from '@google-cloud/pubsub'; + const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImage.js b/dlp/redactImage.js index 1cfe8ca28b..0a11a6b0af 100644 --- a/dlp/redactImage.js +++ b/dlp/redactImage.js @@ -24,8 +24,8 @@ function main(projectId, filepath, minLikelihood, infoTypes, outputPath) { import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries - import {mine} from 'mime'; - import {fs} from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllInfoTypes.js b/dlp/redactImageFileAllInfoTypes.js index f8733ae62f..c0958e8e56 100644 --- a/dlp/redactImageFileAllInfoTypes.js +++ b/dlp/redactImageFileAllInfoTypes.js @@ -23,8 +23,8 @@ function main(projectId, filepath, outputPath) { import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries - import {mine} from 'mime'; - import {fs} from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileAllText.js b/dlp/redactImageFileAllText.js index f5d9829b9c..36f2f02a54 100644 --- a/dlp/redactImageFileAllText.js +++ b/dlp/redactImageFileAllText.js @@ -22,8 +22,8 @@ function main(projectId, filepath, outputPath) { import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries - import {mine} from 'mime'; - import {fs} from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileColoredInfoTypes.js b/dlp/redactImageFileColoredInfoTypes.js index 09f78f3824..e112dfbb71 100644 --- a/dlp/redactImageFileColoredInfoTypes.js +++ b/dlp/redactImageFileColoredInfoTypes.js @@ -22,8 +22,8 @@ function main(projectId, filepath, outputPath) { import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries - import {mine} from 'mime'; - import {fs} from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/redactImageFileListedInfoTypes.js b/dlp/redactImageFileListedInfoTypes.js index 64f54049fd..9ebec44c9a 100644 --- a/dlp/redactImageFileListedInfoTypes.js +++ b/dlp/redactImageFileListedInfoTypes.js @@ -23,8 +23,8 @@ function main(projectId, filepath, infoTypes, outputPath) { import {DLP} from '@google-cloud/dlp'; // Imports required Node.js libraries - import {mine} from 'mime'; - import {fs} from 'fs'; + const mime = require('mime'); + const fs = require('fs'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/system-test/jobs.test.js b/dlp/system-test/jobs.test.js index 65bd014480..98711f28e8 100644 --- a/dlp/system-test/jobs.test.js +++ b/dlp/system-test/jobs.test.js @@ -53,7 +53,7 @@ describe('test', () => { // Helper function for creating test jobs const createTestJob = async () => { // Initialize client library - import {DLP} from '@google-cloud/dlp'; //.v2; + const DLP = require('@google-cloud/dlp').v2; const dlp = new DLP.DlpServiceClient(); // Construct job request From 4a2756c21462b27d1dadfa0226e5acdc47a16acf Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Thu, 6 Mar 2025 13:59:17 +1100 Subject: [PATCH 22/22] Revert "bulk import fix" This reverts commit a65f43c21735d369b686f25fdf754cc37832571f. --- dlp/categoricalRiskAnalysis.js | 2 +- dlp/createInspectTemplate.js | 2 +- dlp/createJob.js | 2 +- dlp/createStoredInfoType.js | 2 +- dlp/createTrigger.js | 2 +- dlp/deIdentifyCloudStorage.js | 2 +- dlp/deIdentifyTableBucketing.js | 2 +- dlp/deIdentifyTableConditionInfoTypes.js | 2 +- dlp/deIdentifyTableConditionMasking.js | 2 +- dlp/deIdentifyTableInfoTypes.js | 2 +- dlp/deIdentifyTableRowSuppress.js | 2 +- dlp/deIdentifyTableWithBucketingConfig.js | 2 +- dlp/deIdentifyTableWithCryptoHash.js | 2 +- dlp/deIdentifyTableWithFpe.js | 2 +- dlp/deIdentifyTableWithMultipleCryptoHash.js | 2 +- dlp/deIdentifyWithExceptionList.js | 2 +- dlp/deIdentifyWithRedaction.js | 2 +- dlp/deIdentifyWithReplaceInfoType.js | 2 +- dlp/deIdentifyWithSimpleWordList.js | 2 +- dlp/deidentifyWithDateShift.js | 2 +- dlp/deidentifyWithDeterministic.js | 2 +- dlp/deidentifyWithDictionaryReplacement.js | 2 +- dlp/deidentifyWithFpe.js | 2 +- dlp/deidentifyWithFpeSurrogate.js | 2 +- dlp/deidentifyWithMask.js | 2 +- dlp/deidentifyWithReplacement.js | 2 +- dlp/deidentifyWithTimeExtraction.js | 2 +- dlp/deleteInspectTemplate.js | 2 +- dlp/deleteJob.js | 2 +- dlp/deleteTrigger.js | 2 +- dlp/getJob.js | 2 +- dlp/inspectBigQuery.js | 2 +- dlp/inspectBigQueryTableWithSampling.js | 2 +- dlp/inspectBigquerySendToScc.js | 2 +- dlp/inspectDataToHybridJobTrigger.js | 2 +- dlp/inspectDatastore.js | 2 +- dlp/inspectDatastoreSendToScc.js | 2 +- dlp/inspectFile.js | 2 +- dlp/inspectGCSFile.js | 2 +- dlp/inspectGcsFileWithSampling.js | 2 +- dlp/inspectGcsSendToScc.js | 2 +- dlp/inspectImageFile.js | 2 +- dlp/inspectImageFileAllInfoTypes.js | 2 +- dlp/inspectImageFileListedInfoTypes.js | 2 +- dlp/inspectPhoneNumber.js | 2 +- dlp/inspectString.js | 2 +- dlp/inspectStringAugmentInfoType.js | 2 +- dlp/inspectStringCustomExcludingSubstring.js | 2 +- dlp/inspectStringCustomHotword.js | 2 +- dlp/inspectStringCustomOmitOverlap.js | 2 +- dlp/inspectStringMultipleRules.js | 2 +- dlp/inspectStringOmitOverlap.js | 2 +- dlp/inspectStringRep.js | 2 +- dlp/inspectStringWithExclusionDict.js | 2 +- dlp/inspectStringWithExclusionDictSubstring.js | 2 +- dlp/inspectStringWithExclusionRegex.js | 2 +- dlp/inspectStringWithoutOverlap.js | 2 +- dlp/inspectTable.js | 2 +- dlp/inspectWithCustomHotwords.js | 2 +- dlp/inspectWithCustomRegex.js | 2 +- dlp/inspectWithHotwordRules.js | 2 +- dlp/inspectWithStoredInfotype.js | 2 +- dlp/kAnonymityAnalysis.js | 2 +- dlp/kAnonymityWithEntityIds.js | 2 +- dlp/kMapEstimationAnalysis.js | 2 +- dlp/lDiversityAnalysis.js | 2 +- dlp/listInspectTemplates.js | 2 +- dlp/listJobs.js | 2 +- dlp/listTriggers.js | 2 +- dlp/metadata.js | 2 +- dlp/numericalRiskAnalysis.js | 2 +- dlp/quickstart.js | 2 +- dlp/redactImage.js | 2 +- dlp/redactImageFileAllInfoTypes.js | 2 +- dlp/redactImageFileAllText.js | 2 +- dlp/redactImageFileColoredInfoTypes.js | 2 +- dlp/redactImageFileListedInfoTypes.js | 2 +- dlp/redactText.js | 2 +- dlp/reidentifyTableWithFpe.js | 2 +- dlp/reidentifyTextWithFpe.js | 2 +- dlp/reidentifyWithDeterministic.js | 2 +- dlp/reidentifyWithFpe.js | 2 +- dlp/reidentifyWithFpeSurrogate.js | 2 +- dlp/updateStoredInfoType.js | 2 +- dlp/updateTrigger.js | 2 +- 85 files changed, 85 insertions(+), 85 deletions(-) diff --git a/dlp/categoricalRiskAnalysis.js b/dlp/categoricalRiskAnalysis.js index da9ca5a836..7a7406272c 100644 --- a/dlp/categoricalRiskAnalysis.js +++ b/dlp/categoricalRiskAnalysis.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_categorical_stats] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/createInspectTemplate.js b/dlp/createInspectTemplate.js index 2720ca4ec4..5e13e694c3 100644 --- a/dlp/createInspectTemplate.js +++ b/dlp/createInspectTemplate.js @@ -31,7 +31,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_inspect_template] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createJob.js b/dlp/createJob.js index 63c2645776..f311c26bb3 100644 --- a/dlp/createJob.js +++ b/dlp/createJob.js @@ -21,7 +21,7 @@ function main(projectId, cloudFileUrl) { // [START dlp_create_job] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/createStoredInfoType.js b/dlp/createStoredInfoType.js index 2028774202..672f99464c 100644 --- a/dlp/createStoredInfoType.js +++ b/dlp/createStoredInfoType.js @@ -29,7 +29,7 @@ async function main( ) { // [START dlp_create_stored_infotype] // Import the required libraries - import {DLP} from '@google-cloud/dlp'; + const dlp = require('@google-cloud/dlp'); // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/createTrigger.js b/dlp/createTrigger.js index fe0af291ff..f4f338d4f4 100644 --- a/dlp/createTrigger.js +++ b/dlp/createTrigger.js @@ -34,7 +34,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_create_trigger] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyCloudStorage.js b/dlp/deIdentifyCloudStorage.js index 346289de84..a876ce18c8 100644 --- a/dlp/deIdentifyCloudStorage.js +++ b/dlp/deIdentifyCloudStorage.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_deidentify_cloud_storage] // Imports the Google Cloud client library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableBucketing.js b/dlp/deIdentifyTableBucketing.js index 4ef40460e4..4c8cc2ae69 100644 --- a/dlp/deIdentifyTableBucketing.js +++ b/dlp/deIdentifyTableBucketing.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_bucketing] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionInfoTypes.js b/dlp/deIdentifyTableConditionInfoTypes.js index 555a1d8a18..7058a7b373 100644 --- a/dlp/deIdentifyTableConditionInfoTypes.js +++ b/dlp/deIdentifyTableConditionInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableConditionMasking.js b/dlp/deIdentifyTableConditionMasking.js index b52eb7bc08..94cfd42b4b 100644 --- a/dlp/deIdentifyTableConditionMasking.js +++ b/dlp/deIdentifyTableConditionMasking.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_condition_masking] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableInfoTypes.js b/dlp/deIdentifyTableInfoTypes.js index dfc87f9b46..4767cb690b 100644 --- a/dlp/deIdentifyTableInfoTypes.js +++ b/dlp/deIdentifyTableInfoTypes.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_deidentify_table_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableRowSuppress.js b/dlp/deIdentifyTableRowSuppress.js index 78e94bf3c2..e62685b93a 100644 --- a/dlp/deIdentifyTableRowSuppress.js +++ b/dlp/deIdentifyTableRowSuppress.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_row_suppress] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize google DLP Client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithBucketingConfig.js b/dlp/deIdentifyTableWithBucketingConfig.js index 057c32d9b0..335a3e6ce9 100644 --- a/dlp/deIdentifyTableWithBucketingConfig.js +++ b/dlp/deIdentifyTableWithBucketingConfig.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_table_primitive_bucketing] // Imports the Google Cloud client library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithCryptoHash.js b/dlp/deIdentifyTableWithCryptoHash.js index a837fe5b99..f63c58974e 100644 --- a/dlp/deIdentifyTableWithCryptoHash.js +++ b/dlp/deIdentifyTableWithCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKeyName) { // [START dlp_deidentify_table_with_crypto_hash] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithFpe.js b/dlp/deIdentifyTableWithFpe.js index 1698397c49..fd71f7e766 100644 --- a/dlp/deIdentifyTableWithFpe.js +++ b/dlp/deIdentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_deidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyTableWithMultipleCryptoHash.js b/dlp/deIdentifyTableWithMultipleCryptoHash.js index fbe493b36b..d953382b22 100644 --- a/dlp/deIdentifyTableWithMultipleCryptoHash.js +++ b/dlp/deIdentifyTableWithMultipleCryptoHash.js @@ -21,7 +21,7 @@ function main(projectId, transientKey1, transientKey2) { // [START dlp_deidentify_table_with_multiple_crypto_hash] // Imports the Google Cloud client library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithExceptionList.js b/dlp/deIdentifyWithExceptionList.js index 7fa51ad242..717a12be0d 100644 --- a/dlp/deIdentifyWithExceptionList.js +++ b/dlp/deIdentifyWithExceptionList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_exception_list] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call diff --git a/dlp/deIdentifyWithRedaction.js b/dlp/deIdentifyWithRedaction.js index 08746e9cc3..8f2d3f20c6 100644 --- a/dlp/deIdentifyWithRedaction.js +++ b/dlp/deIdentifyWithRedaction.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_redact] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithReplaceInfoType.js b/dlp/deIdentifyWithReplaceInfoType.js index 911b85110d..08d8301abc 100644 --- a/dlp/deIdentifyWithReplaceInfoType.js +++ b/dlp/deIdentifyWithReplaceInfoType.js @@ -24,7 +24,7 @@ function main(projectId, string, infoTypes) { infoTypes = parseInfotypes(infoTypes); // [START dlp_deidentify_replace_infotype] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deIdentifyWithSimpleWordList.js b/dlp/deIdentifyWithSimpleWordList.js index 3ef2eaca52..dcdb388b84 100644 --- a/dlp/deIdentifyWithSimpleWordList.js +++ b/dlp/deIdentifyWithSimpleWordList.js @@ -24,7 +24,7 @@ function main(projectId, textToInspect, words, customInfoTypeName) { words = words.split(','); // [START dlp_deidentify_simple_word_list] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // TODO(developer): Replace these variables before running the sample. // const projectId = "your-project-id"; diff --git a/dlp/deidentifyWithDateShift.js b/dlp/deidentifyWithDateShift.js index 5bb4b6c303..e13d96425d 100644 --- a/dlp/deidentifyWithDateShift.js +++ b/dlp/deidentifyWithDateShift.js @@ -33,7 +33,7 @@ function main( dateFields = transformCLI(dateFields); // [START dlp_deidentify_date_shift] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDeterministic.js b/dlp/deidentifyWithDeterministic.js index 73f8805d3c..0793fff4d6 100644 --- a/dlp/deidentifyWithDeterministic.js +++ b/dlp/deidentifyWithDeterministic.js @@ -29,7 +29,7 @@ async function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithDictionaryReplacement.js b/dlp/deidentifyWithDictionaryReplacement.js index d56308f0b5..32576dfb96 100644 --- a/dlp/deidentifyWithDictionaryReplacement.js +++ b/dlp/deidentifyWithDictionaryReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, infoTypes, words) { [infoTypes, words] = transformCLI(infoTypes, words); // [START dlp_deidentify_dictionary_replacement] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpe.js b/dlp/deidentifyWithFpe.js index a26917937c..015b24d7ad 100644 --- a/dlp/deidentifyWithFpe.js +++ b/dlp/deidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, keyName, wrappedKey, surrogateType) { // [START dlp_deidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithFpeSurrogate.js b/dlp/deidentifyWithFpeSurrogate.js index 2eb9cdc601..d2968e60a5 100644 --- a/dlp/deidentifyWithFpeSurrogate.js +++ b/dlp/deidentifyWithFpeSurrogate.js @@ -29,7 +29,7 @@ function main( infoTypes = transformCLI(infoTypes); // [START dlp_deidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithMask.js b/dlp/deidentifyWithMask.js index 3749a49e4e..6e6df7e7ef 100644 --- a/dlp/deidentifyWithMask.js +++ b/dlp/deidentifyWithMask.js @@ -22,7 +22,7 @@ function main(projectId, string, maskingCharacter, numberToMask) { // [START dlp_deidentify_masking] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithReplacement.js b/dlp/deidentifyWithReplacement.js index 6ce33b4a34..84ead95f20 100644 --- a/dlp/deidentifyWithReplacement.js +++ b/dlp/deidentifyWithReplacement.js @@ -22,7 +22,7 @@ function main(projectId, string, replacement) { // [START dlp_deidentify_replace] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deidentifyWithTimeExtraction.js b/dlp/deidentifyWithTimeExtraction.js index 7a32c22c61..03c0e5de14 100644 --- a/dlp/deidentifyWithTimeExtraction.js +++ b/dlp/deidentifyWithTimeExtraction.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_deidentify_time_extract] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteInspectTemplate.js b/dlp/deleteInspectTemplate.js index f4edfbe968..61a8021151 100644 --- a/dlp/deleteInspectTemplate.js +++ b/dlp/deleteInspectTemplate.js @@ -22,7 +22,7 @@ function main(projectId, templateName) { // [START dlp_delete_inspect_template] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteJob.js b/dlp/deleteJob.js index 9716df46fe..78202468e2 100644 --- a/dlp/deleteJob.js +++ b/dlp/deleteJob.js @@ -20,7 +20,7 @@ function main(projectId, jobName) { // [START dlp_delete_job] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/deleteTrigger.js b/dlp/deleteTrigger.js index c004d62acf..9fca52f798 100644 --- a/dlp/deleteTrigger.js +++ b/dlp/deleteTrigger.js @@ -20,7 +20,7 @@ function main(projectId, triggerId) { // [START dlp_delete_trigger] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/getJob.js b/dlp/getJob.js index 117abf1541..19bf9c290b 100644 --- a/dlp/getJob.js +++ b/dlp/getJob.js @@ -21,7 +21,7 @@ function main(jobName) { // [START dlp_get_job] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectBigQuery.js b/dlp/inspectBigQuery.js index c8cedad4d0..e4dafda269 100644 --- a/dlp/inspectBigQuery.js +++ b/dlp/inspectBigQuery.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_bigquery] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/inspectBigQueryTableWithSampling.js b/dlp/inspectBigQueryTableWithSampling.js index 6d9cd5c244..f03cdb8168 100644 --- a/dlp/inspectBigQueryTableWithSampling.js +++ b/dlp/inspectBigQueryTableWithSampling.js @@ -26,7 +26,7 @@ async function main( ) { // [START dlp_inspect_bigquery_with_sampling] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/inspectBigquerySendToScc.js b/dlp/inspectBigquerySendToScc.js index 9d63499d88..c2259fd634 100644 --- a/dlp/inspectBigquerySendToScc.js +++ b/dlp/inspectBigquerySendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, dataProjectId, datasetId, tableId) { // [START dlp_inspect_bigquery_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDataToHybridJobTrigger.js b/dlp/inspectDataToHybridJobTrigger.js index 5d300ad8d0..cbcf4091e4 100644 --- a/dlp/inspectDataToHybridJobTrigger.js +++ b/dlp/inspectDataToHybridJobTrigger.js @@ -22,7 +22,7 @@ async function main(projectId, string, jobTriggerId) { // [START dlp_inspect_send_data_to_hybrid_job_trigger] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectDatastore.js b/dlp/inspectDatastore.js index 71a15075f9..1dfe29b954 100644 --- a/dlp/inspectDatastore.js +++ b/dlp/inspectDatastore.js @@ -35,7 +35,7 @@ async function main( // [START dlp_inspect_datastore] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/inspectDatastoreSendToScc.js b/dlp/inspectDatastoreSendToScc.js index 9d25d36538..5d5084e704 100644 --- a/dlp/inspectDatastoreSendToScc.js +++ b/dlp/inspectDatastoreSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, datastoreNamespace, datastoreKind) { // [START dlp_inspect_datastore_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectFile.js b/dlp/inspectFile.js index 3ed64f9537..26da96e5a7 100644 --- a/dlp/inspectFile.js +++ b/dlp/inspectFile.js @@ -30,7 +30,7 @@ function main( // [START dlp_inspect_file] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Import other required libraries const fs = require('fs'); diff --git a/dlp/inspectGCSFile.js b/dlp/inspectGCSFile.js index ff363376cc..6cce718136 100644 --- a/dlp/inspectGCSFile.js +++ b/dlp/inspectGCSFile.js @@ -32,7 +32,7 @@ async function main( // [START dlp_inspect_gcs] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/inspectGcsFileWithSampling.js b/dlp/inspectGcsFileWithSampling.js index 2e67a21998..5df7fdad70 100644 --- a/dlp/inspectGcsFileWithSampling.js +++ b/dlp/inspectGcsFileWithSampling.js @@ -21,7 +21,7 @@ async function main(projectId, gcsUri, topicId, subscriptionId, infoTypes) { // [START dlp_inspect_gcs_with_sampling] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/inspectGcsSendToScc.js b/dlp/inspectGcsSendToScc.js index 5b0a42bb30..57297b03bc 100644 --- a/dlp/inspectGcsSendToScc.js +++ b/dlp/inspectGcsSendToScc.js @@ -21,7 +21,7 @@ async function main(projectId, gcsPath) { // [START dlp_inspect_gcs_send_to_scc] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlpClient = new DLP.DlpServiceClient(); diff --git a/dlp/inspectImageFile.js b/dlp/inspectImageFile.js index 1b24733d8e..8e6c03c0cd 100644 --- a/dlp/inspectImageFile.js +++ b/dlp/inspectImageFile.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_file] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const mime = require('mime'); const fs = require('fs'); diff --git a/dlp/inspectImageFileAllInfoTypes.js b/dlp/inspectImageFileAllInfoTypes.js index 4486f0a858..b7e7ad7fc3 100644 --- a/dlp/inspectImageFileAllInfoTypes.js +++ b/dlp/inspectImageFileAllInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const mime = require('mime'); const fs = require('fs'); diff --git a/dlp/inspectImageFileListedInfoTypes.js b/dlp/inspectImageFileListedInfoTypes.js index f4533348d0..4789ee0e3b 100644 --- a/dlp/inspectImageFileListedInfoTypes.js +++ b/dlp/inspectImageFileListedInfoTypes.js @@ -21,7 +21,7 @@ function main(projectId, imagePath) { // [START dlp_inspect_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const mime = require('mime'); const fs = require('fs'); diff --git a/dlp/inspectPhoneNumber.js b/dlp/inspectPhoneNumber.js index c4b91bda97..d0db144258 100644 --- a/dlp/inspectPhoneNumber.js +++ b/dlp/inspectPhoneNumber.js @@ -31,7 +31,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_phone_number] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectString.js b/dlp/inspectString.js index 57d3a32072..cfeda45c5c 100644 --- a/dlp/inspectString.js +++ b/dlp/inspectString.js @@ -32,7 +32,7 @@ function main( // [START dlp_inspect_string] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringAugmentInfoType.js b/dlp/inspectStringAugmentInfoType.js index 6beaa6a0fb..95aee9303a 100644 --- a/dlp/inspectStringAugmentInfoType.js +++ b/dlp/inspectStringAugmentInfoType.js @@ -22,7 +22,7 @@ function main(projectId, string, words) { words = words ? words.split(',') : []; // [START dlp_inspect_augment_infotypes] // Imports the Google Cloud client library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomExcludingSubstring.js b/dlp/inspectStringCustomExcludingSubstring.js index f8df43101a..12ff24ec78 100644 --- a/dlp/inspectStringCustomExcludingSubstring.js +++ b/dlp/inspectStringCustomExcludingSubstring.js @@ -22,7 +22,7 @@ function main(projectId, string, excludedWords) { excludedWords = excludedWords ? excludedWords.split(',') : []; // [START dlp_inspect_string_custom_excluding_substring] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomHotword.js b/dlp/inspectStringCustomHotword.js index 07bdef7719..2dc9edf12b 100644 --- a/dlp/inspectStringCustomHotword.js +++ b/dlp/inspectStringCustomHotword.js @@ -21,7 +21,7 @@ function main(projectId, string, customHotword) { // [START dlp_inspect_string_custom_hotword] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringCustomOmitOverlap.js b/dlp/inspectStringCustomOmitOverlap.js index 3e61c9fe21..19b8edba29 100644 --- a/dlp/inspectStringCustomOmitOverlap.js +++ b/dlp/inspectStringCustomOmitOverlap.js @@ -20,7 +20,7 @@ function main(projectId, string) { // [START dlp_inspect_string_custom_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringMultipleRules.js b/dlp/inspectStringMultipleRules.js index 6f76723e2a..de48a6d9a9 100644 --- a/dlp/inspectStringMultipleRules.js +++ b/dlp/inspectStringMultipleRules.js @@ -21,7 +21,7 @@ function main(projectId, string) { // [START dlp_inspect_string_multiple_rules] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringOmitOverlap.js b/dlp/inspectStringOmitOverlap.js index 92084f1546..4a1144d87b 100644 --- a/dlp/inspectStringOmitOverlap.js +++ b/dlp/inspectStringOmitOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_omit_overlap] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringRep.js b/dlp/inspectStringRep.js index 28097a6c65..20a9437650 100644 --- a/dlp/inspectStringRep.js +++ b/dlp/inspectStringRep.js @@ -33,7 +33,7 @@ async function main( // [START dlp_inspect_string_rep] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Assemble the regional endpoint url using provided rep location const opts = { diff --git a/dlp/inspectStringWithExclusionDict.js b/dlp/inspectStringWithExclusionDict.js index f0f3fc64d7..e0e1f15926 100644 --- a/dlp/inspectStringWithExclusionDict.js +++ b/dlp/inspectStringWithExclusionDict.js @@ -23,7 +23,7 @@ function main(projectId, string, infoTypes, excludedWords) { [infoTypes, excludedWords] = transformCLI(infoTypes, excludedWords); // [START dlp_inspect_string_with_exclusion_dict] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionDictSubstring.js b/dlp/inspectStringWithExclusionDictSubstring.js index 2d6b6de14d..621275f234 100644 --- a/dlp/inspectStringWithExclusionDictSubstring.js +++ b/dlp/inspectStringWithExclusionDictSubstring.js @@ -25,7 +25,7 @@ function main(projectId, string, excludedSubstringList) { : []; // [START dlp_inspect_string_with_exclusion_dict_substring] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithExclusionRegex.js b/dlp/inspectStringWithExclusionRegex.js index 77335382da..501b652f10 100644 --- a/dlp/inspectStringWithExclusionRegex.js +++ b/dlp/inspectStringWithExclusionRegex.js @@ -21,7 +21,7 @@ function main(projectId, string, exclusionRegex) { // [START dlp_inspect_string_with_exclusion_regex] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectStringWithoutOverlap.js b/dlp/inspectStringWithoutOverlap.js index c015ba1179..f8d58f6bf1 100644 --- a/dlp/inspectStringWithoutOverlap.js +++ b/dlp/inspectStringWithoutOverlap.js @@ -22,7 +22,7 @@ function main(projectId, string) { // [START dlp_inspect_string_without_overlap] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectTable.js b/dlp/inspectTable.js index 8567712632..db86a7c534 100644 --- a/dlp/inspectTable.js +++ b/dlp/inspectTable.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_table] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomHotwords.js b/dlp/inspectWithCustomHotwords.js index e234778cb3..ea4c0fe6b4 100644 --- a/dlp/inspectWithCustomHotwords.js +++ b/dlp/inspectWithCustomHotwords.js @@ -21,7 +21,7 @@ function main(projectId) { // [START dlp_inspect_column_values_w_custom_hotwords] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithCustomRegex.js b/dlp/inspectWithCustomRegex.js index c654e4b56b..216e883432 100644 --- a/dlp/inspectWithCustomRegex.js +++ b/dlp/inspectWithCustomRegex.js @@ -22,7 +22,7 @@ function main(projectId, string, customRegex) { // [START dlp_inspect_custom_regex] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithHotwordRules.js b/dlp/inspectWithHotwordRules.js index 50e4e54b2d..2fff8e9428 100644 --- a/dlp/inspectWithHotwordRules.js +++ b/dlp/inspectWithHotwordRules.js @@ -32,7 +32,7 @@ function main( [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes); // [START dlp_inspect_hotword_rule] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/inspectWithStoredInfotype.js b/dlp/inspectWithStoredInfotype.js index fa76aacfb7..3295fc5267 100644 --- a/dlp/inspectWithStoredInfotype.js +++ b/dlp/inspectWithStoredInfotype.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, string) { // [START dlp_inspect_with_stored_infotype] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kAnonymityAnalysis.js b/dlp/kAnonymityAnalysis.js index 303ee90508..c5ecdcb81c 100644 --- a/dlp/kAnonymityAnalysis.js +++ b/dlp/kAnonymityAnalysis.js @@ -30,7 +30,7 @@ async function main( // [START dlp_k_anonymity] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/kAnonymityWithEntityIds.js b/dlp/kAnonymityWithEntityIds.js index 379bd47fee..fa42e563d4 100644 --- a/dlp/kAnonymityWithEntityIds.js +++ b/dlp/kAnonymityWithEntityIds.js @@ -21,7 +21,7 @@ async function main(projectId, datasetId, sourceTableId, outputTableId) { // [START dlp_k_anonymity_with_entity_id] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/kMapEstimationAnalysis.js b/dlp/kMapEstimationAnalysis.js index 8f6b0ae8b4..19eb01fa04 100644 --- a/dlp/kMapEstimationAnalysis.js +++ b/dlp/kMapEstimationAnalysis.js @@ -32,7 +32,7 @@ async function main( // [START dlp_k_map] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/lDiversityAnalysis.js b/dlp/lDiversityAnalysis.js index 3ea088b5c9..4c585e7488 100644 --- a/dlp/lDiversityAnalysis.js +++ b/dlp/lDiversityAnalysis.js @@ -30,7 +30,7 @@ async function main( quasiIds = transformCLI(quasiIds); // [START dlp_l_diversity] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/listInspectTemplates.js b/dlp/listInspectTemplates.js index e9b92fa8d6..73e41aaebc 100644 --- a/dlp/listInspectTemplates.js +++ b/dlp/listInspectTemplates.js @@ -20,7 +20,7 @@ function main(projectId) { // [START dlp_list_inspect_templates] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listJobs.js b/dlp/listJobs.js index d3236f75e6..41469ed254 100644 --- a/dlp/listJobs.js +++ b/dlp/listJobs.js @@ -22,7 +22,7 @@ function main(projectId, filter, jobType) { // [START dlp_list_jobs] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/listTriggers.js b/dlp/listTriggers.js index c38382b9a9..c7fd234a7f 100644 --- a/dlp/listTriggers.js +++ b/dlp/listTriggers.js @@ -22,7 +22,7 @@ function main(projectId) { // [START dlp_list_triggers] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/metadata.js b/dlp/metadata.js index d2f56a0da2..02cf404666 100644 --- a/dlp/metadata.js +++ b/dlp/metadata.js @@ -21,7 +21,7 @@ function main(projectId, languageCode, filter) { // [START dlp_list_info_types] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/numericalRiskAnalysis.js b/dlp/numericalRiskAnalysis.js index 0e153646b0..03cab40db5 100644 --- a/dlp/numericalRiskAnalysis.js +++ b/dlp/numericalRiskAnalysis.js @@ -30,7 +30,7 @@ async function main( ) { // [START dlp_numerical_stats] // Import the Google Cloud client libraries - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); const {PubSub} = require('@google-cloud/pubsub'); // Instantiates clients diff --git a/dlp/quickstart.js b/dlp/quickstart.js index 805efeaeec..0d60c0e433 100644 --- a/dlp/quickstart.js +++ b/dlp/quickstart.js @@ -21,7 +21,7 @@ function main(projectId) { // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // [START dlp_quickstart] diff --git a/dlp/redactImage.js b/dlp/redactImage.js index 0a11a6b0af..da893c2e85 100644 --- a/dlp/redactImage.js +++ b/dlp/redactImage.js @@ -21,7 +21,7 @@ function main(projectId, filepath, minLikelihood, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries const mime = require('mime'); diff --git a/dlp/redactImageFileAllInfoTypes.js b/dlp/redactImageFileAllInfoTypes.js index c0958e8e56..1890732349 100644 --- a/dlp/redactImageFileAllInfoTypes.js +++ b/dlp/redactImageFileAllInfoTypes.js @@ -20,7 +20,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries const mime = require('mime'); diff --git a/dlp/redactImageFileAllText.js b/dlp/redactImageFileAllText.js index 36f2f02a54..f3ef7a38ee 100644 --- a/dlp/redactImageFileAllText.js +++ b/dlp/redactImageFileAllText.js @@ -19,7 +19,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_all_text] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries const mime = require('mime'); diff --git a/dlp/redactImageFileColoredInfoTypes.js b/dlp/redactImageFileColoredInfoTypes.js index e112dfbb71..b12625660d 100644 --- a/dlp/redactImageFileColoredInfoTypes.js +++ b/dlp/redactImageFileColoredInfoTypes.js @@ -19,7 +19,7 @@ function main(projectId, filepath, outputPath) { // [START dlp_redact_image_colored_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries const mime = require('mime'); diff --git a/dlp/redactImageFileListedInfoTypes.js b/dlp/redactImageFileListedInfoTypes.js index 9ebec44c9a..6945216c9f 100644 --- a/dlp/redactImageFileListedInfoTypes.js +++ b/dlp/redactImageFileListedInfoTypes.js @@ -20,7 +20,7 @@ function main(projectId, filepath, infoTypes, outputPath) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_image_listed_infotypes] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Imports required Node.js libraries const mime = require('mime'); diff --git a/dlp/redactText.js b/dlp/redactText.js index e18c3e6d9e..305dcd44b6 100644 --- a/dlp/redactText.js +++ b/dlp/redactText.js @@ -21,7 +21,7 @@ function main(projectId, string, minLikelihood, infoTypes) { infoTypes = transformCLI(infoTypes); // [START dlp_redact_text] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTableWithFpe.js b/dlp/reidentifyTableWithFpe.js index a1d3a53c8b..61d04f3272 100644 --- a/dlp/reidentifyTableWithFpe.js +++ b/dlp/reidentifyTableWithFpe.js @@ -21,7 +21,7 @@ async function main(projectId, alphabet, keyName, wrappedKey) { // [START dlp_reidentify_table_fpe] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyTextWithFpe.js b/dlp/reidentifyTextWithFpe.js index ffb4ed54c6..b8bfee6547 100644 --- a/dlp/reidentifyTextWithFpe.js +++ b/dlp/reidentifyTextWithFpe.js @@ -28,7 +28,7 @@ async function main( ) { // [START dlp_reidentify_text_fpe] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithDeterministic.js b/dlp/reidentifyWithDeterministic.js index 8c27162ec6..f4291dd092 100644 --- a/dlp/reidentifyWithDeterministic.js +++ b/dlp/reidentifyWithDeterministic.js @@ -21,7 +21,7 @@ async function main(projectId, string, keyName, wrappedKey, surrogateType) { // [START dlp_reidentify_deterministic] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpe.js b/dlp/reidentifyWithFpe.js index ab71595819..0fe8e14133 100644 --- a/dlp/reidentifyWithFpe.js +++ b/dlp/reidentifyWithFpe.js @@ -22,7 +22,7 @@ function main(projectId, string, alphabet, surrogateType, keyName, wrappedKey) { // [START dlp_reidentify_fpe] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/reidentifyWithFpeSurrogate.js b/dlp/reidentifyWithFpeSurrogate.js index da4b052d30..89a28e3975 100644 --- a/dlp/reidentifyWithFpeSurrogate.js +++ b/dlp/reidentifyWithFpeSurrogate.js @@ -21,7 +21,7 @@ function main(projectId, string, alphabet, surrogateType, unwrappedKey) { // [START dlp_reidentify_free_text_with_fpe_using_surrogate] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlp = new DLP.DlpServiceClient(); diff --git a/dlp/updateStoredInfoType.js b/dlp/updateStoredInfoType.js index 9bbcb8d915..6c6756f122 100644 --- a/dlp/updateStoredInfoType.js +++ b/dlp/updateStoredInfoType.js @@ -21,7 +21,7 @@ async function main(projectId, infoTypeId, outputPath, fileSetUrl) { // [START dlp_update_stored_infotype] // Import the required libraries - import {DLP} from '@google-cloud/dlp'; + const dlp = require('@google-cloud/dlp'); // Create a DLP client const dlpClient = new dlp.DlpServiceClient(); diff --git a/dlp/updateTrigger.js b/dlp/updateTrigger.js index dcbc6621d0..2d2a9b0c5d 100644 --- a/dlp/updateTrigger.js +++ b/dlp/updateTrigger.js @@ -21,7 +21,7 @@ function main(projectId, jobTriggerName) { // [START dlp_update_trigger] // Imports the Google Cloud Data Loss Prevention library - import {DLP} from '@google-cloud/dlp'; + const DLP = require('@google-cloud/dlp'); // Instantiates a client const dlpClient = new DLP.DlpServiceClient();