"use strict";
// Copyright 2019 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 });
const gax = require("google-gax");
const path = require("path");
const gapicConfig = require("./data_catalog_client_config.json");
const version = require('../../../package.json').version;
/**
* Data Catalog API service allows clients to discover, understand, and manage
* their data.
* @class
* @memberof v1beta1
*/
class DataCatalogClient {
/**
* Construct an instance of DataCatalogClient.
*
* @param {object} [options] - The configuration object. See the subsequent
* parameters for more details.
* @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 {function} [options.promise] - Custom promise module to use instead
* of native Promises.
* @param {string} [options.apiEndpoint] - The domain name of the
* API remote host.
*/
constructor(opts) {
this._descriptors = { page: {}, stream: {}, longrunning: {} };
this._terminated = false;
// Ensure that options include the service address and port.
const staticMembers = this.constructor;
const servicePath = opts && opts.servicePath
? opts.servicePath
: opts && opts.apiEndpoint
? opts.apiEndpoint
: staticMembers.servicePath;
const port = opts && opts.port ? opts.port : staticMembers.port;
if (!opts) {
opts = { servicePath, port };
}
opts.servicePath = opts.servicePath || servicePath;
opts.port = opts.port || port;
opts.clientConfig = opts.clientConfig || {};
const isBrowser = typeof window !== 'undefined';
if (isBrowser) {
opts.fallback = true;
}
// If we are in browser, we are already using fallback because of the
// "browser" field in package.json.
// But if we were explicitly requested to use fallback, let's do it now.
const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax;
// Create a `gaxGrpc` object, with any grpc-specific options
// sent to the client.
opts.scopes = this.constructor.scopes;
const gaxGrpc = new gaxModule.GrpcClient(opts);
// Save the auth object to the client, for use by other methods.
this.auth = gaxGrpc.auth;
// Determine the client header string.
const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`];
if (typeof process !== 'undefined' && 'versions' in process) {
clientHeader.push(`gl-node/${process.versions.node}`);
}
else {
clientHeader.push(`gl-web/${gaxModule.version}`);
}
if (!opts.fallback) {
clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
}
// Load the applicable protos.
// For Node.js, pass the path to JSON proto file.
// For browsers, pass the JSON content.
const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json');
const protos = gaxGrpc.loadProto(opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath);
// This API contains "path templates"; forward-slash-separated
// identifiers to uniquely identify resources within the API.
// Create useful helper objects for these.
this._pathTemplates = {
entryGroupPathTemplate: new gaxModule.PathTemplate('projects/{project}/locations/{location}/entryGroups/{entry_group}'),
entryPathTemplate: new gaxModule.PathTemplate('projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}'),
tagTemplatePathTemplate: new gaxModule.PathTemplate('projects/{project}/locations/{location}/tagTemplates/{tag_template}'),
tagPathTemplate: new gaxModule.PathTemplate('projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}/tags/{tag}'),
tagTemplateFieldPathTemplate: new gaxModule.PathTemplate('projects/{project}/locations/{location}/tagTemplates/{tag_template}/fields/{field}'),
};
// 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 = {
searchCatalog: new gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results'),
listTags: new gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tags'),
};
// Put together the default options sent with requests.
const defaults = gaxGrpc.constructSettings('google.cloud.datacatalog.v1beta1.DataCatalog', 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 = {};
// Put together the "service stub" for
// google.cloud.datacatalog.v1beta1.DataCatalog.
this._dataCatalogStub = gaxGrpc.createStub(opts.fallback
? protos.lookupService('google.cloud.datacatalog.v1beta1.DataCatalog')
: // tslint:disable-next-line no-any
protos.google.cloud.datacatalog.v1beta1.DataCatalog, opts);
// Iterate over each of the methods that the service provides
// and create an API call method for each.
const dataCatalogStubMethods = [
'searchCatalog',
'createEntryGroup',
'getEntryGroup',
'deleteEntryGroup',
'createEntry',
'updateEntry',
'deleteEntry',
'getEntry',
'lookupEntry',
'createTagTemplate',
'getTagTemplate',
'updateTagTemplate',
'deleteTagTemplate',
'createTagTemplateField',
'updateTagTemplateField',
'renameTagTemplateField',
'deleteTagTemplateField',
'createTag',
'updateTag',
'deleteTag',
'listTags',
'setIamPolicy',
'getIamPolicy',
'testIamPermissions',
];
for (const methodName of dataCatalogStubMethods) {
const innerCallPromise = this._dataCatalogStub.then(stub => (...args) => {
return stub[methodName].apply(stub, args);
}, (err) => () => {
throw err;
});
const apiCall = gaxModule.createApiCall(innerCallPromise, defaults[methodName], this._descriptors.page[methodName] ||
this._descriptors.stream[methodName] ||
this._descriptors.longrunning[methodName]);
this._innerApiCalls[methodName] = (argument, callOptions, callback) => {
if (this._terminated) {
return Promise.reject('The client has already been closed.');
}
return apiCall(argument, callOptions, callback);
};
}
}
/**
* The DNS address for this API service.
*/
static get servicePath() {
return 'datacatalog.googleapis.com';
}
/**
* The DNS address for this API service - same as servicePath(),
* exists for compatibility reasons.
*/
static get apiEndpoint() {
return 'datacatalog.googleapis.com';
}
/**
* The port for this API service.
*/
static get port() {
return 443;
}
/**
* The scopes needed to make gRPC calls for every method defined
* in this service.
*/
static get scopes() {
return ['https://www.googleapis.com/auth/cloud-platform'];
}
/**
* Return the project ID used by this class.
* @param {function(Error, string)} callback - the callback to
* be called with the current project Id.
*/
getProjectId(callback) {
if (callback) {
this.auth.getProjectId(callback);
return;
}
return this.auth.getProjectId();
}
/**
* Alpha feature.
* Creates an EntryGroup.
* The user should enable the Data Catalog API in the project identified by
* the `parent` parameter (see [Data Catalog Resource Project]
* (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the project this entry group is in. Example:
*
* * projects/{project_id}/locations/{location}
*
* Note that this EntryGroup and its child resources may not actually be
* stored in the location in this name.
* @param {string} request.entryGroupId
* Required. The id of the entry group to create.
* The id must begin with a letter or underscore, contain only English
* letters, numbers and underscores, and be at most 64 characters.
* @param {google.cloud.datacatalog.v1beta1.EntryGroup} request.entryGroup
* The entry group to create. Defaults to an empty entry group.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [EntryGroup]{@link google.cloud.datacatalog.v1beta1.EntryGroup}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
createEntryGroup(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
parent: request.parent || '',
});
return this._innerApiCalls.createEntryGroup(request, options, callback);
}
/**
* Alpha feature.
* Gets an EntryGroup.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the entry group. For example,
* `projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}`.
* @param {google.protobuf.FieldMask} request.readMask
* The fields to return. If not set or empty, all fields are returned.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [EntryGroup]{@link google.cloud.datacatalog.v1beta1.EntryGroup}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
getEntryGroup(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
name: request.name || '',
});
return this._innerApiCalls.getEntryGroup(request, options, callback);
}
/**
* Alpha feature.
* Deletes an EntryGroup. Only entry groups that do not contain entries can be
* deleted. The user should enable the Data Catalog API in the project
* identified by the `name` parameter (see [Data Catalog Resource Project]
* (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the entry group. For example,
* `projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}`.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
deleteEntryGroup(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
name: request.name || '',
});
return this._innerApiCalls.deleteEntryGroup(request, options, callback);
}
/**
* Alpha feature.
* Creates an entry. Currently only entries of 'FILESET' type can be created.
* The user should enable the Data Catalog API in the project identified by
* the `parent` parameter (see [Data Catalog Resource Project]
* (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the entry group this entry is in. Example:
*
* * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}
*
* Note that this Entry and its child resources may not actually be stored in
* the location in this name.
* @param {string} request.entryId
* Required. The id of the entry to create.
* @param {google.cloud.datacatalog.v1beta1.Entry} request.entry
* Required. The entry to create.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Entry]{@link google.cloud.datacatalog.v1beta1.Entry}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
createEntry(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
parent: request.parent || '',
});
return this._innerApiCalls.createEntry(request, options, callback);
}
/**
* Updates an existing entry.
* The user should enable the Data Catalog API in the project identified by
* the `entry.name` parameter (see [Data Catalog Resource Project]
* (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
*
* @param {Object} request
* The request object that will be sent.
* @param {google.cloud.datacatalog.v1beta1.Entry} request.entry
* Required. The updated entry. The "name" field must be set.
* @param {google.protobuf.FieldMask} request.updateMask
* The fields to update on the entry. If absent or empty, all modifiable
* fields are updated.
*
* The following fields are modifiable:
* * For entries with type `DATA_STREAM`:
* * `schema`
* * For entries with type `FILESET`
* * `schema`
* * `display_name`
* * `description`
* * `gcs_fileset_spec`
* * `gcs_fileset_spec.file_patterns`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Entry]{@link google.cloud.datacatalog.v1beta1.Entry}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
updateEntry(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
entry_name: request.entry.name || '',
});
return this._innerApiCalls.updateEntry(request, options, callback);
}
/**
* Alpha feature.
* Deletes an existing entry. Only entries created through
* [CreateEntry][google.cloud.datacatalog.v1beta1.DataCatalog.CreateEntry]
* method can be deleted.
* The user should enable the Data Catalog API in the project identified by
* the `name` parameter (see [Data Catalog Resource Project]
* (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the entry. Example:
*
* * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
deleteEntry(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
name: request.name || '',
});
return this._innerApiCalls.deleteEntry(request, options, callback);
}
/**
* Gets an entry.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the entry. Example:
*
* * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
*
* Entry groups are logical groupings of entries. Currently, users cannot
* create/modify entry groups. They are created by Data Catalog; they include
* `@bigquery` for all BigQuery entries, and `@pubsub` for all Cloud Pub/Sub
* entries.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Entry]{@link google.cloud.datacatalog.v1beta1.Entry}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
getEntry(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
name: request.name || '',
});
return this._innerApiCalls.getEntry(request, options, callback);
}
/**
* Get an entry by target resource name. This method allows clients to use
* the resource name from the source Google Cloud Platform service to get the
* Data Catalog Entry.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.linkedResource
* The full name of the Google Cloud Platform resource the Data Catalog
* entry represents. See:
* https://cloud.google.com/apis/design/resource_names#full_resource_name.
* Full names are case-sensitive.
*
* Examples:
*
* * //bigquery.googleapis.com/projects/projectId/datasets/datasetId/tables/tableId
* * //pubsub.googleapis.com/projects/projectId/topics/topicId
* @param {string} request.sqlResource
* The SQL name of the entry. SQL names are case-sensitive.
*
* Examples:
*
* * `cloud_pubsub.project_id.topic_id`
* * ``pubsub.project_id.`topic.id.with.dots` ``
* * `bigquery.table.project_id.dataset_id.table_id`
* * `bigquery.dataset.project_id.dataset_id`
* * `datacatalog.project_id.location_id.entry_group_id.entry_id`
*
* `*_id`s shoud satisfy the standard SQL rules for identifiers.
* https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Entry]{@link google.cloud.datacatalog.v1beta1.Entry}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
lookupEntry(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
options = options || {};
return this._innerApiCalls.lookupEntry(request, options, callback);
}
/**
* Creates a tag template. The user should enable the Data Catalog API in
* the project identified by the `parent` parameter (see [Data Catalog
* Resource Project](https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more
* information).
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the project and the location this template is in.
* Example:
*
* * projects/{project_id}/locations/{location}
*
* TagTemplate and its child resources may not actually be stored in the
* location in this name.
* @param {string} request.tagTemplateId
* Required. The id of the tag template to create.
* @param {google.cloud.datacatalog.v1beta1.TagTemplate} request.tagTemplate
* Required. The tag template to create.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [TagTemplate]{@link google.cloud.datacatalog.v1beta1.TagTemplate}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
createTagTemplate(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
parent: request.parent || '',
});
return this._innerApiCalls.createTagTemplate(request, options, callback);
}
/**
* Gets a tag template.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the tag template. Example:
*
* * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [TagTemplate]{@link google.cloud.datacatalog.v1beta1.TagTemplate}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
getTagTemplate(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
name: request.name || '',
});
return this._innerApiCalls.getTagTemplate(request, options, callback);
}
/**
* Updates a tag template. This method cannot be used to update the fields of
* a template. The tag template fields are represented as separate resources
* and should be updated using their own create/update/delete methods.
* The user should enable the Data Catalog API in the project identified by
* the `tag_template.name` parameter (see [Data Catalog Resource Project]
* (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
*
* @param {Object} request
* The request object that will be sent.
* @param {google.cloud.datacatalog.v1beta1.TagTemplate} request.tagTemplate
* Required. The template to update. The "name" field must be set.
* @param {google.protobuf.FieldMask} request.updateMask
* The field mask specifies the parts of the template to overwrite.
*
* Allowed fields:
*
* * `display_name`
*
* If absent or empty, all of the allowed fields above will be updated.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [TagTemplate]{@link google.cloud.datacatalog.v1beta1.TagTemplate}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
updateTagTemplate(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
tag_template_name: request.tagTemplate.name || '',
});
return this._innerApiCalls.updateTagTemplate(request, options, callback);
}
/**
* Deletes a tag template and all tags using the template.
* The user should enable the Data Catalog API in the project identified by
* the `name` parameter (see [Data Catalog Resource Project]
* (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the tag template to delete. Example:
*
* * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}
* @param {boolean} request.force
* Required. Currently, this field must always be set to `true`.
* This confirms the deletion of any possible tags using this template.
* `force = false` will be supported in the future.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
deleteTagTemplate(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
name: request.name || '',
});
return this._innerApiCalls.deleteTagTemplate(request, options, callback);
}
/**
* Creates a field in a tag template. The user should enable the Data Catalog
* API in the project identified by the `parent` parameter (see
* [Data Catalog Resource
* Project](https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more
* information).
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the project this template is in. Example:
*
* * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}
*
* Note that this TagTemplateField may not actually be stored in the location
* in this name.
* @param {string} request.tagTemplateFieldId
* Required. The ID of the tag template field to create.
* Field ids can contain letters (both uppercase and lowercase), numbers
* (0-9), underscores (_) and dashes (-). Field IDs must be at least 1
* character long and at most 128 characters long. Field IDs must also be
* unique within their template.
* @param {google.cloud.datacatalog.v1beta1.TagTemplateField} request.tagTemplateField
* Required. The tag template field to create.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [TagTemplateField]{@link google.cloud.datacatalog.v1beta1.TagTemplateField}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
createTagTemplateField(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
parent: request.parent || '',
});
return this._innerApiCalls.createTagTemplateField(request, options, callback);
}
/**
* Updates a field in a tag template. This method cannot be used to update the
* field type. The user should enable the Data Catalog API in the project
* identified by the `name` parameter (see [Data Catalog Resource Project]
* (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the tag template field. Example:
*
* * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}
* @param {google.cloud.datacatalog.v1beta1.TagTemplateField} request.tagTemplateField
* Required. The template to update.
* @param {google.protobuf.FieldMask} request.updateMask
* The field mask specifies the parts of the template to be updated.
* Allowed fields:
*
* * `display_name`
* * `type.enum_type`
*
* If `update_mask` is not set or empty, all of the allowed fields above will
* be updated.
*
* When updating an enum type, the provided values will be merged with the
* existing values. Therefore, enum values can only be added, existing enum
* values cannot be deleted nor renamed.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [TagTemplateField]{@link google.cloud.datacatalog.v1beta1.TagTemplateField}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
updateTagTemplateField(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
name: request.name || '',
});
return this._innerApiCalls.updateTagTemplateField(request, options, callback);
}
/**
* Renames a field in a tag template. The user should enable the Data Catalog
* API in the project identified by the `name` parameter (see [Data Catalog
* Resource Project](https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more
* information).
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the tag template. Example:
*
* * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}
* @param {string} request.newTagTemplateFieldId
* Required. The new ID of this tag template field. For example, `my_new_field`.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [TagTemplateField]{@link google.cloud.datacatalog.v1beta1.TagTemplateField}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
renameTagTemplateField(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
name: request.name || '',
});
return this._innerApiCalls.renameTagTemplateField(request, options, callback);
}
/**
* Deletes a field in a tag template and all uses of that field.
* The user should enable the Data Catalog API in the project identified by
* the `name` parameter (see [Data Catalog Resource Project]
* (https://cloud.google.com/data-catalog/docs/concepts/resource-project) for more information).
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the tag template field to delete. Example:
*
* * projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}
* @param {boolean} request.force
* Required. Currently, this field must always be set to `true`.
* This confirms the deletion of this field from any tags using this field.
* `force = false` will be supported in the future.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
deleteTagTemplateField(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
name: request.name || '',
});
return this._innerApiCalls.deleteTagTemplateField(request, options, callback);
}
/**
* Creates a tag on an [Entry][google.cloud.datacatalog.v1beta1.Entry].
* Note: The project identified by the `parent` parameter for the
* [tag](https://cloud.google.com/data-catalog/docs/reference/rest/v1beta1/projects.locations.entryGroups.entries.tags/create#path-parameters)
* and the
* [tag
* template](https://cloud.google.com/data-catalog/docs/reference/rest/v1beta1/projects.locations.tagTemplates/create#path-parameters)
* used to create the tag must be from the same organization.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the resource to attach this tag to. Tags can be attached to
* Entries. Example:
*
* * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
*
* Note that this Tag and its child resources may not actually be stored in
* the location in this name.
* @param {google.cloud.datacatalog.v1beta1.Tag} request.tag
* Required. The tag to create.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Tag]{@link google.cloud.datacatalog.v1beta1.Tag}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
createTag(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
parent: request.parent || '',
});
return this._innerApiCalls.createTag(request, options, callback);
}
/**
* Updates an existing tag.
*
* @param {Object} request
* The request object that will be sent.
* @param {google.cloud.datacatalog.v1beta1.Tag} request.tag
* Required. The updated tag. The "name" field must be set.
* @param {google.protobuf.FieldMask} request.updateMask
* The fields to update on the Tag. If absent or empty, all modifiable fields
* are updated. Currently the only modifiable field is the field `fields`.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Tag]{@link google.cloud.datacatalog.v1beta1.Tag}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
updateTag(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
tag_name: request.tag.name || '',
});
return this._innerApiCalls.updateTag(request, options, callback);
}
/**
* Deletes a tag.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the tag to delete. Example:
*
* * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}/tags/{tag_id}
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
deleteTag(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
name: request.name || '',
});
return this._innerApiCalls.deleteTag(request, options, callback);
}
/**
* Sets the access control policy for a resource. Replaces any existing
* policy.
* Supported resources are:
* - Tag templates.
* - Entries.
* - Entry groups.
* Note, this method cannot be used to manage policies for BigQuery, Cloud
* Pub/Sub and any external Google Cloud Platform resources synced to Cloud
* Data Catalog.
*
* Callers must have following Google IAM permission
* - `datacatalog.tagTemplates.setIamPolicy` to set policies on tag
* templates.
* - `datacatalog.entries.setIamPolicy` to set policies on entries.
* - `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups.
*
* @param {Object} request
* The request object that will be sent.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
setIamPolicy(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
resource: request.resource || '',
});
return this._innerApiCalls.setIamPolicy(request, options, callback);
}
/**
* Gets the access control policy for a resource. A `NOT_FOUND` error
* is returned if the resource does not exist. An empty policy is returned
* if the resource exists but does not have a policy set on it.
*
* Supported resources are:
* - Tag templates.
* - Entries.
* - Entry groups.
* Note, this method cannot be used to manage policies for BigQuery, Cloud
* Pub/Sub and any external Google Cloud Platform resources synced to Cloud
* Data Catalog.
*
* Callers must have following Google IAM permission
* - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag
* templates.
* - `datacatalog.entries.getIamPolicy` to get policies on entries.
* - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
*
* @param {Object} request
* The request object that will be sent.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
getIamPolicy(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
resource: request.resource || '',
});
return this._innerApiCalls.getIamPolicy(request, options, callback);
}
/**
* Returns the caller's permissions on a resource.
* If the resource does not exist, an empty set of permissions is returned
* (We don't return a `NOT_FOUND` error).
*
* Supported resources are:
* - Tag templates.
* - Entries.
* - Entry groups.
* Note, this method cannot be used to manage policies for BigQuery, Cloud
* Pub/Sub and any external Google Cloud Platform resources synced to Cloud
* Data Catalog.
*
* A caller is not required to have Google IAM permission to make this
* request.
*
* @param {Object} request
* The request object that will be sent.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}.
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
testIamPermissions(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
resource: request.resource || '',
});
return this._innerApiCalls.testIamPermissions(request, options, callback);
}
/**
* Searches Data Catalog for multiple resources like entries, tags that
* match a query.
*
* This is a custom method
* (https://cloud.google.com/apis/design/custom_methods) and does not return
* the complete resource, only the resource identifier and high level
* fields. Clients can subsequentally call `Get` methods.
*
* Note that searches do not have full recall. There may be results that match
* your query but are not returned, even in subsequent pages of results. These
* missing results may vary across repeated calls to search. Do not rely on
* this method if you need to guarantee full recall.
*
* See [Data Catalog Search
* Syntax](https://cloud.google.com/data-catalog/docs/how-to/search-reference) for more information.
*
* @param {Object} request
* The request object that will be sent.
* @param {google.cloud.datacatalog.v1beta1.SearchCatalogRequest.Scope} request.scope
* Required. The scope of this search request.
* @param {string} request.query
* Required. The query string in search query syntax. The query must be non-empty.
*
* Query strings can be simple as "x" or more qualified as:
*
* * name:x
* * column:x
* * description:y
*
* Note: Query tokens need to have a minimum of 3 characters for substring
* matching to work correctly. See [Data Catalog Search
* Syntax](https://cloud.google.com/data-catalog/docs/how-to/search-reference) for more information.
* @param {number} request.pageSize
* Number of results in the search page. If <=0 then defaults to 10. Max limit
* for page_size is 1000. Throws an invalid argument for page_size > 1000.
* @param {string} [request.pageToken]
* Optional. Pagination token returned in an earlier
* [SearchCatalogResponse.next_page_token][google.cloud.datacatalog.v1beta1.SearchCatalogResponse.next_page_token], which
* indicates that this is a continuation of a prior
* [SearchCatalogRequest][google.cloud.datacatalog.v1beta1.DataCatalog.SearchCatalog]
* call, and that the system should return the next page of data. If empty,
* the first page is returned.
* @param {string} request.orderBy
* Specifies the ordering of results, currently supported case-sensitive
* choices are:
*
* * `relevance`, only supports desecending
* * `last_access_timestamp [asc|desc]`, defaults to descending if not
* specified
* * `last_modified_timestamp [asc|desc]`, defaults to descending if not
* specified
*
* If not specified, defaults to `relevance` descending.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [SearchCatalogResponse]{@link google.cloud.datacatalog.v1beta1.SearchCatalogResponse}.
*
* When autoPaginate: false is specified through options, the array has three elements.
* The first element is Array of [SearchCatalogResponse]{@link google.cloud.datacatalog.v1beta1.SearchCatalogResponse} in a single response.
* The second element is the next request object if the response
* indicates the next page exists, or null. The third element is
* an object representing [SearchCatalogResponse]{@link google.cloud.datacatalog.v1beta1.SearchCatalogResponse}.
*
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
searchCatalog(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
options = options || {};
return this._innerApiCalls.searchCatalog(request, options, callback);
}
/**
* Equivalent to {@link searchCatalog}, but returns a NodeJS Stream object.
*
* This fetches the paged responses for {@link searchCatalog} continuously
* and invokes the callback registered for 'data' event for each element in the
* responses.
*
* The returned object has 'end' method when no more elements are required.
*
* autoPaginate option will be ignored.
*
* @see {@link https://nodejs.org/api/stream.html}
*
* @param {Object} request
* The request object that will be sent.
* @param {google.cloud.datacatalog.v1beta1.SearchCatalogRequest.Scope} request.scope
* Required. The scope of this search request.
* @param {string} request.query
* Required. The query string in search query syntax. The query must be non-empty.
*
* Query strings can be simple as "x" or more qualified as:
*
* * name:x
* * column:x
* * description:y
*
* Note: Query tokens need to have a minimum of 3 characters for substring
* matching to work correctly. See [Data Catalog Search
* Syntax](https://cloud.google.com/data-catalog/docs/how-to/search-reference) for more information.
* @param {number} request.pageSize
* Number of results in the search page. If <=0 then defaults to 10. Max limit
* for page_size is 1000. Throws an invalid argument for page_size > 1000.
* @param {string} [request.pageToken]
* Optional. Pagination token returned in an earlier
* [SearchCatalogResponse.next_page_token][google.cloud.datacatalog.v1beta1.SearchCatalogResponse.next_page_token], which
* indicates that this is a continuation of a prior
* [SearchCatalogRequest][google.cloud.datacatalog.v1beta1.DataCatalog.SearchCatalog]
* call, and that the system should return the next page of data. If empty,
* the first page is returned.
* @param {string} request.orderBy
* Specifies the ordering of results, currently supported case-sensitive
* choices are:
*
* * `relevance`, only supports desecending
* * `last_access_timestamp [asc|desc]`, defaults to descending if not
* specified
* * `last_modified_timestamp [asc|desc]`, defaults to descending if not
* specified
*
* If not specified, defaults to `relevance` descending.
* @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 [SearchCatalogResult]{@link google.cloud.datacatalog.v1beta1.SearchCatalogResult} on 'data' event.
*/
searchCatalogStream(request, options) {
request = request || {};
const callSettings = new gax.CallSettings(options);
return this._descriptors.page.searchCatalog.createStream(this._innerApiCalls.searchCatalog, request, callSettings);
}
/**
* Lists the tags on an [Entry][google.cloud.datacatalog.v1beta1.Entry].
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the Data Catalog resource to list the tags of. The
* resource could be an [Entry][google.cloud.datacatalog.v1beta1.Entry].
* @param {number} request.pageSize
* The maximum number of tags to return. Default is 10. Max limit is 1000.
* @param {string} request.pageToken
* Token that specifies which page is requested. If empty, the first page is
* returned.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [ListTagsResponse]{@link google.cloud.datacatalog.v1beta1.ListTagsResponse}.
*
* When autoPaginate: false is specified through options, the array has three elements.
* The first element is Array of [ListTagsResponse]{@link google.cloud.datacatalog.v1beta1.ListTagsResponse} in a single response.
* The second element is the next request object if the response
* indicates the next page exists, or null. The third element is
* an object representing [ListTagsResponse]{@link google.cloud.datacatalog.v1beta1.ListTagsResponse}.
*
* The promise has a method named "cancel" which cancels the ongoing API call.
*/
listTags(request, optionsOrCallback, callback) {
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'] = gax.routingHeader.fromParams({
parent: request.parent || '',
});
return this._innerApiCalls.listTags(request, options, callback);
}
/**
* Equivalent to {@link listTags}, but returns a NodeJS Stream object.
*
* This fetches the paged responses for {@link listTags} continuously
* and invokes the callback registered for 'data' event for each element in the
* responses.
*
* The returned object has 'end' method when no more elements are required.
*
* autoPaginate option will be ignored.
*
* @see {@link https://nodejs.org/api/stream.html}
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The name of the Data Catalog resource to list the tags of. The
* resource could be an [Entry][google.cloud.datacatalog.v1beta1.Entry].
* @param {number} request.pageSize
* The maximum number of tags to return. Default is 10. Max limit is 1000.
* @param {string} request.pageToken
* Token that specifies which page is requested. If empty, the first page is
* returned.
* @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 [Tag]{@link google.cloud.datacatalog.v1beta1.Tag} on 'data' event.
*/
listTagsStream(request, options) {
request = request || {};
const callSettings = new gax.CallSettings(options);
return this._descriptors.page.listTags.createStream(this._innerApiCalls.listTags, request, callSettings);
}
// --------------------
// -- Path templates --
// --------------------
entrygroupPath(project, location) {
return this._pathTemplates.entrygroupPathTemplate.render({
project,
location,
});
}
matchProjectFromEntryGroupName(entrygroupName) {
return this._pathTemplates.entrygroupPathTemplate.match(entrygroupName)
.project;
}
matchLocationFromEntryGroupName(entrygroupName) {
return this._pathTemplates.entrygroupPathTemplate.match(entrygroupName)
.location;
}
entryPath(project, location, entry) {
return this._pathTemplates.entryPathTemplate.render({
project,
location,
entry,
});
}
matchProjectFromEntryName(entryName) {
return this._pathTemplates.entryPathTemplate.match(entryName).project;
}
matchLocationFromEntryName(entryName) {
return this._pathTemplates.entryPathTemplate.match(entryName).location;
}
matchEntryFromEntryName(entryName) {
return this._pathTemplates.entryPathTemplate.match(entryName).entry;
}
tagtemplatePath(project, location) {
return this._pathTemplates.tagtemplatePathTemplate.render({
project,
location,
});
}
matchProjectFromTagTemplateName(tagtemplateName) {
return this._pathTemplates.tagtemplatePathTemplate.match(tagtemplateName)
.project;
}
matchLocationFromTagTemplateName(tagtemplateName) {
return this._pathTemplates.tagtemplatePathTemplate.match(tagtemplateName)
.location;
}
tagPath(project, location, entry, tag) {
return this._pathTemplates.tagPathTemplate.render({
project,
location,
entry,
tag,
});
}
matchProjectFromTagName(tagName) {
return this._pathTemplates.tagPathTemplate.match(tagName).project;
}
matchLocationFromTagName(tagName) {
return this._pathTemplates.tagPathTemplate.match(tagName).location;
}
matchEntryFromTagName(tagName) {
return this._pathTemplates.tagPathTemplate.match(tagName).entry;
}
matchTagFromTagName(tagName) {
return this._pathTemplates.tagPathTemplate.match(tagName).tag;
}
tagtemplatefieldPath(project, location, field) {
return this._pathTemplates.tagtemplatefieldPathTemplate.render({
project,
location,
field,
});
}
matchProjectFromTagTemplateFieldName(tagtemplatefieldName) {
return this._pathTemplates.tagtemplatefieldPathTemplate.match(tagtemplatefieldName).project;
}
matchLocationFromTagTemplateFieldName(tagtemplatefieldName) {
return this._pathTemplates.tagtemplatefieldPathTemplate.match(tagtemplatefieldName).location;
}
matchFieldFromTagTemplateFieldName(tagtemplatefieldName) {
return this._pathTemplates.tagtemplatefieldPathTemplate.match(tagtemplatefieldName).field;
}
/**
* Terminate the GRPC channel and close the client.
*
* The client will no longer be usable and all future behavior is undefined.
*/
close() {
if (!this._terminated) {
return this._dataCatalogStub.then(stub => {
this._terminated = true;
stub.close();
});
}
return Promise.resolve();
}
}
exports.DataCatalogClient = DataCatalogClient;
//# sourceMappingURL=data_catalog_client.js.map