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

Function main

dlp/inspectDatastore.js:22–166  ·  view source on GitHub ↗
(
  projectId,
  dataProjectId,
  namespaceId,
  kind,
  topicId,
  subscriptionId,
  minLikelihood,
  maxFindings,
  infoTypes,
  customInfoTypes
)

Source from the content-addressed store, hash-verified

20// usage: node inspectDatastore.js my-project dataProjectId namespaceId kind topicId subscriptionId minLikelihood maxFindings infoTypes customInfoTypes
21
22async function main(
23 projectId,
24 dataProjectId,
25 namespaceId,
26 kind,
27 topicId,
28 subscriptionId,
29 minLikelihood,
30 maxFindings,
31 infoTypes,
32 customInfoTypes
33) {
34 [infoTypes, customInfoTypes] = transformCLI(infoTypes, customInfoTypes);
35
36 // [START dlp_inspect_datastore]
37 // Import the Google Cloud client libraries
38 const DLP = require('@google-cloud/dlp');
39 const {PubSub} = require('@google-cloud/pubsub');
40
41 // Instantiates clients
42 const dlp = new DLP.DlpServiceClient();
43 const pubsub = new PubSub();
44
45 // The project ID to run the API call under
46 // const projectId = 'my-project';
47
48 // The project ID the target Datastore is stored under
49 // This may or may not equal the calling project ID
50 // const dataProjectId = 'my-project';
51
52 // (Optional) The ID namespace of the Datastore document to inspect.
53 // To ignore Datastore namespaces, set this to an empty string ('')
54 // const namespaceId = '';
55
56 // The kind of the Datastore entity to inspect.
57 // const kind = 'Person';
58
59 // The minimum likelihood required before returning a match
60 // const minLikelihood = 'LIKELIHOOD_UNSPECIFIED';
61
62 // The maximum number of findings to report per request (0 = server maximum)
63 // const maxFindings = 0;
64
65 // The infoTypes of information to match
66 // const infoTypes = [{ name: 'PHONE_NUMBER' }, { name: 'EMAIL_ADDRESS' }, { name: 'CREDIT_CARD_NUMBER' }];
67
68 // The customInfoTypes of information to match
69 // const customInfoTypes = [{ infoType: { name: 'DICT_TYPE' }, dictionary: { wordList: { words: ['foo', 'bar', 'baz']}}},
70 // { infoType: { name: 'REGEX_TYPE' }, regex: {pattern: '\\(\\d{3}\\) \\d{3}-\\d{4}'}}];
71
72 // The name of the Pub/Sub topic to notify once the job completes
73 // TODO(developer): create a Pub/Sub topic to use for this
74 // const topicId = 'MY-PUBSUB-TOPIC'
75
76 // The name of the Pub/Sub subscription to use when listening for job
77 // completion notifications
78 // TODO(developer): create a Pub/Sub subscription to use for this
79 // const subscriptionId = 'MY-PUBSUB-SUBSCRIPTION'

Callers

nothing calls this directly

Calls 2

inspectDatastoreFunction · 0.85
transformCLIFunction · 0.70

Tested by

no test coverage detected