-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(samples): add auto-generated Node samples (#656)
* docs(samples): add auto-generated Node samples build(generator): find protoc based on its bazel location PiperOrigin-RevId: 398604509 Source-Link: googleapis/googleapis@6ef16b9 Source-Link: googleapis/googleapis-gen@8314e1e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODMxNGUxZWFkM2U5MDZkYmYyMDEyY2VkOGQ5MmYyYmM4ZGQ0NWM5NSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * build: ugprade samples engine to Node 10 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Sofia Leon <sofialeon@google.com>
- Loading branch information
1 parent
be73b80
commit f660818
Showing
36 changed files
with
2,443 additions
and
11 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
packages/google-privacy-dlp/samples/generated/v2/dlp_service.activate_job_trigger.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); |
52 changes: 52 additions & 0 deletions
52
packages/google-privacy-dlp/samples/generated/v2/dlp_service.cancel_dlp_job.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); |
83 changes: 83 additions & 0 deletions
83
packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_deidentify_template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:<br/> | ||
* `projects/`<var>PROJECT_ID</var>`/locations/`<var>LOCATION_ID</var> | ||
* + Projects scope, no location specified (defaults to global):<br/> | ||
* `projects/`<var>PROJECT_ID</var> | ||
* + Organizations scope, location specified:<br/> | ||
* `organizations/`<var>ORG_ID</var>`/locations/`<var>LOCATION_ID</var> | ||
* + Organizations scope, no location specified (defaults to global):<br/> | ||
* `organizations/`<var>ORG_ID</var> | ||
* 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)); |
82 changes: 82 additions & 0 deletions
82
packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_dlp_job.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:<br/> | ||
* `projects/`<var>PROJECT_ID</var>`/locations/`<var>LOCATION_ID</var> | ||
* + Projects scope, no location specified (defaults to global):<br/> | ||
* `projects/`<var>PROJECT_ID</var> | ||
* 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)); |
83 changes: 83 additions & 0 deletions
83
packages/google-privacy-dlp/samples/generated/v2/dlp_service.create_inspect_template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:<br/> | ||
* `projects/`<var>PROJECT_ID</var>`/locations/`<var>LOCATION_ID</var> | ||
* + Projects scope, no location specified (defaults to global):<br/> | ||
* `projects/`<var>PROJECT_ID</var> | ||
* + Organizations scope, location specified:<br/> | ||
* `organizations/`<var>ORG_ID</var>`/locations/`<var>LOCATION_ID</var> | ||
* + Organizations scope, no location specified (defaults to global):<br/> | ||
* `organizations/`<var>ORG_ID</var> | ||
* 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)); |
Oops, something went wrong.