MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

dlp/getJob.js:21–47  ·  view source on GitHub ↗
(jobName)

Source from the content-addressed store, hash-verified

19// description: Get DLP inspection job using job name.
20// usage: node getJob.js jobName
21function main(jobName) {
22 // [START dlp_get_job]
23 // Imports the Google Cloud Data Loss Prevention library
24 const DLP = require('@google-cloud/dlp');
25
26 // Instantiates a client
27 const dlp = new DLP.DlpServiceClient();
28
29 // Job name to look for
30 // const jobName = 'your-job-name';
31
32 async function getJob() {
33 // Construct request for finding job using job name.
34 const request = {
35 name: jobName,
36 };
37
38 // Send the request and receive response from the service
39 const [job] = await dlp.getDlpJob(request);
40
41 // Print results.
42 console.log(`Job ${job.name} status: ${job.state}`);
43 }
44
45 getJob();
46 // [END dlp_get_job]
47}
48
49process.on('unhandledRejection', err => {
50 console.error(err.message);

Callers 1

getJob.jsFile · 0.70

Calls 1

getJobFunction · 0.70

Tested by

no test coverage detected