UNPKG

@google-cloud/dlp

Version:
1,078 lines 127 kB
"use strict"; // Copyright 2023 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 // // https://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. // // ** This file is automatically generated by gapic-generator-typescript. ** // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** Object.defineProperty(exports, "__esModule", { value: true }); exports.DlpServiceClient = void 0; const jsonProtos = require("../../protos/protos.json"); /** * Client JSON configuration object, loaded from * `src/v2/dlp_service_client_config.json`. * This file defines retry strategy and timeouts for all API methods in this library. */ const gapicConfig = require("./dlp_service_client_config.json"); const version = require('../../../package.json').version; /** * The Cloud Data Loss Prevention (DLP) API is a service that allows clients * to detect the presence of Personally Identifiable Information (PII) and other * privacy-sensitive data in user-supplied, unstructured data streams, like text * blocks or images. * The service also includes methods for sensitive data redaction and * scheduling of data scans on Google Cloud Platform based data sets. * * To learn more about concepts and find how-to guides see * https://cloud.google.com/dlp/docs/. * @class * @memberof v2 */ class DlpServiceClient { /** * Construct an instance of DlpServiceClient. * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] * @param {string} [options.credentials.private_key] * @param {string} [options.email] - Account email address. Required when * using a .pem or .p12 keyFilename. * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or * .p12 key downloaded from the Google Developers Console. If you provide * a path to a JSON file, the projectId option below is not necessary. * NOTE: .pem and .p12 require you to specify options.email as well. * @param {number} [options.port] - The port on which to connect to * the remote host. * @param {string} [options.projectId] - The project ID from the Google * Developer's Console, e.g. 'grape-spaceship-123'. We will also check * the environment variable GCLOUD_PROJECT for your project ID. If your * app is running in an environment which supports * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you * need to avoid loading the default gRPC version and want to use the fallback * HTTP implementation. Load only fallback version and pass it to the constructor: * ``` * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC * const client = new DlpServiceClient({fallback: true}, gax); * ``` */ constructor(opts, gaxInstance) { var _a, _b; this._terminated = false; this.descriptors = { page: {}, stream: {}, longrunning: {}, batching: {}, }; // Ensure that options include all the required fields. const staticMembers = this.constructor; const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath; this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint)); const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {}; const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function'); opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } // Load google-gax module synchronously if needed if (!gaxInstance) { gaxInstance = require('google-gax'); } // Choose either gRPC or proto-over-HTTP implementation of google-gax. this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); // Save options to use in initialize() method. this._opts = opts; // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; // Set defaultServicePath on the auth object. this.auth.defaultServicePath = staticMembers.servicePath; // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } this.locationsClient = new this._gaxModule.LocationsClient(this._gaxGrpc, opts); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { clientHeader.push(`gl-web/${this._gaxModule.version}`); } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); } else { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { findingPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/findings/{finding}'), organizationPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}'), organizationDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/deidentifyTemplates/{deidentify_template}'), organizationInspectTemplatePathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/inspectTemplates/{inspect_template}'), organizationLocationDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}'), organizationLocationInspectTemplatePathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}'), organizationLocationStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/storedInfoTypes/{stored_info_type}'), organizationStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/storedInfoTypes/{stored_info_type}'), projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'), projectDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/deidentifyTemplates/{deidentify_template}'), projectDlpContentPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/dlpContent'), projectDlpJobPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/dlpJobs/{dlp_job}'), projectInspectTemplatePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/inspectTemplates/{inspect_template}'), projectJobTriggerPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/jobTriggers/{job_trigger}'), projectLocationDeidentifyTemplatePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}'), projectLocationDlpJobPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dlpJobs/{dlp_job}'), projectLocationInspectTemplatePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/inspectTemplates/{inspect_template}'), projectLocationJobTriggerPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/jobTriggers/{job_trigger}'), projectLocationStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/storedInfoTypes/{stored_info_type}'), projectStoredInfoTypePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/storedInfoTypes/{stored_info_type}'), }; // Some of the methods on this service return "paged" results, // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { listInspectTemplates: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'inspectTemplates'), listDeidentifyTemplates: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'deidentifyTemplates'), listJobTriggers: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobTriggers'), listDlpJobs: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs'), listStoredInfoTypes: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'storedInfoTypes'), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings('google.privacy.dlp.v2.DlpService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') }); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. this.warn = this._gaxModule.warn; } /** * Initialize the client. * Performs asynchronous operations (such as authentication) and prepares the client. * This function will be called automatically when any class method is called for the * first time, but if you need to initialize it before calling an actual method, * feel free to call initialize() directly. * * You can await on this method if you want to make sure the client is initialized. * * @returns {Promise} A promise that resolves to an authenticated service stub. */ initialize() { // If the client stub promise is already initialized, return immediately. if (this.dlpServiceStub) { return this.dlpServiceStub; } // Put together the "service stub" for // google.privacy.dlp.v2.DlpService. this.dlpServiceStub = this._gaxGrpc.createStub(this._opts.fallback ? this._protos.lookupService('google.privacy.dlp.v2.DlpService') : // eslint-disable-next-line @typescript-eslint/no-explicit-any this._protos.google.privacy.dlp.v2.DlpService, this._opts, this._providedCustomServicePath); // Iterate over each of the methods that the service provides // and create an API call method for each. const dlpServiceStubMethods = [ 'inspectContent', 'redactImage', 'deidentifyContent', 'reidentifyContent', 'listInfoTypes', 'createInspectTemplate', 'updateInspectTemplate', 'getInspectTemplate', 'listInspectTemplates', 'deleteInspectTemplate', 'createDeidentifyTemplate', 'updateDeidentifyTemplate', 'getDeidentifyTemplate', 'listDeidentifyTemplates', 'deleteDeidentifyTemplate', 'createJobTrigger', 'updateJobTrigger', 'hybridInspectJobTrigger', 'getJobTrigger', 'listJobTriggers', 'deleteJobTrigger', 'activateJobTrigger', 'createDlpJob', 'listDlpJobs', 'getDlpJob', 'deleteDlpJob', 'cancelDlpJob', 'createStoredInfoType', 'updateStoredInfoType', 'getStoredInfoType', 'listStoredInfoTypes', 'deleteStoredInfoType', 'hybridInspectDlpJob', 'finishDlpJob', ]; for (const methodName of dlpServiceStubMethods) { const callPromise = this.dlpServiceStub.then(stub => (...args) => { if (this._terminated) { return Promise.reject('The client has already been closed.'); } const func = stub[methodName]; return func.apply(stub, args); }, (err) => () => { throw err; }); const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback); this.innerApiCalls[methodName] = apiCall; } return this.dlpServiceStub; } /** * The DNS address for this API service. * @returns {string} The DNS address for this service. */ static get servicePath() { return 'dlp.googleapis.com'; } /** * The DNS address for this API service - same as servicePath(), * exists for compatibility reasons. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { return 'dlp.googleapis.com'; } /** * The port for this API service. * @returns {number} The default port for this service. */ static get port() { return 443; } /** * The scopes needed to make gRPC calls for every method defined * in this service. * @returns {string[]} List of default scopes. */ static get scopes() { return ['https://www.googleapis.com/auth/cloud-platform']; } /** * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId(callback) { if (callback) { this.auth.getProjectId(callback); return; } return this.auth.getProjectId(); } inspectContent(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.inspectContent(request, options, callback); } redactImage(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.redactImage(request, options, callback); } deidentifyContent(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.deidentifyContent(request, options, callback); } reidentifyContent(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.reidentifyContent(request, options, callback); } listInfoTypes(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.listInfoTypes(request, options, callback); } createInspectTemplate(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.createInspectTemplate(request, options, callback); } updateInspectTemplate(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.updateInspectTemplate(request, options, callback); } getInspectTemplate(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.getInspectTemplate(request, options, callback); } deleteInspectTemplate(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.deleteInspectTemplate(request, options, callback); } createDeidentifyTemplate(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.createDeidentifyTemplate(request, options, callback); } updateDeidentifyTemplate(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.updateDeidentifyTemplate(request, options, callback); } getDeidentifyTemplate(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.getDeidentifyTemplate(request, options, callback); } deleteDeidentifyTemplate(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.deleteDeidentifyTemplate(request, options, callback); } createJobTrigger(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.createJobTrigger(request, options, callback); } updateJobTrigger(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.updateJobTrigger(request, options, callback); } hybridInspectJobTrigger(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.hybridInspectJobTrigger(request, options, callback); } getJobTrigger(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.getJobTrigger(request, options, callback); } deleteJobTrigger(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.deleteJobTrigger(request, options, callback); } activateJobTrigger(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.activateJobTrigger(request, options, callback); } createDlpJob(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.createDlpJob(request, options, callback); } getDlpJob(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.getDlpJob(request, options, callback); } deleteDlpJob(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.deleteDlpJob(request, options, callback); } cancelDlpJob(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.cancelDlpJob(request, options, callback); } createStoredInfoType(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.createStoredInfoType(request, options, callback); } updateStoredInfoType(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.updateStoredInfoType(request, options, callback); } getStoredInfoType(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.getStoredInfoType(request, options, callback); } deleteStoredInfoType(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.deleteStoredInfoType(request, options, callback); } hybridInspectDlpJob(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.hybridInspectDlpJob(request, options, callback); } finishDlpJob(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: (_a = request.name) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.finishDlpJob(request, options, callback); } listInspectTemplates(request, optionsOrCallback, callback) { var _a; request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); this.initialize(); return this.innerApiCalls.listInspectTemplates(request, options, callback); } /** * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent * 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 * @param {string} request.pageToken * Page token to continue retrieval. Comes from previous call * to `ListInspectTemplates`. * @param {number} request.pageSize * Size of the page, can be limited by the server. If zero server returns * a page of max size 100. * @param {string} request.orderBy * 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 the time the template was created. * - `update_time`: corresponds to the time the template was last updated. * - `name`: corresponds to the template's name. * - `display_name`: corresponds to the template's display name. * @param {string} request.locationId * Deprecated. This field has no effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} * An object stream which emits an object representing {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate} on 'data' event. * The client library will perform auto-pagination by default: it will call the API as many * times as needed. Note that it can affect your quota. * We recommend using `listInspectTemplatesAsync()` * method described below for async iteration which you can stop as needed. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. */ listInspectTemplatesStream(request, options) { var _a; request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', }); const defaultCallSettings = this._defaults['listInspectTemplates']; const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listInspectTemplates.createStream(this.innerApiCalls.listInspectTemplates, request, callSettings); } /** * Equivalent to `listInspectTemplates`, but returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {string} request.parent * 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 * @param {string} request.pageToken * Page token to continue retrieval. Comes from previous call * to `ListInspectTemplates`. * @param {number} request.pageSize * Size of the page, can be limited by the server. If zero server returns * a page of max size 100. * @param {string} request.orderBy * 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 the time the template was created. * - `update_time`: corresponds to the time the template was last updated. * - `name`: corresponds to the template's name. * - `display_name`: corresponds to the template's display name. * @param {string} request.locationId * Deprecated. This field has no effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. * When you iterate the returned iterable, each element will be an object representing * {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. The API will be called under the hood as needed, once per the page, * so you can stop the iteration when you don't need more results. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/dlp_service.list_inspect_templates.js</caption> * region_tag:dlp_v2_generated_DlpService_ListInspectTemplates_async */ listInspectTemplatesAsync(request, options) { var _a; request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: (_a = request.par