diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.activate_job_trigger.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.activate_job_trigger.js new file mode 100644 index 00000000000..eaae036e660 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.activate_job_trigger.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_ActivateJobTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the trigger to activate, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function activateJobTrigger() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.activateJobTrigger(request); + console.log(response); + } + + activateJobTrigger(); + // [END dlp_v2_generated_DlpService_ActivateJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.cancel_dlp_job.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.cancel_dlp_job.js new file mode 100644 index 00000000000..4a648e59eaf --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.cancel_dlp_job.js @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_CancelDlpJob_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the DlpJob resource to be cancelled. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function cancelDlpJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.cancelDlpJob(request); + console.log(response); + } + + cancelDlpJob(); + // [END dlp_v2_generated_DlpService_CancelDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_deidentify_template.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_deidentify_template.js new file mode 100644 index 00000000000..00ffdde87d3 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_deidentify_template.js @@ -0,0 +1,83 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent, deidentifyTemplate) { + // [START dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Required. The DeidentifyTemplate to create. + */ + // const deidentifyTemplate = '' + /** + * The template id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + */ + // const templateId = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function createDeidentifyTemplate() { + // Construct request + const request = { + parent, + deidentifyTemplate, + }; + + // Run request + const response = await dlpClient.createDeidentifyTemplate(request); + console.log(response); + } + + createDeidentifyTemplate(); + // [END dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_dlp_job.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_dlp_job.js new file mode 100644 index 00000000000..62b76b862e4 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_dlp_job.js @@ -0,0 +1,82 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent) { + // [START dlp_v2_generated_DlpService_CreateDlpJob_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource name. + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Set to control what and how to inspect. + */ + // const inspectJob = '' + /** + * Set to choose what metric to calculate. + */ + // const riskJob = '' + /** + * The job id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + */ + // const jobId = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function createDlpJob() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dlpClient.createDlpJob(request); + console.log(response); + } + + createDlpJob(); + // [END dlp_v2_generated_DlpService_CreateDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_inspect_template.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_inspect_template.js new file mode 100644 index 00000000000..965e0a8b0b6 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_inspect_template.js @@ -0,0 +1,83 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent, inspectTemplate) { + // [START dlp_v2_generated_DlpService_CreateInspectTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Required. The InspectTemplate to create. + */ + // const inspectTemplate = '' + /** + * The template id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + */ + // const templateId = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function createInspectTemplate() { + // Construct request + const request = { + parent, + inspectTemplate, + }; + + // Run request + const response = await dlpClient.createInspectTemplate(request); + console.log(response); + } + + createInspectTemplate(); + // [END dlp_v2_generated_DlpService_CreateInspectTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_job_trigger.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_job_trigger.js new file mode 100644 index 00000000000..286952462ac --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_job_trigger.js @@ -0,0 +1,79 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent, jobTrigger) { + // [START dlp_v2_generated_DlpService_CreateJobTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource name. + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Required. The JobTrigger to create. + */ + // const jobTrigger = '' + /** + * The trigger id can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + */ + // const triggerId = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function createJobTrigger() { + // Construct request + const request = { + parent, + jobTrigger, + }; + + // Run request + const response = await dlpClient.createJobTrigger(request); + console.log(response); + } + + createJobTrigger(); + // [END dlp_v2_generated_DlpService_CreateJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_stored_info_type.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_stored_info_type.js new file mode 100644 index 00000000000..2d3308452f9 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_stored_info_type.js @@ -0,0 +1,83 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent, config) { + // [START dlp_v2_generated_DlpService_CreateStoredInfoType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Required. Configuration of the storedInfoType to create. + */ + // const config = '' + /** + * The storedInfoType ID can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\d-_]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + */ + // const storedInfoTypeId = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function createStoredInfoType() { + // Construct request + const request = { + parent, + config, + }; + + // Run request + const response = await dlpClient.createStoredInfoType(request); + console.log(response); + } + + createStoredInfoType(); + // [END dlp_v2_generated_DlpService_CreateStoredInfoType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.deidentify_content.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.deidentify_content.js new file mode 100644 index 00000000000..4ddbf5be771 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.deidentify_content.js @@ -0,0 +1,97 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main() { + // [START dlp_v2_generated_DlpService_DeidentifyContent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Parent resource name. + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Configuration for the de-identification of the content item. + * Items specified here will override the template referenced by the + * deidentify_template_name argument. + */ + // const deidentifyConfig = '' + /** + * Configuration for the inspector. + * Items specified here will override the template referenced by the + * inspect_template_name argument. + */ + // const inspectConfig = '' + /** + * The item to de-identify. Will be treated as text. + */ + // const item = '' + /** + * Template to use. Any configuration directly specified in + * inspect_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + */ + // const inspectTemplateName = 'abc123' + /** + * Template to use. Any configuration directly specified in + * deidentify_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + */ + // const deidentifyTemplateName = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function deidentifyContent() { + // Construct request + const request = {}; + + // Run request + const response = await dlpClient.deidentifyContent(request); + console.log(response); + } + + deidentifyContent(); + // [END dlp_v2_generated_DlpService_DeidentifyContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_deidentify_template.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_deidentify_template.js new file mode 100644 index 00000000000..e5338a3b071 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_deidentify_template.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the organization and deidentify template to be deleted, + * for example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function deleteDeidentifyTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.deleteDeidentifyTemplate(request); + console.log(response); + } + + deleteDeidentifyTemplate(); + // [END dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_dlp_job.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_dlp_job.js new file mode 100644 index 00000000000..f16b54b4407 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_dlp_job.js @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_DeleteDlpJob_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the DlpJob resource to be deleted. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function deleteDlpJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.deleteDlpJob(request); + console.log(response); + } + + deleteDlpJob(); + // [END dlp_v2_generated_DlpService_DeleteDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_inspect_template.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_inspect_template.js new file mode 100644 index 00000000000..62e75ec1c8d --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_inspect_template.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_DeleteInspectTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the organization and inspectTemplate to be deleted, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function deleteInspectTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.deleteInspectTemplate(request); + console.log(response); + } + + deleteInspectTemplate(); + // [END dlp_v2_generated_DlpService_DeleteInspectTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_job_trigger.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_job_trigger.js new file mode 100644 index 00000000000..7f4007826ad --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_job_trigger.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_DeleteJobTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function deleteJobTrigger() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.deleteJobTrigger(request); + console.log(response); + } + + deleteJobTrigger(); + // [END dlp_v2_generated_DlpService_DeleteJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_stored_info_type.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_stored_info_type.js new file mode 100644 index 00000000000..a0259ff613d --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.delete_stored_info_type.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_DeleteStoredInfoType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the organization and storedInfoType to be deleted, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function deleteStoredInfoType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.deleteStoredInfoType(request); + console.log(response); + } + + deleteStoredInfoType(); + // [END dlp_v2_generated_DlpService_DeleteStoredInfoType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.finish_dlp_job.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.finish_dlp_job.js new file mode 100644 index 00000000000..0f071764899 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.finish_dlp_job.js @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_FinishDlpJob_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the DlpJob resource to be cancelled. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function finishDlpJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.finishDlpJob(request); + console.log(response); + } + + finishDlpJob(); + // [END dlp_v2_generated_DlpService_FinishDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_deidentify_template.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_deidentify_template.js new file mode 100644 index 00000000000..25674f1882f --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_deidentify_template.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_GetDeidentifyTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the organization and deidentify template to be read, for + * example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function getDeidentifyTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.getDeidentifyTemplate(request); + console.log(response); + } + + getDeidentifyTemplate(); + // [END dlp_v2_generated_DlpService_GetDeidentifyTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_dlp_job.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_dlp_job.js new file mode 100644 index 00000000000..fb2440e4e66 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_dlp_job.js @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_GetDlpJob_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the DlpJob resource. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function getDlpJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.getDlpJob(request); + console.log(response); + } + + getDlpJob(); + // [END dlp_v2_generated_DlpService_GetDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_inspect_template.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_inspect_template.js new file mode 100644 index 00000000000..fc89fa5db82 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_inspect_template.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_GetInspectTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the organization and inspectTemplate to be read, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function getInspectTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.getInspectTemplate(request); + console.log(response); + } + + getInspectTemplate(); + // [END dlp_v2_generated_DlpService_GetInspectTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_job_trigger.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_job_trigger.js new file mode 100644 index 00000000000..70166d6c97d --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_job_trigger.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_GetJobTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function getJobTrigger() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.getJobTrigger(request); + console.log(response); + } + + getJobTrigger(); + // [END dlp_v2_generated_DlpService_GetJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_stored_info_type.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_stored_info_type.js new file mode 100644 index 00000000000..388b76ca853 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.get_stored_info_type.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_GetStoredInfoType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the organization and storedInfoType to be read, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + */ + // const name = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function getStoredInfoType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.getStoredInfoType(request); + console.log(response); + } + + getStoredInfoType(); + // [END dlp_v2_generated_DlpService_GetStoredInfoType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.hybrid_inspect_dlp_job.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.hybrid_inspect_dlp_job.js new file mode 100644 index 00000000000..b54b7b3e74b --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.hybrid_inspect_dlp_job.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_HybridInspectDlpJob_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the job to execute a hybrid inspect on, for example + * `projects/dlp-test-project/dlpJob/53234423`. + */ + // const name = 'abc123' + /** + * The item to inspect. + */ + // const hybridItem = '' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function hybridInspectDlpJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.hybridInspectDlpJob(request); + console.log(response); + } + + hybridInspectDlpJob(); + // [END dlp_v2_generated_DlpService_HybridInspectDlpJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.hybrid_inspect_job_trigger.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.hybrid_inspect_job_trigger.js new file mode 100644 index 00000000000..812e1cdd3ef --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.hybrid_inspect_job_trigger.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_HybridInspectJobTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the trigger to execute a hybrid inspect on, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + */ + // const name = 'abc123' + /** + * The item to inspect. + */ + // const hybridItem = '' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function hybridInspectJobTrigger() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.hybridInspectJobTrigger(request); + console.log(response); + } + + hybridInspectJobTrigger(); + // [END dlp_v2_generated_DlpService_HybridInspectJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.inspect_content.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.inspect_content.js new file mode 100644 index 00000000000..8fb46996000 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.inspect_content.js @@ -0,0 +1,82 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main() { + // [START dlp_v2_generated_DlpService_InspectContent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Parent resource name. + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Configuration for the inspector. What specified here will override + * the template referenced by the inspect_template_name argument. + */ + // const inspectConfig = '' + /** + * The item to inspect. + */ + // const item = '' + /** + * Template to use. Any configuration directly specified in + * inspect_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + */ + // const inspectTemplateName = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function inspectContent() { + // Construct request + const request = {}; + + // Run request + const response = await dlpClient.inspectContent(request); + console.log(response); + } + + inspectContent(); + // [END dlp_v2_generated_DlpService_InspectContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_deidentify_templates.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_deidentify_templates.js new file mode 100644 index 00000000000..fea2253ea1f --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_deidentify_templates.js @@ -0,0 +1,96 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent) { + // [START dlp_v2_generated_DlpService_ListDeidentifyTemplates_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Page token to continue retrieval. Comes from previous call + * to `ListDeidentifyTemplates`. + */ + // const pageToken = 'abc123' + /** + * Size of the page, can be limited by server. If zero server returns + * a page of max size 100. + */ + // const pageSize = 1234 + /** + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * Example: `name asc,update_time, create_time desc` + * Supported fields are: + * - `create_time`: corresponds to time the template was created. + * - `update_time`: corresponds to time the template was last updated. + * - `name`: corresponds to template's name. + * - `display_name`: corresponds to template's display name. + */ + // const orderBy = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function listDeidentifyTemplates() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dlpClient.listDeidentifyTemplatesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listDeidentifyTemplates(); + // [END dlp_v2_generated_DlpService_ListDeidentifyTemplates_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_dlp_jobs.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_dlp_jobs.js new file mode 100644 index 00000000000..7d4ceaa5059 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_dlp_jobs.js @@ -0,0 +1,120 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent) { + // [START dlp_v2_generated_DlpService_ListDlpJobs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource name. + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Allows filtering. + * Supported syntax: + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of `{field} {operator} {value}`. + * * Supported fields/values for inspect jobs: + * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - `trigger_name` - The resource name of the trigger that created job. + * - 'end_time` - Corresponds to time the job finished. + * - 'start_time` - Corresponds to time the job finished. + * * Supported fields for risk analysis jobs: + * - `state` - RUNNING|CANCELED|FINISHED|FAILED + * - 'end_time` - Corresponds to time the job finished. + * - 'start_time` - Corresponds to time the job finished. + * * The operator must be `=` or `!=`. + * Examples: + * * inspected_storage = cloud_storage AND state = done + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = done OR state = canceled) + * * end_time > \"2017-12-12T00:00:00+00:00\" + * The length of this field should be no more than 500 characters. + */ + // const filter = 'abc123' + /** + * The standard list page size. + */ + // const pageSize = 1234 + /** + * The standard list page token. + */ + // const pageToken = 'abc123' + /** + * The type of job. Defaults to `DlpJobType.INSPECT` + */ + // const type = '' + /** + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * Example: `name asc, end_time asc, create_time desc` + * Supported fields are: + * - `create_time`: corresponds to time the job was created. + * - `end_time`: corresponds to time the job ended. + * - `name`: corresponds to job's name. + * - `state`: corresponds to `state` + */ + // const orderBy = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function listDlpJobs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dlpClient.listDlpJobsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listDlpJobs(); + // [END dlp_v2_generated_DlpService_ListDlpJobs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_info_types.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_info_types.js new file mode 100644 index 00000000000..a862198f2c6 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_info_types.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main() { + // [START dlp_v2_generated_DlpService_ListInfoTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The parent resource name. + * The format of this value is as follows: + * locations/LOCATION_ID + */ + // const parent = 'abc123' + /** + * BCP-47 language code for localized infoType friendly + * names. If omitted, or if localized strings are not available, + * en-US strings will be returned. + */ + // const languageCode = 'abc123' + /** + * filter to only return infoTypes supported by certain parts of the + * API. Defaults to supported_by=INSPECT. + */ + // const filter = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function listInfoTypes() { + // Construct request + const request = {}; + + // Run request + const response = await dlpClient.listInfoTypes(request); + console.log(response); + } + + listInfoTypes(); + // [END dlp_v2_generated_DlpService_ListInfoTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_inspect_templates.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_inspect_templates.js new file mode 100644 index 00000000000..b992b5c29eb --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_inspect_templates.js @@ -0,0 +1,96 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent) { + // [START dlp_v2_generated_DlpService_ListInspectTemplates_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Page token to continue retrieval. Comes from previous call + * to `ListInspectTemplates`. + */ + // const pageToken = 'abc123' + /** + * Size of the page, can be limited by server. If zero server returns + * a page of max size 100. + */ + // const pageSize = 1234 + /** + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * Example: `name asc,update_time, create_time desc` + * Supported fields are: + * - `create_time`: corresponds to time the template was created. + * - `update_time`: corresponds to time the template was last updated. + * - `name`: corresponds to template's name. + * - `display_name`: corresponds to template's display name. + */ + // const orderBy = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function listInspectTemplates() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dlpClient.listInspectTemplatesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listInspectTemplates(); + // [END dlp_v2_generated_DlpService_ListInspectTemplates_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_job_triggers.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_job_triggers.js new file mode 100644 index 00000000000..5939cd2a92b --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_job_triggers.js @@ -0,0 +1,116 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent) { + // [START dlp_v2_generated_DlpService_ListJobTriggers_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource name. + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Page token to continue retrieval. Comes from previous call + * to ListJobTriggers. `order_by` field must not + * change for subsequent calls. + */ + // const pageToken = 'abc123' + /** + * Size of the page, can be limited by a server. + */ + // const pageSize = 1234 + /** + * Comma separated list of triggeredJob fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * Example: `name asc,update_time, create_time desc` + * Supported fields are: + * - `create_time`: corresponds to time the JobTrigger was created. + * - `update_time`: corresponds to time the JobTrigger was last updated. + * - `last_run_time`: corresponds to the last time the JobTrigger ran. + * - `name`: corresponds to JobTrigger's name. + * - `display_name`: corresponds to JobTrigger's display name. + * - `status`: corresponds to JobTrigger's status. + */ + // const orderBy = 'abc123' + /** + * Allows filtering. + * Supported syntax: + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of `{field} {operator} {value}`. + * * Supported fields/values for inspect jobs: + * - `status` - HEALTHY|PAUSED|CANCELLED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by + * quotation marks. Nanoseconds are ignored. + * - 'error_count' - Number of errors that have occurred while running. + * * The operator must be `=` or `!=` for status and inspected_storage. + * Examples: + * * inspected_storage = cloud_storage AND status = HEALTHY + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) + * * last_run_time > \"2017-12-12T00:00:00+00:00\" + * The length of this field should be no more than 500 characters. + */ + // const filter = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function listJobTriggers() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dlpClient.listJobTriggersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listJobTriggers(); + // [END dlp_v2_generated_DlpService_ListJobTriggers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_stored_info_types.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_stored_info_types.js new file mode 100644 index 00000000000..dbc2a531b74 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.list_stored_info_types.js @@ -0,0 +1,97 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent) { + // [START dlp_v2_generated_DlpService_ListStoredInfoTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource name. + * The format of this value varies depending on the scope of the request + * (project or organization) and whether you have [specified a processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * + Organizations scope, location specified:
+ * `organizations/`ORG_ID`/locations/`LOCATION_ID + * + Organizations scope, no location specified (defaults to global):
+ * `organizations/`ORG_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Page token to continue retrieval. Comes from previous call + * to `ListStoredInfoTypes`. + */ + // const pageToken = 'abc123' + /** + * Size of the page, can be limited by server. If zero server returns + * a page of max size 100. + */ + // const pageSize = 1234 + /** + * Comma separated list of fields to order by, + * followed by `asc` or `desc` postfix. This list is case-insensitive, + * default sorting order is ascending, redundant space characters are + * insignificant. + * Example: `name asc, display_name, create_time desc` + * Supported fields are: + * - `create_time`: corresponds to time the most recent version of the + * resource was created. + * - `state`: corresponds to the state of the resource. + * - `name`: corresponds to resource name. + * - `display_name`: corresponds to info type's display name. + */ + // const orderBy = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function listStoredInfoTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dlpClient.listStoredInfoTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listStoredInfoTypes(); + // [END dlp_v2_generated_DlpService_ListStoredInfoTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.redact_image.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.redact_image.js new file mode 100644 index 00000000000..a7fc2eddbab --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.redact_image.js @@ -0,0 +1,82 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main() { + // [START dlp_v2_generated_DlpService_RedactImage_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Parent resource name. + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + /** + * Configuration for the inspector. + */ + // const inspectConfig = '' + /** + * The configuration for specifying what content to redact from images. + */ + // const imageRedactionConfigs = 1234 + /** + * Whether the response should include findings along with the redacted + * image. + */ + // const includeFindings = true + /** + * The content must be PNG, JPEG, SVG or BMP. + */ + // const byteItem = '' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function redactImage() { + // Construct request + const request = {}; + + // Run request + const response = await dlpClient.redactImage(request); + console.log(response); + } + + redactImage(); + // [END dlp_v2_generated_DlpService_RedactImage_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.reidentify_content.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.reidentify_content.js new file mode 100644 index 00000000000..6b8ead940f0 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.reidentify_content.js @@ -0,0 +1,105 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent) { + // [START dlp_v2_generated_DlpService_ReidentifyContent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource name. + * The format of this value varies depending on whether you have [specified a + * processing + * location](https://cloud.google.com/dlp/docs/specifying-location): + * + Projects scope, location specified:
+ * `projects/`PROJECT_ID`/locations/`LOCATION_ID + * + Projects scope, no location specified (defaults to global):
+ * `projects/`PROJECT_ID + * The following example `parent` string specifies a parent project with the + * identifier `example-project`, and specifies the `europe-west3` location + * for processing data: + * parent=projects/example-project/locations/europe-west3 + */ + // const parent = 'abc123' + /** + * Configuration for the re-identification of the content item. + * This field shares the same proto message type that is used for + * de-identification, however its usage here is for the reversal of the + * previous de-identification. Re-identification is performed by examining + * the transformations used to de-identify the items and executing the + * reverse. This requires that only reversible transformations + * be provided here. The reversible transformations are: + * - `CryptoDeterministicConfig` + * - `CryptoReplaceFfxFpeConfig` + */ + // const reidentifyConfig = '' + /** + * Configuration for the inspector. + */ + // const inspectConfig = '' + /** + * The item to re-identify. Will be treated as text. + */ + // const item = '' + /** + * Template to use. Any configuration directly specified in + * `inspect_config` will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + */ + // const inspectTemplateName = 'abc123' + /** + * Template to use. References an instance of `DeidentifyTemplate`. + * Any configuration directly specified in `reidentify_config` or + * `inspect_config` will override those set in the template. The + * `DeidentifyTemplate` used must include only reversible transformations. + * Singular fields that are set in this request will replace their + * corresponding fields in the template. Repeated fields are appended. + * Singular sub-messages and groups are recursively merged. + */ + // const reidentifyTemplateName = 'abc123' + /** + * Deprecated. This field has no effect. + */ + // const locationId = 'abc123' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function reidentifyContent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dlpClient.reidentifyContent(request); + console.log(response); + } + + reidentifyContent(); + // [END dlp_v2_generated_DlpService_ReidentifyContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_deidentify_template.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_deidentify_template.js new file mode 100644 index 00000000000..09e3c34047b --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_deidentify_template.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of organization and deidentify template to be updated, for + * example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + */ + // const name = 'abc123' + /** + * New DeidentifyTemplate value. + */ + // const deidentifyTemplate = '' + /** + * Mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function updateDeidentifyTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.updateDeidentifyTemplate(request); + console.log(response); + } + + updateDeidentifyTemplate(); + // [END dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_inspect_template.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_inspect_template.js new file mode 100644 index 00000000000..85de6d70df2 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_inspect_template.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_UpdateInspectTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of organization and inspectTemplate to be updated, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + */ + // const name = 'abc123' + /** + * New InspectTemplate value. + */ + // const inspectTemplate = '' + /** + * Mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function updateInspectTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.updateInspectTemplate(request); + console.log(response); + } + + updateInspectTemplate(); + // [END dlp_v2_generated_DlpService_UpdateInspectTemplate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_job_trigger.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_job_trigger.js new file mode 100644 index 00000000000..74150330431 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_job_trigger.js @@ -0,0 +1,61 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_UpdateJobTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + */ + // const name = 'abc123' + /** + * New JobTrigger value. + */ + // const jobTrigger = '' + /** + * Mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function updateJobTrigger() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.updateJobTrigger(request); + console.log(response); + } + + updateJobTrigger(); + // [END dlp_v2_generated_DlpService_UpdateJobTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_stored_info_type.js b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_stored_info_type.js new file mode 100644 index 00000000000..75cd7a10297 --- /dev/null +++ b/packages/google-privacy-dlp/samples/generated/v2/dlp_service.update_stored_info_type.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START dlp_v2_generated_DlpService_UpdateStoredInfoType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of organization and storedInfoType to be updated, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + */ + // const name = 'abc123' + /** + * Updated configuration for the storedInfoType. If not provided, a new + * version of the storedInfoType will be created with the existing + * configuration. + */ + // const config = '' + /** + * Mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dlp library + const {DlpServiceClient} = require('@google-cloud/dlp').v2; + + // Instantiates a client + const dlpClient = new DlpServiceClient(); + + async function updateStoredInfoType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dlpClient.updateStoredInfoType(request); + console.log(response); + } + + updateStoredInfoType(); + // [END dlp_v2_generated_DlpService_UpdateStoredInfoType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-privacy-dlp/samples/package.json b/packages/google-privacy-dlp/samples/package.json index 21559811ab1..58c6d6acd21 100644 --- a/packages/google-privacy-dlp/samples/package.json +++ b/packages/google-privacy-dlp/samples/package.json @@ -9,7 +9,7 @@ "*.js" ], "engines": { - "node": ">=8" + "node": ">=10" }, "scripts": { "test": "mocha system-test/*.test.js --timeout=600000" diff --git a/packages/google-privacy-dlp/src/v2/dlp_service_client.ts b/packages/google-privacy-dlp/src/v2/dlp_service_client.ts index ed4835744e8..b602ce261cb 100644 --- a/packages/google-privacy-dlp/src/v2/dlp_service_client.ts +++ b/packages/google-privacy-dlp/src/v2/dlp_service_client.ts @@ -3614,7 +3614,8 @@ export class DlpServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listInspectTemplates']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listInspectTemplates.createStream( this.innerApiCalls.listInspectTemplates as gax.GaxCall, @@ -3701,7 +3702,8 @@ export class DlpServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listInspectTemplates']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listInspectTemplates.asyncIterate( this.innerApiCalls['listInspectTemplates'] as GaxCall, @@ -3922,7 +3924,8 @@ export class DlpServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listDeidentifyTemplates']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listDeidentifyTemplates.createStream( this.innerApiCalls.listDeidentifyTemplates as gax.GaxCall, @@ -4009,7 +4012,8 @@ export class DlpServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listDeidentifyTemplates']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listDeidentifyTemplates.asyncIterate( this.innerApiCalls['listDeidentifyTemplates'] as GaxCall, @@ -4265,7 +4269,8 @@ export class DlpServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listJobTriggers']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listJobTriggers.createStream( this.innerApiCalls.listJobTriggers as gax.GaxCall, @@ -4375,7 +4380,8 @@ export class DlpServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listJobTriggers']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listJobTriggers.asyncIterate( this.innerApiCalls['listJobTriggers'] as GaxCall, @@ -4634,7 +4640,8 @@ export class DlpServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listDlpJobs']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listDlpJobs.createStream( this.innerApiCalls.listDlpJobs as gax.GaxCall, @@ -4746,7 +4753,8 @@ export class DlpServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listDlpJobs']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listDlpJobs.asyncIterate( this.innerApiCalls['listDlpJobs'] as GaxCall, @@ -4965,7 +4973,8 @@ export class DlpServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listStoredInfoTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listStoredInfoTypes.createStream( this.innerApiCalls.listStoredInfoTypes as gax.GaxCall, @@ -5053,7 +5062,8 @@ export class DlpServiceClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listStoredInfoTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listStoredInfoTypes.asyncIterate( this.innerApiCalls['listStoredInfoTypes'] as GaxCall,